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,),
168 public $fk_adherent_type;
185 if (!$this->member_static) {
186 $this->member_static =
new Adherent($this->db);
189 return $this->member_static;
203 $this->isextrafieldmanaged = 0;
208 if (is_object($langs)) {
209 foreach ($this->fields as $key => $val) {
210 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
211 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
212 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
232 return [
'optimize' => $langs->trans(
"WebPortalMember")];
234 $datas[
'picto'] =
img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"WebPortalMember") .
'</u>';
235 if (isset($this->
status)) {
238 $datas[
'ref'] .=
'<br><b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
256 public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option =
'card', $mode =
'', $morecss =
'', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0)
258 global $langs, $hookmanager;
269 $classfortooltip =
'classfortooltip';
273 'objecttype' => $this->element,
278 $classfortooltip =
'classforajaxtooltip';
302 $linkstart .=
'<a href="' . $url .
'"';
304 if (empty($notooltip)) {
306 $langs->load(
"users");
307 $label = $langs->trans(
"ShowUser");
310 $linkclose .= ($label ?
' title="' .
dol_escape_htmltag($label, 1) .
'"' :
' title="tocomplete"');
311 $linkclose .= $dataparams .
' class="' . $classfortooltip . ($morecss ?
' ' . $morecss :
'') .
'"';
314 $linkstart .= $linkclose .
'>';
317 if ($option ===
'nolink') {
322 $result .= $linkstart;
324 $result .=
'<div class="inline-block nopadding valignmiddle">';
327 $paddafterimage =
'';
328 if (abs($withpictoimg) == 1 || abs($withpictoimg) == 4) {
329 $morecss .=
' paddingrightonly';
332 if ($withpictoimg > 0) {
333 $picto =
'<span class="nopadding' . ($morecss ?
' userimg' . $morecss :
'') .
'">' .
img_object(
'',
'user', $paddafterimage .
' ' . ($notooltip ?
'' : $dataparams), 0, 0, $notooltip ? 0 : 1) .
'</span>';
336 $picto =
'<span class="nopadding' . ($morecss ?
' userimg' . $morecss :
'') .
'"' . ($paddafterimage ?
' ' . $paddafterimage :
'') .
'>';
337 $picto .=
Form::showphoto(
'memberphoto', $this, 0, 0, 0,
'userphoto' . (($withpictoimg == -3 || $withpictoimg == -4) ?
'small' :
''),
'mini', 0, 1);
342 if (($withpictoimg > -2 && $withpictoimg != 2) || $withpictoimg == -4) {
344 $result .=
'<span class="nopadding valignmiddle' . ((!isset($this->statut) || $this->statut) ?
'' :
' strikefordisabled') .
345 ($morecss ?
' usertext' . $morecss :
'') .
'">';
347 if ($mode ==
'login') {
348 $result .=
dol_trunc($this->login, $maxlen);
349 } elseif ($mode ==
'ref') {
350 $result .= $this->ref;
352 $result .= $this->
getFullName($langs, 0, ($mode ==
'firstname' ? 2 : ($mode ==
'lastname' ? 4 : -1)), $maxlen);
355 $result .=
'</span>';
374 $hookmanager->initHooks(array($this->element .
'dao'));
375 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
376 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
378 $result = $hookmanager->resPrint;
380 $result .= $hookmanager->resPrint;
393 return $this->
LibStatut($this->
status, $this->need_subscription, $this->datefin, $mode);
407 public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0)
410 return $this->
getMemberStatic()->LibStatut($status, $need_subscription, $date_end_subscription, $mode);
421 global
$conf, $langs, $form, $extralanguages;
423 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
427 $elementforaltlanguage = $this->element;
434 $address =
dol_print_address($coords,
'address_' . $htmlkey .
'_' . $this->
id, $this->element, $this->
id, 1,
', ');
442 $arrayoflangcode = array();
447 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
448 if (!is_object($extralanguages)) {
449 include_once DOL_DOCUMENT_ROOT .
'/core/class/extralanguages.class.php';
452 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
454 if (!empty($extralanguages->attributes[$elementforaltlanguage][
'address']) || !empty($extralanguages->attributes[$elementforaltlanguage][
'town'])) {
455 $out .=
"<!-- alternatelanguage for '" . $elementforaltlanguage .
"' set to fields '" . implode(
',', $extralanguages->attributes[$elementforaltlanguage]) .
"' -->\n";
457 if (!is_object($form)) {
458 $form =
new Form($this->db);
462 foreach ($arrayoflangcode as $extralangcode) {
465 $coords = $this->
getFullAddress(1,
', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
466 $htmltext .= $s .
dol_print_address($coords,
'address_' . $htmlkey .
'_' . $this->
id, $this->element, $this->
id, 1,
', ');
468 $out .= $form->textwithpicto(
'', $htmltext, -1,
'language',
'opacitymedium paddingleft');
474 if (!in_array($this->country_code, $countriesusingstate) && !
getDolGlobalString(
'MAIN_FORCE_STATE_INTO_ADDRESS')
476 if (
getDolGlobalInt(
'MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
477 $out .= ($outdone ?
' - ' :
'') . $this->region .
' - ' . $this->state;
479 $out .= ($outdone ?
' - ' :
'') . $this->state;
485 $out =
'<div class="address inline-block">' . $out .
'</div>';
488 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)) {
489 $out .= ($outdone ?
'<br>' :
'');
491 if (!empty($this->phone) && empty($this->phone_pro)) {
492 $out .=
dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
495 if (!empty($this->phone_pro)) {
496 $out .=
dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
499 if (!empty($this->phone_mobile)) {
500 $out .=
dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'mobile', $langs->trans(
"PhoneMobile"));
503 if (!empty($this->phone_perso)) {
504 $out .=
dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePerso"));
507 if (!empty($this->office_phone)) {
508 $out .=
dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'phone', $langs->trans(
"PhonePro"));
511 if (!empty($this->user_mobile)) {
512 $out .=
dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'mobile', $langs->trans(
"PhoneMobile"));
515 if (!empty($this->fax)) {
516 $out .=
dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'fax', $langs->trans(
"Fax"));
519 if (!empty($this->office_fax)) {
520 $out .=
dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid,
'',
' ',
'fax', $langs->trans(
"Fax"));
525 $out .=
'<div style="clear: both;"></div>';
528 if (!empty($this->
email)) {
532 if (!empty($this->url)) {
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.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...