dolibarr  13.0.2
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
7  * Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
8  * Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9  * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
31 require '../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
42 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
44 
45 // Load translation files required by the page
46 $langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal"));
47 
48 $action = GETPOST('action', 'aZ09');
49 $cancel = GETPOST('cancel', 'alpha');
50 $backtopage = GETPOST('backtopage', 'alpha');
51 $confirm = GETPOST('confirm', 'alpha');
52 $rowid = GETPOST('rowid', 'int');
53 $id = GETPOST('id') ?GETPOST('id', 'int') : $rowid;
54 $typeid = GETPOST('typeid', 'int');
55 $userid = GETPOST('userid', 'int');
56 $socid = GETPOST('socid', 'int');
57 
58 if (!empty($conf->mailmanspip->enabled)) {
59  include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
60 
61  $langs->load('mailmanspip');
62 
63  $mailmanspip = new MailmanSpip($db);
64 }
65 
66 $object = new Adherent($db);
67 $extrafields = new ExtraFields($db);
68 
69 // fetch optionals attributes and labels
70 $extrafields->fetch_name_optionals_label($object->table_element);
71 
72 $socialnetworks = getArrayOfSocialNetworks();
73 
74 // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
75 $object->getCanvas($id);
76 $canvas = $object->canvas ? $object->canvas : GETPOST("canvas");
77 $objcanvas = null;
78 if (!empty($canvas)) {
79  require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
80  $objcanvas = new Canvas($db, $action);
81  $objcanvas->getCanvas('adherent', 'membercard', $canvas);
82 }
83 
84 // Security check
85 $result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
86 
87 if ($id > 0) {
88  // Load member
89  $result = $object->fetch($id);
90 
91  // Define variables to know what current user can do on users
92  $canadduser = ($user->admin || $user->rights->user->user->creer);
93  // Define variables to know what current user can do on properties of user linked to edited member
94  if ($object->user_id) {
95  // $User is the user who edits, $object->user_id is the id of the related user in the edited member
96  $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
97  || (($user->id != $object->user_id) && $user->rights->user->user->creer));
98  $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
99  || (($user->id != $object->user_id) && $user->rights->user->user->password));
100  }
101 }
102 
103 // Define variables to determine what the current user can do on the members
104 $canaddmember = $user->rights->adherent->creer;
105 // Define variables to determine what the current user can do on the properties of a member
106 if ($id) {
107  $caneditfieldmember = $user->rights->adherent->creer;
108 }
109 
110 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
111 $hookmanager->initHooks(array('membercard', 'globalcard'));
112 
113 
114 
115 /*
116  * Actions
117  */
118 
119 $parameters = array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm);
120 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
121 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
122 
123 if (empty($reshook)) {
124  if ($cancel) {
125  if (!empty($backtopage)) {
126  header("Location: ".$backtopage);
127  exit;
128  }
129  $action = '';
130  }
131 
132  if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
133  $error = 0;
134  if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
135  if ($userid != $user->id && $userid != $object->user_id) {
136  $error++;
137  setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
138  }
139  }
140 
141  if (!$error) {
142  if ($userid != $object->user_id) { // If link differs from currently in database
143  $result = $object->setUserId($userid);
144  if ($result < 0) dol_print_error($object->db, $object->error);
145  $action = '';
146  }
147  }
148  }
149 
150  if ($action == 'setsocid') {
151  $error = 0;
152  if (!$error) {
153  if ($socid != $object->socid) { // If link differs from currently in database
154  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
155  $sql .= " WHERE socid = ".((int) $socid);
156  $sql .= " AND entity = ".$conf->entity;
157  $resql = $db->query($sql);
158  if ($resql) {
159  $obj = $db->fetch_object($resql);
160  if ($obj && $obj->rowid > 0) {
161  $othermember = new Adherent($db);
162  $othermember->fetch($obj->rowid);
163  $thirdparty = new Societe($db);
164  $thirdparty->fetch($socid);
165  $error++;
166  setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors');
167  }
168  }
169 
170  if (!$error) {
171  $result = $object->setThirdPartyId($socid);
172  if ($result < 0) dol_print_error($object->db, $object->error);
173  $action = '';
174  }
175  }
176  }
177  }
178 
179  // Create user from a member
180  if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) {
181  if ($result > 0) {
182  // Creation user
183  $nuser = new User($db);
184  $tmpuser = dol_clone($object);
185  if (GETPOST('internalorexternal', 'aZ09') == 'internal') {
186  $tmpuser->fk_soc = 0;
187  }
188 
189  $result = $nuser->create_from_member($tmpuser, GETPOST('login', 'alphanohtml'));
190 
191  if ($result < 0) {
192  $langs->load("errors");
193  setEventMessages($langs->trans($nuser->error), null, 'errors');
194  } else {
195  setEventMessages($langs->trans("NewUserCreated", $nuser->login), null, 'mesgs');
196  $action = '';
197  }
198  } else {
199  setEventMessages($object->error, $object->errors, 'errors');
200  }
201  }
202 
203  // Create third party from a member
204  if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
205  if ($result > 0) {
206  // User creation
207  $company = new Societe($db);
208  $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
209 
210  if ($result < 0) {
211  $langs->load("errors");
212  setEventMessages($langs->trans($company->error), null, 'errors');
213  setEventMessages($company->error, $company->errors, 'errors');
214  }
215  } else {
216  setEventMessages($object->error, $object->errors, 'errors');
217  }
218  }
219 
220  if ($action == 'update' && !$cancel && $user->rights->adherent->creer) {
221  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
222 
223  $birthdate = '';
224  if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int'))
225  {
226  $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
227  }
228  $lastname = GETPOST("lastname", 'alphanohtml');
229  $firstname = GETPOST("firstname", 'alphanohtml');
230  $gender = GETPOST("gender", 'alphanohtml');
231  $societe = GETPOST("societe", 'alphanohtml');
232  $morphy = GETPOST("morphy", 'alphanohtml');
233  $login = GETPOST("login", 'alphanohtml');
234  if ($morphy != 'mor' && empty($lastname)) {
235  $error++;
236  $langs->load("errors");
237  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
238  }
239  if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) {
240  $error++;
241  $langs->load("errors");
242  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
243  }
244  if ($morphy == 'mor' && empty($societe)) {
245  $error++;
246  $langs->load("errors");
247  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
248  }
249  // Check if the login already exists
250  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
251  if (empty($login)) {
252  $error++;
253  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
254  }
255  }
256  // Create new object
257  if ($result > 0 && !$error) {
258  $object->oldcopy = clone $object;
259 
260  // Change values
261  $object->civility_id = trim(GETPOST("civility_id", 'alphanohtml'));
262  $object->firstname = trim(GETPOST("firstname", 'alphanohtml'));
263  $object->lastname = trim(GETPOST("lastname", 'alphanohtml'));
264  $object->gender = trim(GETPOST("gender", 'alphanohtml'));
265  $object->login = trim(GETPOST("login", 'alphanohtml'));
266  $object->pass = trim(GETPOST("pass", 'alpha'));
267 
268  $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated
269  $object->company = trim(GETPOST("societe", 'alphanohtml'));
270 
271  $object->address = trim(GETPOST("address", 'alphanohtml'));
272  $object->zip = trim(GETPOST("zipcode", 'alphanohtml'));
273  $object->town = trim(GETPOST("town", 'alphanohtml'));
274  $object->state_id = GETPOST("state_id", 'int');
275  $object->country_id = GETPOST("country_id", 'int');
276 
277  $object->phone = trim(GETPOST("phone", 'alpha'));
278  $object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
279  $object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha'));
280  $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
281  $object->socialnetworks = array();
282  foreach ($socialnetworks as $key => $value) {
283  if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
284  $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
285  }
286  }
287  //$object->skype = trim(GETPOST("skype", 'alpha'));
288  //$object->twitter = trim(GETPOST("twitter", 'alpha'));
289  //$object->facebook = trim(GETPOST("facebook", 'alpha'));
290  //$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
291  $object->birth = $birthdate;
292 
293  $object->typeid = GETPOST("typeid", 'int');
294  //$object->note = trim(GETPOST("comment","alpha"));
295  $object->morphy = GETPOST("morphy", 'alpha');
296 
297  if (GETPOST('deletephoto', 'alpha')) $object->photo = '';
298  elseif (!empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
299 
300  // Get status and public property
301  $object->statut = GETPOST("statut", 'alpha');
302  $object->public = GETPOST("public", 'alpha');
303 
304  // Fill array 'array_options' with data from add form
305  $ret = $extrafields->setOptionalsFromPost(null, $object);
306  if ($ret < 0) $error++;
307 
308  // Check if we need to also synchronize user information
309  $nosyncuser = 0;
310  if ($object->user_id) { // If linked to a user
311  if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser = 1; // Disable synchronizing
312  }
313 
314  // Check if we need to also synchronize password information
315  $nosyncuserpass = 0;
316  if ($object->user_id) { // If linked to a user
317  if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing
318  }
319 
320  $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
321 
322  if ($result >= 0 && !count($object->errors)) {
323  $categories = GETPOST('memcats', 'array');
324  $object->setCategories($categories);
325 
326  // Logo/Photo save
327  $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos';
328  $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
329  if ($file_OK) {
330  if (GETPOST('deletephoto')) {
331  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
332  $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo;
333  $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs';
334  dol_delete_file($fileimg);
335  dol_delete_dir_recursive($dirthumbs);
336  }
337 
338  if (image_format_supported($_FILES['photo']['name']) > 0) {
339  dol_mkdir($dir);
340 
341  if (@is_dir($dir)) {
342  $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
343  if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) {
344  setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
345  } else {
346  // Create thumbs
347  $object->addThumbs($newfile);
348  }
349  }
350  } else {
351  setEventMessages("ErrorBadImageFormat", null, 'errors');
352  }
353  } else {
354  switch ($_FILES['photo']['error']) {
355  case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
356  case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
357  $errors[] = "ErrorFileSizeTooLarge";
358  break;
359  case 3: //uploaded file was only partially uploaded
360  $errors[] = "ErrorFilePartiallyUploaded";
361  break;
362  }
363  }
364 
365  $rowid = $object->id;
366  $id = $object->id;
367  $action = '';
368 
369  if (!empty($backtopage)) {
370  header("Location: ".$backtopage);
371  exit;
372  }
373  } else {
374  setEventMessages($object->error, $object->errors, 'errors');
375  $action = '';
376  }
377  } else {
378  $action = 'edit';
379  }
380  }
381 
382  if ($action == 'add' && $user->rights->adherent->creer) {
383  if ($canvas) $object->canvas = $canvas;
384  $birthdate = '';
385  if (GETPOSTISSET("birthday") && GETPOST("birthday") && GETPOSTISSET("birthmonth") && GETPOST("birthmonth") && GETPOSTISSET("birthyear") && GETPOST("birthyear")) {
386  $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
387  }
388  $datesubscription = '';
389  if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) {
390  $datesubscription = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", "int"), GETPOST("reyear", "int"));
391  }
392 
393  $typeid = GETPOST("typeid", 'int');
394  $civility_id = GETPOST("civility_id", 'alphanohtml');
395  $lastname = GETPOST("lastname", 'alphanohtml');
396  $firstname = GETPOST("firstname", 'alphanohtml');
397  $gender = GETPOST("gender", 'alphanohtml');
398  $societe = GETPOST("societe", 'alphanohtml');
399  $address = GETPOST("address", 'alphanohtml');
400  $zip = GETPOST("zipcode", 'alphanohtml');
401  $town = GETPOST("town", 'alphanohtml');
402  $state_id = GETPOST("state_id", 'int');
403  $country_id = GETPOST("country_id", 'int');
404 
405  $phone = GETPOST("phone", 'alpha');
406  $phone_perso = GETPOST("phone_perso", 'alpha');
407  $phone_mobile = GETPOST("phone_mobile", 'alpha');
408  // $skype=GETPOST("member_skype", 'alpha');
409  // $twitter=GETPOST("member_twitter", 'alpha');
410  // $facebook=GETPOST("member_facebook", 'alpha');
411  // $linkedin=GETPOST("member_linkedin", 'alpha');
412  $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
413  $login = GETPOST("member_login", 'alphanohtml');
414  $pass = GETPOST("password", 'alpha');
415  $photo = GETPOST("photo", 'alpha');
416  $morphy = GETPOST("morphy", 'alphanohtml');
417  $public = GETPOST("public", 'alphanohtml');
418 
419  $userid = GETPOST("userid", 'int');
420  $socid = GETPOST("socid", 'int');
421 
422  $object->civility_id = $civility_id;
423  $object->firstname = $firstname;
424  $object->lastname = $lastname;
425  $object->gender = $gender;
426  $object->societe = $societe; // deprecated
427  $object->company = $societe;
428  $object->address = $address;
429  $object->zip = $zip;
430  $object->town = $town;
431  $object->state_id = $state_id;
432  $object->country_id = $country_id;
433  $object->phone = $phone;
434  $object->phone_perso = $phone_perso;
435  $object->phone_mobile = $phone_mobile;
436  $object->socialnetworks = array();
437  if (!empty($conf->socialnetworks->enabled)) {
438  foreach ($socialnetworks as $key => $value) {
439  if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
440  $object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml');
441  }
442  }
443  }
444 
445  // $object->skype = $skype;
446  // $object->twitter = $twitter;
447  // $object->facebook = $facebook;
448  // $object->linkedin = $linkedin;
449 
450  $object->email = $email;
451  $object->login = $login;
452  $object->pass = $pass;
453  $object->birth = $birthdate;
454  $object->photo = $photo;
455  $object->typeid = $typeid;
456  //$object->note = $comment;
457  $object->morphy = $morphy;
458  $object->user_id = $userid;
459  $object->socid = $socid;
460  $object->public = $public;
461 
462  // Fill array 'array_options' with data from add form
463  $ret = $extrafields->setOptionalsFromPost(null, $object);
464  if ($ret < 0) $error++;
465 
466  // Check parameters
467  if (empty($morphy) || $morphy == "-1") {
468  $error++;
469  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MemberNature")), null, 'errors');
470  }
471  // Tests if the login already exists
472  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
473  if (empty($login)) {
474  $error++;
475  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors');
476  } else {
477  $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
478  $result = $db->query($sql);
479  if ($result) {
480  $num = $db->num_rows($result);
481  }
482  if ($num) {
483  $error++;
484  $langs->load("errors");
485  setEventMessages($langs->trans("ErrorLoginAlreadyExists", $login), null, 'errors');
486  }
487  }
488  if (empty($pass)) {
489  $error++;
490  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
491  }
492  }
493  if ($morphy == 'mor' && empty($societe)) {
494  $error++;
495  $langs->load("errors");
496  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
497  }
498  if ($morphy != 'mor' && empty($lastname)) {
499  $error++;
500  $langs->load("errors");
501  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
502  }
503  if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) {
504  $error++;
505  $langs->load("errors");
506  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
507  }
508  if (!($typeid > 0)) { // Keep () before !
509  $error++;
510  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
511  }
512  if ($conf->global->ADHERENT_MAIL_REQUIRED && !isValidEMail($email)) {
513  $error++;
514  $langs->load("errors");
515  setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
516  }
517  $public = 0;
518  if (isset($public)) $public = 1;
519 
520  if (!$error) {
521  $db->begin();
522 
523  // Email about right and login does not exist
524  $result = $object->create($user);
525  if ($result > 0) {
526  // Foundation categories
527  $memcats = GETPOST('memcats', 'array');
528  $object->setCategories($memcats);
529 
530  $db->commit();
531  $rowid = $object->id;
532  $id = $object->id;
533  $action = '';
534  } else {
535  $db->rollback();
536 
537  if ($object->error) {
538  setEventMessages($object->error, $object->errors, 'errors');
539  } else {
540  setEventMessages($object->error, $object->errors, 'errors');
541  }
542 
543  $action = 'create';
544  }
545  } else {
546  $action = 'create';
547  }
548  }
549 
550  if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
551  $result = $object->delete($id, $user);
552  if ($result > 0) {
553  if (!empty($backtopage)) {
554  header("Location: ".$backtopage);
555  exit;
556  } else {
557  header("Location: list.php");
558  exit;
559  }
560  } else {
561  $errmesg = $object->error;
562  }
563  }
564 
565  if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') {
566  $error = 0;
567 
568  $db->begin();
569 
570  $adht = new AdherentType($db);
571  $adht->fetch($object->typeid);
572 
573  $result = $object->validate($user);
574 
575  if ($result >= 0 && !count($object->errors)) {
576  // Send confirmation email (according to parameters of member type. Otherwise generic)
577  if ($object->email && GETPOST("send_mail")) {
578  $subject = '';
579  $msg = '';
580 
581  // Send subscription email
582  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
583  $formmail = new FormMail($db);
584  // Set output language
585  $outputlangs = new Translate('', $conf);
586  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
587  // Load traductions files required by page
588  $outputlangs->loadLangs(array("main", "members"));
589  // Get email content from template
590  $arraydefaultmessage = null;
591  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
592 
593  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
594 
595  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
596  $subject = $arraydefaultmessage->topic;
597  $msg = $arraydefaultmessage->content;
598  }
599 
600  if (empty($labeltouse) || (int) $labeltouse === -1) {
601  //fallback on the old configuration.
602  setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
603  $error++;
604  } else {
605  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
606  complete_substitutions_array($substitutionarray, $outputlangs, $object);
607  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
608  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
609 
610  $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
611 
612  $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
613  if ($result < 0) {
614  $error++;
615  setEventMessages($object->error, $object->errors, 'errors');
616  }
617  }
618  }
619  } else {
620  $error++;
621  if ($object->error) {
622  setEventMessages($object->error, $object->errors, 'errors');
623  } else {
624  setEventMessages($object->error, $object->errors, 'errors');
625  }
626  }
627 
628  if (!$error) {
629  $db->commit();
630  } else {
631  $db->rollback();
632  }
633  $action = '';
634  }
635 
636  if ($user->rights->adherent->supprimer && $action == 'confirm_resign') {
637  $error = 0;
638 
639  if ($confirm == 'yes') {
640  $adht = new AdherentType($db);
641  $adht->fetch($object->typeid);
642 
643  $result = $object->resiliate($user);
644 
645  if ($result >= 0 && !count($object->errors)) {
646  if ($object->email && GETPOST("send_mail")) {
647  $subject = '';
648  $msg = '';
649 
650  // Send subscription email
651  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
652  $formmail = new FormMail($db);
653  // Set output language
654  $outputlangs = new Translate('', $conf);
655  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
656  // Load traductions files required by page
657  $outputlangs->loadLangs(array("main", "members"));
658  // Get email content from template
659  $arraydefaultmessage = null;
660  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
661 
662  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
663 
664  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
665  $subject = $arraydefaultmessage->topic;
666  $msg = $arraydefaultmessage->content;
667  }
668 
669  if (empty($labeltouse) || (int) $labeltouse === -1) {
670  //fallback on the old configuration.
671  setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
672  $error++;
673  } else {
674  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
675  complete_substitutions_array($substitutionarray, $outputlangs, $object);
676  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
677  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
678 
679  $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
680 
681  $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
682  if ($result < 0) {
683  $error++;
684  setEventMessages($object->error, $object->errors, 'errors');
685  }
686  }
687  }
688  } else {
689  $error++;
690 
691  if ($object->error) {
692  setEventMessages($object->error, $object->errors, 'errors');
693  } else {
694  setEventMessages($object->error, $object->errors, 'errors');
695  }
696  $action = '';
697  }
698  }
699  if (!empty($backtopage) && !$error) {
700  header("Location: ".$backtopage);
701  exit;
702  }
703  }
704 
705  // SPIP Management
706  if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') {
707  if (!count($object->errors)) {
708  if (!$mailmanspip->del_to_spip($object)) {
709  setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
710  }
711  }
712  }
713 
714  if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') {
715  if (!count($object->errors)) {
716  if (!$mailmanspip->add_to_spip($object)) {
717  setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
718  }
719  }
720  }
721 
722  // Actions when printing a doc from card
723  include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
724 
725  // Actions to build doc
726  $upload_dir = $conf->adherent->dir_output;
727  $permissiontoadd = $user->rights->adherent->creer;
728  include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
729 
730  // Actions to send emails
731  $triggersendname = 'MEMBER_SENTBYMAIL';
732  $paramname = 'id';
733  $mode = 'emailfrommember';
734  $trackid = 'mem'.$object->id;
735  include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
736 }
737 
738 
739 /*
740  * View
741  */
742 
743 $form = new Form($db);
744 $formfile = new FormFile($db);
745 $formcompany = new FormCompany($db);
746 
747 $title = $langs->trans("Member")." - ".$langs->trans("Card");
748 $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
749 llxHeader('', $title, $help_url);
750 
751 $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
752 
753 if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
754  // -----------------------------------------
755  // When used with CANVAS
756  // -----------------------------------------
757  if (empty($object->error) && $id) {
758  $object = new Adherent($db);
759  $result = $object->fetch($id);
760  if ($result <= 0) dol_print_error('', $object->error);
761  }
762  $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
763  $objcanvas->display_canvas($action); // Show template
764 } else {
765  // -----------------------------------------
766  // When used in standard mode
767  // -----------------------------------------
768 
769  if ($action == 'create') {
770  /* ************************************************************************** */
771  /* */
772  /* Creation mode */
773  /* */
774  /* ************************************************************************** */
775  $object->canvas = $canvas;
776  $object->state_id = GETPOST('state_id', 'int');
777 
778  // We set country_id, country_code and country for the selected country
779  $object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id;
780  if ($object->country_id) {
781  $tmparray = getCountry($object->country_id, 'all');
782  $object->country_code = $tmparray['code'];
783  $object->country = $tmparray['label'];
784  }
785 
786  if (!empty($socid)) {
787  $object = new Societe($db);
788  if ($socid > 0) $object->fetch($socid);
789 
790  if (!($object->id > 0)) {
791  $langs->load("errors");
792  print($langs->trans('ErrorRecordNotFound'));
793  exit;
794  }
795  }
796 
797  $adht = new AdherentType($db);
798 
799  print load_fiche_titre($langs->trans("NewMember"), '', 'members');
800 
801  if ($conf->use_javascript_ajax) {
802  print "\n".'<script type="text/javascript" language="javascript">';
803  print 'jQuery(document).ready(function () {
804  jQuery("#selectcountry_id").change(function() {
805  document.formsoc.action.value="create";
806  document.formsoc.submit();
807  });
808  function initfieldrequired()
809  {
810  jQuery("#tdcompany").removeClass("fieldrequired");
811  jQuery("#tdlastname").removeClass("fieldrequired");
812  jQuery("#tdfirstname").removeClass("fieldrequired");
813  if (jQuery("#morphy").val() == \'mor\')
814  {
815  jQuery("#tdcompany").addClass("fieldrequired");
816  }
817  if (jQuery("#morphy").val() == \'phy\')
818  {
819  jQuery("#tdlastname").addClass("fieldrequired");
820  jQuery("#tdfirstname").addClass("fieldrequired");
821  }
822  }
823  jQuery("#morphy").change(function() {
824  initfieldrequired();
825  });
826  initfieldrequired();
827  })';
828  print '</script>'."\n";
829  }
830 
831  print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
832  print '<input type="hidden" name="token" value="'.newToken().'">';
833  print '<input type="hidden" name="action" value="add">';
834  print '<input type="hidden" name="socid" value="'.$socid.'">';
835  if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
836 
838 
839  print '<table class="border centpercent">';
840  print '<tbody>';
841 
842  // Login
843  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
844  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>';
845  }
846 
847  // Password
848  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
849  require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
850  $generated_password = getRandomPassword(false);
851  print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
852  print '<input type="text" class="minwidth300" maxlength="50" name="password" value="'.$generated_password.'">';
853  print '</td></tr>';
854  }
855 
856  // Type
857  print '<tr><td class="fieldrequired">'.$langs->trans("MemberType").'</td><td>';
858  $listetype = $adht->liste_array(1);
859  if (count($listetype)) {
860  print $form->selectarray("typeid", $listetype, (GETPOST('typeid', 'int') ? GETPOST('typeid', 'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', '', 1);
861  } else {
862  print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
863  }
864  print "</td>\n";
865 
866  // Morphy
867  $morphys["phy"] = $langs->trans("Physical");
868  $morphys["mor"] = $langs->trans("Moral");
869  print '<tr><td class="fieldrequired">'.$langs->trans("MemberNature")."</td><td>\n";
870  print $form->selectarray("morphy", $morphys, (GETPOST('morphy', 'alpha') ?GETPOST('morphy', 'alpha') : $object->morphy), 1, 0, 0, '', 0, 0, 0, '', '', 1);
871  print "</td>\n";
872 
873  // Company
874  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') : $object->company).'"></td></tr>';
875 
876  // Civility
877  print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
878  print $formcompany->select_civility(GETPOST('civility_id', 'int') ? GETPOST('civility_id', 'int') : $object->civility_id, 'civility_id', 'maxwidth150', 1).'</td>';
879  print '</tr>';
880 
881  // Lastname
882  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>';
883  print '</tr>';
884 
885  // Firstname
886  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>';
887  print '</tr>';
888 
889  // Gender
890  print '<tr><td>'.$langs->trans("Gender").'</td>';
891  print '<td>';
892  $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
893  print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1);
894  print '</td></tr>';
895 
896  // EMail
897  print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
898  print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
899 
900  // Address
901  print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
902  print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
903  print '</td></tr>';
904 
905  // Zip / Town
906  print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
907  print $formcompany->select_ziptown((GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
908  print ' ';
909  print $formcompany->select_ziptown((GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
910  print '</td></tr>';
911 
912  // Country
913  $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
914  print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
915  print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
916  if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
917  print '</td></tr>';
918 
919  // State
920  if (empty($conf->global->MEMBER_DISABLE_STATE)) {
921  print '<tr><td>'.$langs->trans('State').'</td><td>';
922  if ($object->country_id) {
923  print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
924  } else {
925  print $countrynotdefined;
926  }
927  print '</td></tr>';
928  }
929 
930  // Pro phone
931  print '<tr><td>'.$langs->trans("PhonePro").'</td>';
932  print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $object->phone).'"></td></tr>';
933 
934  // Personal phone
935  print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
936  print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
937 
938  // Mobile phone
939  print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
940  print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
941 
942  if (!empty($conf->socialnetworks->enabled)) {
943  foreach ($socialnetworks as $key => $value) {
944  if (!$value['active']) break;
945  print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOSTISSET('member_'.$key) ? GETPOST('member_'.$key, 'alpha') : $object->socialnetworks[$key]).'"></td></tr>';
946  }
947  }
948 
949  // Birth Date
950  print "<tr><td>".$langs->trans("DateOfBirth")."</td><td>\n";
951  print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
952  print "</td></tr>\n";
953 
954  // Public profil
955  print "<tr><td>".$langs->trans("Public")."</td><td>\n";
956  print $form->selectyesno("public", $object->public, 1);
957  print "</td></tr>\n";
958 
959  // Categories
960  if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
961  print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
962  $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
963  print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
964  print "</td></tr>";
965  }
966 
967  // Other attributes
968  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
969 
970  print '<tbody>';
971  print "</table>\n";
972 
973  print dol_get_fiche_end();
974 
975  print '<div class="center">';
976  print '<input type="submit" name="button" class="button" value="'.$langs->trans("AddMember").'">';
977  print '&nbsp;&nbsp;';
978  if (!empty($backtopage)) {
979  print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
980  } else {
981  print '<input type="button" class="button button-cancel" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
982  }
983  print '</div>';
984 
985  print "</form>\n";
986  }
987 
988  if ($action == 'edit') {
989  /********************************************
990  *
991  * Edition mode
992  *
993  ********************************************/
994 
995  $res = $object->fetch($id);
996  if ($res < 0) {
997  dol_print_error($db, $object->error); exit;
998  }
999  $res = $object->fetch_optionals();
1000  if ($res < 0) {
1001  dol_print_error($db); exit;
1002  }
1003 
1004  $adht = new AdherentType($db);
1005  $adht->fetch($object->typeid);
1006 
1007  // We set country_id, and country_code, country of the chosen country
1008  $country = GETPOST('country', 'int');
1009  if (!empty($country) || $object->country_id) {
1010  $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country) ? $country : $object->country_id);
1011  $resql = $db->query($sql);
1012  if ($resql) {
1013  $obj = $db->fetch_object($resql);
1014  } else {
1015  dol_print_error($db);
1016  }
1017  $object->country_id = $obj->rowid;
1018  $object->country_code = $obj->code;
1019  $object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
1020  }
1021 
1022  $head = member_prepare_head($object);
1023 
1024 
1025  if ($conf->use_javascript_ajax) {
1026  print "\n".'<script type="text/javascript" language="javascript">';
1027  print 'jQuery(document).ready(function () {
1028  jQuery("#selectcountry_id").change(function() {
1029  document.formsoc.action.value="edit";
1030  document.formsoc.submit();
1031  });
1032  function initfieldrequired()
1033  {
1034  jQuery("#tdcompany").removeClass("fieldrequired");
1035  jQuery("#tdlastname").removeClass("fieldrequired");
1036  jQuery("#tdfirstname").removeClass("fieldrequired");
1037  if (jQuery("#morphy").val() == \'mor\')
1038  {
1039  jQuery("#tdcompany").addClass("fieldrequired");
1040  }
1041  if (jQuery("#morphy").val() == \'phy\')
1042  {
1043  jQuery("#tdlastname").addClass("fieldrequired");
1044  jQuery("#tdfirstname").addClass("fieldrequired");
1045  }
1046  }
1047  jQuery("#morphy").change(function() {
1048  initfieldrequired();
1049  });
1050  initfieldrequired();
1051  })';
1052  print '</script>'."\n";
1053  }
1054 
1055  print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
1056  print '<input type="hidden" name="token" value="'.newToken().'" />';
1057  print '<input type="hidden" name="action" value="update" />';
1058  print '<input type="hidden" name="rowid" value="'.$id.'" />';
1059  print '<input type="hidden" name="statut" value="'.$object->statut.'" />';
1060  if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
1061 
1062  print dol_get_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
1063 
1064  print '<table class="border centpercent">';
1065 
1066  // Ref
1067  print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>';
1068 
1069  // Login
1070  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1071  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>';
1072  }
1073 
1074  // Password
1075  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1076  print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET("pass") ? GETPOST("pass", '', 2) : $object->pass).'"></td></tr>';
1077  }
1078  // Morphy
1079  $morphys["phy"] = $langs->trans("Physical");
1080  $morphys["mor"] = $langs->trans("Moral");
1081  print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberNature").'</span></td><td>';
1082  print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ? GETPOST("morphy", 'alpha') : $object->morphy), 0, 0, 0, '', 0, 0, 0, '', '', 1);
1083  print "</td></tr>";
1084 
1085  // Type
1086  print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
1087  if ($user->rights->adherent->creer) {
1088  print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $object->typeid), 0, 0, 0, '', 0, 0, 0, '', '', 1);
1089  } else {
1090  print $adht->getNomUrl(1);
1091  print '<input type="hidden" name="typeid" value="'.$object->typeid.'">';
1092  }
1093  print "</td></tr>";
1094 
1095  // Company
1096  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>';
1097 
1098  // Civility
1099  print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
1100  print $formcompany->select_civility(GETPOSTISSET("civility_id") ? GETPOST("civility_id", 'alpha') : $object->civility_id, 'civility_id', 'maxwidth150', 1);
1101  print '</td>';
1102  print '</tr>';
1103 
1104  // Lastname
1105  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>';
1106  print '</tr>';
1107 
1108  // Firstname
1109  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>';
1110  print '</tr>';
1111 
1112  // Gender
1113  print '<tr><td>'.$langs->trans("Gender").'</td>';
1114  print '<td>';
1115  $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
1116  print $form->selectarray('gender', $arraygender, GETPOSTISSET('gender') ? GETPOST('gender', 'alphanohtml') : $object->gender, 1, 0, 0, '', 0, 0, 0, '', '', 1);
1117  print '</td></tr>';
1118 
1119  // Photo
1120  print '<tr><td>'.$langs->trans("Photo").'</td>';
1121  print '<td class="hideonsmartphone" valign="middle">';
1122  print $form->showphoto('memberphoto', $object)."\n";
1123  if ($caneditfieldmember) {
1124  if ($object->photo) print "<br>\n";
1125  print '<table class="nobordernopadding">';
1126  if ($object->photo) print '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
1127  print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
1128  print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
1129  print '</table>';
1130  }
1131  print '</td></tr>';
1132 
1133  // EMail
1134  print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
1135  print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
1136 
1137  // Address
1138  print '<tr><td>'.$langs->trans("Address").'</td><td>';
1139  print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml', 2) : $object->address).'</textarea>';
1140  print '</td></tr>';
1141 
1142  // Zip / Town
1143  print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
1144  print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode", 'alphanohtml', 2) : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
1145  print ' ';
1146  print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town", 'alphanohtml', 2) : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
1147  print '</td></tr>';
1148 
1149  // Country
1150  //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined
1151  print '<tr><td>'.$langs->trans('Country').'</td><td>';
1152  print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id, 'country_id');
1153  if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1154  print '</td></tr>';
1155 
1156  // State
1157  if (empty($conf->global->MEMBER_DISABLE_STATE)) {
1158  print '<tr><td>'.$langs->trans('State').'</td><td>';
1159  print $formcompany->select_state($object->state_id, GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id);
1160  print '</td></tr>';
1161  }
1162 
1163  // Pro phone
1164  print '<tr><td>'.$langs->trans("PhonePro").'</td>';
1165  print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" value="'.(GETPOSTISSET("phone") ? GETPOST("phone") : $object->phone).'"></td></tr>';
1166 
1167  // Personal phone
1168  print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
1169  print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" value="'.(GETPOSTISSET("phone_perso") ? GETPOST("phone_perso") : $object->phone_perso).'"></td></tr>';
1170 
1171  // Mobile phone
1172  print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
1173  print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
1174 
1175  if (!empty($conf->socialnetworks->enabled)) {
1176  foreach ($socialnetworks as $key => $value) {
1177  if (!$value['active']) break;
1178  print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : $object->socialnetworks[$key]).'"></td></tr>';
1179  }
1180  }
1181 
1182  // Birth Date
1183  print "<tr><td>".$langs->trans("DateOfBirth")."</td><td>\n";
1184  print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
1185  print "</td></tr>\n";
1186 
1187  // Public profil
1188  print "<tr><td>".$langs->trans("Public")."</td><td>\n";
1189  print $form->selectyesno("public", (GETPOSTISSET("public") ? GETPOST("public", 'alphanohtml', 2) : $object->public), 1);
1190  print "</td></tr>\n";
1191 
1192  // Categories
1193  if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
1194  print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td>';
1195  print '<td>';
1196  $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
1197  $c = new Categorie($db);
1198  $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
1199  $arrayselected = array();
1200  if (is_array($cats)) {
1201  foreach ($cats as $cat) {
1202  $arrayselected[] = $cat->id;
1203  }
1204  }
1205  print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
1206  print "</td></tr>";
1207  }
1208 
1209  // Third party Dolibarr
1210  if (!empty($conf->societe->enabled)) {
1211  print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
1212  if ($object->socid) {
1213  $company = new Societe($db);
1214  $result = $company->fetch($object->socid);
1215  print $company->getNomUrl(1);
1216  } else {
1217  print $langs->trans("NoThirdPartyAssociatedToMember");
1218  }
1219  print '</td></tr>';
1220  }
1221 
1222  // Login Dolibarr
1223  print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td colspan="2" class="valeur">';
1224  if ($object->user_id) {
1225  $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
1226  } else print $langs->trans("NoDolibarrAccess");
1227  print '</td></tr>';
1228 
1229  // Other attributes. Fields from hook formObjectOptions and Extrafields.
1230  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
1231 
1232  print '</table>';
1233  print dol_get_fiche_end();
1234 
1235  print '<div class="center">';
1236  print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
1237  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1238  print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1239  print '</div>';
1240 
1241  print '</form>';
1242  }
1243 
1244  if ($id > 0 && $action != 'edit') {
1245  /* ************************************************************************** */
1246  /* */
1247  /* View mode */
1248  /* */
1249  /* ************************************************************************** */
1250 
1251  $res = $object->fetch($id);
1252  if ($res < 0) {
1253  dol_print_error($db, $object->error); exit;
1254  }
1255  $res = $object->fetch_optionals();
1256  if ($res < 0) {
1257  dol_print_error($db); exit;
1258  }
1259 
1260  $adht = new AdherentType($db);
1261  $res = $adht->fetch($object->typeid);
1262  if ($res < 0) {
1263  dol_print_error($db); exit;
1264  }
1265 
1266 
1267  /*
1268  * Show tabs
1269  */
1270  $head = member_prepare_head($object);
1271 
1272  print dol_get_fiche_head($head, 'general', $langs->trans("Member"), -1, 'user');
1273 
1274  // Confirm create user
1275  if ($action == 'create_user') {
1276  $login = (GETPOSTISSET('login') ? GETPOST('login', 'alphanohtml') : $object->login);
1277  if (empty($login)) {
1278  // Full firstname and name separated with a dot : firstname.name
1279  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
1280  $login = dol_buildlogin($object->lastname, $object->firstname);
1281  }
1282  if (empty($login)) $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
1283 
1284  // Create a form array
1285  $formquestion = array(
1286  array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
1287  );
1288  if (!empty($conf->societe->enabled) && $object->socid > 0) {
1289  $object->fetch_thirdparty();
1290  $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")));
1291  }
1292  $text = '';
1293  if (!empty($conf->societe->enabled) && $object->socid <= 0) {
1294  $text .= $langs->trans("UserWillBeInternalUser").'<br>';
1295  }
1296  $text .= $langs->trans("ConfirmCreateLogin");
1297  print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
1298  }
1299 
1300  // Confirm create third party
1301  if ($action == 'create_thirdparty') {
1302  $companyalias = '';
1303  $fullname = $object->getFullName($langs);
1304 
1305  if ($object->morphy == 'mor') {
1306  $companyname = $object->company;
1307  if (!empty($fullname)) $companyalias = $fullname;
1308  } else {
1309  $companyname = $fullname;
1310  if (!empty($object->company)) $companyalias = $object->company;
1311  }
1312 
1313  // Create a form array
1314  $formquestion = array(
1315  array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
1316  array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
1317  );
1318 
1319  print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrThirdParty"), $langs->trans("ConfirmCreateThirdParty"), "confirm_create_thirdparty", $formquestion, 'yes');
1320  }
1321 
1322  // Confirm validate member
1323  if ($action == 'valid') {
1324  $langs->load("mails");
1325 
1326  $adht = new AdherentType($db);
1327  $adht->fetch($object->typeid);
1328 
1329  $subject = '';
1330  $msg = '';
1331 
1332  // Send subscription email
1333  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
1334  $formmail = new FormMail($db);
1335  // Set output language
1336  $outputlangs = new Translate('', $conf);
1337  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1338  // Load traductions files required by page
1339  $outputlangs->loadLangs(array("main", "members"));
1340  // Get email content from template
1341  $arraydefaultmessage = null;
1342  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
1343 
1344  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
1345 
1346  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1347  $subject = $arraydefaultmessage->topic;
1348  $msg = $arraydefaultmessage->content;
1349  }
1350 
1351  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
1352  complete_substitutions_array($substitutionarray, $outputlangs, $object);
1353  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
1354  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
1355 
1356  $tmp = $langs->trans("SendingAnEMailToMember");
1357  $tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
1358  $tmp .= '<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
1359  $helpcontent = '';
1360  $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
1361  $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
1362  $helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
1363  $helpcontent .= $subjecttosend."\n";
1364  $helpcontent .= "<br>";
1365  $helpcontent .= '<b>'.$langs->trans("Content").'</b>:<br>';
1366  $helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
1367  $label = $form->textwithpicto($tmp, $helpcontent, 1, 'help');
1368 
1369  // Create form popup
1370  $formquestion = array();
1371  if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
1372  if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
1373  $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>'');
1374  }
1375  if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
1376  $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value'=>'');
1377  }
1378  print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220);
1379  }
1380 
1381  // Confirm terminate
1382  if ($action == 'resign') {
1383  $langs->load("mails");
1384 
1385  $adht = new AdherentType($db);
1386  $adht->fetch($object->typeid);
1387 
1388  $subject = '';
1389  $msg = '';
1390 
1391  // Send subscription email
1392  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
1393  $formmail = new FormMail($db);
1394  // Set output language
1395  $outputlangs = new Translate('', $conf);
1396  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1397  // Load traductions files required by page
1398  $outputlangs->loadLangs(array("main", "members"));
1399  // Get email content from template
1400  $arraydefaultmessage = null;
1401  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
1402 
1403  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
1404 
1405  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1406  $subject = $arraydefaultmessage->topic;
1407  $msg = $arraydefaultmessage->content;
1408  }
1409 
1410  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
1411  complete_substitutions_array($substitutionarray, $outputlangs, $object);
1412  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
1413  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
1414 
1415  $tmp = $langs->trans("SendingAnEMailToMember");
1416  $tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
1417  $tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
1418  $helpcontent = '';
1419  $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
1420  $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
1421  $helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
1422  $helpcontent .= $subjecttosend."\n";
1423  $helpcontent .= "<br>";
1424  $helpcontent .= '<b>'.$langs->trans("Content").'</b>:<br>';
1425  $helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
1426  $label = $form->textwithpicto($tmp, $helpcontent, 1, 'help');
1427 
1428  // Create an array
1429  $formquestion = array();
1430  if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 'true' : 'false'));
1431  if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
1432  print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 240);
1433  }
1434 
1435  // Confirm remove member
1436  if ($action == 'delete') {
1437  $formquestion = array();
1438  if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
1439  print $form->formconfirm("card.php?rowid=".$id, $langs->trans("DeleteMember"), $langs->trans("ConfirmDeleteMember"), "confirm_delete", $formquestion, 'no', 1);
1440  }
1441 
1442  // Confirm add in spip
1443  if ($action == 'add_spip') {
1444  print $form->formconfirm("card.php?rowid=".$id, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
1445  }
1446  // Confirm removed from spip
1447  if ($action == 'del_spip') {
1448  print $form->formconfirm("card.php?rowid=$id", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
1449  }
1450 
1451  $rowspan = 17;
1452  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
1453  if (!empty($conf->societe->enabled)) $rowspan++;
1454 
1455  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
1456 
1457  dol_banner_tab($object, 'rowid', $linkback);
1458 
1459  print '<div class="fichecenter">';
1460  print '<div class="fichehalfleft">';
1461 
1462  print '<div class="underbanner clearboth"></div>';
1463  print '<table class="border tableforfield centpercent">';
1464 
1465  // Login
1466  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1467  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
1468  }
1469 
1470  // Type
1471  print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
1472 
1473  // Morphy
1474  print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
1475  print '</tr>';
1476 
1477  // Gender
1478  print '<tr><td>'.$langs->trans("Gender").'</td>';
1479  print '<td>';
1480  if ($object->gender) print $langs->trans("Gender".$object->gender);
1481  print '</td></tr>';
1482 
1483  // Company
1484  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
1485 
1486  // Civility
1487  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
1488  print '</tr>';
1489 
1490  // Password
1491  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
1492  print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
1493  if ($object->pass) {
1494  print preg_replace('/./i', '*', $object->pass);
1495  } else {
1496  if ($user->admin) {
1497  print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
1498  } else {
1499  print $langs->trans("Hidden");
1500  }
1501  }
1502  if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
1503  $langs->load("errors");
1504  $htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
1505  print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
1506  }
1507  print '</td></tr>';
1508  }
1509 
1510  // Date end subscription
1511  print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
1512  if ($object->datefin) {
1513  print dol_print_date($object->datefin, 'day');
1514  if ($object->hasDelay()) {
1515  print " ".img_warning($langs->trans("Late"));
1516  }
1517  } else {
1518  if ($object->need_subscription == 0) {
1519  print $langs->trans("SubscriptionNotNeeded");
1520  } elseif (!$adht->subscription) {
1521  print $langs->trans("SubscriptionNotRecorded");
1522  if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
1523  } else {
1524  print $langs->trans("SubscriptionNotReceived");
1525  if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
1526  }
1527  }
1528  print '</td></tr>';
1529 
1530  print '</table>';
1531 
1532  print '</div>';
1533 
1534  print '<div class="fichehalfright"><div class="ficheaddleft">';
1535  print '<div class="underbanner clearboth"></div>';
1536 
1537  print '<table class="border tableforfield tableforfield" width="100%">';
1538 
1539  // Birth Date
1540  print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
1541 
1542  // Public
1543  print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
1544 
1545  // Categories
1546  if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
1547  print '<tr><td>'.$langs->trans("Categories").'</td>';
1548  print '<td colspan="2">';
1549  print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
1550  print '</td></tr>';
1551  }
1552 
1553  // Other attributes
1554  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1555 
1556  // Third party Dolibarr
1557  if (!empty($conf->societe->enabled)) {
1558  print '<tr><td>';
1559  $editenable = $user->rights->adherent->creer;
1560  print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
1561  print '</td><td colspan="2" class="valeur">';
1562  if ($action == 'editthirdparty') {
1563  $htmlname = 'socid';
1564  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
1565  print '<input type="hidden" name="rowid" value="'.$object->id.'">';
1566  print '<input type="hidden" name="action" value="set'.$htmlname.'">';
1567  print '<input type="hidden" name="token" value="'.newToken().'">';
1568  print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
1569  print '<tr><td>';
1570  print $form->select_company($object->socid, 'socid', '', 1);
1571  print '</td>';
1572  print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
1573  print '</tr></table></form>';
1574  } else {
1575  if ($object->socid) {
1576  $company = new Societe($db);
1577  $result = $company->fetch($object->socid);
1578  print $company->getNomUrl(1);
1579  } else {
1580  print $langs->trans("NoThirdPartyAssociatedToMember");
1581  }
1582  }
1583  print '</td></tr>';
1584  }
1585 
1586  // Login Dolibarr
1587  print '<tr><td>';
1588  $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
1589  print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
1590  print '</td><td colspan="2" class="valeur">';
1591  if ($action == 'editlogin') {
1592  $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
1593  } else {
1594  if ($object->user_id) {
1595  $linkeduser = new User($db);
1596  $linkeduser->fetch($object->user_id);
1597  print $linkeduser->getNomUrl(-1);
1598  } else {
1599  print $langs->trans("NoDolibarrAccess");
1600  }
1601  }
1602  print '</td></tr>';
1603 
1604  //VCard
1605  print '<tr><td>';
1606  print $langs->trans("VCard").'</td><td colspan="3">';
1607  print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">';
1608  print img_picto($langs->trans("Download"), 'vcard.png', 'class="paddingrightonly"');
1609  print $langs->trans("Download");
1610  print '</a>';
1611  print '</td></tr>';
1612 
1613  print "</table>\n";
1614 
1615  print "</div></div></div>\n";
1616  print '<div style="clear:both"></div>';
1617 
1618  print dol_get_fiche_end();
1619 
1620 
1621  /*
1622  * Action bar
1623  */
1624 
1625  print '<div class="tabsAction">';
1626  $parameters = array();
1627  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
1628  if (empty($reshook)) {
1629  if ($action != 'editlogin' && $action != 'editthirdparty') {
1630  // Send
1631  if (empty($user->socid)) {
1632  if ($object->statut == 1) {
1633  print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
1634  }
1635  }
1636 
1637  // Send card by email
1638  // TODO Remove this to replace with a template
1639  /*
1640  if ($user->rights->adherent->creer)
1641  {
1642  if ($object->statut >= 1)
1643  {
1644  if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
1645  else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
1646  }
1647  else
1648  {
1649  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
1650  }
1651  }
1652  else
1653  {
1654  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
1655  }*/
1656 
1657  // Modify
1658  if ($user->rights->adherent->creer) {
1659  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify")."</a></div>";
1660  } else {
1661  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
1662  }
1663 
1664  // Validate
1665  if ($object->statut == -1) {
1666  if ($user->rights->adherent->creer) {
1667  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate")."</a></div>\n";
1668  } else {
1669  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</font></div>';
1670  }
1671  }
1672 
1673  // Reactivate
1674  if ($object->statut == 0) {
1675  if ($user->rights->adherent->creer) {
1676  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a></div>\n";
1677  } else {
1678  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable")."</font></div>";
1679  }
1680  }
1681 
1682  // Terminate
1683  if ($object->statut >= 1) {
1684  if ($user->rights->adherent->supprimer) {
1685  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=resign">'.$langs->trans("Resiliate")."</a></div>\n";
1686  } else {
1687  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate")."</font></div>";
1688  }
1689  }
1690 
1691  // Create third party
1692  if (!empty($conf->societe->enabled) && !$object->socid) {
1693  if ($user->rights->societe->creer) {
1694  if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
1695  else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
1696  } else {
1697  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty")."</font></div>";
1698  }
1699  }
1700 
1701  // Create user
1702  if (!$user->socid && !$object->user_id) {
1703  if ($user->rights->user->user->creer) {
1704  if ($object->statut != -1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
1705  else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
1706  } else {
1707  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
1708  }
1709  }
1710 
1711  // Action SPIP
1712  if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
1713  $isinspip = $mailmanspip->is_in_spip($object);
1714 
1715  if ($isinspip == 1) {
1716  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=del_spip">'.$langs->trans("DeleteIntoSpip")."</a></div>\n";
1717  }
1718  if ($isinspip == 0) {
1719  print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip")."</a></div>\n";
1720  }
1721  }
1722 
1723  // Delete
1724  if ($user->rights->adherent->supprimer) {
1725  print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
1726  } else {
1727  print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete")."</font></div>";
1728  }
1729  }
1730  }
1731  print '</div>';
1732 
1733  if ($isinspip == -1) {
1734  print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
1735  }
1736 
1737 
1738  // Select mail models is same action as presend
1739  if (GETPOST('modelselected')) {
1740  $action = 'presend';
1741  }
1742 
1743  if ($action != 'presend') {
1744  print '<div class="fichecenter"><div class="fichehalfleft">';
1745  print '<a name="builddoc"></a>'; // ancre
1746 
1747  // Documents generes
1748  $filename = dol_sanitizeFileName($object->ref);
1749  //$filename = 'tmp_cards.php';
1750  //$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
1751  $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'member');
1752  $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
1753  $genallowed = $user->rights->adherent->lire;
1754  $delallowed = $user->rights->adherent->creer;
1755 
1756  print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
1757  $somethingshown = $formfile->numoffiles;
1758 
1759  // Show links to link elements
1760  //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
1761  //$somethingshown = $form->showLinkedObjectBlock($object, '');
1762 
1763  // Show links to link elements
1764  /*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
1765  if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
1766  */
1767 
1768  // Show online payment link
1769  $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
1770 
1771  if ($useonlinepayment) {
1772  print '<br>';
1773 
1774  require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
1775  print showOnlinePaymentUrl('membersubscription', $object->ref);
1776  }
1777 
1778  print '</div><div class="fichehalfright"><div class="ficheaddleft">';
1779 
1780  $MAX = 10;
1781 
1782  $morehtmlright = '<a href="'.DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id.'">';
1783  $morehtmlright .= $langs->trans("SeeAll");
1784  $morehtmlright .= '</a>';
1785 
1786  // List of actions on element
1787  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
1788  $formactions = new FormActions($db);
1789  $somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright);
1790 
1791  print '</div></div></div>';
1792  }
1793 
1794  // Presend form
1795  $modelmail = 'member';
1796  $defaulttopic = 'CardContent';
1797  $diroutput = $conf->adherent->dir_output;
1798  $trackid = 'mem'.$object->id;
1799 
1800  include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
1801  }
1802 }
1803 
1804 // End of page
1805 llxFooter();
1806 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
Classe permettant la generation du formulaire html d&#39;envoi de mail unitaire Usage: $formail = new For...
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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...
if(!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort"u if(!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort"u if(!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status"u statut
Definition: list.php:632
Class to manage building of HTML components.
Class to manage canvas.
getArrayOfSocialNetworks()
Get array of social network dictionary.
Class to manage Dolibarr users.
Definition: user.class.php:44
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
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...
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
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...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
Definition: images.lib.php:39
llxHeader()
Empty header.
Definition: wrapper.php:45
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Class to build HTML component for third parties management Only common components are here...
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories) ...
Definition: files.lib.php:1286
Class to manage members of a foundation.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
Definition: files.lib.php:1144
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
Class to offer components to list and upload files.
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.
Definition: files.lib.php:999
Class to manage members type.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=&gt;newva...
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.
Class to manage mailman and spip.
llxFooter()
Empty footer.
Definition: wrapper.php:59
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
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 &quot;subst...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...