34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51 $langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"other",
"paypal"));
55 $action =
GETPOST(
'action',
'aZ09');
56 $cancel =
GETPOST(
'cancel',
'alpha');
57 $backtopage =
GETPOST(
'backtopage',
'alpha');
58 $confirm =
GETPOST(
'confirm',
'alpha');
59 $rowid =
GETPOST(
'rowid',
'int');
61 $typeid =
GETPOST(
'typeid',
'int');
62 $userid =
GETPOST(
'userid',
'int');
63 $socid =
GETPOST(
'socid',
'int');
67 include_once DOL_DOCUMENT_ROOT.
'/mailmanspip/class/mailmanspip.class.php';
69 $langs->load(
'mailmanspip');
78 $extrafields->fetch_name_optionals_label($object->table_element);
83 $object->getCanvas($id);
84 $canvas = $object->canvas ? $object->canvas :
GETPOST(
"canvas");
86 if (!empty($canvas)) {
87 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
88 $objcanvas =
new Canvas($db, $action);
89 $objcanvas->getCanvas(
'adherent',
'membercard', $canvas);
93 $hookmanager->initHooks(array(
'membercard',
'globalcard'));
96 if ($id > 0 || !empty($ref)) {
98 $result = $object->fetch($id, $ref);
101 $canadduser = ($user->admin || $user->hasRight(
'user',
'user',
'creer'));
103 if ($object->user_id) {
105 $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight(
'user',
'self',
'creer'))
106 || (($user->id != $object->user_id) && $user->hasRight(
'user',
'user',
'creer')));
107 $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight(
'user',
'self',
'password'))
108 || (($user->id != $object->user_id) && $user->hasRight(
'user',
'user',
'password')));
113 $canaddmember = $user->hasRight(
'adherent',
'creer');
116 $caneditfieldmember = $user->hasRight(
'adherent',
'creer');
120 $result =
restrictedArea($user,
'adherent', $object->id,
'',
'',
'socid',
'rowid', 0);
127 $parameters = array(
'id'=>$id,
'rowid'=>$id,
'objcanvas'=>$objcanvas,
'confirm'=>$confirm);
128 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
133 if (empty($reshook)) {
134 $backurlforlist = DOL_URL_ROOT.
'/adherents/list.php';
136 if (empty($backtopage) || ($cancel && empty($id))) {
137 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
138 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
139 $backtopage = $backurlforlist;
141 $backtopage = DOL_URL_ROOT.
'/adherents/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
147 if (!empty($backtopageforcancel)) {
148 header(
"Location: ".$backtopageforcancel);
150 } elseif (!empty($backtopage)) {
151 header(
"Location: ".$backtopage);
157 if ($action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
159 if (!$user->hasRight(
'user',
'user',
'creer')) {
160 if ($userid != $user->id && $userid != $object->user_id) {
162 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
167 if ($userid != $object->user_id) {
168 $result = $object->setUserId($userid);
177 if ($action ==
'setsocid') {
180 if ($socid != $object->socid) {
181 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
182 $sql .=
" WHERE socid = ".((int) $socid);
183 $sql .=
" AND entity = ".$conf->entity;
184 $resql = $db->query($sql);
186 $obj = $db->fetch_object(
$resql);
187 if ($obj && $obj->rowid > 0) {
189 $othermember->fetch($obj->rowid);
190 $thirdparty =
new Societe($db);
191 $thirdparty->fetch($socid);
193 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
198 $result = $object->setThirdPartyId($socid);
209 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
212 $nuser =
new User($db);
214 if (
GETPOST(
'internalorexternal',
'aZ09') ==
'internal') {
215 $tmpuser->fk_soc = 0;
218 $result = $nuser->create_from_member($tmpuser,
GETPOST(
'login',
'alphanohtml'));
221 $langs->load(
"errors");
224 setEventMessages($langs->trans(
"NewUserCreated", $nuser->login),
null,
'mesgs');
233 if ($action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
237 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'));
240 $langs->load(
"errors");
249 if ($action ==
'update' && !$cancel && $user->hasRight(
'adherent',
'creer')) {
250 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
256 $lastname =
GETPOST(
"lastname",
'alphanohtml');
257 $firstname =
GETPOST(
"firstname",
'alphanohtml');
258 $gender =
GETPOST(
"gender",
'alphanohtml');
259 $societe =
GETPOST(
"societe",
'alphanohtml');
260 $morphy =
GETPOST(
"morphy",
'alphanohtml');
261 $login =
GETPOST(
"login",
'alphanohtml');
262 if ($morphy !=
'mor' && empty($lastname)) {
264 $langs->load(
"errors");
265 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
267 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
269 $langs->load(
"errors");
270 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
272 if ($morphy ==
'mor' && empty($societe)) {
274 $langs->load(
"errors");
275 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
278 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
281 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
285 if ($result > 0 && !$error) {
289 $object->civility_id = trim(
GETPOST(
"civility_id",
'alphanohtml'));
290 $object->firstname = trim(
GETPOST(
"firstname",
'alphanohtml'));
291 $object->lastname = trim(
GETPOST(
"lastname",
'alphanohtml'));
292 $object->gender = trim(
GETPOST(
"gender",
'alphanohtml'));
293 $object->login = trim(
GETPOST(
"login",
'alphanohtml'));
294 $object->pass = trim(
GETPOST(
"pass",
'none'));
296 $object->societe = trim(
GETPOST(
"societe",
'alphanohtml'));
297 $object->company = trim(
GETPOST(
"societe",
'alphanohtml'));
299 $object->address = trim(
GETPOST(
"address",
'alphanohtml'));
300 $object->zip = trim(
GETPOST(
"zipcode",
'alphanohtml'));
301 $object->town = trim(
GETPOST(
"town",
'alphanohtml'));
302 $object->state_id =
GETPOST(
"state_id",
'int');
303 $object->country_id =
GETPOST(
"country_id",
'int');
305 $object->phone = trim(
GETPOST(
"phone",
'alpha'));
306 $object->phone_perso = trim(
GETPOST(
"phone_perso",
'alpha'));
307 $object->phone_mobile = trim(
GETPOST(
"phone_mobile",
'alpha'));
308 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
309 $object->url = trim(
GETPOST(
'member_url',
'custom', 0, FILTER_SANITIZE_URL));
310 $object->socialnetworks = array();
311 foreach ($socialnetworks as $key => $value) {
313 $object->socialnetworks[$key] = trim(
GETPOST($key,
'alphanohtml'));
320 $object->birth = $birthdate;
321 $object->default_lang =
GETPOST(
'default_lang',
'alpha');
322 $object->typeid =
GETPOST(
"typeid",
'int');
324 $object->morphy =
GETPOST(
"morphy",
'alpha');
326 if (
GETPOST(
'deletephoto',
'alpha')) {
328 } elseif (!empty($_FILES[
'photo'][
'name'])) {
333 $object->statut =
GETPOST(
"statut",
'alpha');
334 $object->public =
GETPOST(
"public",
'alpha');
337 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
344 if ($object->user_id) {
345 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'creer')) {
352 if ($object->user_id) {
353 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'password')) {
359 $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
361 if ($result >= 0 && !count($object->errors)) {
362 $categories =
GETPOST(
'memcats',
'array');
363 $object->setCategories($categories);
366 $dir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos';
367 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
370 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
371 $fileimg = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/'.$object->photo;
372 $dirthumbs = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/thumbs';
382 if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
386 $object->addThumbs($newfile);
393 switch ($_FILES[
'photo'][
'error']) {
396 $errors[] =
"ErrorFileSizeTooLarge";
399 $errors[] =
"ErrorFilePartiallyUploaded";
404 $rowid = $object->id;
408 if (!empty($backtopage)) {
409 header(
"Location: ".$backtopage);
424 if ($action ==
'add' && $user->hasRight(
'adherent',
'creer')) {
426 $object->canvas = $canvas;
432 $datesubscription =
'';
437 $typeid =
GETPOST(
"typeid",
'int');
438 $civility_id =
GETPOST(
"civility_id",
'alphanohtml');
439 $lastname =
GETPOST(
"lastname",
'alphanohtml');
440 $firstname =
GETPOST(
"firstname",
'alphanohtml');
441 $gender =
GETPOST(
"gender",
'alphanohtml');
442 $societe =
GETPOST(
"societe",
'alphanohtml');
443 $address =
GETPOST(
"address",
'alphanohtml');
444 $zip =
GETPOST(
"zipcode",
'alphanohtml');
445 $town =
GETPOST(
"town",
'alphanohtml');
446 $state_id =
GETPOST(
"state_id",
'int');
447 $country_id =
GETPOST(
"country_id",
'int');
449 $phone =
GETPOST(
"phone",
'alpha');
450 $phone_perso =
GETPOST(
"phone_perso",
'alpha');
451 $phone_mobile =
GETPOST(
"phone_mobile",
'alpha');
456 $email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
457 $url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
458 $login =
GETPOST(
"member_login",
'alphanohtml');
459 $pass =
GETPOST(
"password",
'none');
460 $photo =
GETPOST(
"photo",
'alphanohtml');
461 $morphy =
GETPOST(
"morphy",
'alphanohtml');
462 $public =
GETPOST(
"public",
'alphanohtml');
464 $userid =
GETPOST(
"userid",
'int');
465 $socid =
GETPOST(
"socid",
'int');
466 $default_lang =
GETPOST(
'default_lang',
'alpha');
468 $object->civility_id = $civility_id;
469 $object->firstname = $firstname;
470 $object->lastname = $lastname;
471 $object->gender = $gender;
472 $object->societe = $societe;
473 $object->company = $societe;
474 $object->address = $address;
476 $object->town = $town;
477 $object->state_id = $state_id;
478 $object->country_id = $country_id;
479 $object->phone = $phone;
480 $object->phone_perso = $phone_perso;
481 $object->phone_mobile = $phone_mobile;
482 $object->socialnetworks = array();
484 foreach ($socialnetworks as $key => $value) {
486 $object->socialnetworks[$key] =
GETPOST(
"member_".$key,
'alphanohtml');
496 $object->email = $email;
498 $object->login = $login;
499 $object->pass = $pass;
500 $object->birth = $birthdate;
501 $object->photo = $photo;
502 $object->typeid = $typeid;
504 $object->morphy = $morphy;
505 $object->user_id = $userid;
506 $object->socid = $socid;
507 $object->public = $public;
508 $object->default_lang = $default_lang;
510 $ret = $extrafields->setOptionalsFromPost(
null, $object);
516 if (empty($morphy) || $morphy ==
"-1") {
518 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")),
null,
'errors');
521 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
524 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
526 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
527 $result = $db->query($sql);
529 $num = $db->num_rows($result);
533 $langs->load(
"errors");
534 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login),
null,
'errors');
539 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")),
null,
'errors');
542 if ($morphy ==
'mor' && empty($societe)) {
544 $langs->load(
"errors");
545 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
547 if ($morphy !=
'mor' && empty($lastname)) {
549 $langs->load(
"errors");
550 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
552 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
554 $langs->load(
"errors");
555 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
557 if (!($typeid > 0)) {
559 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
561 if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
563 $langs->load(
"errors");
566 if (!empty($object->url) && !
isValidUrl($object->url)) {
567 $langs->load(
"errors");
568 setEventMessages($langs->trans(
"ErrorBadUrl", $object->url),
null,
'errors');
571 if (isset($public)) {
579 $result = $object->create($user);
582 $memcats =
GETPOST(
'memcats',
'array');
583 $object->setCategories($memcats);
586 $rowid = $object->id;
589 $backtopage = preg_replace(
'/__ID__/', $id, $backtopage);
597 if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
601 $result = $company->create_from_member($object);
603 $langs->load(
"errors");
612 $action = ($result < 0 || !$error) ?
'' :
'create';
614 if (!$error && $backtopage) {
615 header(
"Location: ".$backtopage);
620 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
621 $result = $object->delete($id, $user);
624 if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"],
'/').
'/', $backtopage)) {
625 header(
"Location: ".$backtopage);
628 header(
"Location: list.php");
636 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_valid' && $confirm ==
'yes') {
642 $adht->fetch($object->typeid);
644 $result = $object->validate($user);
646 if ($result >= 0 && !count($object->errors)) {
648 if ($object->email &&
GETPOST(
"send_mail")) {
653 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
657 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
659 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
661 $arraydefaultmessage =
null;
664 if (!empty($labeltouse)) {
665 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
668 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
669 $subject = $arraydefaultmessage->topic;
670 $msg = $arraydefaultmessage->content;
673 if (empty($labeltouse) || (
int) $labeltouse === -1) {
675 $langs->load(
"errors");
676 setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>',
null,
'errors');
684 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
686 $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
695 if ($object->error) {
710 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_resiliate') {
713 if ($confirm ==
'yes') {
715 $adht->fetch($object->typeid);
717 $result = $object->resiliate($user);
719 if ($result >= 0 && !count($object->errors)) {
720 if ($object->email &&
GETPOST(
"send_mail")) {
725 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
729 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
731 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
733 $arraydefaultmessage =
null;
736 if (!empty($labeltouse)) {
737 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
740 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
741 $subject = $arraydefaultmessage->topic;
742 $msg = $arraydefaultmessage->content;
745 if (empty($labeltouse) || (
int) $labeltouse === -1) {
755 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
757 $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
767 if ($object->error) {
775 if (!empty($backtopage) && !$error) {
776 header(
"Location: ".$backtopage);
781 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_exclude') {
784 if ($confirm ==
'yes') {
786 $adht->fetch($object->typeid);
788 $result = $object->exclude($user);
790 if ($result >= 0 && !count($object->errors)) {
791 if ($object->email &&
GETPOST(
"send_mail")) {
796 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
800 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
802 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
804 $arraydefaultmessage =
null;
807 if (!empty($labeltouse)) {
808 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
811 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
812 $subject = $arraydefaultmessage->topic;
813 $msg = $arraydefaultmessage->content;
816 if (empty($labeltouse) || (
int) $labeltouse === -1) {
826 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
828 $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
838 if ($object->error) {
846 if (!empty($backtopage) && !$error) {
847 header(
"Location: ".$backtopage);
853 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_del_spip' && $confirm ==
'yes') {
854 if (!count($object->errors)) {
855 if (!$mailmanspip->del_to_spip($object)) {
856 setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
861 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_add_spip' && $confirm ==
'yes') {
862 if (!count($object->errors)) {
863 if (!$mailmanspip->add_to_spip($object)) {
864 setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
870 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
873 $upload_dir = $conf->adherent->dir_output;
874 $permissiontoadd = $user->hasRight(
'adherent',
'creer');
875 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
878 $triggersendname =
'MEMBER_SENTBYMAIL';
880 $mode =
'emailfrommember';
881 $trackid =
'mem'.$object->id;
882 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
895 $title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
896 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
899 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
901 if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
905 if (empty($object->error) && $id) {
907 $result = $object->fetch($id);
912 $objcanvas->assign_values($action, $object->id, $object->ref);
913 $objcanvas->display_canvas($action);
920 if ($action ==
'create') {
921 $object->canvas = $canvas;
922 $object->state_id =
GETPOST(
'state_id',
'int');
925 $object->country_id =
GETPOST(
'country_id',
'int') ?
GETPOST(
'country_id',
'int') : $mysoc->country_id;
926 if ($object->country_id) {
927 $tmparray =
getCountry($object->country_id,
'all');
928 $object->country_code = $tmparray[
'code'];
929 $object->country = $tmparray[
'label'];
933 if (!empty($socid)) {
938 if (!($soc->id > 0)) {
939 $langs->load(
"errors");
940 print($langs->trans(
'ErrorRecordNotFound'));
949 if ($conf->use_javascript_ajax) {
950 print
"\n".
'<script type="text/javascript">'.
"\n";
951 print
'jQuery(document).ready(function () {
952 jQuery("#selectcountry_id").change(function() {
953 document.formsoc.action.value="create";
954 document.formsoc.submit();
956 function initfieldrequired() {
957 jQuery("#tdcompany").removeClass("fieldrequired");
958 jQuery("#tdlastname").removeClass("fieldrequired");
959 jQuery("#tdfirstname").removeClass("fieldrequired");
960 if (jQuery("#morphy").val() == \'mor\') {
961 jQuery("#tdcompany").addClass("fieldrequired");
963 if (jQuery("#morphy").val() == \'phy\') {
964 jQuery("#tdlastname").addClass("fieldrequired");
965 jQuery("#tdfirstname").addClass("fieldrequired");
968 jQuery("#morphy").change(function() {
973 print
'</script>'.
"\n";
976 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
977 print
'<input type="hidden" name="token" value="'.newToken().
'">';
978 print
'<input type="hidden" name="action" value="add">';
979 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
981 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
986 print
'<table class="border centpercent">';
990 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
991 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>';
995 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
996 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
998 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
999 print
'<input type="text" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag($generated_password).
'">';
1004 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
1005 $listetype = $adht->liste_array(1);
1006 if (count($listetype)) {
1007 print
$form->selectarray(
"typeid", $listetype, (
GETPOST(
'typeid',
'int') ?
GETPOST(
'typeid',
'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0,
'', 0, 0, 0,
'',
'', 1);
1009 print
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
1014 $morphys[
"phy"] = $langs->trans(
"Physical");
1015 $morphys[
"mor"] = $langs->trans(
"Moral");
1016 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
1017 print
$form->selectarray(
"morphy", $morphys, (
GETPOST(
'morphy',
'alpha') ?
GETPOST(
'morphy',
'alpha') : $object->morphy), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1021 print
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(
GETPOSTISSET(
'societe') ?
GETPOST(
'societe',
'alphanohtml') : $soc->
name).
'"></td></tr>';
1024 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1025 print $formcompany->select_civility(
GETPOST(
'civility_id',
'int') ?
GETPOST(
'civility_id',
'int') : $object->civility_id,
'civility_id',
'maxwidth150', 1).
'</td>';
1029 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>';
1033 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>';
1037 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1039 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1040 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1044 print
'<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'</span>' :
'').
'</td>';
1045 print
'<td>'.img_picto(
'',
'object_email').
' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(
GETPOSTISSET(
'member_email') ?
GETPOST(
'member_email',
'alpha') : $soc->email).
'"></td></tr>';
1048 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1049 print
'<td>'.img_picto(
'',
'globe').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(
GETPOSTISSET(
'member_url') ?
GETPOST(
'member_url',
'alpha') : $object->url).
'"></td></tr>';
1052 print
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
1053 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address',
'alphanohtml') : $soc->address).
'</textarea>';
1057 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1058 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode',
'alphanohtml') : $soc->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1060 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town',
'alphanohtml') : $soc->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1064 if (empty($soc->country_id)) {
1065 $soc->country_id = $mysoc->country_id;
1066 $soc->country_code = $mysoc->country_code;
1067 $soc->state_id = $mysoc->state_id;
1069 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1070 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1071 print
$form->select_country(
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id',
'alpha') : $soc->country_id,
'country_id');
1073 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1078 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1079 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1080 if ($soc->country_id) {
1081 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1082 print $formcompany->select_state(
GETPOSTISSET(
'state_id') ?
GETPOST(
'state_id',
'int') : $soc->state_id, $soc->country_code);
1084 print $countrynotdefined;
1090 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1091 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>';
1094 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1095 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>';
1098 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1099 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>';
1102 foreach ($socialnetworks as $key => $value) {
1103 if (!$value[
'active']) {
1106 $val = (
GETPOSTISSET(
'member_'.$key) ?
GETPOST(
'member_'.$key,
'alpha') : (empty($object->socialnetworks[$key]) ?
'' : $object->socialnetworks[$key]));
1107 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
1112 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1113 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1114 print
"</td></tr>\n";
1117 print
"<tr><td>".$langs->trans(
"Public").
"</td><td>\n";
1118 print
$form->selectyesno(
"public", $object->public, 1);
1119 print
"</td></tr>\n";
1122 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1123 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td><td>';
1124 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
'parent',
null,
null, 1);
1125 print
img_picto(
'',
'category').$form->multiselectarray(
'memcats', $cate_arbo,
GETPOST(
'memcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1130 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1137 print
$form->buttonsSaveCancel(
"AddMember");
1143 if ($action ==
'edit') {
1144 $res = $object->fetch($id);
1148 $res = $object->fetch_optionals();
1154 $adht->fetch($object->typeid);
1157 $country =
GETPOST(
'country',
'int');
1158 if (!empty($country) || $object->country_id) {
1159 $sql =
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country where rowid = ".(!empty($country) ? $country : $object->country_id);
1160 $resql = $db->query($sql);
1162 $obj = $db->fetch_object(
$resql);
1166 $object->country_id = $obj->rowid;
1167 $object->country_code = $obj->code;
1168 $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
1174 if ($conf->use_javascript_ajax) {
1175 print
"\n".
'<script type="text/javascript">';
1176 print
'jQuery(document).ready(function () {
1177 jQuery("#selectcountry_id").change(function() {
1178 document.formsoc.action.value="edit";
1179 document.formsoc.submit();
1181 function initfieldrequired() {
1182 jQuery("#tdcompany").removeClass("fieldrequired");
1183 jQuery("#tdlastname").removeClass("fieldrequired");
1184 jQuery("#tdfirstname").removeClass("fieldrequired");
1185 if (jQuery("#morphy").val() == \'mor\') {
1186 jQuery("#tdcompany").addClass("fieldrequired");
1188 if (jQuery("#morphy").val() == \'phy\') {
1189 jQuery("#tdlastname").addClass("fieldrequired");
1190 jQuery("#tdfirstname").addClass("fieldrequired");
1193 jQuery("#morphy").change(function() {
1194 initfieldrequired();
1196 initfieldrequired();
1198 print
'</script>'.
"\n";
1201 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1202 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1203 print
'<input type="hidden" name="action" value="update" />';
1204 print
'<input type="hidden" name="rowid" value="'.$id.
'" />';
1205 print
'<input type="hidden" name="statut" value="'.$object->statut.
'" />';
1207 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1212 print
'<table class="border centpercent">';
1215 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.$object->ref.
'</td></tr>';
1218 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1219 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>';
1223 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1224 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",
'none', 2) : $object->pass).
'"></td></tr>';
1228 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
1229 if ($user->hasRight(
'adherent',
'creer')) {
1230 print
$form->selectarray(
"typeid", $adht->liste_array(), (
GETPOSTISSET(
"typeid") ?
GETPOST(
"typeid",
'int') : $object->typeid), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1232 print $adht->getNomUrl(1);
1233 print
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
1238 $morphys[
"phy"] = $langs->trans(
"Physical");
1239 $morphys[
"mor"] = $langs->trans(
"Moral");
1240 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
1241 print
$form->selectarray(
"morphy", $morphys, (
GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'alpha') : $object->morphy), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1245 print
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(
GETPOSTISSET(
"societe") ?
GETPOST(
"societe",
'alphanohtml', 2) : $object->company).
'"></td></tr>';
1248 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1249 print $formcompany->select_civility(
GETPOSTISSET(
"civility_id") ?
GETPOST(
"civility_id",
'alpha') : $object->civility_id,
'civility_id',
'maxwidth150', 1);
1254 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>';
1258 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>';
1262 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1264 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1265 print
$form->selectarray(
'gender', $arraygender,
GETPOSTISSET(
'gender') ?
GETPOST(
'gender',
'alphanohtml') : $object->gender, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1269 print
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
1270 print
'<td class="hideonsmartphone" valign="middle">';
1271 print
$form->showphoto(
'memberphoto', $object).
"\n";
1272 if ($caneditfieldmember) {
1273 if ($object->photo) {
1276 print
'<table class="nobordernopadding">';
1277 if ($object->photo) {
1278 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
1280 print
'<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
1283 $maxmin = $maxfilesizearray[
'maxmin'];
1285 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1287 print
'<input type="file" class="flat" name="photo" id="photoinput">';
1294 print
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'</span>' :
'').
'</td>';
1295 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",
'', 2) : $object->email).
'"></td></tr>';
1298 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1299 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>';
1302 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
1303 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(
GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml', 2) : $object->address).
'</textarea>';
1307 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1308 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode",
'alphanohtml', 2) : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1310 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town",
'alphanohtml', 2) : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1315 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1316 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1317 print
$form->select_country(
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id,
'country_id');
1319 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1324 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1325 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1326 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1327 print $formcompany->select_state($object->state_id,
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id);
1332 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1333 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(
GETPOSTISSET(
"phone") ?
GETPOST(
"phone") : $object->phone).
'"></td></tr>';
1336 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1337 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>';
1340 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1341 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>';
1344 foreach ($socialnetworks as $key => $value) {
1345 if (!$value[
'active']) {
1348 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="'.$key.
'" class="minwidth100" value="'.(
GETPOSTISSET($key) ?
GETPOST($key,
'alphanohtml') : $object->socialnetworks[$key]).
'"></td></tr>';
1353 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1354 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1355 print
"</td></tr>\n";
1359 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
1360 print
img_picto(
'',
'language').$formadmin->select_language($object->default_lang,
'default_lang', 0, 0, 1);
1366 print
"<tr><td>".$langs->trans(
"Public").
"</td><td>\n";
1367 print
$form->selectyesno(
"public", (
GETPOSTISSET(
"public") ?
GETPOST(
"public",
'alphanohtml', 2) : $object->public), 1);
1368 print
"</td></tr>\n";
1371 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1372 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td>';
1374 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
null,
null,
null, 1);
1376 $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
1377 $arrayselected = array();
1378 if (is_array($cats)) {
1379 foreach ($cats as $cat) {
1380 $arrayselected[] = $cat->id;
1383 print
$form->multiselectarray(
'memcats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'100%');
1389 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
1390 if ($object->socid) {
1392 $result = $company->fetch($object->socid);
1393 print $company->getNomUrl(1);
1395 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1401 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
1402 if ($object->user_id) {
1403 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'none');
1405 print $langs->trans(
"NoDolibarrAccess");
1410 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1415 print
$form->buttonsSaveCancel(
"Save",
'');
1421 if ($id > 0 && $action !=
'edit') {
1422 $res = $object->fetch($id);
1426 $res = $object->fetch_optionals();
1432 $res = $adht->fetch($object->typeid);
1446 if ($action ==
'create_user') {
1448 if (empty($login)) {
1450 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1453 if (empty($login)) {
1454 $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
1458 $formquestion = array(
1459 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login)
1462 $object->fetch_thirdparty();
1463 $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")));
1467 $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
1469 $text .= $langs->trans(
"ConfirmCreateLogin");
1470 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1474 if ($action ==
'create_thirdparty') {
1476 $fullname = $object->getFullName($langs);
1478 if ($object->morphy ==
'mor') {
1479 $companyname = $object->company;
1480 if (!empty($fullname)) {
1481 $companyalias = $fullname;
1484 $companyname = $fullname;
1485 if (!empty($object->company)) {
1486 $companyalias = $object->company;
1491 $formquestion = array(
1492 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
1493 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
1496 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion,
'yes');
1500 if ($action ==
'valid') {
1501 $langs->load(
"mails");
1504 $adht->fetch($object->typeid);
1510 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1513 $outputlangs =
new Translate(
'', $conf);
1514 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1516 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
1518 $arraydefaultmessage =
null;
1521 if (!empty($labeltouse)) {
1522 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1525 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1526 $subject = $arraydefaultmessage->topic;
1527 $msg = $arraydefaultmessage->content;
1535 $tmp = $langs->trans(
"SendingAnEMailToMember");
1536 $tmp .=
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1537 $tmp .=
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>';
1539 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1540 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1541 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1542 $helpcontent .= $subjecttosend.
"\n";
1543 $helpcontent .=
"<br>";
1544 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1546 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1549 $formquestion = array();
1550 if ($object->email) {
1551 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
true :
false));
1553 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
1554 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroMailManEnabled"),
'value'=>
'');
1556 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1557 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroSpipEnabled"),
'value'=>
'');
1559 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"),
"confirm_valid", $formquestion,
'yes', 1, 220);
1563 if ($action ==
'resiliate') {
1564 $langs->load(
"mails");
1567 $adht->fetch($object->typeid);
1573 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1576 $outputlangs =
new Translate(
'', $conf);
1577 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1579 $outputlangs->loadLangs(array(
"main",
"members"));
1581 $arraydefaultmessage =
null;
1584 if (!empty($labeltouse)) {
1585 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1588 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1589 $subject = $arraydefaultmessage->topic;
1590 $msg = $arraydefaultmessage->content;
1598 $tmp = $langs->trans(
"SendingAnEMailToMember");
1599 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1600 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1602 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1603 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1604 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1605 $helpcontent .= $subjecttosend.
"\n";
1606 $helpcontent .=
"<br>";
1607 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1609 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1612 $formquestion = array();
1613 if ($object->email) {
1614 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1617 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1619 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"),
"confirm_resiliate", $formquestion,
'no', 1, 240);
1623 if ($action ==
'exclude') {
1624 $langs->load(
"mails");
1627 $adht->fetch($object->typeid);
1633 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1636 $outputlangs =
new Translate(
'', $conf);
1637 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1639 $outputlangs->loadLangs(array(
"main",
"members"));
1641 $arraydefaultmessage =
null;
1644 if (!empty($labeltouse)) {
1645 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1648 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1649 $subject = $arraydefaultmessage->topic;
1650 $msg = $arraydefaultmessage->content;
1658 $tmp = $langs->trans(
"SendingAnEMailToMember");
1659 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1660 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1662 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1663 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1664 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1665 $helpcontent .= $subjecttosend.
"\n";
1666 $helpcontent .=
"<br>";
1667 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1669 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1672 $formquestion = array();
1673 if ($object->email) {
1674 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1677 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1679 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"),
"confirm_exclude", $formquestion,
'no', 1, 240);
1683 if ($action ==
'delete') {
1684 $formquestion = array();
1686 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1688 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"),
"confirm_delete", $formquestion,
'no', 1);
1692 if ($action ==
'add_spip') {
1693 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'),
'confirm_add_spip');
1696 if ($action ==
'del_spip') {
1697 print
$form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'),
'confirm_del_spip');
1701 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1708 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1710 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.$object->id.
'" class="refid">';
1711 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1712 $morehtmlref .=
'</a>';
1715 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1717 print
'<div class="fichecenter">';
1718 print
'<div class="fichehalfleft">';
1720 print
'<div class="underbanner clearboth"></div>';
1721 print
'<table class="border tableforfield centpercent">';
1724 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1725 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag($object->login).
'</td></tr>';
1729 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
1730 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
1733 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
1734 print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
1738 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.
dol_escape_htmltag($object->company).
'</td></tr>';
1741 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$object->getCivilityLabel().
'</td>';
1745 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1746 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
1747 if ($object->pass) {
1748 print preg_replace(
'/./i',
'*', $object->pass);
1751 print
'<!-- '.$langs->trans(
"Crypted").
': '.$object->pass_indatabase_crypted.
' -->';
1753 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1755 if (!empty($object->pass_indatabase) && empty($object->user_id)) {
1756 $langs->load(
"errors");
1757 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
1758 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
1764 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
1765 if ($object->datefin) {
1767 if ($object->hasDelay()) {
1768 print
" ".img_warning($langs->trans(
"Late"));
1771 if ($object->need_subscription == 0) {
1772 print $langs->trans(
"SubscriptionNotNeeded");
1773 } elseif (!$adht->subscription) {
1774 print $langs->trans(
"SubscriptionNotRecorded");
1776 print
" ".img_warning($langs->trans(
"Late"));
1779 print $langs->trans(
"SubscriptionNotReceived");
1781 print
" ".img_warning($langs->trans(
"Late"));
1791 print
'<div class="fichehalfright">';
1792 print
'<div class="underbanner clearboth"></div>';
1794 print
'<table class="border tableforfield centpercent">';
1797 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1798 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1799 print
'<td colspan="2">';
1800 print
$form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
1805 print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date($object->birth,
'day').
'</td></tr>';
1809 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1810 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1813 $langs->load(
"languages");
1814 $labellang = ($object->default_lang ? $langs->trans(
'Language_'.$object->default_lang) :
'');
1815 print
picto_from_langcode($object->default_lang,
'class="paddingrightonly saturatemedium opacitylow"');
1821 print
'<tr><td>'.$langs->trans(
"Public").
'</td><td class="valeur">'.
yn($object->public).
'</td></tr>';
1824 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1829 $editenable = $user->hasRight(
'adherent',
'creer');
1830 print
$form->editfieldkey(
'LinkedToDolibarrThirdParty',
'thirdparty',
'', $object, $editenable);
1831 print
'</td><td colspan="2" class="valeur">';
1832 if ($action ==
'editthirdparty') {
1833 $htmlname =
'socid';
1834 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
1835 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
1836 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
1837 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1838 print
'<table class="nobordernopadding">';
1840 print
$form->select_company($object->socid,
'socid',
'', 1);
1842 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
1843 print
'</tr></table></form>';
1845 if ($object->socid) {
1847 $result = $company->fetch($object->socid);
1848 print $company->getNomUrl(1);
1851 $tmparray = $company->getOutstandingBills(
'customer');
1852 if (!empty($tmparray[
'refs'])) {
1853 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']).
')';
1858 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
1866 $editenable = $user->hasRight(
'adherent',
'creer') && $user->hasRight(
'user',
'user',
'creer');
1867 print
$form->editfieldkey(
'LinkedToDolibarrUser',
'login',
'', $object, $editenable);
1868 print
'</td><td colspan="2" class="valeur">';
1869 if ($action ==
'editlogin') {
1870 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'userid',
'');
1872 if ($object->user_id) {
1873 $linkeduser =
new User($db);
1874 $linkeduser->fetch($object->user_id);
1875 print $linkeduser->getNomUrl(-1);
1877 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1884 print
"</div></div>\n";
1885 print
'<div style="clear:both"></div>';
1894 print
'<div class="tabsAction">';
1897 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1898 if (empty($reshook)) {
1899 if ($action !=
'editlogin' && $action !=
'editthirdparty') {
1901 if (empty($user->socid)) {
1903 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>'.
"\n";
1922 if ($user->hasRight(
'adherent',
'creer')) {
1923 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
1925 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
1930 if ($user->hasRight(
'adherent',
'creer')) {
1931 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
1933 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
1939 if ($user->hasRight(
'adherent',
'creer')) {
1940 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid">'.$langs->trans(
"Reenable").
"</a>\n";
1942 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
1948 if ($user->hasRight(
'adherent',
'supprimer')) {
1949 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=resiliate">'.$langs->trans(
"Resiliate").
"</a></span>\n";
1951 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
1957 if ($user->hasRight(
'adherent',
'supprimer')) {
1958 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=exclude">'.$langs->trans(
"Exclude").
"</a></span>\n";
1960 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
1966 if ($user->hasRight(
'societe',
'creer')) {
1968 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int) $object->id).
'&action=create_thirdparty" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrThirdPartyDesc")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
1970 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
1973 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
1978 if (!$user->socid && !$object->user_id) {
1979 if ($user->hasRight(
'user',
'user',
'creer')) {
1981 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int) $object->id).
'&action=create_user" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrLoginDesc")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
1983 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
1986 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
1991 if (
isModEnabled(
'mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1992 $isinspip = $mailmanspip->is_in_spip($object);
1994 if ($isinspip == 1) {
1995 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=del_spip&token='.
newToken().
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
1997 if ($isinspip == 0) {
1998 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=add_spip&token='.
newToken().
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
2003 if ($user->hasRight(
'adherent',
'supprimer')) {
2004 print
'<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
2006 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
2012 if ($isinspip == -1) {
2013 print
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
2018 if (
GETPOST(
'modelselected')) {
2019 $action =
'presend';
2022 if ($action !=
'presend') {
2023 print
'<div class="fichecenter"><div class="fichehalfleft">';
2024 print
'<a name="builddoc"></a>';
2028 $filedir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member');
2029 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
2030 $genallowed = $user->hasRight(
'adherent',
'lire');
2031 $delallowed = $user->hasRight(
'adherent',
'creer');
2033 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);
2034 $somethingshown = $formfile->numoffiles;
2050 if ($useonlinepayment) {
2052 if (empty($amount)) {
2053 $amount =
price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount));
2055 if (empty($amount)) {
2058 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2059 print showOnlinePaymentUrl(
'membersubscription', $object->ref, $amount);
2062 print
'</div><div class="fichehalfright">';
2066 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/adherents/agenda.php?id='.$object->id);
2069 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2071 $somethingshown =
$formactions->showactions($object, $object->element, $socid, 1,
'listactions', $MAX,
'', $morehtmlcenter);
2073 print
'</div></div>';
2077 $modelmail =
'member';
2078 $defaulttopic =
'CardContent';
2079 $diroutput = $conf->adherent->dir_output;
2080 $trackid =
'mem'.$object->id;
2082 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
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.
Class to manage members type.
Class to manage categories.
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=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
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_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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...
isModEnabled($module)
Is Dolibarr module enabled.
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)
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 informations.
$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.