28require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
38 public $module =
'webportal';
63 'woman' =>
'Genderwoman',
64 'other' =>
'Genderother',
70 protected $member_static =
null;
114 public $fields = array(
115 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 10,),
116 'ref' => array(
'type' =>
'varchar(30)',
'label' =>
'Ref',
'default' =>
'1',
'enabled' => 1,
'visible' => 5,
'notnull' => 1,
'position' => 12,
'index' => 1,
'showonheader' => 1,),
117 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'default' =>
'1',
'enabled' => 1,
'visible' => -2,
'notnull' => 1,
'position' => 15,
'index' => 1,),
119 'lastname' => array(
'type' =>
'varchar(50)',
'label' =>
'Lastname',
'enabled' => 1,
'visible' => 4,
'position' => 30,
'showonheader' => 1,),
120 'firstname' => array(
'type' =>
'varchar(50)',
'label' =>
'Firstname',
'enabled' => 1,
'visible' => 4,
'position' => 35,
'showonheader' => 1,),
121 'gender' => array(
'type' =>
'varchar(10)',
'label' =>
'Gender',
'enabled' => 1,
'visible' => 4,
'position' => 50,
'arrayofkeyval' => self::GENDER_LIST,
'showonheader' => 1,),
122 'company' => array(
'type' =>
'varchar(128)',
'label' =>
'Societe',
'enabled' => 1,
'visible' => 4,
'position' => 65,
'showonheader' => 1,),
123 'address' => array(
'type' =>
'text',
'label' =>
'Address',
'enabled' => 1,
'visible' => 4,
'position' => 75,
'showonheader' => 1,),
124 'zip' => array(
'type' =>
'varchar(10)',
'label' =>
'Zip',
'enabled' => 1,
'visible' => 4,
'position' => 80,
'showonheader' => 1,),
125 'town' => array(
'type' =>
'varchar(50)',
'label' =>
'Town',
'enabled' => 1,
'visible' => 4,
'position' => 85,
'showonheader' => 1,),
126 'state_id' => array(
'type' =>
'integer',
'label' =>
'State id',
'enabled' =>
'!getDolGlobalString("MEMBER_DISABLE_STATE")',
'visible' => -5,
'position' => 90,
'showonheader' => 1,),
127 'country_id' => array(
'type' =>
'integer:Ccountry:core/class/ccountry.class.php',
'label' =>
'Country',
'enabled' => 1,
'visible' => 4,
'position' => 95,
'showonheader' => 1,),
128 'phone' => array(
'type' =>
'varchar(30)',
'label' =>
'Phone',
'enabled' => 1,
'visible' => 4,
'position' => 115,
'showonheader' => 1,),
129 'phone_perso' => array(
'type' =>
'varchar(30)',
'label' =>
'Phone perso',
'enabled' => 1,
'visible' => 4,
'position' => 120,
'showonheader' => 1,),
130 'phone_mobile' => array(
'type' =>
'varchar(30)',
'label' =>
'Phone mobile',
'enabled' => 1,
'visible' => 4,
'position' => 125,
'showonheader' => 1,),
131 'email' => array(
'type' =>
'varchar(255)',
'label' =>
'Email',
'enabled' => 1,
'visible' => 4,
'position' => 200,
'showonheader' => 1,
'picto' =>
'email'),
132 'url' => array(
'type' =>
'varchar(255)',
'label' =>
'Url',
'enabled' => 1,
'visible' => 4,
'position' => 210,
'showonheader' => 1,),
134 'login' => array(
'type' =>
'varchar(50)',
'label' =>
'Login',
'enabled' => 1,
'visible' => 4,
'position' => 240,),
135 'typeid' => array(
'type' =>
'integer:AdherentType:adherents/class/adherent_type.class.php',
'label' =>
'MemberType',
'enabled' => 1,
'visible' => 4,
'notnull' => 1,
'position' => 255),
136 'morphy' => array(
'type' =>
'varchar(3)',
'label' =>
'MemberNature',
'enabled' => 1,
'visible' => 4,
'notnull' => 1,
'position' => 260,
'arrayofkeyval' => self::MORPHY_LIST,),
137 'civility_id' => array(
'type' =>
'sellist:c_civility:label:rowid::active=1',
'label' =>
'Civility',
'enabled' => 1,
'visible' => 4,
'position' => 270,),
138 'birth' => array(
'type' =>
'date',
'label' =>
'DateOfBirth',
'enabled' => 1,
'visible' => 4,
'position' => 290,),
139 'fk_soc' => array(
'type' =>
'integer:Societe:societe/class/societe.class.php',
'label' =>
'ThirdParty',
'enabled' => 1,
'visible' => 5,
'position' => 300,),
141 'datefin' => array(
'type' =>
'date',
'label' =>
'SubscriptionEndDate',
'enabled' => 1,
'visible' => 5,
'position' => 400,),
143 'status' => array(
'type' =>
'smallint(6)',
'label' =>
'Status',
'enabled' => 1,
'visible' => 5,
'notnull' => 1,
'position' => 500,
'arrayofkeyval' => self::ARRAY_STATUS_LABEL,
'showonheader' => 1,),
162 public $fk_adherent_type;
179 if (!$this->member_static) {
180 $this->member_static =
new Adherent($this->db);
183 return $this->member_static;
197 $this->isextrafieldmanaged = 0;
202 if (is_object($langs)) {
203 foreach ($this->fields as $key => $val) {
204 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
205 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
206 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
227 return [
'optimize' => $langs->trans(
"WebPortalMember")];
229 $datas[
'picto'] =
img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"WebPortalMember") .
'</u>';
230 if (isset($this->
status)) {
233 $datas[
'ref'] .=
'<br><b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
251 public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option =
'card', $mode =
'', $morecss =
'', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0)
253 global $langs, $hookmanager;
264 $classfortooltip =
'classfortooltip';
268 'objecttype' => $this->element,
273 $classfortooltip =
'classforajaxtooltip';
297 $linkstart .=
'<a href="' . $url .
'"';
299 if (empty($notooltip)) {
301 $langs->load(
"users");
302 $label = $langs->trans(
"ShowUser");
305 $linkclose .= ($label ?
' title="' .
dol_escape_htmltag($label, 1) .
'"' :
' title="tocomplete"');
306 $linkclose .= $dataparams .
' class="' . $classfortooltip . ($morecss ?
' ' . $morecss :
'') .
'"';
309 $linkstart .= $linkclose .
'>';
312 if ($option ===
'nolink') {
317 $result .= $linkstart;
319 $result .=
'<div class="inline-block nopadding valignmiddle">';
322 $paddafterimage =
'';
323 if (abs($withpictoimg) == 1 || abs($withpictoimg) == 4) {
324 $morecss .=
' paddingrightonly';
327 if ($withpictoimg > 0) {
328 $picto =
'<span class="nopadding' . ($morecss ?
' userimg' . $morecss :
'') .
'">' .
img_object(
'',
'user', $paddafterimage .
' ' . ($notooltip ?
'' : $dataparams), 0, 0, $notooltip ? 0 : 1) .
'</span>';
331 $picto =
'<span class="nopadding' . ($morecss ?
' userimg' . $morecss :
'') .
'"' . ($paddafterimage ?
' ' . $paddafterimage :
'') .
'>';
332 $picto .=
Form::showphoto(
'memberphoto', $this, 0, 0, 0,
'userphoto' . (($withpictoimg == -3 || $withpictoimg == -4) ?
'small' :
''),
'mini', 0, 1);
337 if (($withpictoimg > -2 && $withpictoimg != 2) || $withpictoimg == -4) {
339 $result .=
'<span class="nopadding valignmiddle' . ((!isset($this->statut) || $this->statut) ?
'' :
' strikefordisabled') .
340 ($morecss ?
' usertext' . $morecss :
'') .
'">';
342 if ($mode ==
'login') {
343 $result .=
dol_trunc($this->login, $maxlen);
344 } elseif ($mode ==
'ref') {
345 $result .= $this->ref;
347 $result .= $this->
getFullName($langs,
'', ($mode ==
'firstname' ? 2 : ($mode ==
'lastname' ? 4 : -1)), $maxlen);
350 $result .=
'</span>';
369 $hookmanager->initHooks(array($this->element .
'dao'));
370 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
371 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
373 $result = $hookmanager->resPrint;
375 $result .= $hookmanager->resPrint;
388 return $this->
LibStatut($this->
status, $this->need_subscription, $this->datefin, $mode);
402 public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0)
405 return $this->
getMemberStatic()->LibStatut($status, $need_subscription, $date_end_subscription, $mode);
416 global $conf, $langs, $form, $extralanguages;
418 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
422 $elementforaltlanguage = $this->element;
429 $address =
dol_print_address($coords,
'address_' . $htmlkey .
'_' . $this->
id, $this->element, $this->
id, 1,
', ');
437 $arrayoflangcode = array();
442 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
443 if (!is_object($extralanguages)) {
444 include_once DOL_DOCUMENT_ROOT .
'/core/class/extralanguages.class.php';
447 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
449 if (!empty($extralanguages->attributes[$elementforaltlanguage][
'address']) || !empty($extralanguages->attributes[$elementforaltlanguage][
'town'])) {
450 $out .=
"<!-- alternatelanguage for '" . $elementforaltlanguage .
"' set to fields '" . implode(
',', $extralanguages->attributes[$elementforaltlanguage]) .
"' -->\n";
452 if (!is_object($form)) {
453 $form =
new Form($this->db);
457 foreach ($arrayoflangcode as $extralangcode) {
460 $coords = $this->
getFullAddress(1,
', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
461 $htmltext .= $s .
dol_print_address($coords,
'address_' . $htmlkey .
'_' . $this->
id, $this->element, $this->
id, 1,
', ');
463 $out .= $form->textwithpicto(
'', $htmltext, -1,
'language',
'opacitymedium paddingleft');
469 if (!in_array($this->country_code, $countriesusingstate) && !
getDolGlobalString(
'MAIN_FORCE_STATE_INTO_ADDRESS')
471 if (
getDolGlobalInt(
'MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
472 $out .= ($outdone ?
' - ' :
'') . $this->region .
' - ' . $this->state;
474 $out .= ($outdone ?
' - ' :
'') . $this->state;
480 $out =
'<div class="address inline-block">' . $out .
'</div>';
483 if (!empty($this->phone) || !empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) {
484 $out .= ($outdone ?
'<br>' :
'');
486 if (!empty($this->phone) && empty($this->phone_pro)) {
487 $out .=
dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
490 if (!empty($this->phone_pro)) {
491 $out .=
dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
494 if (!empty($this->phone_mobile)) {
495 $out .=
dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'mobile', $langs->trans(
"PhoneMobile"));
498 if (!empty($this->phone_perso)) {
499 $out .=
dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePerso"));
502 if (!empty($this->office_phone)) {
503 $out .=
dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
506 if (!empty($this->user_mobile)) {
507 $out .=
dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'mobile', $langs->trans(
"PhoneMobile"));
510 if (!empty($this->fax)) {
511 $out .=
dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'fax', $langs->trans(
"Fax"));
514 if (!empty($this->office_fax)) {
515 $out .=
dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'fax', $langs->trans(
"Fax"));
520 $out .=
'<div style="clear: both;"></div>';
523 if (!empty($this->
email)) {
527 if (!empty($this->url)) {
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Class to manage members of a foundation.
const STATUS_EXCLUDED
Excluded.
const STATUS_DRAFT
Draft status.
const STATUS_RESILIATED
Resiliated.
const STATUS_VALIDATED
Validated status.
getFullAddress($withcountry=0, $sep="\n", $withregion=0, $extralangcode='')
Return full address of contact.
fetchValuesForExtraLanguages()
Function to get alternative languages of a data into $this->array_languages This method is NOT called...
Class to manage Dolibarr database access.
Class for WebPortalMember.
const ARRAY_STATUS_LABEL
Status list (short label)
__construct(DoliDB $db)
Constructor.
getLibStatut($mode=0)
Retourne le libelle du statut d'un adherent (brouillon, valide, resilie, exclu)
getTooltipContentArray($params)
getTooltipContentArray
getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1, $notooltip=0, $addlinktonotes=0)
Return clickable name (with picto eventually)
LibStatut($status, $need_subscription, $date_end_subscription, $mode=0)
Renvoi le libelle d'un statut donne.
const MORPHY_LIST
MorPhy list : Moral or Physical.
const GENDER_LIST
Gender list.
getBannerAddressForWebPortal($htmlkey)
Return full address for banner.
getMemberStatic()
Get member for static method.
getFullName($langs, $option=0, $nameorder=-1, $maxlen=0)
Return full name (civility+' '+name+' '+lastname)
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dol_print_address($address, $htmlid, $element, $id, $noprint=0, $charfornl='')
Format address string.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...