/** * Get XCN : extended composite ID number and name for persons * * @param CMbObject $object Object * @param CInteropReceiver $actor Actor * @param bool $repeatable Repeatable field * * @return array */ function getXCN(CMbObject $object, CInteropReceiver $actor, $repeatable = false) { $xcn1 = $xcn2 = $xcn3 = $xcn9 = $xcn13 = null; $idex = new CIdSante400(); if ($object instanceof CMedecin) { $object->completeField("adeli", "rpps"); $idex = $object->loadLastId400(); $xcn1 = CValue::first($object->adeli, $object->rpps, $idex->id400, $object->_id); $xcn2 = $object->nom; $xcn3 = $object->prenom; $xcn9 = $this->getXCN9($object, $idex, $actor); $xcn13 = $object->adeli ? "ADELI" : ($object->rpps ? "RPPS" : "RI"); } if ($object instanceof CUser) { $xcn1 = $object->_id; $xcn2 = $object->user_last_name; $xcn3 = $object->user_first_name; $xcn9 = $this->getXCN9($object); $xcn13 = "RI"; } if ($object instanceof CMediusers) { $object->completeField("adeli", "rpps"); $idex = CIdSante400::getMatch("CMediusers", $actor->_tag_mediuser, null, $object->_id); $xcn1 = CValue::first($object->adeli, $object->rpps, $idex->id400, $object->_id); $xcn2 = $object->_user_last_name; $xcn3 = $object->_user_first_name; $xcn9 = $this->getXCN9($object, $idex, $actor); $xcn13 = $object->adeli ? "ADELI" : ($object->rpps ? "RPPS" : "RI"); } if ($repeatable && $actor->_configs["build_PV1_7"] == "repeatable" && $object instanceof CMediusers) { $xcn = array(null, $xcn2, $xcn3, null, null, null, null, null, $xcn9, "L", null, null, null); $xncs = array(); // Ajout du RPPS if ($object->rpps) { $xcn[0] = $object->rpps; $xcn[8] = $this->getAssigningAuthority("RPPS"); $xcn[12] = "RPPS"; $xncs[] = $xcn; } // Ajout de l'ADELI if ($object->adeli) { $xcn[0] = $object->adeli; $xcn[8] = $this->getAssigningAuthority("ADELI"); $xcn[12] = "ADELI"; $xncs[] = $xcn; } // Ajout de l'Idex if ($idex->id400) { $xcn[0] = $idex->id400; $xcn[8] = $this->getAssigningAuthority("actor", null, $actor); $xcn[12] = "RI"; $xncs[] = $xcn; } // Est-ce que l'on transmet notre identifiant de praticien if ($actor->_configs["send_own_identifier"]) { // Ajout de l'ID Mediboard $xcn[0] = $object->_id; $xcn[8] = $this->getAssigningAuthority("mediboard"); $xcn[12] = "RI"; $xncs[] = $xcn; } return $xncs; } else { return array(array($xcn1, $xcn2, $xcn3, null, null, null, null, null, $xcn9, "L", null, null, $xcn13, null, null, null, null, null, null, null, null, null, null)); } }