35require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
60$langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"other",
"paypal"));
64$action =
GETPOST(
'action',
'aZ09');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$backtopage =
GETPOST(
'backtopage',
'alpha');
67$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
78 include_once DOL_DOCUMENT_ROOT.
'/mailmanspip/class/mailmanspip.class.php';
80 $langs->load(
'mailmanspip');
92$extrafields->fetch_name_optionals_label(
$object->table_element);
100if (!empty($canvas)) {
101 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
102 $objcanvas =
new Canvas($db, $action);
103 $objcanvas->getCanvas(
'adherent',
'membercard', $canvas);
107$hookmanager->initHooks(array(
'membercard',
'globalcard'));
110if ($id > 0 || !empty($ref)) {
112 $result =
$object->fetch($id, $ref);
115 $canadduser = ($user->admin || $user->hasRight(
'user',
'user',
'creer'));
119 $caneditfielduser = ((($user->id ==
$object->user_id) && $user->hasRight(
'user',
'self',
'creer'))
120 || (($user->id !=
$object->user_id) && $user->hasRight(
'user',
'user',
'creer')));
121 $caneditpassworduser = ((($user->id ==
$object->user_id) && $user->hasRight(
'user',
'self',
'password'))
122 || (($user->id !=
$object->user_id) && $user->hasRight(
'user',
'user',
'password')));
127$canaddmember = $user->hasRight(
'adherent',
'creer');
128$caneditfieldmember =
false;
131 $caneditfieldmember = $user->hasRight(
'adherent',
'creer');
133$permissiontoeditextra = $canaddmember;
134if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
136 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
142if (!$user->hasRight(
'adherent',
'creer') && $action ==
'edit') {
146$linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((
isModEnabled(
'multicompany')) ?
'?entity='.$conf->entity :
'');
153$parameters = array(
'id' => $id,
'rowid' => $id,
'objcanvas' => $objcanvas,
'confirm' => $confirm);
154$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
159if (empty($reshook)) {
160 $backurlforlist = DOL_URL_ROOT.
'/adherents/list.php';
162 if (empty($backtopage) || ($cancel && empty($id))) {
163 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
164 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
165 $backtopage = $backurlforlist;
167 $backtopage = DOL_URL_ROOT.
'/adherents/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
173 if (!empty($backtopageforcancel)) {
174 header(
"Location: ".$backtopageforcancel);
176 } elseif (!empty($backtopage)) {
177 header(
"Location: ".$backtopage);
183 if ($action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
185 if (!$user->hasRight(
'user',
'user',
'creer')) {
186 if ($userid != $user->id && $userid !=
$object->user_id) {
188 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
193 if ($userid !=
$object->user_id) {
194 $result =
$object->setUserId($userid);
203 if ($action ==
'setsocid' && $caneditfieldmember) {
206 if ($socid !=
$object->socid) {
207 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
208 $sql .=
" WHERE socid = ".((int) $socid);
209 $sql .=
" AND entity = ".$conf->entity;
210 $resql = $db->query($sql);
212 $obj = $db->fetch_object($resql);
213 if ($obj && $obj->rowid > 0) {
215 $othermember->fetch($obj->rowid);
216 $thirdparty =
new Societe($db);
217 $thirdparty->fetch($socid);
219 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
224 $result =
$object->setThirdPartyId($socid);
235 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
238 $nuser =
new User($db);
240 if (
GETPOST(
'internalorexternal',
'aZ09') ==
'internal') {
241 $tmpuser->fk_soc = 0;
245 $result = $nuser->create_from_member($tmpuser,
GETPOST(
'login',
'alphanohtml'));
248 $langs->load(
"errors");
251 setEventMessages($langs->trans(
"NewUserCreated", $nuser->login),
null,
'mesgs');
260 if ($action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
264 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'));
267 $langs->load(
"errors");
275 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'adherent',
'creer')) {
276 $member_origin_id =
GETPOSTINT(
'member_origin');
279 if ($member_origin_id <= 0) {
280 $langs->load(
'errors');
281 setEventMessages($langs->trans(
'MergeOriginMemberIsMAndatory'),
null,
'errors');
283 if (!$error && $member_origin->fetch($member_origin_id) < 1) {
288 $result =
$object->mergeMembers($member_origin_id);
299 if ($action ==
'update' && !$cancel && $user->hasRight(
'adherent',
'creer')) {
300 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
306 $lastname =
GETPOST(
"lastname",
'alphanohtml');
307 $firstname =
GETPOST(
"firstname",
'alphanohtml');
308 $gender =
GETPOST(
"gender",
'alphanohtml');
309 $societe =
GETPOST(
"societe",
'alphanohtml');
310 $morphy =
GETPOST(
"morphy",
'alphanohtml');
311 $login =
GETPOST(
"login",
'alphanohtml');
312 if ($morphy !=
'mor' && empty($lastname)) {
314 $langs->load(
"errors");
315 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
317 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
319 $langs->load(
"errors");
320 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
322 if ($morphy ==
'mor' && empty($societe)) {
324 $langs->load(
"errors");
325 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
331 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
335 if ($result > 0 && !$error) {
339 $object->civility_code = trim(
GETPOST(
"civility_code",
'alphanohtml'));
344 if (GETPOSTISSET(
'pass')) {
360 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
362 $object->socialnetworks = array();
363 foreach ($socialnetworks as $key => $value) {
364 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
365 $object->socialnetworks[$key] = trim(
GETPOST($key,
'alphanohtml'));
375 if (!empty($_FILES[
'photo'][
'name'])) {
376 $current_photo =
$object->photo;
380 $current_photo =
$object->photo;
390 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
398 if ($user->id !=
$object->user_id && !$user->hasRight(
'user',
'user',
'creer')) {
405 if (GETPOSTISSET(
'pass')) {
408 if ($user->id ==
$object->user_id) {
409 if (!$user->hasRight(
'user',
'self',
'password')) {
413 if (!$user->hasRight(
'user',
'user',
'password')) {
421 $nosyncthirdparty =
getDolGlobalInt(
'MEMBER_NO_SYNC_LINKED_THIRDPARTY');
423 $result =
$object->update($user, 0, $nosyncuser, $nosyncuserpass, $nosyncthirdparty);
425 if ($result >= 0 && !count(
$object->errors)) {
426 $categories =
GETPOST(
'memcats',
'array');
427 $object->setCategories($categories);
430 $dir = $conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos';
431 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
432 if (
GETPOST(
'deletephoto') && $current_photo) {
433 $fileimg = $dir.
'/'.$current_photo;
434 $dirthumbs = $dir.
'/thumbs';
440 if ($current_photo !=
$object->photo) {
441 $fileimg = $dir.
'/'.$current_photo;
442 $dirthumbs = $dir.
'/thumbs';
451 if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
459 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
471 switch ($_FILES[
'photo'][
'error']) {
474 $errors[] =
"ErrorFileSizeTooLarge";
477 $errors[] =
"ErrorFilePartiallyUploaded";
486 if (!empty($backtopage)) {
487 header(
"Location: ".$backtopage);
502 if ($action ==
'add' && $user->hasRight(
'adherent',
'creer')) {
507 if (GETPOSTISSET(
"birthday") &&
GETPOST(
"birthday") && GETPOSTISSET(
"birthmonth") &&
GETPOST(
"birthmonth") && GETPOSTISSET(
"birthyear") &&
GETPOST(
"birthyear")) {
510 $datesubscription =
'';
511 if (GETPOSTISSET(
"reday") && GETPOSTISSET(
"remonth") && GETPOSTISSET(
"reyear")) {
516 $civility_code =
GETPOST(
"civility_code",
'alphanohtml');
517 $lastname =
GETPOST(
"lastname",
'alphanohtml');
518 $firstname =
GETPOST(
"firstname",
'alphanohtml');
519 $gender =
GETPOST(
"gender",
'alphanohtml');
520 $societe =
GETPOST(
"societe",
'alphanohtml');
521 $address =
GETPOST(
"address",
'alphanohtml');
522 $zip =
GETPOST(
"zipcode",
'alphanohtml');
523 $town =
GETPOST(
"town",
'alphanohtml');
527 $phone =
GETPOST(
"phone",
'alpha');
528 $phone_perso =
GETPOST(
"phone_perso",
'alpha');
529 $phone_mobile =
GETPOST(
"phone_mobile",
'alpha');
530 $email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'aZ09arobase'));
531 $url = trim(
GETPOST(
'url',
'url'));
532 $login =
GETPOST(
"member_login",
'alphanohtml');
533 $pass =
GETPOST(
"password",
'password');
534 $photo =
GETPOST(
"photo",
'alphanohtml');
535 $morphy =
GETPOST(
"morphy",
'alphanohtml');
540 $default_lang =
GETPOST(
'default_lang',
'alpha');
542 $object->civility_code = $civility_code;
543 $object->firstname = $firstname;
552 $object->country_id = $country_id;
554 $object->phone_perso = $phone_perso;
555 $object->phone_mobile = $phone_mobile;
556 $object->socialnetworks = array();
558 foreach ($socialnetworks as $key => $value) {
559 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
560 $object->socialnetworks[$key] =
GETPOST(
"member_".$key,
'alphanohtml');
577 $object->default_lang = $default_lang;
579 $ret = $extrafields->setOptionalsFromPost(
null, $object);
585 if (empty($morphy) || $morphy ==
"-1") {
587 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")),
null,
'errors');
593 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
595 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
596 $result = $db->query($sql);
599 $num = $db->num_rows($result);
603 $langs->load(
"errors");
604 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login),
null,
'errors');
609 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")),
null,
'errors');
612 if ($morphy ==
'mor' && empty($societe)) {
614 $langs->load(
"errors");
615 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
617 if ($morphy !=
'mor' && empty($lastname)) {
619 $langs->load(
"errors");
620 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
622 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
624 $langs->load(
"errors");
625 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
627 if (!($typeid > 0)) {
629 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
633 $langs->load(
"errors");
637 $langs->load(
"errors");
645 $result =
$object->create($user);
648 $memcats =
GETPOST(
'memcats',
'array');
649 $object->setCategories($memcats);
656 $backtopage = preg_replace(
'/__ID__/', (
string) $id, $backtopage);
669 $result = $company->create_from_member($object);
671 $langs->load(
"errors");
680 $action = ($result < 0 || !$error) ?
'' :
'create';
682 if (!$error && $backtopage) {
683 header(
"Location: ".$backtopage);
688 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
689 $result =
$object->delete($user);
692 if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"],
'/').
'/', $backtopage)) {
693 header(
"Location: ".$backtopage);
696 header(
"Location: list.php");
704 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_valid' && $confirm ==
'yes') {
712 $result =
$object->validate($user);
714 if ($result >= 0 && !count(
$object->errors)) {
721 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
725 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
727 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
729 $arraydefaultmessage =
null;
732 if (!empty($labeltouse)) {
733 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
736 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
737 $subject = (string) $arraydefaultmessage->topic;
738 $msg = (string) $arraydefaultmessage->content;
741 if (empty($labeltouse) || (
int) $labeltouse === -1) {
743 $langs->load(
"errors");
744 setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>',
null,
'errors');
747 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
752 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
754 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
774 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_resiliate') {
777 if ($confirm ==
'yes') {
781 $result =
$object->resiliate($user);
783 if ($result >= 0 && !count(
$object->errors)) {
789 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
793 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
795 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
797 $arraydefaultmessage =
null;
800 if (!empty($labeltouse)) {
801 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
804 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
805 $subject = (string) $arraydefaultmessage->topic;
806 $msg = (string) $arraydefaultmessage->content;
809 if (empty($labeltouse) || (
int) $labeltouse === -1) {
814 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
819 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
821 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
835 if (!empty($backtopage) && !$error) {
836 header(
"Location: ".$backtopage);
841 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_exclude') {
844 if ($confirm ==
'yes') {
848 $result =
$object->exclude($user);
850 if ($result >= 0 && !count(
$object->errors)) {
856 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
860 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
862 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
864 $arraydefaultmessage =
null;
867 if (!empty($labeltouse)) {
868 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
871 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
872 $subject = (string) $arraydefaultmessage->topic;
873 $msg = (string) $arraydefaultmessage->content;
876 if (empty($labeltouse) || (
int) $labeltouse === -1) {
881 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
886 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
888 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
902 if (!empty($backtopage) && !$error) {
903 header(
"Location: ".$backtopage);
908 if ($action ==
'update_extras' && $permissiontoeditextra) {
910 $attribute_name =
GETPOST(
'attribute',
'aZ09');
913 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
918 $result =
$object->updateExtraField($attribute_name,
'MEMBER_MODIFY');
925 $action =
'edit_extras';
930 if (is_object($mailmanspip)) {
931 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_del_spip' && $confirm ==
'yes') {
933 if (!$mailmanspip->del_to_spip($object)) {
934 setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
939 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_add_spip' && $confirm ==
'yes') {
941 if (!$mailmanspip->add_to_spip($object)) {
942 setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
949 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
952 $upload_dir = $conf->member->dir_output;
953 $permissiontoadd = $user->hasRight(
'adherent',
'creer');
954 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
957 $triggersendname =
'MEMBER_SENTBYMAIL';
959 $mode =
'emailfrommember';
960 $trackid =
'mem'.$object->id;
961 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
969$form =
new Form($db);
974$title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
975$help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
977llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-card');
979$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
981if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
985 if (empty(
$object->error) && $id) {
993 $objcanvas->display_canvas($action);
1000 if ($action ==
'create') {
1008 $object->country_code = $tmparray[
'code'];
1009 $object->country = $tmparray[
'label'];
1013 if (!empty($socid)) {
1015 $soc->fetch($socid);
1018 if (!($soc->id > 0)) {
1019 $langs->load(
"errors");
1020 print($langs->trans(
'ErrorRecordNotFound'));
1029 if ($conf->use_javascript_ajax) {
1030 print
"\n".
'<script type="text/javascript">'.
"\n";
1031 print
'jQuery(document).ready(function () {
1032 jQuery("#selectcountry_id").change(function() {
1033 document.formsoc.action.value="create";
1034 document.formsoc.submit();
1036 function initfieldrequired() {
1037 jQuery("#tdcompany").removeClass("fieldrequired");
1038 jQuery("#tdlastname").removeClass("fieldrequired");
1039 jQuery("#tdfirstname").removeClass("fieldrequired");
1040 if (jQuery(\'input[name="morphy"]:checked\').val() == \'mor\') {
1041 jQuery("#tdcompany").addClass("fieldrequired");
1043 if (jQuery(\'input[name="morphy"]:checked\').val() == \'phy\') {
1044 jQuery("#tdlastname").addClass("fieldrequired");
1045 jQuery("#tdfirstname").addClass("fieldrequired");
1048 jQuery(\'input[name="morphy"]\').change(function() {
1049 initfieldrequired();
1051 initfieldrequired();
1053 print
'</script>'.
"\n";
1056 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1057 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1058 print
'<input type="hidden" name="action" value="add">';
1059 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1061 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1066 print
'<table class="border centpercent">';
1071 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"member_login") ?
GETPOST(
"member_login",
'alphanohtml', 2) :
$object->login).
'" autofocus="autofocus"></td></tr>';
1076 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
1078 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
1079 print
'<input type="password" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag(
GETPOST(
'password') ?
GETPOST(
'password') : $generated_password).
'">';
1084 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
1085 $listetype = $adht->liste_array(1);
1086 print
img_picto(
'', $adht->picto,
'class="pictofixedwidth"');
1087 if (count($listetype)) {
1088 print $form->selectarray(
"typeid", $listetype, (
GETPOSTINT(
'typeid') ?
GETPOSTINT(
'typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0,
'', 0, 0, 0,
'',
'minwidth200', 1);
1090 print
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
1092 if ($user->hasRight(
'member',
'configurer')) {
1093 print
' <a href="'.dolBuildUrl(DOL_URL_ROOT.
'/adherents/type.php', [
'action' =>
'create',
'backtopage' =>
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'create',
'typeid' =>
'--IDFORBACKTOPAGE--'])]).
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewMemberType").
'"></span></a>';
1099 "phy" => $langs->trans(
"Physical"),
1100 "mor" => $langs->trans(
"Moral"),
1102 $checkednature =
GETPOST(
"morphy",
'alpha');
1103 $listetype_natures = $adht->morphyByType(1);
1104 $listetype_natures_json = json_encode($listetype_natures);
1106 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
1107 print
'<span id="spannature1" class="nonature-back spannature paddinglarge marginrightonly"><label for="phisicalinput" class="spanlabel">'.$morphys[
"phy"].
'</label><input id="phisicalinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="phy"'.($checkednature ==
"phy" ?
' checked="checked"' :
'').
'></span>';
1108 print
'<span id="spannature2" class="nonature-back spannature paddinglarge marginrightonly"><label for="moralinput" class="spanlabel">'.$morphys[
"mor"].
'</label><input id="moralinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="mor"'.($checkednature ==
"mor" ?
' checked="checked"' :
'').
'></span>';
1111 if ($conf->use_javascript_ajax) {
1113 var listetype_natures = $listetype_natures_json;
1116 jQuery(function($) {
1117 function refreshNatureCss() {
1118 $(".spannature").each(function(index) {
1119 let $span = $("#spannature" + (index + 1));
1120 let checked = $span.find(".checkforselect").is(":checked");
1124 $span.addClass("member-individual-back").removeClass("nonature-back member-company-back");
1125 } else if (index === 1) {
1126 $span.addClass("member-company-back").removeClass("nonature-back member-individual-back");
1129 $span.removeClass("member-individual-back member-company-back")
1130 .addClass("nonature-back");
1135 $(".spannature").on("click", function() {
1136 console.log("Nature clicked");
1140 $("#typeid").on("change", function() {
1141 let morphy = listetype_natures[$(this).val()];
1143 let $phyInput = $("#phisicalinput");
1144 let $morInput = $("#moralinput");
1145 let $tdLast = $("#tdlastname");
1146 let $tdFirst = $("#tdfirstname");
1147 let $tdCompany = $("#tdcompany");
1148 let $span1 = $("#spannature1");
1149 let $span2 = $("#spannature2");
1153 $phyInput.prop({disabled: false, checked: true});
1154 $morInput.prop({disabled: true, checked: false});
1155 $span1.addClass("member-individual-back").removeClass("nonature-back");
1156 $span2.removeClass("member-company-back").addClass("nonature-back");
1157 $tdLast.addClass("fieldrequired");
1158 $tdFirst.addClass("fieldrequired");
1159 $tdCompany.removeClass("fieldrequired");
1163 $phyInput.prop({disabled: true, checked: false});
1164 $morInput.prop({disabled: false, checked: true});
1165 $span2.addClass("member-company-back").removeClass("nonature-back");
1166 $span1.removeClass("member-individual-back").addClass("nonature-back");
1167 $tdCompany.addClass("fieldrequired");
1168 $tdLast.removeClass("fieldrequired");
1169 $tdFirst.removeClass("fieldrequired");
1173 $phyInput.prop({disabled: false, checked: false});
1174 $morInput.prop({disabled: false, checked: false});
1175 $span1.removeClass("member-individual-back").addClass("nonature-back");
1176 $span2.removeClass("member-company-back").addClass("nonature-back");
1189 print
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
' / '.$langs->trans(
"Organization").
'</td><td>'.
img_picto(
'',
'company',
'class="pictofixedwidth"').
'<input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET(
'societe') ?
GETPOST(
'societe',
'alphanohtml') : $soc->
name).
'"></td></tr>';
1192 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1193 print $formcompany->select_civility(GETPOSTISSET(
'civility_code') ?
GETPOST(
'civility_code') :
$object->civility_code,
'civility_code',
'maxwidth150', 1).
'</td>';
1197 print
'<tr><td id="tdlastname">'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
'lastname') ?
GETPOST(
'lastname',
'alphanohtml') :
$object->lastname).
'"></td>';
1201 print
'<tr><td id="tdfirstname">'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
'firstname') ?
GETPOST(
'firstname',
'alphanohtml') :
$object->firstname).
'"></td>';
1205 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1207 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
1208 print $form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1212 print
'<tr><td>'.(getDolGlobalString(
'ADHERENT_MAIL_REQUIRED') ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
'ADHERENT_MAIL_REQUIRED') ?
'</span>' :
'').
'</td>';
1213 print
'<td>'.img_picto(
'',
'object_email',
'class="pictofixedwidth"').
' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET(
'member_email') ?
GETPOST(
'member_email',
'alpha') : $soc->
email).
'"></td></tr>';
1216 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1217 print
'<td>'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET(
'member_url') ?
GETPOST(
'member_url',
'alpha') :
$object->url).
'"></td></tr>';
1220 print
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
1221 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address',
'alphanohtml') : $soc->
address).
'</textarea>';
1225 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1226 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode',
'alphanohtml') : $soc->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1228 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town',
'alphanohtml') : $soc->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1232 if (empty($soc->country_id)) {
1233 $soc->country_id =
$mysoc->country_id;
1234 $soc->country_code =
$mysoc->country_code;
1235 $soc->state_id =
$mysoc->state_id;
1237 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1238 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1239 print $form->select_country(GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id',
'alpha') : $soc->country_id,
'country_id');
1241 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1247 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1248 if ($soc->country_id || GETPOSTISSET(
'country_id')) {
1249 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1250 print $formcompany->select_state(GETPOSTISSET(
'state_id') ?
GETPOSTINT(
'state_id') : $soc->state_id, GETPOSTISSET(
'country_id') ?
GETPOSTINT(
'country_id') : $soc->country_code);
1252 print $countrynotdefined;
1258 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1259 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" size="20" value="'.(GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') : $soc->phone).
'"></td></tr>';
1262 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1263 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET(
'phone_perso') ?
GETPOST(
'phone_perso',
'alpha') :
$object->phone_perso).
'"></td></tr>';
1266 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1267 print
'<td>'.img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'"></td></tr>';
1270 foreach ($socialnetworks as $key => $value) {
1271 if (!$value[
'active']) {
1274 $val = (GETPOSTISSET(
'member_'.$key) ?
GETPOST(
'member_'.$key,
'alpha') : (empty(
$object->socialnetworks[$key]) ?
'' :
$object->socialnetworks[$key]));
1275 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
1280 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1281 print
img_picto(
'',
'object_calendar',
'class="pictofixedwidth"').$form->selectDate((
$object->birth ?
$object->birth : -1),
'birth', 0, 0, 1,
'formsoc');
1282 print
"</td></tr>\n";
1286 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
1287 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
1288 print
"</td><td>\n";
1289 print $form->selectyesno(
"public",
$object->public, 1,
false, 0, 1);
1290 print
"</td></tr>\n";
1293 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1294 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td><td>';
1295 print $form->selectCategories(Categorie::TYPE_MEMBER,
'memcats', $object);
1300 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1307 print $form->buttonsSaveCancel(
"AddMember");
1313 if ($action ==
'edit') {
1319 $res =
$object->fetch_optionals();
1326 $adht->fetch(
$object->typeid);
1330 if (!empty($country) ||
$object->country_id) {
1331 $sql =
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country";
1332 $sql .=
" WHERE rowid = ".(int) (!empty($country) ? $country :
$object->country_id);
1333 $resql = $db->query($sql);
1335 $obj = $db->fetch_object($resql);
1340 if (is_object($obj)) {
1341 $object->country_id = $obj->rowid;
1342 $object->country_code = $obj->code;
1343 $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
1350 if ($conf->use_javascript_ajax) {
1351 print
"\n".
'<script type="text/javascript">';
1352 print
'jQuery(document).ready(function () {
1353 jQuery("#selectcountry_id").change(function() {
1354 document.formsoc.action.value="edit";
1355 document.formsoc.submit();
1357 function initfieldrequired() {
1358 jQuery("#tdcompany").removeClass("fieldrequired");
1359 jQuery("#tdlastname").removeClass("fieldrequired");
1360 jQuery("#tdfirstname").removeClass("fieldrequired");
1361 if (jQuery(\'input[name="morphy"]:checked\').val() == \'mor\') {
1362 jQuery("#tdcompany").addClass("fieldrequired");
1364 if (jQuery(\'input[name="morphy"]:checked\').val() == \'phy\') {
1365 jQuery("#tdlastname").addClass("fieldrequired");
1366 jQuery("#tdfirstname").addClass("fieldrequired");
1369 jQuery(\'input[name="morphy"]\').change(function() {
1370 initfieldrequired();
1372 initfieldrequired();
1374 print
'</script>'.
"\n";
1377 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1378 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1379 print
'<input type="hidden" name="action" value="update" />';
1380 print
'<input type="hidden" name="rowid" value="'.$id.
'" />';
1381 print
'<input type="hidden" name="statut" value="'.$object->status.
'" />';
1383 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1388 print
'<table class="border centpercent">';
1391 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.
$object->ref.
'</td></tr>';
1395 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"login") ?
GETPOST(
"login",
'alphanohtml', 2) :
$object->login).
'"></td></tr>';
1400 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.
dol_escape_htmltag(GETPOSTISSET(
"pass") ?
GETPOST(
"pass",
'password', 2) :
'').
'"></td></tr>';
1404 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
1405 if ($user->hasRight(
'adherent',
'creer')) {
1406 print $form->selectarray(
"typeid", $adht->liste_array(), (GETPOSTISSET(
"typeid") ?
GETPOSTINT(
"typeid") :
$object->typeid), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200', 1);
1408 print $adht->getNomUrl(1);
1409 print
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
1414 $morphys[
"phy"] = $langs->trans(
"Physical");
1415 $morphys[
"mor"] = $langs->trans(
"Moral");
1416 $checkednature = (GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'alpha') :
$object->morphy);
1417 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
1418 print
'<span id="spannature1" class="member-individual-back spannature paddinglarge marginrightonly"><label for="phisicalinput" class="valignmiddle">'.$morphys[
"phy"].
'<input id="phisicalinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="phy"'.($checkednature ==
"phy" ?
' checked="checked"' :
'').
'></label></span>';
1419 print
'<span id="spannature1" class="member-company-back spannature paddinglarge marginrightonly"><label for="moralinput" class="valignmiddle">'.$morphys[
"mor"].
'<input id="moralinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="mor"'.($checkednature ==
"mor" ?
' checked="checked"' :
'').
'></label></span>';
1423 print
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
'</td><td>'.
img_picto(
'',
'company',
'class="pictofixedwidth"').
'<input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET(
"societe") ?
GETPOST(
"societe",
'alphanohtml', 2) :
$object->company).
'"></td></tr>';
1426 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1427 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'alpha') :
$object->civility_code,
'civility_code',
'maxwidth150', 1);
1432 print
'<tr><td id="tdlastname">'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"lastname") ?
GETPOST(
"lastname",
'alphanohtml', 2) :
$object->lastname).
'"></td>';
1436 print
'<tr><td id="tdfirstname">'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"firstname") ?
GETPOST(
"firstname",
'alphanohtml', 3) :
$object->firstname).
'"></td>';
1440 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1442 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
1443 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender',
'alphanohtml') :
$object->gender, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1447 print
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
1448 print
'<td class="hideonsmartphone" valign="middle">';
1449 print $form->showphoto(
'memberphoto', $object).
"\n";
1450 if ($caneditfieldmember) {
1454 print
'<table class="nobordernopadding">';
1456 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"><label for="photodelete" class="paddingleft">'.$langs->trans(
"Delete").
'</label><br></td></tr>';
1460 $maxmin = $maxfilesizearray[
'maxmin'];
1462 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1464 print
'<input type="file" class="flat" name="photo" id="photoinput">';
1471 print
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'</span>' :
'').
'</td>';
1472 print
'<td>'.img_picto(
'',
'object_email',
'class="pictofixedwidth"').
'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET(
"member_email") ?
GETPOST(
"member_email",
'alphanohtml', 2) :
$object->
email).
'"></td></tr>';
1475 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1476 print
'<td>'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
'<input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET(
'member_url') ?
GETPOST(
'member_url',
'alpha') :
$object->url).
'"></td></tr>';
1479 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
1480 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml', 2) :
$object->
address).
'</textarea>';
1484 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1485 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode",
'alphanohtml', 2) :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1487 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town",
'alphanohtml', 2) :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1492 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1493 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1494 print $form->select_country(GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") :
$object->country_id,
'country_id');
1496 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1502 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1503 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1504 print $formcompany->select_state(
$object->state_id, GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") :
$object->country_id);
1509 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1510 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(GETPOSTISSET(
"phone") ?
GETPOST(
"phone") :
$object->phone).
'"></td></tr>';
1513 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1514 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone_perso" value="'.(GETPOSTISSET(
"phone_perso") ?
GETPOST(
"phone_perso") :
$object->phone_perso).
'"></td></tr>';
1517 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1518 print
'<td>'.img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" value="'.(GETPOSTISSET(
"phone_mobile") ?
GETPOST(
"phone_mobile") :
$object->phone_mobile).
'"></td></tr>';
1521 foreach ($socialnetworks as $key => $value) {
1522 if (!$value[
'active']) {
1525 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="'.$key.
'" class="minwidth100" value="'.(GETPOSTISSET($key) ?
GETPOST($key,
'alphanohtml') : (isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] : null)).
'"></td></tr>';
1530 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1531 print
img_picto(
'',
'object_calendar',
'class="pictofixedwidth"').$form->selectDate((
$object->birth ?
$object->birth : -1),
'birth', 0, 0, 1,
'formsoc');
1532 print
"</td></tr>\n";
1536 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
1537 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(), 1);
1544 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
1545 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
1546 print
"</td><td>\n";
1547 print $form->selectyesno(
"public", (GETPOSTISSET(
"public") ?
GETPOST(
"public",
'alphanohtml', 2) :
$object->public), 1, false, 0, 1);
1548 print
"</td></tr>\n";
1551 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1552 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td>';
1554 print $form->selectCategories(Categorie::TYPE_MEMBER,
'memcats', $object);
1560 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
1563 $result = $company->fetch(
$object->socid);
1564 print $company->getNomUrl(1);
1566 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1572 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
1574 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id, (
string)
$object->user_id,
'none');
1576 print $langs->trans(
"NoDolibarrAccess");
1581 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1586 print $form->buttonsSaveCancel(
"Save",
'Cancel');
1592 if ($id > 0 && $action !=
'edit') {
1598 $res =
$object->fetch_optionals();
1605 $res = $adht->fetch(
$object->typeid);
1617 print
dol_get_fiche_head($head,
'general', $langs->trans(
"Member"), -1,
'user', 0,
'',
'', 0,
'', 1);
1620 if ($action ==
'create_user') {
1621 $login = (GETPOSTISSET(
'login') ?
GETPOST(
'login',
'alphanohtml') :
$object->login);
1622 if (empty($login)) {
1624 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1627 if (empty($login)) {
1628 $login = strtolower(substr(
$object->firstname, 0, 4)).strtolower(substr(
$object->lastname, 0, 4));
1632 $formquestion = array(
1633 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login)
1637 $formquestion[] = array(
'label' => $langs->trans(
"UserWillBe"),
'type' =>
'radio',
'name' =>
'internalorexternal',
'default' =>
'external',
'values' => array(
'external' => $langs->trans(
"External").
' - '.$langs->trans(
"LinkedToDolibarrThirdParty").
' '.
$object->thirdparty->getNomUrl(1,
'', 0, 1),
'internal' => $langs->trans(
"Internal")));
1641 $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
1643 $text .= $langs->trans(
"ConfirmCreateLogin");
1644 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1648 if ($action ==
'create_thirdparty') {
1650 $fullname =
$object->getFullName($langs);
1652 if (
$object->morphy ==
'mor') {
1653 $companyname = (string)
$object->company;
1654 if (!empty($fullname)) {
1655 $companyalias = (string) $fullname;
1658 $companyname = $fullname;
1659 if (!empty(
$object->company)) {
1660 $companyalias = (string)
$object->company;
1665 $formquestion = array(
1666 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
1667 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
1670 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion,
'yes');
1674 if ($action ==
'valid') {
1675 $langs->load(
"mails");
1678 $adht->fetch(
$object->typeid);
1684 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1687 $outputlangs =
new Translate(
'', $conf);
1688 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
1690 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
1692 $arraydefaultmessage =
null;
1695 if (!empty($labeltouse)) {
1696 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1699 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1700 $subject = (string) $arraydefaultmessage->topic;
1701 $msg = (string) $arraydefaultmessage->content;
1704 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
1709 $tmp = $langs->trans(
"SendingAnEMailToMember");
1710 $tmp .=
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'</b>, ';
1711 $tmp .=
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>';
1713 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'<br>'.
"\n";
1714 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1715 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1716 $helpcontent .= $subjecttosend.
"\n";
1717 $helpcontent .=
"<br>";
1718 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1721 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1724 $formquestion = array();
1726 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
true : false));
1729 $formquestion[] = array(
'type' =>
'other',
'label' => $langs->transnoentitiesnoconv(
"SynchroMailManEnabled"),
'value' =>
'');
1732 $formquestion[] = array(
'type' =>
'other',
'label' => $langs->transnoentitiesnoconv(
"SynchroSpipEnabled"),
'value' =>
'');
1734 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"),
"confirm_valid", $formquestion,
'yes', 1, 250);
1738 if ($action ==
'resiliate') {
1739 $langs->load(
"mails");
1742 $adht->fetch(
$object->typeid);
1748 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1751 $outputlangs =
new Translate(
'', $conf);
1752 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
1754 $outputlangs->loadLangs(array(
"main",
"members"));
1756 $arraydefaultmessage =
null;
1759 if (!empty($labeltouse)) {
1760 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1763 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1764 $subject = (string) $arraydefaultmessage->topic;
1765 $msg = (string) $arraydefaultmessage->content;
1768 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
1773 $tmp = $langs->trans(
"SendingAnEMailToMember");
1774 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'</b>, ';
1775 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>)';
1777 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'<br>'.
"\n";
1778 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1779 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1780 $helpcontent .= $subjecttosend.
"\n";
1781 $helpcontent .=
"<br>";
1782 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1785 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1788 $formquestion = array();
1790 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
'true' :
'false'));
1793 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1795 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"),
"confirm_resiliate", $formquestion,
'no', 1, 240);
1799 if ($action ==
'exclude') {
1800 $langs->load(
"mails");
1803 $adht->fetch(
$object->typeid);
1809 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1812 $outputlangs =
new Translate(
'', $conf);
1813 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ?
$mysoc->default_lang :
$object->thirdparty->default_lang);
1815 $outputlangs->loadLangs(array(
"main",
"members"));
1817 $arraydefaultmessage =
null;
1820 if (!empty($labeltouse)) {
1821 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1824 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1825 $subject = (string) $arraydefaultmessage->topic;
1826 $msg = (string) $arraydefaultmessage->content;
1829 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null, $object);
1834 $tmp = $langs->trans(
"SendingAnEMailToMember");
1835 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'</b>, ';
1836 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>)';
1838 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM', $conf->email_from).
'<br>'.
"\n";
1839 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1840 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1841 $helpcontent .= $subjecttosend.
"\n";
1842 $helpcontent .=
"<br>";
1843 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1846 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1849 $formquestion = array();
1851 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
'true' :
'false'));
1854 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1856 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"),
"confirm_exclude", $formquestion,
'no', 1, 240);
1860 if ($action ==
'delete') {
1861 $formquestion = array();
1863 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1865 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"),
"confirm_delete", $formquestion,
'no', 1);
1869 if ($action ==
'add_spip') {
1870 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'),
'confirm_add_spip');
1874 if ($action ==
'merge') {
1875 $formquestion = array(
1877 'name' =>
'member_origin',
1878 'label' => $langs->trans(
'MergeOriginMember'),
1880 'value' => $form->selectMembers(
'',
'member_origin',
'', 0, 1,
'', 0, array(), 0,
'SelectMember', 0,
'minwidth200', array(), 1, array(
$object->id))
1884 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"MergeMembers"), $langs->trans(
"ConfirmMergeMembers"),
"confirm_merge", $formquestion,
'no', 1, 300);
1888 if ($action ==
'del_spip') {
1889 print $form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'),
'confirm_del_spip');
1900 $linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/adherents/list.php', [
'restore_lastsearch_values' => 1]).
'">'.$langs->trans(
"BackToList").
'</a>';
1902 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/adherents/vcard.php', [
'id' =>
$object->id]).
'" class="refid valignmiddle">';
1903 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1904 $morehtmlref .=
'</a>';
1907 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1909 print
'<div class="fichecenter">';
1910 print
'<div class="fichehalfleft">';
1912 print
'<div class="underbanner clearboth"></div>';
1913 print
'<table class="border tableforfield centpercent">';
1917 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag(
$object->login).
'</td></tr>';
1921 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Type").
'</td>';
1922 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
1925 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
1926 print
'<td class="valeur">'.$object->getmorphylib(
'', 1).
'</td>';
1933 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.
$object->getCivilityLabel().
'</td>';
1938 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
1940 print preg_replace(
'/./i',
'*',
$object->pass);
1943 print
'<!-- '.$langs->trans(
"Crypted").
': '.
$object->pass_indatabase_crypted.
' -->';
1945 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1947 if (!empty(
$object->pass_indatabase) && empty(
$object->user_id)) {
1948 $langs->load(
"errors");
1949 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
1950 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
1956 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
1960 print
" ".img_warning($langs->trans(
"Late"));
1963 if (
$object->need_subscription == 0) {
1964 print $langs->trans(
"SubscriptionNotNeeded");
1965 } elseif (!$adht->subscription) {
1966 print $langs->trans(
"SubscriptionNotRecorded");
1968 print
" ".img_warning($langs->trans(
"Late"));
1971 print $langs->trans(
"SubscriptionNotReceived");
1973 print
" ".img_warning($langs->trans(
"Late"));
1983 print
'<div class="fichehalfright">';
1984 print
'<div class="underbanner clearboth"></div>';
1986 print
'<table class="border tableforfield centpercent">';
1989 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1990 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1992 print $form->showCategories(
$object->id, Categorie::TYPE_MEMBER, 1);
1997 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date(
$object->birth,
'day').
'</td></tr>';
2001 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2002 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
2005 $langs->load(
"languages");
2006 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
2014 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
2015 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
2016 print
'</td><td class="valeur">'.yn(
$object->public).
'</td></tr>';
2019 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2024 $editenable = $user->hasRight(
'adherent',
'creer');
2025 print $form->editfieldkey(
'LinkedToDolibarrThirdParty',
'thirdparty',
'', $object, $editenable);
2026 print
'</td><td colspan="2" class="valeur">';
2027 if ($action ==
'editthirdparty') {
2028 $htmlname =
'socid';
2029 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
2030 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
2031 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
2032 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2033 print
'<table class="nobordernopadding">';
2035 print $form->select_company(
$object->socid,
'socid',
'', 1);
2037 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
2038 print
'</tr></table></form>';
2042 $result = $company->fetch(
$object->socid);
2043 print $company->getNomUrl(1);
2046 $tmparray = $company->getOutstandingBills(
'customer');
2047 if (!empty($tmparray[
'refs'])) {
2048 print
' - '.img_picto($langs->trans(
"Invoices"),
'bill',
'class="paddingright"').
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?socid='.
$object->socid.
'">'.$langs->trans(
"Invoices").
' ('.count($tmparray[
'refs']).
')';
2053 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
2061 $editenable = $user->hasRight(
'adherent',
'creer') && $user->hasRight(
'user',
'user',
'creer');
2062 print $form->editfieldkey(
'LinkedToDolibarrUser',
'login',
'', $object, (
int) $editenable);
2063 print
'</td><td colspan="2" class="valeur">';
2064 if ($action ==
'editlogin') {
2065 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id, (
string)
$object->user_id,
'userid', array());
2068 $linkeduser =
new User($db);
2069 $linkeduser->fetch(
$object->user_id);
2070 print $linkeduser->getNomUrl(-1);
2072 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
2079 print
"</div></div>\n";
2080 print
'<div class="clearboth"></div>';
2089 print
'<div class="tabsAction">';
2091 $parameters = array();
2092 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2093 if (empty($reshook)) {
2094 if ($action !=
'editlogin' && $action !=
'editthirdparty') {
2096 if (empty($user->socid)) {
2098 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
2117 if ($user->hasRight(
'adherent',
'creer')) {
2118 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'edit'],
true).
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
2120 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
2125 if ($user->hasRight(
'adherent',
'creer')) {
2126 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'valid'],
true).
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
2128 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
2134 if ($user->hasRight(
'adherent',
'creer')) {
2135 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'valid'],
true).
'">'.$langs->trans(
"Reenable").
"</a>\n";
2137 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
2143 if ($user->hasRight(
'adherent',
'supprimer')) {
2144 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'resiliate'],
true).
'">'.$langs->trans(
"Resiliate").
"</a></span>\n";
2146 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
2152 if ($user->hasRight(
'adherent',
'supprimer')) {
2153 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'exclude'],
true).
'">'.$langs->trans(
"Exclude").
"</a></span>\n";
2155 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
2161 if ($user->hasRight(
'societe',
'creer')) {
2163 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'create_thirdparty'],
true).
'" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrThirdPartyDesc")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
2165 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
2168 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
2173 if (!$user->socid && !
$object->user_id) {
2174 if ($user->hasRight(
'user',
'user',
'creer')) {
2176 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'create_user'],
true).
'" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrLoginDesc")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
2178 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
2181 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
2187 $isinspip = $mailmanspip->is_in_spip($object);
2189 if ($isinspip == 1) {
2190 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'del_spip'],
true).
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
2192 if ($isinspip == 0) {
2193 print
'<a class="butAction" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'add_spip'],
true).
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
2198 print
dolGetButtonAction($langs->trans(
'MergeMembers'), $langs->trans(
'Merge'),
'danger',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'merge'],
true),
'', $user->hasRight(
'adherent',
'supprimer'));
2201 if ($user->hasRight(
'adherent',
'supprimer')) {
2202 print
'<a class="butActionDelete" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'delete'],
true).
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
2204 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
2210 if ($isinspip == -1) {
2211 print
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
2216 if (
GETPOST(
'modelselected')) {
2217 $action =
'presend';
2220 if ($action !=
'presend') {
2221 print
'<div class="fichecenter"><div class="fichehalfleft">';
2222 print
'<a name="builddoc"></a>';
2226 $filedir = $conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member');
2227 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.
$object->id;
2228 $genallowed = $user->hasRight(
'adherent',
'lire');
2229 $delallowed = $user->hasRight(
'adherent',
'creer');
2231 print $formfile->showdocuments(
'member', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', (empty(
$object->default_lang) ?
'' :
$object->default_lang),
'',
$object);
2232 $somethingshown = $formfile->numoffiles;
2240 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2241 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
2242 $useonlinepayment = count($validpaymentmethod);
2244 if ($useonlinepayment) {
2246 if (empty($amount)) {
2247 $amount = max($adht->amount,
$object->first_subscription_amount,
$object->last_subscription_amount);
2249 if (empty($amount)) {
2252 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2253 print showOnlinePaymentUrl(
'membersubscription',
$object->ref, $amount);
2256 print
'</div><div class="fichehalfright">';
2260 $morehtmlcenter =
'';
2261 $messagingUrl =
dolBuildUrl(DOL_URL_ROOT.
'/adherents/messaging.php', [
'id' =>
$object->id]);
2262 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1);
2266 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2268 $somethingshown = $formactions->showactions($object,
$object->element, $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
2270 print
'</div></div>';
2274 $modelmail =
'member';
2275 $defaulttopic =
'CardContent';
2276 $diroutput = $conf->member->dir_output;
2277 $trackid =
'mem'.$object->id;
2279 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
const STATUS_EXCLUDED
Excluded.
const STATUS_DRAFT
Draft status.
const STATUS_RESILIATED
Resiliated (membership end and was not renew)
const STATUS_VALIDATED
Validated status.
Class to manage members type.
Class to manage mailman and spip.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
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").
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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...
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
$conf db name
Only used if Module[ID]Name translation string is not found.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
getMaxFileSizeArray()
Return the max allowed for file upload.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.