35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
62$langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"other",
"paypal"));
66$action =
GETPOST(
'action',
'aZ09');
67$cancel =
GETPOST(
'cancel',
'alpha');
68$backtopage =
GETPOST(
'backtopage',
'alpha');
69$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
70$confirm =
GETPOST(
'confirm',
'alpha');
79if (isModEnabled(
'mailmanspip')) {
80 include_once DOL_DOCUMENT_ROOT.
'/mailmanspip/class/mailmanspip.class.php';
82 $langs->load(
'mailmanspip');
93$extrafields->fetch_name_optionals_label(
$object->table_element);
101if (!empty($canvas)) {
102 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
103 $objcanvas =
new Canvas($db, $action);
104 $objcanvas->getCanvas(
'adherent',
'membercard', $canvas);
108$hookmanager->initHooks(array(
'membercard',
'globalcard'));
111if ($id > 0 || !empty($ref)) {
113 $result =
$object->fetch($id, $ref);
116 $canadduser = ($user->admin || $user->hasRight(
'user',
'user',
'creer'));
120 $caneditfielduser = ((($user->id ==
$object->user_id) && $user->hasRight(
'user',
'self',
'creer'))
121 || (($user->id !=
$object->user_id) && $user->hasRight(
'user',
'user',
'creer')));
122 $caneditpassworduser = ((($user->id ==
$object->user_id) && $user->hasRight(
'user',
'self',
'password'))
123 || (($user->id !=
$object->user_id) && $user->hasRight(
'user',
'user',
'password')));
128$canaddmember = $user->hasRight(
'adherent',
'creer');
129$caneditfieldmember =
false;
132 $caneditfieldmember = $user->hasRight(
'adherent',
'creer');
134$permissiontoeditextra = $canaddmember;
135if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
137 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
143if (!$user->hasRight(
'adherent',
'creer') && $action ==
'edit') {
147$linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((isModEnabled(
'multicompany')) ?
'?entity='.
$conf->entity :
'');
154$parameters = array(
'id' => $id,
'rowid' => $id,
'objcanvas' => $objcanvas,
'confirm' => $confirm);
155$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
160if (empty($reshook)) {
161 $backurlforlist = DOL_URL_ROOT.
'/adherents/list.php';
163 if (empty($backtopage) || ($cancel && empty($id))) {
164 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
165 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
166 $backtopage = $backurlforlist;
168 $backtopage = DOL_URL_ROOT.
'/adherents/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
174 if (!empty($backtopageforcancel)) {
175 header(
"Location: ".$backtopageforcancel);
177 } elseif (!empty($backtopage)) {
178 header(
"Location: ".$backtopage);
184 if ($action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
186 if (!$user->hasRight(
'user',
'user',
'creer')) {
187 if ($userid != $user->id && $userid !=
$object->user_id) {
189 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
194 if ($userid !=
$object->user_id) {
195 $result =
$object->setUserId($userid);
204 if ($action ==
'setsocid' && $caneditfieldmember) {
207 if ($socid !=
$object->socid) {
208 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
209 $sql .=
" WHERE socid = ".((int) $socid);
210 $sql .=
" AND entity = ".$conf->entity;
211 $resql = $db->query($sql);
213 $obj = $db->fetch_object($resql);
214 if ($obj && $obj->rowid > 0) {
216 $othermember->fetch($obj->rowid);
217 $thirdparty =
new Societe($db);
218 $thirdparty->fetch($socid);
220 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
225 $result =
$object->setThirdPartyId($socid);
236 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
239 $nuser =
new User($db);
241 if (
GETPOST(
'internalorexternal',
'aZ09') ==
'internal') {
242 $tmpuser->fk_soc = 0;
245 $result = $nuser->create_from_member($tmpuser,
GETPOST(
'login',
'alphanohtml'));
248 $langs->load(
"errors");
251 setEventMessages($langs->trans(
"NewUserCreated", $nuser->login),
null,
'mesgs');
260 if ($action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
264 $result = $company->create_from_member(
$object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'));
267 $langs->load(
"errors");
276 if ($action ==
'update' && !$cancel && $user->hasRight(
'adherent',
'creer')) {
277 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
283 $lastname =
GETPOST(
"lastname",
'alphanohtml');
284 $firstname =
GETPOST(
"firstname",
'alphanohtml');
285 $gender =
GETPOST(
"gender",
'alphanohtml');
286 $societe =
GETPOST(
"societe",
'alphanohtml');
287 $morphy =
GETPOST(
"morphy",
'alphanohtml');
288 $login =
GETPOST(
"login",
'alphanohtml');
289 if ($morphy !=
'mor' && empty($lastname)) {
291 $langs->load(
"errors");
292 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
294 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
296 $langs->load(
"errors");
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
299 if ($morphy ==
'mor' && empty($societe)) {
301 $langs->load(
"errors");
302 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
308 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
312 if ($result > 0 && !$error) {
316 $object->civility_id = trim(
GETPOST(
"civility_id",
'alphanohtml'));
321 if (GETPOSTISSET(
'pass')) {
337 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'alpha'));
339 $object->socialnetworks = array();
340 foreach ($socialnetworks as $key => $value) {
341 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
342 $object->socialnetworks[$key] = trim(
GETPOST($key,
'alphanohtml'));
351 if (
GETPOST(
'deletephoto',
'alpha')) {
353 } elseif (!empty($_FILES[
'photo'][
'name']) && empty($_FILES[
'photo'][
'error'])) {
363 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
371 if ($user->id !=
$object->user_id && !$user->hasRight(
'user',
'user',
'creer')) {
378 if (GETPOSTISSET(
'pass')) {
381 if ($user->id ==
$object->user_id) {
382 if (!$user->hasRight(
'user',
'self',
'password')) {
386 if (!$user->hasRight(
'user',
'user',
'password')) {
394 $result =
$object->update($user, 0, $nosyncuser, $nosyncuserpass);
396 if ($result >= 0 && !count(
$object->errors)) {
397 $categories =
GETPOST(
'memcats',
'array');
398 $object->setCategories($categories);
402 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
405 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
407 $dirthumbs =
$conf->member->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'member').
'/photos/thumbs';
417 $resultupload =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
419 if (!is_numeric($resultupload) || $resultupload <= 0) {
427 $langs->load(
"errors");
431 switch ($_FILES[
'photo'][
'error']) {
434 $langs->load(
"errors");
447 if (!empty($backtopage)) {
448 header(
"Location: ".$backtopage);
463 if ($action ==
'add' && $user->hasRight(
'adherent',
'creer')) {
468 if (GETPOSTISSET(
"birthday") &&
GETPOST(
"birthday") && GETPOSTISSET(
"birthmonth") &&
GETPOST(
"birthmonth") && GETPOSTISSET(
"birthyear") &&
GETPOST(
"birthyear")) {
471 $datesubscription =
'';
472 if (GETPOSTISSET(
"reday") && GETPOSTISSET(
"remonth") && GETPOSTISSET(
"reyear")) {
477 $civility_id =
GETPOST(
"civility_id",
'alphanohtml');
478 $lastname =
GETPOST(
"lastname",
'alphanohtml');
479 $firstname =
GETPOST(
"firstname",
'alphanohtml');
480 $gender =
GETPOST(
"gender",
'alphanohtml');
481 $societe =
GETPOST(
"societe",
'alphanohtml');
482 $address =
GETPOST(
"address",
'alphanohtml');
483 $zip =
GETPOST(
"zipcode",
'alphanohtml');
484 $town =
GETPOST(
"town",
'alphanohtml');
488 $phone =
GETPOST(
"phone",
'alpha');
489 $phone_perso =
GETPOST(
"phone_perso",
'alpha');
490 $phone_mobile =
GETPOST(
"phone_mobile",
'alpha');
491 $email = preg_replace(
'/\s+/',
'',
GETPOST(
"member_email",
'aZ09arobase'));
492 $url = trim(
GETPOST(
'url',
'url'));
493 $login =
GETPOST(
"member_login",
'alphanohtml');
494 $pass =
GETPOST(
"password",
'password');
495 $photo =
GETPOST(
"photo",
'alphanohtml');
496 $morphy =
GETPOST(
"morphy",
'alphanohtml');
501 $default_lang =
GETPOST(
'default_lang',
'alpha');
503 $object->civility_id = $civility_id;
504 $object->firstname = $firstname;
513 $object->country_id = $country_id;
515 $object->phone_perso = $phone_perso;
516 $object->phone_mobile = $phone_mobile;
517 $object->socialnetworks = array();
518 if (isModEnabled(
'socialnetworks')) {
519 foreach ($socialnetworks as $key => $value) {
520 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
521 $object->socialnetworks[$key] =
GETPOST(
"member_".$key,
'alphanohtml');
538 $object->default_lang = $default_lang;
540 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
546 if (empty($morphy) || $morphy ==
"-1") {
548 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")),
null,
'errors');
554 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")),
null,
'errors');
556 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
557 $result = $db->query($sql);
560 $num = $db->num_rows($result);
564 $langs->load(
"errors");
565 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login),
null,
'errors');
570 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")),
null,
'errors');
573 if ($morphy ==
'mor' && empty($societe)) {
575 $langs->load(
"errors");
576 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")),
null,
'errors');
578 if ($morphy !=
'mor' && empty($lastname)) {
580 $langs->load(
"errors");
581 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")),
null,
'errors');
583 if ($morphy !=
'mor' && (!isset($firstname) || $firstname ==
'')) {
585 $langs->load(
"errors");
586 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")),
null,
'errors');
588 if (!($typeid > 0)) {
590 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
594 $langs->load(
"errors");
598 $langs->load(
"errors");
602 if (isset($public)) {
610 $result =
$object->create($user);
613 $memcats =
GETPOST(
'memcats',
'array');
614 $object->setCategories($memcats);
621 $backtopage = preg_replace(
'/__ID__/', (
string) $id, $backtopage);
634 $result = $company->create_from_member(
$object);
636 $langs->load(
"errors");
645 $action = ($result < 0 || !$error) ?
'' :
'create';
647 if (!$error && $backtopage) {
648 header(
"Location: ".$backtopage);
653 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_delete' && $confirm ==
'yes') {
654 $result =
$object->delete($user);
657 if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"],
'/').
'/', $backtopage)) {
658 header(
"Location: ".$backtopage);
661 header(
"Location: list.php");
669 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_valid' && $confirm ==
'yes') {
677 $result =
$object->validate($user);
679 if ($result >= 0 && !count(
$object->errors)) {
686 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
690 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
692 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
694 $arraydefaultmessage =
null;
697 if (!empty($labeltouse)) {
698 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
701 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
702 $subject = (string) $arraydefaultmessage->topic;
703 $msg = (string) $arraydefaultmessage->content;
706 if (empty($labeltouse) || (
int) $labeltouse === -1) {
708 $langs->load(
"errors");
709 setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>',
null,
'errors');
712 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
717 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
719 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
739 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_resiliate') {
742 if ($confirm ==
'yes') {
746 $result =
$object->resiliate($user);
748 if ($result >= 0 && !count(
$object->errors)) {
754 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
758 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
760 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
762 $arraydefaultmessage =
null;
765 if (!empty($labeltouse)) {
766 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
769 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
770 $subject = (string) $arraydefaultmessage->topic;
771 $msg = (string) $arraydefaultmessage->content;
774 if (empty($labeltouse) || (
int) $labeltouse === -1) {
779 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
784 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
786 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
800 if (!empty($backtopage) && !$error) {
801 header(
"Location: ".$backtopage);
806 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_exclude') {
809 if ($confirm ==
'yes') {
813 $result =
$object->exclude($user);
815 if ($result >= 0 && !count(
$object->errors)) {
821 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
825 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
827 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
829 $arraydefaultmessage =
null;
832 if (!empty($labeltouse)) {
833 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
836 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
837 $subject = (string) $arraydefaultmessage->topic;
838 $msg = (string) $arraydefaultmessage->content;
841 if (empty($labeltouse) || (
int) $labeltouse === -1) {
846 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
851 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
853 $result =
$object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
867 if (!empty($backtopage) && !$error) {
868 header(
"Location: ".$backtopage);
873 if ($action ==
'update_extras' && $permissiontoeditextra) {
875 $attribute_name =
GETPOST(
'attribute',
'aZ09');
878 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
883 $result =
$object->updateExtraField($attribute_name,
'MEMBER_MODIFY');
890 $action =
'edit_extras';
895 if (is_object($mailmanspip)) {
896 if ($user->hasRight(
'adherent',
'supprimer') && $action ==
'confirm_del_spip' && $confirm ==
'yes') {
898 if (!$mailmanspip->del_to_spip(
$object)) {
899 setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
904 if ($user->hasRight(
'adherent',
'creer') && $action ==
'confirm_add_spip' && $confirm ==
'yes') {
906 if (!$mailmanspip->add_to_spip(
$object)) {
907 setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error,
null,
'errors');
914 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
917 $upload_dir =
$conf->member->dir_output;
918 $permissiontoadd = $user->hasRight(
'adherent',
'creer');
919 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
922 $triggersendname =
'MEMBER_SENTBYMAIL';
924 $mode =
'emailfrommember';
925 $trackid =
'mem'.$object->id;
926 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
934$form =
new Form($db);
939$title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
940$help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
942llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-card');
944$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
946if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
950 if (empty(
$object->error) && $id) {
958 $objcanvas->display_canvas($action);
965 if ($action ==
'create') {
973 $object->country_code = $tmparray[
'code'];
974 $object->country = $tmparray[
'label'];
978 if (!empty($socid)) {
983 if (!($soc->id > 0)) {
984 $langs->load(
"errors");
985 print($langs->trans(
'ErrorRecordNotFound'));
994 if (
$conf->use_javascript_ajax) {
995 print
"\n".
'<script type="text/javascript">'.
"\n";
996 print
'jQuery(document).ready(function () {
997 jQuery("#selectcountry_id").change(function() {
998 document.formsoc.action.value="create";
999 document.formsoc.submit();
1001 function initfieldrequired() {
1002 jQuery("#tdcompany").removeClass("fieldrequired");
1003 jQuery("#tdlastname").removeClass("fieldrequired");
1004 jQuery("#tdfirstname").removeClass("fieldrequired");
1005 if (jQuery(\'input[name="morphy"]:checked\').val() == \'mor\') {
1006 jQuery("#tdcompany").addClass("fieldrequired");
1008 if (jQuery(\'input[name="morphy"]:checked\').val() == \'phy\') {
1009 jQuery("#tdlastname").addClass("fieldrequired");
1010 jQuery("#tdfirstname").addClass("fieldrequired");
1013 jQuery(\'input[name="morphy"]\').change(function() {
1014 initfieldrequired();
1016 initfieldrequired();
1018 print
'</script>'.
"\n";
1021 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1022 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1023 print
'<input type="hidden" name="action" value="add">';
1024 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1026 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1031 print
'<table class="border centpercent">';
1036 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>';
1041 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
1043 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
1044 print
'<input type="text" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag($generated_password).
'">';
1049 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
1050 $listetype = $adht->liste_array(1);
1051 print
img_picto(
'', $adht->picto,
'class="pictofixedwidth"');
1052 if (count($listetype)) {
1053 print $form->selectarray(
"typeid", $listetype, (
GETPOSTINT(
'typeid') ?
GETPOSTINT(
'typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0,
'', 0, 0, 0,
'',
'minwidth200', 1);
1055 print
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
1057 if ($user->hasRight(
'member',
'configurer')) {
1058 print
' <a href="'.DOL_URL_ROOT.
'/adherents/type.php?action=create&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create&typeid=--IDFORBACKTOPAGE--').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewMemberType").
'"></span></a>';
1064 $morphys[
"phy"] = $langs->trans(
"Physical");
1065 $morphys[
"mor"] = $langs->trans(
"Moral");
1066 $checkednature =
GETPOST(
"morphy",
'alpha');
1068 print
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
1069 print
'<span id="spannature1" class="nonature-back spannature paddinglarge marginrightonly"><label for="phisicalinput" class="valignmiddle">'.$morphys[
"phy"].
'<input id="phisicalinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="phy"'.($checkednature ==
"phy" ?
' checked="checked"' :
'').
'></label></span>';
1070 print
'<span id="spannature2" class="nonature-back spannature paddinglarge marginrightonly"><label for="moralinput" class="valignmiddle">'.$morphys[
"mor"].
'<input id="moralinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="mor"'.($checkednature ==
"mor" ?
' checked="checked"' :
'').
'></label></span>';
1073 if (
$conf->use_javascript_ajax) {
1075 function refreshNatureCss() {
1076 jQuery(".spannature").each(function( index ) {
1077 console.log(jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked"));
1078 if (jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked")) {
1080 jQuery("#spannature"+(index+1)).addClass("member-individual-back").removeClass("nonature-back");
1083 jQuery("#spannature"+(index+1)).addClass("member-company-back").removeClass("nonature-back");
1086 jQuery("#spannature"+(index+1)).removeClass("member-individual-back").removeClass("member-company-back").addClass("nonature-back");
1090 jQuery(".spannature").click(function(){
1091 console.log("We click on a nature");
1101 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>';
1104 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1105 print $formcompany->select_civility(
GETPOSTINT(
'civility_id') ?
GETPOSTINT(
'civility_id') :
$object->civility_id,
'civility_id',
'maxwidth150', 1).
'</td>';
1109 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>';
1113 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>';
1117 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1119 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
1120 print $form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1124 print
'<tr><td>'.(getDolGlobalString(
'ADHERENT_MAIL_REQUIRED') ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
'ADHERENT_MAIL_REQUIRED') ?
'</span>' :
'').
'</td>';
1125 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>';
1128 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'),
$object, 0).
'</td>';
1129 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>';
1132 print
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
1133 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address',
'alphanohtml') : $soc->
address).
'</textarea>';
1137 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1138 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode',
'alphanohtml') : $soc->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1140 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town',
'alphanohtml') : $soc->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1144 if (empty($soc->country_id)) {
1145 $soc->country_id = $mysoc->country_id;
1146 $soc->country_code = $mysoc->country_code;
1147 $soc->state_id = $mysoc->state_id;
1149 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1150 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1151 print $form->select_country(GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id',
'alpha') : $soc->country_id,
'country_id');
1153 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1159 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1160 if ($soc->country_id || GETPOSTISSET(
'country_id')) {
1161 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1162 print $formcompany->select_state(GETPOSTISSET(
'state_id') ?
GETPOSTINT(
'state_id') : $soc->state_id, GETPOSTISSET(
'country_id') ?
GETPOSTINT(
'country_id') : $soc->country_code);
1164 print $countrynotdefined;
1170 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1171 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>';
1174 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1175 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>';
1178 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1179 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>';
1181 if (isModEnabled(
'socialnetworks')) {
1182 foreach ($socialnetworks as $key => $value) {
1183 if (!$value[
'active']) {
1186 $val = (GETPOSTISSET(
'member_'.$key) ?
GETPOST(
'member_'.$key,
'alpha') : (empty(
$object->socialnetworks[$key]) ?
'' :
$object->socialnetworks[$key]));
1187 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
1192 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1193 print
img_picto(
'',
'object_calendar',
'class="pictofixedwidth"').$form->selectDate((
$object->birth ?
$object->birth : -1),
'birth', 0, 0, 1,
'formsoc');
1194 print
"</td></tr>\n";
1198 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
1199 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
1200 print
"</td><td>\n";
1201 print $form->selectyesno(
"public",
$object->public, 1,
false, 0, 1);
1202 print
"</td></tr>\n";
1205 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1206 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'',
$object, 0).
'</td><td>';
1207 print $form->selectCategories(Categorie::TYPE_MEMBER,
'memcats',
$object);
1212 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1219 print $form->buttonsSaveCancel(
"AddMember");
1225 if ($action ==
'edit') {
1231 $res =
$object->fetch_optionals();
1238 $adht->fetch(
$object->typeid);
1242 if (!empty($country) ||
$object->country_id) {
1243 $sql =
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country";
1244 $sql .=
" WHERE rowid = ".(int) (!empty($country) ? $country :
$object->country_id);
1245 $resql = $db->query($sql);
1247 $obj = $db->fetch_object($resql);
1252 if (is_object($obj)) {
1253 $object->country_id = $obj->rowid;
1254 $object->country_code = $obj->code;
1255 $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
1262 if (
$conf->use_javascript_ajax) {
1263 print
"\n".
'<script type="text/javascript">';
1264 print
'jQuery(document).ready(function () {
1265 jQuery("#selectcountry_id").change(function() {
1266 document.formsoc.action.value="edit";
1267 document.formsoc.submit();
1269 function initfieldrequired() {
1270 jQuery("#tdcompany").removeClass("fieldrequired");
1271 jQuery("#tdlastname").removeClass("fieldrequired");
1272 jQuery("#tdfirstname").removeClass("fieldrequired");
1273 if (jQuery(\'input[name="morphy"]:checked\').val() == \'mor\') {
1274 jQuery("#tdcompany").addClass("fieldrequired");
1276 if (jQuery(\'input[name="morphy"]:checked\').val() == \'phy\') {
1277 jQuery("#tdlastname").addClass("fieldrequired");
1278 jQuery("#tdfirstname").addClass("fieldrequired");
1281 jQuery(\'input[name="morphy"]\').change(function() {
1282 initfieldrequired();
1284 initfieldrequired();
1286 print
'</script>'.
"\n";
1289 print
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
1290 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1291 print
'<input type="hidden" name="action" value="update" />';
1292 print
'<input type="hidden" name="rowid" value="'.$id.
'" />';
1293 print
'<input type="hidden" name="statut" value="'.$object->status.
'" />';
1295 print
'<input type="hidden" name="backtopage" value="'.($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
1300 print
'<table class="border centpercent">';
1303 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.
$object->ref.
'</td></tr>';
1307 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>';
1312 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.
dol_escape_htmltag(GETPOSTISSET(
"pass") ?
GETPOST(
"pass",
'password', 2) :
'').
'"></td></tr>';
1316 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
1317 if ($user->hasRight(
'adherent',
'creer')) {
1318 print $form->selectarray(
"typeid", $adht->liste_array(), (GETPOSTISSET(
"typeid") ?
GETPOSTINT(
"typeid") :
$object->typeid), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth200', 1);
1320 print $adht->getNomUrl(1);
1321 print
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
1326 $morphys[
"phy"] = $langs->trans(
"Physical");
1327 $morphys[
"mor"] = $langs->trans(
"Moral");
1328 $checkednature = (GETPOSTISSET(
"morphy") ?
GETPOST(
"morphy",
'alpha') :
$object->morphy);
1329 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
1330 print
'<span id="spannature1" class="member-individual-back spannature paddinglarge marginrightonly"><label for="phisicalinput" class="valignmiddle">'.$morphys[
"phy"].
'<input id="phisicalinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="phy"'.($checkednature ==
"phy" ?
' checked="checked"' :
'').
'></label></span>';
1331 print
'<span id="spannature1" class="member-company-back spannature paddinglarge marginrightonly"><label for="moralinput" class="valignmiddle">'.$morphys[
"mor"].
'<input id="moralinput" class="flat checkforselect marginleftonly valignmiddle" type="radio" name="morphy" value="mor"'.($checkednature ==
"mor" ?
' checked="checked"' :
'').
'></label></span>';
1335 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>';
1338 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
1339 print $formcompany->select_civility(GETPOSTISSET(
"civility_id") ?
GETPOST(
"civility_id",
'alpha') :
$object->civility_id,
'civility_id',
'maxwidth150', 1);
1344 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>';
1348 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>';
1352 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
1354 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
1355 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender',
'alphanohtml') :
$object->gender, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1359 print
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
1360 print
'<td class="hideonsmartphone" valign="middle">';
1361 print $form->showphoto(
'memberphoto',
$object).
"\n";
1362 if ($caneditfieldmember) {
1366 print
'<table class="nobordernopadding">';
1368 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"><label for="photodelete" class="paddingleft">'.$langs->trans(
"Delete").
'</label><br></td></tr>';
1372 $maxmin = $maxfilesizearray[
'maxmin'];
1374 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1376 print
'<input type="file" class="flat" name="photo" id="photoinput">';
1383 print
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'<span class="fieldrequired">' :
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'</span>' :
'').
'</td>';
1384 print
'<td>'.img_picto(
'',
'object_email',
'class="pictofixedwidth"').
'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET(
"member_email") ?
GETPOST(
"member_email",
'alphanohtml', 2) :
$object->
email).
'"></td></tr>';
1387 print
'<tr><td>'.$form->editfieldkey(
'Web',
'member_url',
GETPOST(
'member_url',
'alpha'),
$object, 0).
'</td>';
1388 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>';
1391 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
1392 print
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml', 2) :
$object->
address).
'</textarea>';
1396 print
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
1397 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode",
'alphanohtml', 2) :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1399 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town",
'alphanohtml', 2) :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1404 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
1405 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1406 print $form->select_country(GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") :
$object->country_id,
'country_id');
1408 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1414 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
1415 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1416 print $formcompany->select_state(
$object->state_id, GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
"alpha") :
$object->country_id);
1421 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1422 print
'<td>'.img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(GETPOSTISSET(
"phone") ?
GETPOST(
"phone") :
$object->phone).
'"></td></tr>';
1425 print
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
1426 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>';
1429 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1430 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>';
1432 if (isModEnabled(
'socialnetworks')) {
1433 foreach ($socialnetworks as $key => $value) {
1434 if (!$value[
'active']) {
1437 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>';
1442 print
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
1443 print
img_picto(
'',
'object_calendar',
'class="pictofixedwidth"').$form->selectDate((
$object->birth ?
$object->birth : -1),
'birth', 0, 0, 1,
'formsoc');
1444 print
"</td></tr>\n";
1448 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
1449 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(), 1);
1456 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
1457 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
1458 print
"</td><td>\n";
1459 print $form->selectyesno(
"public", (GETPOSTISSET(
"public") ?
GETPOST(
"public",
'alphanohtml', 2) :
$object->public), 1, false, 0, 1);
1460 print
"</td></tr>\n";
1463 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1464 print
'<tr><td>'.$form->editfieldkey(
"Categories",
'memcats',
'',
$object, 0).
'</td>';
1466 print $form->selectCategories(Categorie::TYPE_MEMBER,
'memcats',
$object);
1471 if (isModEnabled(
'societe')) {
1472 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
1475 $result = $company->fetch(
$object->socid);
1476 print $company->getNomUrl(1);
1478 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1484 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
1486 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id, (
string)
$object->user_id,
'none');
1488 print $langs->trans(
"NoDolibarrAccess");
1493 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1498 print $form->buttonsSaveCancel(
"Save",
'Cancel');
1504 if ($id > 0 && $action !=
'edit') {
1510 $res =
$object->fetch_optionals();
1517 $res = $adht->fetch(
$object->typeid);
1529 print
dol_get_fiche_head($head,
'general', $langs->trans(
"Member"), -1,
'user', 0,
'',
'', 0,
'', 1);
1532 if ($action ==
'create_user') {
1533 $login = (GETPOSTISSET(
'login') ?
GETPOST(
'login',
'alphanohtml') :
$object->login);
1534 if (empty($login)) {
1536 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1539 if (empty($login)) {
1540 $login = strtolower(substr(
$object->firstname, 0, 4)).strtolower(substr(
$object->lastname, 0, 4));
1544 $formquestion = array(
1545 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login)
1547 if (isModEnabled(
'societe') &&
$object->socid > 0) {
1549 $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")));
1552 if (isModEnabled(
'societe') &&
$object->socid <= 0) {
1553 $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
1555 $text .= $langs->trans(
"ConfirmCreateLogin");
1556 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1560 if ($action ==
'create_thirdparty') {
1562 $fullname =
$object->getFullName($langs);
1564 if (
$object->morphy ==
'mor') {
1565 $companyname = (string)
$object->company;
1566 if (!empty($fullname)) {
1567 $companyalias = (string) $fullname;
1570 $companyname = $fullname;
1571 if (!empty(
$object->company)) {
1572 $companyalias = (string)
$object->company;
1577 $formquestion = array(
1578 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
1579 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
1582 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".
$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion,
'yes');
1586 if ($action ==
'valid') {
1587 $langs->load(
"mails");
1590 $adht->fetch(
$object->typeid);
1596 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1600 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
1602 $outputlangs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other"));
1604 $arraydefaultmessage =
null;
1607 if (!empty($labeltouse)) {
1608 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1611 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1612 $subject = (string) $arraydefaultmessage->topic;
1613 $msg = (string) $arraydefaultmessage->content;
1616 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
1621 $tmp = $langs->trans(
"SendingAnEMailToMember");
1622 $tmp .=
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'</b>, ';
1623 $tmp .=
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>';
1625 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'<br>'.
"\n";
1626 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1627 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1628 $helpcontent .= $subjecttosend.
"\n";
1629 $helpcontent .=
"<br>";
1630 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1633 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1636 $formquestion = array();
1638 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
true : false));
1641 $formquestion[] = array(
'type' =>
'other',
'label' => $langs->transnoentitiesnoconv(
"SynchroMailManEnabled"),
'value' =>
'');
1644 $formquestion[] = array(
'type' =>
'other',
'label' => $langs->transnoentitiesnoconv(
"SynchroSpipEnabled"),
'value' =>
'');
1646 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"),
"confirm_valid", $formquestion,
'yes', 1, 250);
1650 if ($action ==
'resiliate') {
1651 $langs->load(
"mails");
1654 $adht->fetch(
$object->typeid);
1660 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1664 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
1666 $outputlangs->loadLangs(array(
"main",
"members"));
1668 $arraydefaultmessage =
null;
1671 if (!empty($labeltouse)) {
1672 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1675 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1676 $subject = (string) $arraydefaultmessage->topic;
1677 $msg = (string) $arraydefaultmessage->content;
1680 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
1685 $tmp = $langs->trans(
"SendingAnEMailToMember");
1686 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'</b>, ';
1687 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>)';
1689 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'<br>'.
"\n";
1690 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1691 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1692 $helpcontent .= $subjecttosend.
"\n";
1693 $helpcontent .=
"<br>";
1694 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1697 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1700 $formquestion = array();
1702 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
'true' :
'false'));
1705 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1707 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"),
"confirm_resiliate", $formquestion,
'no', 1, 240);
1711 if ($action ==
'exclude') {
1712 $langs->load(
"mails");
1715 $adht->fetch(
$object->typeid);
1721 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1725 $outputlangs->setDefaultLang(!empty(
$object->default_lang) ?
$object->default_lang : (empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang));
1727 $outputlangs->loadLangs(array(
"main",
"members"));
1729 $arraydefaultmessage =
null;
1732 if (!empty($labeltouse)) {
1733 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1736 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1737 $subject = (string) $arraydefaultmessage->topic;
1738 $msg = (string) $arraydefaultmessage->content;
1741 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0,
null,
$object);
1746 $tmp = $langs->trans(
"SendingAnEMailToMember");
1747 $tmp .=
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'</b>, ';
1748 $tmp .= $langs->trans(
"MailRecipient").
': <b>'.
$object->email.
'</b>)';
1750 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM',
$conf->email_from).
'<br>'.
"\n";
1751 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.
$object->email.
'<br>'.
"\n";
1752 $helpcontent .=
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
1753 $helpcontent .= $subjecttosend.
"\n";
1754 $helpcontent .=
"<br>";
1755 $helpcontent .=
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
1758 $label = $form->textwithpicto($tmp, $helpcontent, 1,
'help');
1761 $formquestion = array();
1763 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'send_mail',
'label' => $label,
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ?
'true' :
'false'));
1766 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1768 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"),
"confirm_exclude", $formquestion,
'no', 1, 240);
1772 if ($action ==
'delete') {
1773 $formquestion = array();
1775 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'backtopage',
'value' => ($backtopage !=
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
1777 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"),
"confirm_delete", $formquestion,
'no', 1);
1781 if ($action ==
'add_spip') {
1782 print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'),
'confirm_add_spip');
1785 if ($action ==
'del_spip') {
1786 print $form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'),
'confirm_del_spip');
1793 if (isModEnabled(
'societe')) {
1797 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1799 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.
$object->id.
'" class="refid">';
1800 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1801 $morehtmlref .=
'</a>';
1804 dol_banner_tab(
$object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1806 print
'<div class="fichecenter">';
1807 print
'<div class="fichehalfleft">';
1809 print
'<div class="underbanner clearboth"></div>';
1810 print
'<table class="border tableforfield centpercent">';
1814 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag(
$object->login).
'</td></tr>';
1818 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
1819 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
1822 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
1823 print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
1830 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.
$object->getCivilityLabel().
'</td>';
1835 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
1837 print preg_replace(
'/./i',
'*',
$object->pass);
1840 print
'<!-- '.$langs->trans(
"Crypted").
': '.
$object->pass_indatabase_crypted.
' -->';
1842 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1844 if (!empty(
$object->pass_indatabase) && empty(
$object->user_id)) {
1845 $langs->load(
"errors");
1846 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
1847 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
1853 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
1857 print
" ".img_warning($langs->trans(
"Late"));
1860 if (
$object->need_subscription == 0) {
1861 print $langs->trans(
"SubscriptionNotNeeded");
1862 } elseif (!$adht->subscription) {
1863 print $langs->trans(
"SubscriptionNotRecorded");
1865 print
" ".img_warning($langs->trans(
"Late"));
1868 print $langs->trans(
"SubscriptionNotReceived");
1870 print
" ".img_warning($langs->trans(
"Late"));
1880 print
'<div class="fichehalfright">';
1881 print
'<div class="underbanner clearboth"></div>';
1883 print
'<table class="border tableforfield centpercent">';
1886 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1887 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1888 print
'<td colspan="2">';
1889 print $form->showCategories(
$object->id, Categorie::TYPE_MEMBER, 1);
1894 print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date(
$object->birth,
'day').
'</td></tr>';
1898 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1899 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1902 $langs->load(
"languages");
1903 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
1911 $htmltext = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
1912 print $form->textwithpicto($langs->trans(
"MembershipPublic"), $htmltext, 1,
'help',
'', 0, 3,
'membershippublic');
1913 print
'</td><td class="valeur">'.yn(
$object->public).
'</td></tr>';
1916 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1919 if (isModEnabled(
'societe')) {
1921 $editenable = $user->hasRight(
'adherent',
'creer');
1922 print $form->editfieldkey(
'LinkedToDolibarrThirdParty',
'thirdparty',
'',
$object, $editenable);
1923 print
'</td><td colspan="2" class="valeur">';
1924 if ($action ==
'editthirdparty') {
1925 $htmlname =
'socid';
1926 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
1927 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
1928 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
1929 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1930 print
'<table class="nobordernopadding">';
1932 print $form->select_company(
$object->socid,
'socid',
'', 1);
1934 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
1935 print
'</tr></table></form>';
1939 $result = $company->fetch(
$object->socid);
1940 print $company->getNomUrl(1);
1943 $tmparray = $company->getOutstandingBills(
'customer');
1944 if (!empty($tmparray[
'refs'])) {
1945 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']).
')';
1950 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
1958 $editenable = $user->hasRight(
'adherent',
'creer') && $user->hasRight(
'user',
'user',
'creer');
1959 print $form->editfieldkey(
'LinkedToDolibarrUser',
'login',
'',
$object, (
int) $editenable);
1960 print
'</td><td colspan="2" class="valeur">';
1961 if ($action ==
'editlogin') {
1962 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.
$object->id, (
string)
$object->user_id,
'userid', array());
1965 $linkeduser =
new User($db);
1966 $linkeduser->fetch(
$object->user_id);
1967 print $linkeduser->getNomUrl(-1);
1969 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1976 print
"</div></div>\n";
1977 print
'<div class="clearboth"></div>';
1986 print
'<div class="tabsAction">';
1988 $parameters = array();
1989 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1990 if (empty($reshook)) {
1991 if ($action !=
'editlogin' && $action !=
'editthirdparty') {
1993 if (empty($user->socid)) {
1995 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.((int)
$object->id).
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>'.
"\n";
2014 if ($user->hasRight(
'adherent',
'creer')) {
2015 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
2017 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
2022 if ($user->hasRight(
'adherent',
'creer')) {
2023 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
2025 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
2031 if ($user->hasRight(
'adherent',
'creer')) {
2032 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"Reenable").
"</a>\n";
2034 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
2040 if ($user->hasRight(
'adherent',
'supprimer')) {
2041 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=resiliate&token='.
newToken().
'">'.$langs->trans(
"Resiliate").
"</a></span>\n";
2043 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
2049 if ($user->hasRight(
'adherent',
'supprimer')) {
2050 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=exclude&token='.
newToken().
'">'.$langs->trans(
"Exclude").
"</a></span>\n";
2052 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
2057 if (isModEnabled(
'societe') && !
$object->socid) {
2058 if ($user->hasRight(
'societe',
'creer')) {
2060 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int)
$object->id).
'&action=create_thirdparty&token='.
newToken().
'" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrThirdPartyDesc")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
2062 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
2065 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
2070 if (!$user->socid && !
$object->user_id) {
2071 if ($user->hasRight(
'user',
'user',
'creer')) {
2073 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int)
$object->id).
'&action=create_user&token='.
newToken().
'" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrLoginDesc")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
2075 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
2078 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
2084 $isinspip = $mailmanspip->is_in_spip(
$object);
2086 if ($isinspip == 1) {
2087 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=del_spip&token='.
newToken().
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
2089 if ($isinspip == 0) {
2090 print
'<a class="butAction" href="card.php?rowid='.((int)
$object->id).
'&action=add_spip&token='.
newToken().
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
2095 if ($user->hasRight(
'adherent',
'supprimer')) {
2096 print
'<a class="butActionDelete" href="card.php?rowid='.((int)
$object->id).
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
2098 print
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
2104 if ($isinspip == -1) {
2105 print
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
2110 if (
GETPOST(
'modelselected')) {
2111 $action =
'presend';
2114 if ($action !=
'presend') {
2115 print
'<div class="fichecenter"><div class="fichehalfleft">';
2116 print
'<a name="builddoc"></a>';
2121 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.
$object->id;
2122 $genallowed = $user->hasRight(
'adherent',
'lire');
2123 $delallowed = $user->hasRight(
'adherent',
'creer');
2125 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);
2126 $somethingshown = $formfile->numoffiles;
2134 include_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2135 $validpaymentmethod = getValidOnlinePaymentMethods(
'');
2136 $useonlinepayment = count($validpaymentmethod);
2138 if ($useonlinepayment) {
2140 if (empty($amount)) {
2141 $amount = max($adht->amount,
$object->first_subscription_amount,
$object->last_subscription_amount);
2143 if (empty($amount)) {
2146 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
2147 print showOnlinePaymentUrl(
'membersubscription',
$object->ref, $amount);
2150 print
'</div><div class="fichehalfright">';
2154 $morehtmlcenter =
'';
2155 $messagingUrl = DOL_URL_ROOT.
'/adherents/messaging.php?rowid='.
$object->id;
2156 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'ShowAsConversation'),
'',
'fa fa-comments imgforviewmode', $messagingUrl,
'', 1);
2157 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/adherents/agenda.php?id='.
$object->id);
2160 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2162 $somethingshown = $formactions->showactions(
$object,
$object->element, $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter);
2164 print
'</div></div>';
2168 $modelmail =
'member';
2169 $defaulttopic =
'CardContent';
2170 $diroutput =
$conf->member->dir_output;
2171 $trackid =
'mem'.$object->id;
2173 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
const STATUS_EXCLUDED
Excluded.
const STATUS_DRAFT
Draft status.
const STATUS_RESILIATED
Resiliated (membership end and was not renew)
const STATUS_VALIDATED
Validated status.
Class to manage members type.
Class to manage mailman and spip.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
getMaxFileSizeArray()
Return the max allowed for file upload.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.