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'));
316 $object->birth = $birthdate;
317 $object->default_lang =
GETPOST(
'default_lang',
'alpha');
318 $object->typeid =
GETPOST(
"typeid",
'int');
320 $object->morphy =
GETPOST(
"morphy",
'alpha');
322 if (
GETPOST(
'deletephoto',
'alpha')) {
324 } elseif (!empty($_FILES[
'photo'][
'name'])) {
329 $object->statut =
GETPOST(
"statut",
'alpha');
330 $object->public =
GETPOST(
"public",
'alpha');
333 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
340 if ($object->user_id) {
341 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'creer')) {
348 if ($object->user_id) {
349 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'password')) {
355 $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
357 if ($result >= 0 && !count($object->errors)) {
358 $categories =
GETPOST(
'memcats',
'array');
359 $object->setCategories($categories);
362 $dir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos';
363 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
366 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
367 $fileimg = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/'.$object->photo;
368 $dirthumbs = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/thumbs';
378 if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
382 $object->addThumbs($newfile);
389 switch ($_FILES[
'photo'][
'error']) {
392 $errors[] =
"ErrorFileSizeTooLarge";
395 $errors[] =
"ErrorFilePartiallyUploaded";
400 $rowid = $object->id;
404 if (!empty($backtopage)) {
405 header(
"Location: ".$backtopage);
420 if ($action ==
'add' && $user->hasRight(
'adherent',
'creer')) {
422 $object->canvas = $canvas;
428 $datesubscription =
'';
433 $typeid =
GETPOST(
"typeid",
'int');
434 $civility_id =
GETPOST(
"civility_id",
'alphanohtml');
435 $lastname =
GETPOST(
"lastname",
'alphanohtml');
436 $firstname =
GETPOST(
"firstname",
'alphanohtml');
437 $gender =
GETPOST(
"gender",
'alphanohtml');
438 $societe =
GETPOST(
"societe",
'alphanohtml');
439 $address =
GETPOST(
"address",
'alphanohtml');
440 $zip =
GETPOST(
"zipcode",
'alphanohtml');
441 $town =
GETPOST(
"town",
'alphanohtml');
442 $state_id =
GETPOST(
"state_id",
'int');
443 $country_id =
GETPOST(
"country_id",
'int');
445 $phone =
GETPOST(
"phone",
'alpha');
446 $phone_perso =
GETPOST(
"phone_perso",
'alpha');
447 $phone_mobile =
GETPOST(
"phone_mobile",
'alpha');
452 $email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
453 $url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
454 $login =
GETPOST(
"member_login",
'alphanohtml');
455 $pass =
GETPOST(
"password",
'none');
456 $photo =
GETPOST(
"photo",
'alphanohtml');
457 $morphy =
GETPOST(
"morphy",
'alphanohtml');
458 $public =
GETPOST(
"public",
'alphanohtml');
460 $userid =
GETPOST(
"userid",
'int');
461 $socid =
GETPOST(
"socid",
'int');
462 $default_lang =
GETPOST(
'default_lang',
'alpha');
464 $object->civility_id = $civility_id;
465 $object->firstname = $firstname;
466 $object->lastname = $lastname;
467 $object->gender = $gender;
468 $object->societe = $societe;
469 $object->company = $societe;
470 $object->address = $address;
472 $object->town = $town;
473 $object->state_id = $state_id;
474 $object->country_id = $country_id;
475 $object->phone = $phone;
476 $object->phone_perso = $phone_perso;
477 $object->phone_mobile = $phone_mobile;
478 $object->socialnetworks = array();
480 foreach ($socialnetworks as $key => $value) {
482 $object->socialnetworks[$key] =
GETPOST(
"member_".$key,
'alphanohtml');
487 $object->email = $email;
489 $object->login = $login;
490 $object->pass = $pass;
491 $object->birth = $birthdate;
492 $object->photo = $photo;
493 $object->typeid = $typeid;
495 $object->morphy = $morphy;
496 $object->user_id = $userid;
497 $object->socid = $socid;
498 $object->public = $public;
499 $object->default_lang = $default_lang;
501 $ret = $extrafields->setOptionalsFromPost(
null, $object);
507 if (empty($morphy) || $morphy ==
"-1") {
509 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")),
null,
'errors');
512 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
515 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
517 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
518 $result = $db->query(
$sql);
520 $num = $db->num_rows($result);
524 $langs->load(
"errors");
525 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login),
null,
'errors');
530 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")),
null,
'errors');
533 if ($morphy ==
'mor' && empty($societe)) {
535 $langs->load(
"errors");
536 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
538 if ($morphy !=
'mor' && empty($lastname)) {
540 $langs->load(
"errors");
541 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
543 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
545 $langs->load(
"errors");
546 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
548 if (!($typeid > 0)) {
550 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
552 if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
554 $langs->load(
"errors");
557 if (!empty($object->url) && !
isValidUrl($object->url)) {
558 $langs->load(
"errors");
559 setEventMessages($langs->trans(
"ErrorBadUrl", $object->url),
null,
'errors');
562 if (isset($public)) {
570 $result = $object->create($user);
573 $memcats =
GETPOST(
'memcats',
'array');
574 $object->setCategories($memcats);
577 $rowid = $object->id;
580 $backtopage = preg_replace(
'/__ID__/', $id, $backtopage);
588 if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
592 $result = $company->create_from_member($object);
594 $langs->load(
"errors");
603 $action = ($result < 0 || !$error) ?
'' :
'create';
605 if (!$error && $backtopage) {
606 header(
"Location: ".$backtopage);
611 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
612 $result = $object->delete($id, $user);
615 if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"],
'/').
'/', $backtopage)) {
616 header(
"Location: ".$backtopage);
619 header(
"Location: list.php");
627 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_valid' && $confirm ==
'yes') {
633 $adht->fetch($object->typeid);
635 $result = $object->validate($user);
637 if ($result >= 0 && !count($object->errors)) {
639 if ($object->email &&
GETPOST(
"send_mail")) {
644 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
648 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
650 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
652 $arraydefaultmessage =
null;
655 if (!empty($labeltouse)) {
656 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
659 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
660 $subject = $arraydefaultmessage->topic;
661 $msg = $arraydefaultmessage->content;
664 if (empty($labeltouse) || (
int) $labeltouse === -1) {
666 $langs->load(
"errors");
667 setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>',
null,
'errors');
675 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
677 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
686 if ($object->error) {
701 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_resiliate') {
704 if ($confirm ==
'yes') {
706 $adht->fetch($object->typeid);
708 $result = $object->resiliate($user);
710 if ($result >= 0 && !count($object->errors)) {
711 if ($object->email &&
GETPOST(
"send_mail")) {
716 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
720 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
722 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
724 $arraydefaultmessage =
null;
727 if (!empty($labeltouse)) {
728 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
731 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
732 $subject = $arraydefaultmessage->topic;
733 $msg = $arraydefaultmessage->content;
736 if (empty($labeltouse) || (
int) $labeltouse === -1) {
746 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
748 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
758 if ($object->error) {
766 if (!empty($backtopage) && !$error) {
767 header(
"Location: ".$backtopage);
772 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_exclude') {
775 if ($confirm ==
'yes') {
777 $adht->fetch($object->typeid);
779 $result = $object->exclude($user);
781 if ($result >= 0 && !count($object->errors)) {
782 if ($object->email &&
GETPOST(
"send_mail")) {
787 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
791 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
793 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
795 $arraydefaultmessage =
null;
798 if (!empty($labeltouse)) {
799 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
802 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
803 $subject = $arraydefaultmessage->topic;
804 $msg = $arraydefaultmessage->content;
807 if (empty($labeltouse) || (
int) $labeltouse === -1) {
817 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
819 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
829 if ($object->error) {
837 if (!empty($backtopage) && !$error) {
838 header(
"Location: ".$backtopage);
844 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_del_spip' && $confirm ==
'yes') {
845 if (!count($object->errors)) {
846 if (!$mailmanspip->del_to_spip($object)) {
847 setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
852 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_add_spip' && $confirm ==
'yes') {
853 if (!count($object->errors)) {
854 if (!$mailmanspip->add_to_spip($object)) {
855 setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
861 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
864 $upload_dir = $conf->adherent->dir_output;
865 $permissiontoadd = $user->hasRight(
'adherent',
'creer');
866 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
869 $triggersendname =
'MEMBER_SENTBYMAIL';
871 $mode =
'emailfrommember';
872 $trackid =
'mem'.$object->id;
873 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
886 $title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
887 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
890 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
892 if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
896 if (empty($object->error) && $id) {
898 $result = $object->fetch($id);
903 $objcanvas->assign_values($action, $object->id, $object->ref);
904 $objcanvas->display_canvas($action);
911 if ($action ==
'create') {
912 $object->canvas = $canvas;
913 $object->state_id =
GETPOST(
'state_id',
'int');
916 $object->country_id =
GETPOST(
'country_id',
'int') ?
GETPOST(
'country_id',
'int') : $mysoc->country_id;
917 if ($object->country_id) {
918 $tmparray =
getCountry($object->country_id,
'all');
919 $object->country_code = $tmparray[
'code'];
920 $object->country = $tmparray[
'label'];
924 if (!empty($socid)) {
929 if (!($soc->id > 0)) {
930 $langs->load(
"errors");
931 print($langs->trans(
'ErrorRecordNotFound'));
940 if ($conf->use_javascript_ajax) {
941 print
"\n".
'<script type="text/javascript">'.
"\n";
942 print
'jQuery(document).ready(function () {
943 jQuery("#selectcountry_id").change(function() {
944 document.formsoc.action.value="create";
945 document.formsoc.submit();
947 function initfieldrequired() {
948 jQuery("#tdcompany").removeClass("fieldrequired");
949 jQuery("#tdlastname").removeClass("fieldrequired");
950 jQuery("#tdfirstname").removeClass("fieldrequired");
951 if (jQuery("#morphy").val() == \'mor\') {
952 jQuery("#tdcompany").addClass("fieldrequired");
954 if (jQuery("#morphy").val() == \'phy\') {
955 jQuery("#tdlastname").addClass("fieldrequired");
956 jQuery("#tdfirstname").addClass("fieldrequired");
959 jQuery("#morphy").change(function() {
964 print
'</script>'.
"\n";
967 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
968 print
'<input type="hidden" name="token" value="'.newToken().
'">';
969 print
'<input type="hidden" name="action" value="add">';
970 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
972 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
977 print
'<table class="border centpercent">';
981 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
982 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>';
986 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
987 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
989 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
990 print
'<input type="text" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag($generated_password).
'">';
995 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
996 $listetype = $adht->liste_array(1);
997 if (count($listetype)) {
998 print
$form->selectarray(
"typeid", $listetype, (
GETPOST(
'typeid',
'int') ?
GETPOST(
'typeid',
'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0,
'', 0, 0, 0,
'',
'', 1);
1000 print
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
1005 $morphys[
"phy"] = $langs->trans(
"Physical");
1006 $morphys[
"mor"] = $langs->trans(
"Moral");
1007 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
1008 print
$form->selectarray(
"morphy", $morphys, (
GETPOST(
'morphy',
'alpha') ?
GETPOST(
'morphy',
'alpha') : $object->morphy), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1012 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>';
1015 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1016 print $formcompany->select_civility(
GETPOST(
'civility_id',
'int') ?
GETPOST(
'civility_id',
'int') : $object->civility_id,
'civility_id',
'maxwidth150', 1).
'</td>';
1020 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>';
1024 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>';
1028 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1030 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1031 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1035 print
'<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'</span>' :
'').
'</td>';
1036 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>';
1039 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1040 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>';
1043 print
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
1044 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address',
'alphanohtml') : $soc->address).
'</textarea>';
1048 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1049 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode',
'alphanohtml') : $soc->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1051 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town',
'alphanohtml') : $soc->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1055 if (empty($soc->country_id)) {
1056 $soc->country_id = $mysoc->country_id;
1057 $soc->country_code = $mysoc->country_code;
1058 $soc->state_id = $mysoc->state_id;
1060 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1061 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1062 print
$form->select_country(
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id',
'alpha') : $soc->country_id,
'country_id');
1064 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1069 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1070 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1071 if ($soc->country_id) {
1072 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1073 print $formcompany->select_state(
GETPOSTISSET(
'state_id') ?
GETPOST(
'state_id',
'int') : $soc->state_id, $soc->country_code);
1075 print $countrynotdefined;
1081 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1082 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>';
1085 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1086 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>';
1089 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1090 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>';
1093 foreach ($socialnetworks as $key => $value) {
1094 if (!$value[
'active']) {
1097 $val = (
GETPOSTISSET(
'member_'.$key) ?
GETPOST(
'member_'.$key,
'alpha') : (empty($object->socialnetworks[$key]) ?
'' : $object->socialnetworks[$key]));
1098 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
1103 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1104 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1105 print
"</td></tr>\n";
1108 print
"<tr><td>".$langs->trans(
"Public").
"</td><td>\n";
1109 print
$form->selectyesno(
"public", $object->public, 1);
1110 print
"</td></tr>\n";
1113 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1114 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td><td>';
1115 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
'parent',
null,
null, 1);
1116 print
img_picto(
'',
'category').$form->multiselectarray(
'memcats', $cate_arbo,
GETPOST(
'memcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1121 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1128 print
$form->buttonsSaveCancel(
"AddMember");
1134 if ($action ==
'edit') {
1135 $res = $object->fetch($id);
1139 $res = $object->fetch_optionals();
1145 $adht->fetch($object->typeid);
1148 $country =
GETPOST(
'country',
'int');
1149 if (!empty($country) || $object->country_id) {
1150 $sql =
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country where rowid = ".(!empty($country) ? $country : $object->country_id);
1151 $resql = $db->query(
$sql);
1153 $obj = $db->fetch_object($resql);
1157 $object->country_id = $obj->rowid;
1158 $object->country_code = $obj->code;
1159 $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
1165 if ($conf->use_javascript_ajax) {
1166 print
"\n".
'<script type="text/javascript">';
1167 print
'jQuery(document).ready(function () {
1168 jQuery("#selectcountry_id").change(function() {
1169 document.formsoc.action.value="edit";
1170 document.formsoc.submit();
1172 function initfieldrequired() {
1173 jQuery("#tdcompany").removeClass("fieldrequired");
1174 jQuery("#tdlastname").removeClass("fieldrequired");
1175 jQuery("#tdfirstname").removeClass("fieldrequired");
1176 if (jQuery("#morphy").val() == \'mor\') {
1177 jQuery("#tdcompany").addClass("fieldrequired");
1179 if (jQuery("#morphy").val() == \'phy\') {
1180 jQuery("#tdlastname").addClass("fieldrequired");
1181 jQuery("#tdfirstname").addClass("fieldrequired");
1184 jQuery("#morphy").change(function() {
1185 initfieldrequired();
1187 initfieldrequired();
1189 print
'</script>'.
"\n";
1192 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1193 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1194 print
'<input type="hidden" name="action" value="update" />';
1195 print
'<input type="hidden" name="rowid" value="'.$id.
'" />';
1196 print
'<input type="hidden" name="statut" value="'.$object->statut.
'" />';
1198 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1203 print
'<table class="border centpercent">';
1206 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.$object->ref.
'</td></tr>';
1209 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1210 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>';
1214 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1215 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>';
1219 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
1220 if ($user->hasRight(
'adherent',
'creer')) {
1221 print
$form->selectarray(
"typeid", $adht->liste_array(), (
GETPOSTISSET(
"typeid") ?
GETPOST(
"typeid",
'int') : $object->typeid), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1223 print $adht->getNomUrl(1);
1224 print
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
1229 $morphys[
"phy"] = $langs->trans(
"Physical");
1230 $morphys[
"mor"] = $langs->trans(
"Moral");
1231 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
1232 print
$form->selectarray(
"morphy", $morphys, (
GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'alpha') : $object->morphy), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1236 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>';
1239 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1240 print $formcompany->select_civility(
GETPOSTISSET(
"civility_id") ?
GETPOST(
"civility_id",
'alpha') : $object->civility_id,
'civility_id',
'maxwidth150', 1);
1245 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>';
1249 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>';
1253 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1255 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1256 print
$form->selectarray(
'gender', $arraygender,
GETPOSTISSET(
'gender') ?
GETPOST(
'gender',
'alphanohtml') : $object->gender, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1260 print
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
1261 print
'<td class="hideonsmartphone" valign="middle">';
1262 print
$form->showphoto(
'memberphoto', $object).
"\n";
1263 if ($caneditfieldmember) {
1264 if ($object->photo) {
1267 print
'<table class="nobordernopadding">';
1268 if ($object->photo) {
1269 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
1271 print
'<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
1274 $maxmin = $maxfilesizearray[
'maxmin'];
1276 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1278 print
'<input type="file" class="flat" name="photo" id="photoinput">';
1285 print
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'</span>' :
'').
'</td>';
1286 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>';
1289 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1290 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>';
1293 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
1294 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(
GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml', 2) : $object->address).
'</textarea>';
1298 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1299 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode",
'alphanohtml', 2) : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1301 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town",
'alphanohtml', 2) : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1306 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1307 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1308 print
$form->select_country(
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id,
'country_id');
1310 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1315 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1316 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1317 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1318 print $formcompany->select_state($object->state_id,
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id);
1323 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1324 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(
GETPOSTISSET(
"phone") ?
GETPOST(
"phone") : $object->phone).
'"></td></tr>';
1327 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1328 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>';
1331 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1332 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>';
1335 foreach ($socialnetworks as $key => $value) {
1336 if (!$value[
'active']) {
1339 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>';
1344 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1345 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1346 print
"</td></tr>\n";
1350 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
1351 print
img_picto(
'',
'language').$formadmin->select_language($object->default_lang,
'default_lang', 0, 0, 1);
1357 print
"<tr><td>".$langs->trans(
"Public").
"</td><td>\n";
1358 print
$form->selectyesno(
"public", (
GETPOSTISSET(
"public") ?
GETPOST(
"public",
'alphanohtml', 2) : $object->public), 1);
1359 print
"</td></tr>\n";
1362 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1363 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td>';
1365 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
null,
null,
null, 1);
1367 $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
1368 $arrayselected = array();
1369 if (is_array($cats)) {
1370 foreach ($cats as $cat) {
1371 $arrayselected[] = $cat->id;
1374 print
$form->multiselectarray(
'memcats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'100%');
1380 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
1381 if ($object->socid) {
1383 $result = $company->fetch($object->socid);
1384 print $company->getNomUrl(1);
1386 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1392 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
1393 if ($object->user_id) {
1394 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'none');
1396 print $langs->trans(
"NoDolibarrAccess");
1401 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1406 print
$form->buttonsSaveCancel(
"Save",
'');
1412 if ($id > 0 && $action !=
'edit') {
1413 $res = $object->fetch($id);
1417 $res = $object->fetch_optionals();
1423 $res = $adht->fetch($object->typeid);
1437 if ($action ==
'create_user') {
1439 if (empty($login)) {
1441 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1444 if (empty($login)) {
1445 $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
1449 $formquestion = array(
1450 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login)
1453 $object->fetch_thirdparty();
1454 $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")));
1458 $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
1460 $text .= $langs->trans(
"ConfirmCreateLogin");
1461 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1465 if ($action ==
'create_thirdparty') {
1467 $fullname = $object->getFullName($langs);
1469 if ($object->morphy ==
'mor') {
1470 $companyname = $object->company;
1471 if (!empty($fullname)) {
1472 $companyalias = $fullname;
1475 $companyname = $fullname;
1476 if (!empty($object->company)) {
1477 $companyalias = $object->company;
1482 $formquestion = array(
1483 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
1484 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
1487 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion,
'yes');
1491 if ($action ==
'valid') {
1492 $langs->load(
"mails");
1495 $adht->fetch($object->typeid);
1501 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1504 $outputlangs =
new Translate(
'', $conf);
1505 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1507 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
1509 $arraydefaultmessage =
null;
1512 if (!empty($labeltouse)) {
1513 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1516 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1517 $subject = $arraydefaultmessage->topic;
1518 $msg = $arraydefaultmessage->content;
1526 $tmp = $langs->trans(
"SendingAnEMailToMember");
1527 $tmp .=
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1528 $tmp .=
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>';
1530 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1531 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1532 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1533 $helpcontent .= $subjecttosend.
"\n";
1534 $helpcontent .=
"<br>";
1535 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1537 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1540 $formquestion = array();
1541 if ($object->email) {
1542 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
true :
false));
1544 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
1545 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroMailManEnabled"),
'value'=>
'');
1547 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1548 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroSpipEnabled"),
'value'=>
'');
1550 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"),
"confirm_valid", $formquestion,
'yes', 1, 220);
1554 if ($action ==
'resiliate') {
1555 $langs->load(
"mails");
1558 $adht->fetch($object->typeid);
1564 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1567 $outputlangs =
new Translate(
'', $conf);
1568 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1570 $outputlangs->loadLangs(array(
"main",
"members"));
1572 $arraydefaultmessage =
null;
1575 if (!empty($labeltouse)) {
1576 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1579 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1580 $subject = $arraydefaultmessage->topic;
1581 $msg = $arraydefaultmessage->content;
1589 $tmp = $langs->trans(
"SendingAnEMailToMember");
1590 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1591 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1593 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1594 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1595 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1596 $helpcontent .= $subjecttosend.
"\n";
1597 $helpcontent .=
"<br>";
1598 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1600 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1603 $formquestion = array();
1604 if ($object->email) {
1605 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1608 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1610 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"),
"confirm_resiliate", $formquestion,
'no', 1, 240);
1614 if ($action ==
'exclude') {
1615 $langs->load(
"mails");
1618 $adht->fetch($object->typeid);
1624 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1627 $outputlangs =
new Translate(
'', $conf);
1628 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1630 $outputlangs->loadLangs(array(
"main",
"members"));
1632 $arraydefaultmessage =
null;
1635 if (!empty($labeltouse)) {
1636 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1639 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1640 $subject = $arraydefaultmessage->topic;
1641 $msg = $arraydefaultmessage->content;
1649 $tmp = $langs->trans(
"SendingAnEMailToMember");
1650 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1651 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1653 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1654 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1655 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1656 $helpcontent .= $subjecttosend.
"\n";
1657 $helpcontent .=
"<br>";
1658 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1660 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1663 $formquestion = array();
1664 if ($object->email) {
1665 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1668 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1670 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"),
"confirm_exclude", $formquestion,
'no', 1, 240);
1674 if ($action ==
'delete') {
1675 $formquestion = array();
1677 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1679 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"),
"confirm_delete", $formquestion,
'no', 1);
1683 if ($action ==
'add_spip') {
1684 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'),
'confirm_add_spip');
1687 if ($action ==
'del_spip') {
1688 print
$form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'),
'confirm_del_spip');
1692 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1699 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1701 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.$object->id.
'" class="refid">';
1702 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1703 $morehtmlref .=
'</a>';
1706 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1708 print
'<div class="fichecenter">';
1709 print
'<div class="fichehalfleft">';
1711 print
'<div class="underbanner clearboth"></div>';
1712 print
'<table class="border tableforfield centpercent">';
1715 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1716 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag($object->login).
'</td></tr>';
1720 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
1721 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
1724 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
1725 print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
1729 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.
dol_escape_htmltag($object->company).
'</td></tr>';
1732 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$object->getCivilityLabel().
'</td>';
1736 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1737 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
1738 if ($object->pass) {
1739 print preg_replace(
'/./i',
'*', $object->pass);
1742 print
'<!-- '.$langs->trans(
"Crypted").
': '.$object->pass_indatabase_crypted.
' -->';
1744 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1746 if (!empty($object->pass_indatabase) && empty($object->user_id)) {
1747 $langs->load(
"errors");
1748 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
1749 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
1755 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
1756 if ($object->datefin) {
1758 if ($object->hasDelay()) {
1759 print
" ".img_warning($langs->trans(
"Late"));
1762 if ($object->need_subscription == 0) {
1763 print $langs->trans(
"SubscriptionNotNeeded");
1764 } elseif (!$adht->subscription) {
1765 print $langs->trans(
"SubscriptionNotRecorded");
1767 print
" ".img_warning($langs->trans(
"Late"));
1770 print $langs->trans(
"SubscriptionNotReceived");
1772 print
" ".img_warning($langs->trans(
"Late"));
1782 print
'<div class="fichehalfright">';
1783 print
'<div class="underbanner clearboth"></div>';
1785 print
'<table class="border tableforfield centpercent">';
1788 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1789 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1790 print
'<td colspan="2">';
1791 print
$form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
1796 print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date($object->birth,
'day').
'</td></tr>';
1800 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1801 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1804 $langs->load(
"languages");
1805 $labellang = ($object->default_lang ? $langs->trans(
'Language_'.$object->default_lang) :
'');
1806 print
picto_from_langcode($object->default_lang,
'class="paddingrightonly saturatemedium opacitylow"');
1812 print
'<tr><td>'.$langs->trans(
"Public").
'</td><td class="valeur">'.
yn($object->public).
'</td></tr>';
1815 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1820 $editenable = $user->hasRight(
'adherent',
'creer');
1821 print
$form->editfieldkey(
'LinkedToDolibarrThirdParty',
'thirdparty',
'', $object, $editenable);
1822 print
'</td><td colspan="2" class="valeur">';
1823 if ($action ==
'editthirdparty') {
1824 $htmlname =
'socid';
1825 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
1826 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
1827 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
1828 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1829 print
'<table class="nobordernopadding">';
1831 print
$form->select_company($object->socid,
'socid',
'', 1);
1833 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
1834 print
'</tr></table></form>';
1836 if ($object->socid) {
1838 $result = $company->fetch($object->socid);
1839 print $company->getNomUrl(1);
1842 $tmparray = $company->getOutstandingBills(
'customer');
1843 if (!empty($tmparray[
'refs'])) {
1844 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']).
')';
1849 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
1857 $editenable = $user->hasRight(
'adherent',
'creer') && $user->hasRight(
'user',
'user',
'creer');
1858 print
$form->editfieldkey(
'LinkedToDolibarrUser',
'login',
'', $object, $editenable);
1859 print
'</td><td colspan="2" class="valeur">';
1860 if ($action ==
'editlogin') {
1861 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'userid',
'');
1863 if ($object->user_id) {
1864 $linkeduser =
new User($db);
1865 $linkeduser->fetch($object->user_id);
1866 print $linkeduser->getNomUrl(-1);
1868 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1875 print
"</div></div>\n";
1876 print
'<div class="clearboth"></div>';
1885 print
'<div class="tabsAction">';
1888 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1889 if (empty($reshook)) {
1890 if ($action !=
'editlogin' && $action !=
'editthirdparty') {
1892 if (empty($user->socid)) {
1894 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>'.
"\n";
1913 if ($user->hasRight(
'adherent',
'creer')) {
1914 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
1916 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
1921 if ($user->hasRight(
'adherent',
'creer')) {
1922 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
1924 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
1930 if ($user->hasRight(
'adherent',
'creer')) {
1931 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid">'.$langs->trans(
"Reenable").
"</a>\n";
1933 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
1939 if ($user->hasRight(
'adherent',
'supprimer')) {
1940 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=resiliate">'.$langs->trans(
"Resiliate").
"</a></span>\n";
1942 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
1948 if ($user->hasRight(
'adherent',
'supprimer')) {
1949 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=exclude">'.$langs->trans(
"Exclude").
"</a></span>\n";
1951 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
1957 if ($user->hasRight(
'societe',
'creer')) {
1959 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";
1961 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
1964 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
1969 if (!$user->socid && !$object->user_id) {
1970 if ($user->hasRight(
'user',
'user',
'creer')) {
1972 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";
1974 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
1977 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
1982 if (
isModEnabled(
'mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1983 $isinspip = $mailmanspip->is_in_spip($object);
1985 if ($isinspip == 1) {
1986 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=del_spip&token='.
newToken().
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
1988 if ($isinspip == 0) {
1989 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=add_spip&token='.
newToken().
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
1994 if ($user->hasRight(
'adherent',
'supprimer')) {
1995 print
'<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
1997 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
2003 if ($isinspip == -1) {
2004 print
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
2009 if (
GETPOST(
'modelselected')) {
2010 $action =
'presend';
2013 if ($action !=
'presend') {
2014 print
'<div class="fichecenter"><div class="fichehalfleft">';
2015 print
'<a name="builddoc"></a>';
2019 $filedir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member');
2020 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
2021 $genallowed = $user->hasRight(
'adherent',
'lire');
2022 $delallowed = $user->hasRight(
'adherent',
'creer');
2024 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);
2025 $somethingshown = $formfile->numoffiles;
2041 if ($useonlinepayment) {
2043 if (empty($amount)) {
2044 $amount =
price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount));
2046 if (empty($amount)) {
2049 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2050 print showOnlinePaymentUrl(
'membersubscription', $object->ref, $amount);
2053 print
'</div><div class="fichehalfright">';
2057 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/adherents/agenda.php?id='.$object->id);
2060 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2062 $somethingshown =
$formactions->showactions($object, $object->element, $socid, 1,
'listactions', $MAX,
'', $morehtmlcenter);
2064 print
'</div></div>';
2068 $modelmail =
'member';
2069 $defaulttopic =
'CardContent';
2070 $diroutput = $conf->adherent->dir_output;
2071 $trackid =
'mem'.$object->id;
2073 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';