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);
122 $linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((
isModEnabled(
'multicompany')) ?
'?entity='.$conf->entity :
'');
129 $parameters = array(
'id'=>$id,
'rowid'=>$id,
'objcanvas'=>$objcanvas,
'confirm'=>$confirm);
130 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
135 if (empty($reshook)) {
136 $backurlforlist = DOL_URL_ROOT.
'/adherents/list.php';
138 if (empty($backtopage) || ($cancel && empty($id))) {
139 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
140 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
141 $backtopage = $backurlforlist;
143 $backtopage = DOL_URL_ROOT.
'/adherents/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
149 if (!empty($backtopageforcancel)) {
150 header(
"Location: ".$backtopageforcancel);
152 } elseif (!empty($backtopage)) {
153 header(
"Location: ".$backtopage);
159 if ($action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
161 if (!$user->hasRight(
'user',
'user',
'creer')) {
162 if ($userid != $user->id && $userid != $object->user_id) {
164 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
169 if ($userid != $object->user_id) {
170 $result = $object->setUserId($userid);
179 if ($action ==
'setsocid') {
182 if ($socid != $object->socid) {
183 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
184 $sql .=
" WHERE socid = ".((int) $socid);
185 $sql .=
" AND entity = ".$conf->entity;
186 $resql = $db->query(
$sql);
188 $obj = $db->fetch_object($resql);
189 if ($obj && $obj->rowid > 0) {
191 $othermember->fetch($obj->rowid);
192 $thirdparty =
new Societe($db);
193 $thirdparty->fetch($socid);
195 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
200 $result = $object->setThirdPartyId($socid);
211 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
214 $nuser =
new User($db);
216 if (
GETPOST(
'internalorexternal',
'aZ09') ==
'internal') {
217 $tmpuser->fk_soc = 0;
220 $result = $nuser->create_from_member($tmpuser,
GETPOST(
'login',
'alphanohtml'));
223 $langs->load(
"errors");
226 setEventMessages($langs->trans(
"NewUserCreated", $nuser->login),
null,
'mesgs');
235 if ($action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
239 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'));
242 $langs->load(
"errors");
251 if ($action ==
'update' && !$cancel && $user->hasRight(
'adherent',
'creer')) {
252 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
258 $lastname =
GETPOST(
"lastname",
'alphanohtml');
259 $firstname =
GETPOST(
"firstname",
'alphanohtml');
260 $gender =
GETPOST(
"gender",
'alphanohtml');
261 $societe =
GETPOST(
"societe",
'alphanohtml');
262 $morphy =
GETPOST(
"morphy",
'alphanohtml');
263 $login =
GETPOST(
"login",
'alphanohtml');
264 if ($morphy !=
'mor' && empty($lastname)) {
266 $langs->load(
"errors");
267 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
269 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
271 $langs->load(
"errors");
272 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
274 if ($morphy ==
'mor' && empty($societe)) {
276 $langs->load(
"errors");
277 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
280 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
283 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
287 if ($result > 0 && !$error) {
291 $object->civility_id = trim(
GETPOST(
"civility_id",
'alphanohtml'));
292 $object->firstname = trim(
GETPOST(
"firstname",
'alphanohtml'));
293 $object->lastname = trim(
GETPOST(
"lastname",
'alphanohtml'));
294 $object->gender = trim(
GETPOST(
"gender",
'alphanohtml'));
295 $object->login = trim(
GETPOST(
"login",
'alphanohtml'));
296 $object->pass = trim(
GETPOST(
"pass",
'none'));
298 $object->societe = trim(
GETPOST(
"societe",
'alphanohtml'));
299 $object->company = trim(
GETPOST(
"societe",
'alphanohtml'));
301 $object->address = trim(
GETPOST(
"address",
'alphanohtml'));
302 $object->zip = trim(
GETPOST(
"zipcode",
'alphanohtml'));
303 $object->town = trim(
GETPOST(
"town",
'alphanohtml'));
304 $object->state_id =
GETPOST(
"state_id",
'int');
305 $object->country_id =
GETPOST(
"country_id",
'int');
307 $object->phone = trim(
GETPOST(
"phone",
'alpha'));
308 $object->phone_perso = trim(
GETPOST(
"phone_perso",
'alpha'));
309 $object->phone_mobile = trim(
GETPOST(
"phone_mobile",
'alpha'));
310 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
311 $object->url = trim(
GETPOST(
'member_url',
'custom', 0, FILTER_SANITIZE_URL));
312 $object->socialnetworks = array();
313 foreach ($socialnetworks as $key => $value) {
315 $object->socialnetworks[$key] = trim(
GETPOST($key,
'alphanohtml'));
318 $object->birth = $birthdate;
319 $object->default_lang =
GETPOST(
'default_lang',
'alpha');
320 $object->typeid =
GETPOST(
"typeid",
'int');
322 $object->morphy =
GETPOST(
"morphy",
'alpha');
324 if (
GETPOST(
'deletephoto',
'alpha')) {
326 } elseif (!empty($_FILES[
'photo'][
'name'])) {
331 $object->statut =
GETPOST(
"statut",
'alpha');
332 $object->public =
GETPOST(
"public",
'alpha');
335 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
342 if ($object->user_id) {
343 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'creer')) {
350 if ($object->user_id) {
351 if ($user->id != $object->user_id && !$user->hasRight(
'user',
'user',
'password')) {
357 $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
359 if ($result >= 0 && !count($object->errors)) {
360 $categories =
GETPOST(
'memcats',
'array');
361 $object->setCategories($categories);
364 $dir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos';
365 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
368 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
369 $fileimg = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/'.$object->photo;
370 $dirthumbs = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member').
'/photos/thumbs';
380 if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
384 $object->addThumbs($newfile);
391 switch ($_FILES[
'photo'][
'error']) {
394 $errors[] =
"ErrorFileSizeTooLarge";
397 $errors[] =
"ErrorFilePartiallyUploaded";
402 $rowid = $object->id;
406 if (!empty($backtopage)) {
407 header(
"Location: ".$backtopage);
422 if ($action ==
'add' && $user->hasRight(
'adherent',
'creer')) {
424 $object->canvas = $canvas;
430 $datesubscription =
'';
435 $typeid =
GETPOST(
"typeid",
'int');
436 $civility_id =
GETPOST(
"civility_id",
'alphanohtml');
437 $lastname =
GETPOST(
"lastname",
'alphanohtml');
438 $firstname =
GETPOST(
"firstname",
'alphanohtml');
439 $gender =
GETPOST(
"gender",
'alphanohtml');
440 $societe =
GETPOST(
"societe",
'alphanohtml');
441 $address =
GETPOST(
"address",
'alphanohtml');
442 $zip =
GETPOST(
"zipcode",
'alphanohtml');
443 $town =
GETPOST(
"town",
'alphanohtml');
444 $state_id =
GETPOST(
"state_id",
'int');
445 $country_id =
GETPOST(
"country_id",
'int');
447 $phone =
GETPOST(
"phone",
'alpha');
448 $phone_perso =
GETPOST(
"phone_perso",
'alpha');
449 $phone_mobile =
GETPOST(
"phone_mobile",
'alpha');
454 $email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
455 $url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
456 $login =
GETPOST(
"member_login",
'alphanohtml');
457 $pass =
GETPOST(
"password",
'none');
458 $photo =
GETPOST(
"photo",
'alphanohtml');
459 $morphy =
GETPOST(
"morphy",
'alphanohtml');
460 $public =
GETPOST(
"public",
'alphanohtml');
462 $userid =
GETPOST(
"userid",
'int');
463 $socid =
GETPOST(
"socid",
'int');
464 $default_lang =
GETPOST(
'default_lang',
'alpha');
466 $object->civility_id = $civility_id;
467 $object->firstname = $firstname;
468 $object->lastname = $lastname;
469 $object->gender = $gender;
470 $object->societe = $societe;
471 $object->company = $societe;
472 $object->address = $address;
474 $object->town = $town;
475 $object->state_id = $state_id;
476 $object->country_id = $country_id;
477 $object->phone = $phone;
478 $object->phone_perso = $phone_perso;
479 $object->phone_mobile = $phone_mobile;
480 $object->socialnetworks = array();
482 foreach ($socialnetworks as $key => $value) {
484 $object->socialnetworks[$key] =
GETPOST(
"member_".$key,
'alphanohtml');
489 $object->email = $email;
491 $object->login = $login;
492 $object->pass = $pass;
493 $object->birth = $birthdate;
494 $object->photo = $photo;
495 $object->typeid = $typeid;
497 $object->morphy = $morphy;
498 $object->user_id = $userid;
499 $object->socid = $socid;
500 $object->public = $public;
501 $object->default_lang = $default_lang;
503 $ret = $extrafields->setOptionalsFromPost(
null, $object);
509 if (empty($morphy) || $morphy ==
"-1") {
511 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")),
null,
'errors');
514 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
517 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
519 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
520 $result = $db->query(
$sql);
522 $num = $db->num_rows($result);
526 $langs->load(
"errors");
527 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login),
null,
'errors');
532 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")),
null,
'errors');
535 if ($morphy ==
'mor' && empty($societe)) {
537 $langs->load(
"errors");
538 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
540 if ($morphy !=
'mor' && empty($lastname)) {
542 $langs->load(
"errors");
543 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
545 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
547 $langs->load(
"errors");
548 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
550 if (!($typeid > 0)) {
552 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
554 if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
556 $langs->load(
"errors");
559 if (!empty($object->url) && !
isValidUrl($object->url)) {
560 $langs->load(
"errors");
561 setEventMessages($langs->trans(
"ErrorBadUrl", $object->url),
null,
'errors');
564 if (isset($public)) {
572 $result = $object->create($user);
575 $memcats =
GETPOST(
'memcats',
'array');
576 $object->setCategories($memcats);
579 $rowid = $object->id;
582 $backtopage = preg_replace(
'/__ID__/', $id, $backtopage);
590 if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
594 $result = $company->create_from_member($object);
596 $langs->load(
"errors");
605 $action = ($result < 0 || !$error) ?
'' :
'create';
607 if (!$error && $backtopage) {
608 header(
"Location: ".$backtopage);
613 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
614 $result = $object->delete($id, $user);
617 if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"],
'/').
'/', $backtopage)) {
618 header(
"Location: ".$backtopage);
621 header(
"Location: list.php");
629 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_valid' && $confirm ==
'yes') {
635 $adht->fetch($object->typeid);
637 $result = $object->validate($user);
639 if ($result >= 0 && !count($object->errors)) {
641 if ($object->email &&
GETPOST(
"send_mail")) {
646 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
650 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
652 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
654 $arraydefaultmessage =
null;
657 if (!empty($labeltouse)) {
658 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
661 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
662 $subject = $arraydefaultmessage->topic;
663 $msg = $arraydefaultmessage->content;
666 if (empty($labeltouse) || (
int) $labeltouse === -1) {
668 $langs->load(
"errors");
669 setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>',
null,
'errors');
677 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
679 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
688 if ($object->error) {
703 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_resiliate') {
706 if ($confirm ==
'yes') {
708 $adht->fetch($object->typeid);
710 $result = $object->resiliate($user);
712 if ($result >= 0 && !count($object->errors)) {
713 if ($object->email &&
GETPOST(
"send_mail")) {
718 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
722 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
724 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
726 $arraydefaultmessage =
null;
729 if (!empty($labeltouse)) {
730 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
733 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
734 $subject = $arraydefaultmessage->topic;
735 $msg = $arraydefaultmessage->content;
738 if (empty($labeltouse) || (
int) $labeltouse === -1) {
748 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
750 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
760 if ($object->error) {
768 if (!empty($backtopage) && !$error) {
769 header(
"Location: ".$backtopage);
774 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_exclude') {
777 if ($confirm ==
'yes') {
779 $adht->fetch($object->typeid);
781 $result = $object->exclude($user);
783 if ($result >= 0 && !count($object->errors)) {
784 if ($object->email &&
GETPOST(
"send_mail")) {
789 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
793 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
795 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
797 $arraydefaultmessage =
null;
800 if (!empty($labeltouse)) {
801 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
804 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
805 $subject = $arraydefaultmessage->topic;
806 $msg = $arraydefaultmessage->content;
809 if (empty($labeltouse) || (
int) $labeltouse === -1) {
819 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
821 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
831 if ($object->error) {
839 if (!empty($backtopage) && !$error) {
840 header(
"Location: ".$backtopage);
846 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_del_spip' && $confirm ==
'yes') {
847 if (!count($object->errors)) {
848 if (!$mailmanspip->del_to_spip($object)) {
849 setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
854 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_add_spip' && $confirm ==
'yes') {
855 if (!count($object->errors)) {
856 if (!$mailmanspip->add_to_spip($object)) {
857 setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
863 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
866 $upload_dir = $conf->adherent->dir_output;
867 $permissiontoadd = $user->hasRight(
'adherent',
'creer');
868 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
871 $triggersendname =
'MEMBER_SENTBYMAIL';
873 $mode =
'emailfrommember';
874 $trackid =
'mem'.$object->id;
875 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
888 $title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
889 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
892 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
894 if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
898 if (empty($object->error) && $id) {
900 $result = $object->fetch($id);
905 $objcanvas->assign_values($action, $object->id, $object->ref);
906 $objcanvas->display_canvas($action);
913 if ($action ==
'create') {
914 $object->canvas = $canvas;
915 $object->state_id =
GETPOST(
'state_id',
'int');
918 $object->country_id =
GETPOST(
'country_id',
'int') ?
GETPOST(
'country_id',
'int') : $mysoc->country_id;
919 if ($object->country_id) {
920 $tmparray =
getCountry($object->country_id,
'all');
921 $object->country_code = $tmparray[
'code'];
922 $object->country = $tmparray[
'label'];
926 if (!empty($socid)) {
931 if (!($soc->id > 0)) {
932 $langs->load(
"errors");
933 print($langs->trans(
'ErrorRecordNotFound'));
942 if ($conf->use_javascript_ajax) {
943 print
"\n".
'<script type="text/javascript">'.
"\n";
944 print
'jQuery(document).ready(function () {
945 jQuery("#selectcountry_id").change(function() {
946 document.formsoc.action.value="create";
947 document.formsoc.submit();
949 function initfieldrequired() {
950 jQuery("#tdcompany").removeClass("fieldrequired");
951 jQuery("#tdlastname").removeClass("fieldrequired");
952 jQuery("#tdfirstname").removeClass("fieldrequired");
953 if (jQuery("#morphy").val() == \'mor\') {
954 jQuery("#tdcompany").addClass("fieldrequired");
956 if (jQuery("#morphy").val() == \'phy\') {
957 jQuery("#tdlastname").addClass("fieldrequired");
958 jQuery("#tdfirstname").addClass("fieldrequired");
961 jQuery("#morphy").change(function() {
966 print
'</script>'.
"\n";
969 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
970 print
'<input type="hidden" name="token" value="'.newToken().
'">';
971 print
'<input type="hidden" name="action" value="add">';
972 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
974 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
979 print
'<table class="border centpercent">';
983 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
984 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>';
988 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
989 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
991 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
992 print
'<input type="text" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag($generated_password).
'">';
997 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
998 $listetype = $adht->liste_array(1);
999 print
img_picto(
'', $adht->picto,
'class="pictofixedwidth"');
1000 if (count($listetype)) {
1001 print
$form->selectarray(
"typeid", $listetype, (
GETPOST(
'typeid',
'int') ?
GETPOST(
'typeid',
'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0,
'', 0, 0, 0,
'',
'', 1);
1003 print
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
1008 $morphys[
"phy"] = $langs->trans(
"Physical");
1009 $morphys[
"mor"] = $langs->trans(
"Moral");
1010 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
1011 print
$form->selectarray(
"morphy", $morphys, (
GETPOST(
'morphy',
'alpha') ?
GETPOST(
'morphy',
'alpha') : $object->morphy), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1015 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>';
1018 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1019 print $formcompany->select_civility(
GETPOST(
'civility_id',
'int') ?
GETPOST(
'civility_id',
'int') : $object->civility_id,
'civility_id',
'maxwidth150', 1).
'</td>';
1023 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>';
1027 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>';
1031 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1033 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1034 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1038 print
'<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ?
'</span>' :
'').
'</td>';
1039 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>';
1042 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1043 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>';
1046 print
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
1047 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address',
'alphanohtml') : $soc->address).
'</textarea>';
1051 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1052 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode',
'alphanohtml') : $soc->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1054 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town',
'alphanohtml') : $soc->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1058 if (empty($soc->country_id)) {
1059 $soc->country_id = $mysoc->country_id;
1060 $soc->country_code = $mysoc->country_code;
1061 $soc->state_id = $mysoc->state_id;
1063 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1064 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1065 print
$form->select_country(
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id',
'alpha') : $soc->country_id,
'country_id');
1067 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1072 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1073 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1074 if ($soc->country_id) {
1075 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1076 print $formcompany->select_state(
GETPOSTISSET(
'state_id') ?
GETPOST(
'state_id',
'int') : $soc->state_id, $soc->country_code);
1078 print $countrynotdefined;
1084 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1085 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>';
1088 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1089 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>';
1092 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1093 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>';
1096 foreach ($socialnetworks as $key => $value) {
1097 if (!$value[
'active']) {
1100 $val = (
GETPOSTISSET(
'member_'.$key) ?
GETPOST(
'member_'.$key,
'alpha') : (empty($object->socialnetworks[$key]) ?
'' : $object->socialnetworks[$key]));
1101 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
1106 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1107 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1108 print
"</td></tr>\n";
1111 print
"<tr><td>".$langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
"</td><td>\n";
1112 print
$form->selectyesno(
"public", $object->public, 1);
1113 print
"</td></tr>\n";
1116 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1117 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td><td>';
1118 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
'parent',
null,
null, 1);
1119 print
img_picto(
'',
'category').$form->multiselectarray(
'memcats', $cate_arbo,
GETPOST(
'memcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1124 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1131 print
$form->buttonsSaveCancel(
"AddMember");
1137 if ($action ==
'edit') {
1138 $res = $object->fetch($id);
1142 $res = $object->fetch_optionals();
1148 $adht->fetch($object->typeid);
1151 $country =
GETPOST(
'country',
'int');
1152 if (!empty($country) || $object->country_id) {
1153 $sql =
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country where rowid = ".(!empty($country) ? $country : $object->country_id);
1154 $resql = $db->query(
$sql);
1156 $obj = $db->fetch_object($resql);
1160 $object->country_id = $obj->rowid;
1161 $object->country_code = $obj->code;
1162 $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
1168 if ($conf->use_javascript_ajax) {
1169 print
"\n".
'<script type="text/javascript">';
1170 print
'jQuery(document).ready(function () {
1171 jQuery("#selectcountry_id").change(function() {
1172 document.formsoc.action.value="edit";
1173 document.formsoc.submit();
1175 function initfieldrequired() {
1176 jQuery("#tdcompany").removeClass("fieldrequired");
1177 jQuery("#tdlastname").removeClass("fieldrequired");
1178 jQuery("#tdfirstname").removeClass("fieldrequired");
1179 if (jQuery("#morphy").val() == \'mor\') {
1180 jQuery("#tdcompany").addClass("fieldrequired");
1182 if (jQuery("#morphy").val() == \'phy\') {
1183 jQuery("#tdlastname").addClass("fieldrequired");
1184 jQuery("#tdfirstname").addClass("fieldrequired");
1187 jQuery("#morphy").change(function() {
1188 initfieldrequired();
1190 initfieldrequired();
1192 print
'</script>'.
"\n";
1195 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1196 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1197 print
'<input type="hidden" name="action" value="update" />';
1198 print
'<input type="hidden" name="rowid" value="'.$id.
'" />';
1199 print
'<input type="hidden" name="statut" value="'.$object->statut.
'" />';
1201 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1206 print
'<table class="border centpercent">';
1209 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.$object->ref.
'</td></tr>';
1212 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1213 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>';
1217 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1218 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>';
1222 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
1223 if ($user->hasRight(
'adherent',
'creer')) {
1224 print
$form->selectarray(
"typeid", $adht->liste_array(), (
GETPOSTISSET(
"typeid") ?
GETPOST(
"typeid",
'int') : $object->typeid), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1226 print $adht->getNomUrl(1);
1227 print
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
1232 $morphys[
"phy"] = $langs->trans(
"Physical");
1233 $morphys[
"mor"] = $langs->trans(
"Moral");
1234 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
1235 print
$form->selectarray(
"morphy", $morphys, (
GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'alpha') : $object->morphy), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1239 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>';
1242 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1243 print $formcompany->select_civility(
GETPOSTISSET(
"civility_id") ?
GETPOST(
"civility_id",
'alpha') : $object->civility_id,
'civility_id',
'maxwidth150', 1);
1248 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>';
1252 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>';
1256 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1258 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
1259 print
$form->selectarray(
'gender', $arraygender,
GETPOSTISSET(
'gender') ?
GETPOST(
'gender',
'alphanohtml') : $object->gender, 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1263 print
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
1264 print
'<td class="hideonsmartphone" valign="middle">';
1265 print
$form->showphoto(
'memberphoto', $object).
"\n";
1266 if ($caneditfieldmember) {
1267 if ($object->photo) {
1270 print
'<table class="nobordernopadding">';
1271 if ($object->photo) {
1272 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
1274 print
'<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
1277 $maxmin = $maxfilesizearray[
'maxmin'];
1279 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1281 print
'<input type="file" class="flat" name="photo" id="photoinput">';
1288 print
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'</span>' :
'').
'</td>';
1289 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>';
1292 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'), $object, 0).
'</td>';
1293 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>';
1296 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
1297 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(
GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml', 2) : $object->address).
'</textarea>';
1301 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1302 print $formcompany->select_ziptown((
GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode",
'alphanohtml', 2) : $object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1304 print $formcompany->select_ziptown((
GETPOSTISSET(
"town") ?
GETPOST(
"town",
'alphanohtml', 2) : $object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1309 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1310 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1311 print
$form->select_country(
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id,
'country_id');
1313 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1318 if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1319 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1320 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1321 print $formcompany->select_state($object->state_id,
GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") : $object->country_id);
1326 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1327 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(
GETPOSTISSET(
"phone") ?
GETPOST(
"phone") : $object->phone).
'"></td></tr>';
1330 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1331 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>';
1334 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1335 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>';
1338 foreach ($socialnetworks as $key => $value) {
1339 if (!$value[
'active']) {
1342 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="'.$key.
'" class="minwidth100" value="'.(
GETPOSTISSET($key) ?
GETPOST($key,
'alphanohtml') : (isset($object->socialnetworks[$key])? $object->socialnetworks[$key] : null)).
'"></td></tr>';
1347 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1348 print
$form->selectDate(($object->birth ? $object->birth : -1),
'birth',
'',
'', 1,
'formsoc');
1349 print
"</td></tr>\n";
1353 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
1354 print
img_picto(
'',
'language').$formadmin->select_language($object->default_lang,
'default_lang', 0, 0, 1);
1360 print
"<tr><td>".$langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
"</td><td>\n";
1361 print
$form->selectyesno(
"public", (
GETPOSTISSET(
"public") ?
GETPOST(
"public",
'alphanohtml', 2) : $object->public), 1);
1362 print
"</td></tr>\n";
1365 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1366 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'', $object, 0).
'</td>';
1368 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_MEMBER,
null,
null,
null,
null, 1);
1370 $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
1371 $arrayselected = array();
1372 if (is_array($cats)) {
1373 foreach ($cats as $cat) {
1374 $arrayselected[] = $cat->id;
1377 print
$form->multiselectarray(
'memcats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'100%');
1383 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
1384 if ($object->socid) {
1386 $result = $company->fetch($object->socid);
1387 print $company->getNomUrl(1);
1389 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1395 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
1396 if ($object->user_id) {
1397 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'none');
1399 print $langs->trans(
"NoDolibarrAccess");
1404 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1409 print
$form->buttonsSaveCancel(
"Save",
'Cancel');
1415 if ($id > 0 && $action !=
'edit') {
1416 $res = $object->fetch($id);
1420 $res = $object->fetch_optionals();
1426 $res = $adht->fetch($object->typeid);
1440 if ($action ==
'create_user') {
1442 if (empty($login)) {
1444 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1447 if (empty($login)) {
1448 $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
1452 $formquestion = array(
1453 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login)
1456 $object->fetch_thirdparty();
1457 $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")));
1461 $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
1463 $text .= $langs->trans(
"ConfirmCreateLogin");
1464 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1468 if ($action ==
'create_thirdparty') {
1470 $fullname = $object->getFullName($langs);
1472 if ($object->morphy ==
'mor') {
1473 $companyname = $object->company;
1474 if (!empty($fullname)) {
1475 $companyalias = $fullname;
1478 $companyname = $fullname;
1479 if (!empty($object->company)) {
1480 $companyalias = $object->company;
1485 $formquestion = array(
1486 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
1487 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
1490 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion,
'yes');
1494 if ($action ==
'valid') {
1495 $langs->load(
"mails");
1498 $adht->fetch($object->typeid);
1504 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1507 $outputlangs =
new Translate(
'', $conf);
1508 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1510 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
1512 $arraydefaultmessage =
null;
1515 if (!empty($labeltouse)) {
1516 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1519 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1520 $subject = $arraydefaultmessage->topic;
1521 $msg = $arraydefaultmessage->content;
1529 $tmp = $langs->trans(
"SendingAnEMailToMember");
1530 $tmp .=
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1531 $tmp .=
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>';
1533 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1534 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1535 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1536 $helpcontent .= $subjecttosend.
"\n";
1537 $helpcontent .=
"<br>";
1538 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1540 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1543 $formquestion = array();
1544 if ($object->email) {
1545 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
true :
false));
1547 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
1548 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroMailManEnabled"),
'value'=>
'');
1550 if (
isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1551 $formquestion[] = array(
'type'=>
'other',
'label'=>$langs->transnoentitiesnoconv(
"SynchroSpipEnabled"),
'value'=>
'');
1553 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"),
"confirm_valid", $formquestion,
'yes', 1, 220);
1557 if ($action ==
'resiliate') {
1558 $langs->load(
"mails");
1561 $adht->fetch($object->typeid);
1567 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1570 $outputlangs =
new Translate(
'', $conf);
1571 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1573 $outputlangs->loadLangs(array(
"main",
"members"));
1575 $arraydefaultmessage =
null;
1578 if (!empty($labeltouse)) {
1579 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1582 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1583 $subject = $arraydefaultmessage->topic;
1584 $msg = $arraydefaultmessage->content;
1592 $tmp = $langs->trans(
"SendingAnEMailToMember");
1593 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1594 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1596 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1597 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1598 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1599 $helpcontent .= $subjecttosend.
"\n";
1600 $helpcontent .=
"<br>";
1601 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1603 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1606 $formquestion = array();
1607 if ($object->email) {
1608 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1611 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1613 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"),
"confirm_resiliate", $formquestion,
'no', 1, 240);
1617 if ($action ==
'exclude') {
1618 $langs->load(
"mails");
1621 $adht->fetch($object->typeid);
1627 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1630 $outputlangs =
new Translate(
'', $conf);
1631 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1633 $outputlangs->loadLangs(array(
"main",
"members"));
1635 $arraydefaultmessage =
null;
1638 if (!empty($labeltouse)) {
1639 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1642 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1643 $subject = $arraydefaultmessage->topic;
1644 $msg = $arraydefaultmessage->content;
1652 $tmp = $langs->trans(
"SendingAnEMailToMember");
1653 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
1654 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
1656 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1657 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1658 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1659 $helpcontent .= $subjecttosend.
"\n";
1660 $helpcontent .=
"<br>";
1661 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1663 $label =
$form->textwithpicto($tmp, $helpcontent, 1,
'help');
1666 $formquestion = array();
1667 if ($object->email) {
1668 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
'true' :
'false'));
1671 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1673 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"),
"confirm_exclude", $formquestion,
'no', 1, 240);
1677 if ($action ==
'delete') {
1678 $formquestion = array();
1680 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1682 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"),
"confirm_delete", $formquestion,
'no', 1);
1686 if ($action ==
'add_spip') {
1687 print
$form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'),
'confirm_add_spip');
1690 if ($action ==
'del_spip') {
1691 print
$form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'),
'confirm_del_spip');
1695 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1702 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1704 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.$object->id.
'" class="refid">';
1705 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1706 $morehtmlref .=
'</a>';
1709 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1711 print
'<div class="fichecenter">';
1712 print
'<div class="fichehalfleft">';
1714 print
'<div class="underbanner clearboth"></div>';
1715 print
'<table class="border tableforfield centpercent">';
1718 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1719 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag($object->login).
'</td></tr>';
1723 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
1724 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
1727 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
1728 print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
1732 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.
dol_escape_htmltag($object->company).
'</td></tr>';
1735 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$object->getCivilityLabel().
'</td>';
1739 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1740 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
1741 if ($object->pass) {
1742 print preg_replace(
'/./i',
'*', $object->pass);
1745 print
'<!-- '.$langs->trans(
"Crypted").
': '.$object->pass_indatabase_crypted.
' -->';
1747 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1749 if (!empty($object->pass_indatabase) && empty($object->user_id)) {
1750 $langs->load(
"errors");
1751 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
1752 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
1758 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
1759 if ($object->datefin) {
1761 if ($object->hasDelay()) {
1762 print
" ".img_warning($langs->trans(
"Late"));
1765 if ($object->need_subscription == 0) {
1766 print $langs->trans(
"SubscriptionNotNeeded");
1767 } elseif (!$adht->subscription) {
1768 print $langs->trans(
"SubscriptionNotRecorded");
1770 print
" ".img_warning($langs->trans(
"Late"));
1773 print $langs->trans(
"SubscriptionNotReceived");
1775 print
" ".img_warning($langs->trans(
"Late"));
1785 print
'<div class="fichehalfright">';
1786 print
'<div class="underbanner clearboth"></div>';
1788 print
'<table class="border tableforfield centpercent">';
1791 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
1792 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1793 print
'<td colspan="2">';
1794 print
$form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
1799 print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date($object->birth,
'day').
'</td></tr>';
1803 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1804 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1807 $langs->load(
"languages");
1808 $labellang = ($object->default_lang ? $langs->trans(
'Language_'.$object->default_lang) :
'');
1809 print
picto_from_langcode($object->default_lang,
'class="paddingrightonly saturatemedium opacitylow"');
1815 print
'<tr><td>'.$langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
'</td><td class="valeur">'.
yn($object->public).
'</td></tr>';
1818 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1823 $editenable = $user->hasRight(
'adherent',
'creer');
1824 print
$form->editfieldkey(
'LinkedToDolibarrThirdParty',
'thirdparty',
'', $object, $editenable);
1825 print
'</td><td colspan="2" class="valeur">';
1826 if ($action ==
'editthirdparty') {
1827 $htmlname =
'socid';
1828 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
1829 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
1830 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
1831 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1832 print
'<table class="nobordernopadding">';
1834 print
$form->select_company($object->socid,
'socid',
'', 1);
1836 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
1837 print
'</tr></table></form>';
1839 if ($object->socid) {
1841 $result = $company->fetch($object->socid);
1842 print $company->getNomUrl(1);
1845 $tmparray = $company->getOutstandingBills(
'customer');
1846 if (!empty($tmparray[
'refs'])) {
1847 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']).
')';
1852 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
1860 $editenable = $user->hasRight(
'adherent',
'creer') && $user->hasRight(
'user',
'user',
'creer');
1861 print
$form->editfieldkey(
'LinkedToDolibarrUser',
'login',
'', $object, $editenable);
1862 print
'</td><td colspan="2" class="valeur">';
1863 if ($action ==
'editlogin') {
1864 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'userid',
'');
1866 if ($object->user_id) {
1867 $linkeduser =
new User($db);
1868 $linkeduser->fetch($object->user_id);
1869 print $linkeduser->getNomUrl(-1);
1871 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1878 print
"</div></div>\n";
1879 print
'<div class="clearboth"></div>';
1888 print
'<div class="tabsAction">';
1891 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1892 if (empty($reshook)) {
1893 if ($action !=
'editlogin' && $action !=
'editthirdparty') {
1895 if (empty($user->socid)) {
1897 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>'.
"\n";
1916 if ($user->hasRight(
'adherent',
'creer')) {
1917 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
1919 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
1924 if ($user->hasRight(
'adherent',
'creer')) {
1925 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
1927 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
1933 if ($user->hasRight(
'adherent',
'creer')) {
1934 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid">'.$langs->trans(
"Reenable").
"</a>\n";
1936 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
1942 if ($user->hasRight(
'adherent',
'supprimer')) {
1943 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=resiliate">'.$langs->trans(
"Resiliate").
"</a></span>\n";
1945 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
1951 if ($user->hasRight(
'adherent',
'supprimer')) {
1952 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=exclude">'.$langs->trans(
"Exclude").
"</a></span>\n";
1954 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
1960 if ($user->hasRight(
'societe',
'creer')) {
1962 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";
1964 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
1967 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
1972 if (!$user->socid && !$object->user_id) {
1973 if ($user->hasRight(
'user',
'user',
'creer')) {
1975 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";
1977 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
1980 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
1985 if (
isModEnabled(
'mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
1986 $isinspip = $mailmanspip->is_in_spip($object);
1988 if ($isinspip == 1) {
1989 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=del_spip&token='.
newToken().
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
1991 if ($isinspip == 0) {
1992 print
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=add_spip&token='.
newToken().
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
1997 if ($user->hasRight(
'adherent',
'supprimer')) {
1998 print
'<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
2000 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
2006 if ($isinspip == -1) {
2007 print
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
2012 if (
GETPOST(
'modelselected')) {
2013 $action =
'presend';
2016 if ($action !=
'presend') {
2017 print
'<div class="fichecenter"><div class="fichehalfleft">';
2018 print
'<a name="builddoc"></a>';
2022 $filedir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'member');
2023 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
2024 $genallowed = $user->hasRight(
'adherent',
'lire');
2025 $delallowed = $user->hasRight(
'adherent',
'creer');
2027 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);
2028 $somethingshown = $formfile->numoffiles;
2044 if ($useonlinepayment) {
2046 if (empty($amount)) {
2047 $amount = max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount);
2049 if (empty($amount)) {
2052 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2053 print showOnlinePaymentUrl(
'membersubscription', $object->ref, $amount);
2056 print
'</div><div class="fichehalfright">';
2060 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/adherents/agenda.php?id='.$object->id);
2063 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2065 $somethingshown =
$formactions->showactions($object, $object->element, $socid, 1,
'listactions', $MAX,
'', $morehtmlcenter);
2067 print
'</div></div>';
2071 $modelmail =
'member';
2072 $defaulttopic =
'CardContent';
2073 $diroutput = $conf->adherent->dir_output;
2074 $trackid =
'mem'.$object->id;
2076 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') && $user->hasRight('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') && $user->hasRight('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)) $sql
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.