public function organisation()
    {
        if ( !isset($_GET['organisation']) )
        {
            return false;
        }

        $db = MMDB::instance();
        $organisation = $db->escapeString(trim($_GET['organisation']));
        
        return ReferentialValue::fetchReferentialByIdentifierForAutoComplete('organisationName', $organisation, 'asc', 10);
    }
 /**
  * @param string $identifier
  * @param bool $filter [optional]
  * @return string[]
  */
 public static function getReferentialValues( $identifier, $filter = false, $tableAsoc = true )
 {
     $result = array();
     if ( !empty( $identifier ) )
     {
         $referentialValues = ReferentialValue::fetchReferentialByIdentifier( $identifier, $filter );
         if($tableAsoc)
         {
             foreach ( $referentialValues as $value )
             {
                 $result[$value->attribute('code')] = $value->attribute('label');
             }
         }
         else
         {
             foreach ( $referentialValues as $value )
             {
                 $result[] = $value->attribute('label');
             }
         }
     }
     return $result;
 }
// Get last placement value
$sql = 'SELECT MAX(placement) AS last_placement FROM mm_referential_value WHERE cluster_identifier = "' . $clusterIdentifier . '" AND referential_category_id = ' . $categoryId;
$query = $db->arrayQuery($sql);
$lastPlacement = isset($query[0]['last_placement']) ? $query[0]['last_placement'] : 0;

$count = 0;
while (($data = fgetcsv($handle)) !== FALSE)
{
    if ($header && $count == 0)
    {
        $cli->output('Ommiting import csv header');
        $header = false;
        continue;
    }

    $placement = $lastPlacement + $count + 1;

    $referentialValue = new ReferentialValue();
    $referentialValue->setAttribute('code', $data[0]);
    $referentialValue->setAttribute('label', $data[0]);
    $referentialValue->setAttribute('referential_category_id', $categoryId);
    $referentialValue->setAttribute('cluster_identifier', $clusterIdentifier);
    $referentialValue->setAttribute('placement', $placement);
    $referentialValue->store();
    $count++;
}

$db->commit();
fclose($handle);
$script->shutdown( 0, "Russia location import finished. Processed {$count} locations");