diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2f3cc68ab96..d1c95cf6199 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -70,12 +70,12 @@ class Adherent extends CommonObject public $mesgs; /** - * @var string login of member + * @var ?string login of member */ public $login; /** - * @var string Clear password in memory + * @var ?string Clear password in memory */ public $pass; @@ -186,7 +186,7 @@ class Adherent extends CommonObject public $default_lang; /** - * @var string photo of member + * @var ?string photo of member */ public $photo; @@ -225,7 +225,7 @@ class Adherent extends CommonObject public $typeid; /** - * @var string label type member + * @var ?string label type member */ public $type; @@ -536,6 +536,10 @@ class Adherent extends CommonObject global $langs; $birthday = dol_print_date($this->birth, 'day'); + $photo = isset($this->photo) ? $this->photo : ''; + $login = isset($this->login) ? $this->login : ''; + $type = isset($this->type) ? $this->type : ''; + $pass = isset($this->pass) ? $this->pass : ''; $msgishtml = 0; if (dol_textishtml($text, 1)) { @@ -560,11 +564,11 @@ class Adherent extends CommonObject $infos .= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n"; $infos .= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n"; if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { - $infos .= $langs->transnoentities("Login").": ".$this->login."\n"; - $infos .= $langs->transnoentities("Password").": ".$this->pass."\n"; + $infos .= $langs->transnoentities("Login").": ".$login."\n"; + $infos .= $langs->transnoentities("Password").": ".$pass."\n"; } $infos .= $langs->transnoentities("Birthday").": ".$birthday."\n"; - $infos .= $langs->transnoentities("Photo").": ".$this->photo."\n"; + $infos .= $langs->transnoentities("Photo").": ".$photo."\n"; $infos .= $langs->transnoentities("Public").": ".yn($this->public); // Substitutions @@ -583,13 +587,13 @@ class Adherent extends CommonObject '__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($this->country) : ($this->country ? $this->country : ''), '__EMAIL__' => $msgishtml ? dol_htmlentitiesbr((string) $this->email) : ($this->email ? $this->email : ''), '__BIRTH__' => $msgishtml ? dol_htmlentitiesbr($birthday) : ($birthday ? $birthday : ''), - '__PHOTO__' => $msgishtml ? dol_htmlentitiesbr($this->photo) : ($this->photo ? $this->photo : ''), - '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($this->login) : ($this->login ? $this->login : ''), - '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($this->pass) : ($this->pass ? $this->pass : ''), + '__PHOTO__' => $msgishtml ? dol_htmlentitiesbr($photo) : $photo, + '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($login) : $login, + '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($pass) : $pass, '__PHONE__' => $msgishtml ? dol_htmlentitiesbr($this->phone) : ($this->phone ? $this->phone : ''), '__PHONEPRO__' => $msgishtml ? dol_htmlentitiesbr($this->phone_perso) : ($this->phone_perso ? $this->phone_perso : ''), '__PHONEMOBILE__' => $msgishtml ? dol_htmlentitiesbr($this->phone_mobile) : ($this->phone_mobile ? $this->phone_mobile : ''), - '__TYPE__' => $msgishtml ? dol_htmlentitiesbr($this->type) : ($this->type ? $this->type : '') + '__TYPE__' => $msgishtml ? dol_htmlentitiesbr($type) : $type, ); complete_substitutions_array($substitutionarray, $langs, $this); @@ -956,9 +960,6 @@ class Adherent extends CommonObject $result = $luser->fetch($this->user_id); if ($result >= 0) { - //var_dump($this->user_login);exit; - //var_dump($this->login);exit; - // If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one. if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { $luser->login = $this->login; @@ -969,7 +970,7 @@ class Adherent extends CommonObject $luser->firstname = $this->firstname; $luser->lastname = $this->lastname; $luser->gender = $this->gender; - $luser->pass = $this->pass; + $luser->pass = isset($this->pass) ? $this->pass : ''; //$luser->socid=$this->fk_soc; // We do not enable this. This may transform a user into an external user. $luser->birth = $this->birth; @@ -2463,7 +2464,7 @@ class Adherent extends CommonObject ($morecss ? ' usertext'.$morecss : '').'">'; } if ($mode == 'login') { - $result .= dol_trunc($this->login, $maxlen); + $result .= dol_trunc(isset($this->login) ? $this->login : '', $maxlen); } elseif ($mode == 'ref') { $result .= $this->ref; } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c7a06e59e68..483bfb4fd72 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9423,6 +9423,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } } else { '@phan-var-force Adherent|Delivery $object'; + /** @var Adherent|Delivery $object */ $substitutionarray['__ID__'] = $object->id; $substitutionarray['__REF__'] = $object->ref; $substitutionarray['__NEWREF__'] = $object->newref; @@ -9463,6 +9464,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0) { '@phan-var-force Adherent $object'; + /** @var Adherent $object */ $birthday = (empty($object->birth) ? '' : dol_print_date($object->birth, 'day')); $substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : ''); @@ -9561,12 +9563,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'recruitmentcandidature') { '@phan-var-force RecruitmentCandidature $object'; + /** @var RecruitmentCandidature $object */ $substitutionarray['__CANDIDATE_FULLNAME__'] = $object->getFullName($outputlangs); $substitutionarray['__CANDIDATE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : ''; $substitutionarray['__CANDIDATE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : ''; } if (is_object($object) && $object->element == 'conferenceorboothattendee') { '@phan-var-force ConferenceOrBoothAttendee $object'; + /** ConferenceOrBoothAttendee $object */ $substitutionarray['__ATTENDEE_FULLNAME__'] = $object->getFullName($outputlangs); $substitutionarray['__ATTENDEE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : ''; $substitutionarray['__ATTENDEE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : ''; @@ -9574,6 +9578,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'project') { '@phan-var-force Project $object'; + /** @var Project $object */ $substitutionarray['__PROJECT_ID__'] = $object->id; $substitutionarray['__PROJECT_REF__'] = $object->ref; $substitutionarray['__PROJECT_NAME__'] = $object->title; @@ -9607,22 +9612,26 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'facture') { '@phan-var-force Facture $object'; + /** @var Facture $object */ $substitutionarray['__INVOICE_SITUATION_NUMBER__'] = isset($object->situation_counter) ? $object->situation_counter : ''; } if (is_object($object) && $object->element == 'shipping') { '@phan-var-force Expedition $object'; + /** @var Expedition $object */ $substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number; $substitutionarray['__SHIPPINGTRACKNUMURL__'] = $object->tracking_url; $substitutionarray['__SHIPPINGMETHOD__'] = $object->shipping_method; } if (is_object($object) && $object->element == 'reception') { '@phan-var-force Reception $object'; + /** @var Reception $object */ $substitutionarray['__RECEPTIONTRACKNUM__'] = $object->tracking_number; $substitutionarray['__RECEPTIONTRACKNUMURL__'] = $object->tracking_url; } if (is_object($object) && $object->element == 'contrat' && $object->id > 0 && is_array($object->lines)) { '@phan-var-force Contrat $object'; + /** @var Contrat $object */ $dateplannedstart = ''; $datenextexpiration = ''; foreach ($object->lines as $line) { @@ -9644,6 +9653,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, // add substitution variables for ticket if (is_object($object) && $object->element == 'ticket') { '@phan-var-force Ticket $object'; + /** @var Ticket $object */ $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; $substitutionarray['__TICKET_SUBJECT__'] = $object->subject; $substitutionarray['__TICKET_TYPE__'] = $object->type_code; @@ -9774,46 +9784,55 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'propal') { '@phan-var-force Propal $object'; + /** @var Propal $object */ $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'commande') { '@phan-var-force Commande $object'; + /** @var Commande $object */ $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id; } if (is_object($object) && $object->element == 'facture') { '@phan-var-force Facture $object'; + /** @var Facture $object */ $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id; } if (is_object($object) && $object->element == 'contrat') { '@phan-var-force Contrat $object'; + /** @var Contrat $object */ $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'fichinter') { '@phan-var-force Fichinter $object'; + /** @var Fichinter $object */ $substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; $substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref, 1, $object); } if (is_object($object) && $object->element == 'supplier_proposal') { '@phan-var-force SupplierProposal $object'; + /** @var SupplierProposal $object */ $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; } if (is_object($object) && $object->element == 'invoice_supplier') { '@phan-var-force FactureFournisseur $object'; + /** @var FactureFournisseur $object */ $substitutionarray['__URL_SUPPLIER_INVOICE__'] = DOL_MAIN_URL_ROOT."/fourn/facture/card.php?id=".$object->id; } if (is_object($object) && $object->element == 'shipping') { '@phan-var-force Expedition $object'; + /** @var Expedition $object */ $substitutionarray['__URL_SHIPMENT__'] = DOL_MAIN_URL_ROOT."/expedition/card.php?id=".$object->id; } } if (is_object($object) && $object->element == 'action') { '@phan-var-force ActionComm $object'; + /** @var ActionComm $object */ $substitutionarray['__EVENT_LABEL__'] = $object->label; $substitutionarray['__EVENT_TYPE__'] = $outputlangs->trans("Action".$object->type_code); $substitutionarray['__EVENT_DATE__'] = dol_print_date($object->datep, 'day', 'auto', $outputlangs); @@ -9823,6 +9842,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if ((empty($exclude) || !in_array('objectamount', $exclude)) && (empty($include) || in_array('objectamount', $include))) { '@phan-var-force Facture|FactureRec $object'; + /** @var Facture|FactureRec|null $object */ include_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php'; $substitutionarray['__DATE_YMD__'] = is_object($object) ? (isset($object->date) ? dol_print_date($object->date, 'day', false, $outputlangs) : null) : ''; @@ -9921,6 +9941,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])), '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])), '__YEAR__' => (string) $tmp['year'], + '__YEAR_PREVIOUS_MONTH__' => (string) $tmp3['year'], + '__YEAR_NEXT_MONTH__' => (string) $tmp5['year'], '__PREVIOUS_DAY__' => (string) $tmp2['day'], '__PREVIOUS_MONTH__' => (string) $tmp3['month'], '__PREVIOUS_MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp3['month'])),