/**
  * return the sex if found for firstname, else return null
  *
  * @param string $firstname the firstname to have
  *
  * @return string|null sex (u = undefined, f = female, m = male, null = not in base)
  */
 static function getSexFor($firstname)
 {
     $prenom_exploded = preg_split('/[-_ ]+/', $firstname);
     // get the first firstname of composed one
     $first_first_name = addslashes(trim(reset($prenom_exploded)));
     $object = new self();
     $object->firstname = $first_first_name;
     $nb_objects = $object->countMatchingList();
     if ($nb_objects > 1) {
         $object->language = "french";
         $object->loadMatchingObject();
     }
     if (!$object->_id || $object->sex == "u") {
         $object = new self();
         $object->firstname = $first_first_name;
         $object->loadMatchingObject();
     }
     return $object->sex ? $object->sex : "u";
 }
 static function countCurrentList()
 {
     $prestation = new self();
     $prestation->group_id = CGroups::loadCurrent()->_id;
     return $prestation->countMatchingList();
 }
Example #3
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if (!$this->_forwardRefMerging) {
         $patient_link = new self();
         $patient_link->patient_id1 = $this->patient_id2;
         $patient_link->patient_id2 = $this->patient_id1;
         if ($patient_link->countMatchingList() > 0) {
             //todo trad
             return "Lien déjà existant";
         }
     }
     return parent::check();
 }