type.php 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
  6. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  7. * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
  8. * Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
  9. * Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
  10. * Copyright (C) 2021 Waël Almoman <info@almoman.com>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  24. */
  25. /**
  26. * \file htdocs/adherents/type.php
  27. * \ingroup member
  28. * \brief Member's type setup
  29. */
  30. // Load Dolibarr environment
  31. require '../main.inc.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
  34. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  36. require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
  37. // Load translation files required by the page
  38. $langs->load("members");
  39. $rowid = GETPOST('rowid', 'int');
  40. $action = GETPOST('action', 'aZ09');
  41. $massaction = GETPOST('massaction', 'alpha');
  42. $cancel = GETPOST('cancel', 'alpha');
  43. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
  44. $backtopage = GETPOST('backtopage', 'alpha');
  45. $mode = GETPOST('mode', 'alopha');
  46. $sall = GETPOST("sall", "alpha");
  47. $filter = GETPOST("filter", 'alpha');
  48. $search_ref = GETPOST('search_ref', 'alpha');
  49. $search_lastname = GETPOST('search_lastname', 'alpha');
  50. $search_login = GETPOST('search_login', 'alpha');
  51. $search_email = GETPOST('search_email', 'alpha');
  52. $type = GETPOST('type', 'intcomma');
  53. $status = GETPOST('status', 'alpha');
  54. $optioncss = GETPOST('optioncss', 'alpha');
  55. // Load variable for pagination
  56. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  57. $sortfield = GETPOST('sortfield', 'aZ09comma');
  58. $sortorder = GETPOST('sortorder', 'aZ09comma');
  59. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  60. if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  61. // If $page is not defined, or '' or -1 or if we click on clear filters
  62. $page = 0;
  63. }
  64. $offset = $limit * $page;
  65. $pageprev = $page - 1;
  66. $pagenext = $page + 1;
  67. if (!$sortorder) {
  68. $sortorder = "DESC";
  69. }
  70. if (!$sortfield) {
  71. $sortfield = "d.lastname";
  72. }
  73. $label = GETPOST("label", "alpha");
  74. $morphy = GETPOST("morphy", "alpha");
  75. $status = GETPOST("status", "int");
  76. $subscription = GETPOST("subscription", "int");
  77. $amount = GETPOST('amount', 'alpha');
  78. $duration_value = GETPOST('duration_value', 'int');
  79. $duration_unit = GETPOST('duration_unit', 'alpha');
  80. $vote = GETPOST("vote", "int");
  81. $comment = GETPOST("comment", 'restricthtml');
  82. $mail_valid = GETPOST("mail_valid", 'restricthtml');
  83. $caneditamount = GETPOSTINT("caneditamount");
  84. // Initialize technical objects
  85. $object = new AdherentType($db);
  86. $extrafields = new ExtraFields($db);
  87. $hookmanager->initHooks(array('membertypecard', 'globalcard'));
  88. // Fetch optionals attributes and labels
  89. $extrafields->fetch_name_optionals_label($object->table_element);
  90. // Security check
  91. $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
  92. /*
  93. * Actions
  94. */
  95. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  96. $search_ref = "";
  97. $search_lastname = "";
  98. $search_login = "";
  99. $search_email = "";
  100. $type = "";
  101. $sall = "";
  102. }
  103. if (GETPOST('cancel', 'alpha')) {
  104. $action = 'list';
  105. $massaction = '';
  106. }
  107. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  108. $massaction = '';
  109. }
  110. if ($cancel) {
  111. $action = '';
  112. if (!empty($backtopage)) {
  113. header("Location: ".$backtopage);
  114. exit;
  115. }
  116. }
  117. if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
  118. $object->label = trim($label);
  119. $object->morphy = trim($morphy);
  120. $object->status = (int) $status;
  121. $object->subscription = (int) $subscription;
  122. $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
  123. $object->caneditamount = $caneditamount;
  124. $object->duration_value = $duration_value;
  125. $object->duration_unit = $duration_unit;
  126. $object->note_public = trim($comment);
  127. $object->note_private = '';
  128. $object->mail_valid = trim($mail_valid);
  129. $object->vote = (int) $vote;
  130. // Fill array 'array_options' with data from add form
  131. $ret = $extrafields->setOptionalsFromPost(null, $object);
  132. if ($ret < 0) {
  133. $error++;
  134. }
  135. if (empty($object->label)) {
  136. $error++;
  137. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
  138. } else {
  139. $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle = '".$db->escape($object->label)."'";
  140. $sql .= " WHERE entity IN (".getEntity('member_type').")";
  141. $result = $db->query($sql);
  142. $num = null;
  143. if ($result) {
  144. $num = $db->num_rows($result);
  145. }
  146. if ($num) {
  147. $error++;
  148. $langs->load("errors");
  149. setEventMessages($langs->trans("ErrorLabelAlreadyExists", $login), null, 'errors');
  150. }
  151. }
  152. if (!$error) {
  153. $id = $object->create($user);
  154. if ($id > 0) {
  155. header("Location: ".$_SERVER["PHP_SELF"]);
  156. exit;
  157. } else {
  158. setEventMessages($object->error, $object->errors, 'errors');
  159. $action = 'create';
  160. }
  161. } else {
  162. $action = 'create';
  163. }
  164. }
  165. if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
  166. $object->fetch($rowid);
  167. $object->oldcopy = dol_clone($object);
  168. $object->label= trim($label);
  169. $object->morphy = trim($morphy);
  170. $object->status = (int) $status;
  171. $object->subscription = (int) $subscription;
  172. $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
  173. $object->caneditamount = $caneditamount;
  174. $object->duration_value = $duration_value;
  175. $object->duration_unit = $duration_unit;
  176. $object->note_public = trim($comment);
  177. $object->note_private = '';
  178. $object->mail_valid = trim($mail_valid);
  179. $object->vote = (boolean) trim($vote);
  180. // Fill array 'array_options' with data from add form
  181. $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
  182. if ($ret < 0) {
  183. $error++;
  184. }
  185. $ret = $object->update($user);
  186. if ($ret >= 0 && !count($object->errors)) {
  187. setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
  188. } else {
  189. setEventMessages($object->error, $object->errors, 'errors');
  190. }
  191. header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id);
  192. exit;
  193. }
  194. if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
  195. $object->fetch($rowid);
  196. $res = $object->delete();
  197. if ($res > 0) {
  198. setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
  199. header("Location: ".$_SERVER["PHP_SELF"]);
  200. exit;
  201. } else {
  202. setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
  203. $action = '';
  204. }
  205. }
  206. /*
  207. * View
  208. */
  209. $form = new Form($db);
  210. $formproduct = new FormProduct($db);
  211. $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
  212. llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
  213. // List of members type
  214. if (!$rowid && $action != 'create' && $action != 'edit') {
  215. //print dol_get_fiche_head('');
  216. $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy";
  217. $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
  218. $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
  219. $result = $db->query($sql);
  220. if ($result) {
  221. $num = $db->num_rows($result);
  222. $nbtotalofrecords = $num;
  223. $i = 0;
  224. $param = '';
  225. if (!empty($mode)) {
  226. $param .= '&mode'.urlencode($mode);
  227. }
  228. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  229. $param .= '&contextpage='.$contextpage;
  230. }
  231. if ($limit > 0 && $limit != $conf->liste_limit) {
  232. $param .= '&limit='.$limit;
  233. }
  234. $newcardbutton = '';
  235. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
  236. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
  237. if ($user->hasRight('adherent', 'configurer')) {
  238. $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
  239. }
  240. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  241. if ($optioncss != '') {
  242. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  243. }
  244. print '<input type="hidden" name="token" value="'.newToken().'">';
  245. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  246. print '<input type="hidden" name="action" value="list">';
  247. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  248. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  249. print '<input type="hidden" name="mode" value="'.$mode.'">';
  250. print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
  251. $moreforfilter = '';
  252. print '<div class="div-table-responsive">';
  253. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  254. print '<tr class="liste_titre">';
  255. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  256. print '<th>&nbsp;</th>';
  257. }
  258. print '<th>'.$langs->trans("Ref").'</th>';
  259. print '<th>'.$langs->trans("Label").'</th>';
  260. print '<th class="center">'.$langs->trans("MembersNature").'</th>';
  261. print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
  262. print '<th class="center">'.$langs->trans("Amount").'</th>';
  263. print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
  264. print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
  265. print '<th class="center">'.$langs->trans("Status").'</th>';
  266. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  267. print '<th>&nbsp;</th>';
  268. }
  269. print "</tr>\n";
  270. $membertype = new AdherentType($db);
  271. $i = 0;
  272. /*$savnbfield = $totalarray['nbfield'];
  273. $totalarray = array();
  274. $totalarray['nbfield'] = 0;*/
  275. $imaxinloop = ($limit ? min($num, $limit) : $num);
  276. while ($i < $imaxinloop) {
  277. $objp = $db->fetch_object($result);
  278. $membertype->id = $objp->rowid;
  279. $membertype->ref = $objp->rowid;
  280. $membertype->label = $objp->rowid;
  281. $membertype->status = $objp->status;
  282. $membertype->subscription = $objp->subscription;
  283. $membertype->amount = $objp->amount;
  284. $membertype->caneditamount = $objp->caneditamount;
  285. if ($mode == 'kanban') {
  286. if ($i == 0) {
  287. print '<tr><td colspan="12">';
  288. print '<div class="box-flex-container kanban">';
  289. }
  290. //output kanban
  291. $membertype->label = $objp->label;
  292. print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
  293. if ($i == ($imaxinloop - 1)) {
  294. print '</div>';
  295. print '</td></tr>';
  296. }
  297. } else {
  298. print '<tr class="oddeven">';
  299. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  300. if ($user->hasRight('adherent', 'configurer')) {
  301. print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
  302. }
  303. }
  304. print '<td class="nowraponall">';
  305. print $membertype->getNomUrl(1);
  306. //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
  307. print '</td>';
  308. print '<td>'.dol_escape_htmltag($objp->label).'</td>';
  309. print '<td class="center">';
  310. if ($objp->morphy == 'phy') {
  311. print $langs->trans("Physical");
  312. } elseif ($objp->morphy == 'mor') {
  313. print $langs->trans("Moral");
  314. } else {
  315. print $langs->trans("MorAndPhy");
  316. }
  317. print '</td>';
  318. print '<td class="center">'.yn($objp->subscription).'</td>';
  319. print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
  320. print '<td class="center">'.yn($objp->caneditamount).'</td>';
  321. print '<td class="center">'.yn($objp->vote).'</td>';
  322. print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
  323. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  324. if ($user->hasRight('adherent', 'configurer')) {
  325. print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
  326. }
  327. }
  328. print "</tr>";
  329. }
  330. $i++;
  331. }
  332. // If no record found
  333. if ($num == 0) {
  334. /*$colspan = 1;
  335. foreach ($arrayfields as $key => $val) {
  336. if (!empty($val['checked'])) {
  337. $colspan++;
  338. }
  339. }*/
  340. $colspan = 9;
  341. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  342. }
  343. print "</table>";
  344. print '</div>';
  345. print '</form>';
  346. } else {
  347. dol_print_error($db);
  348. }
  349. }
  350. // Creation
  351. if ($action == 'create') {
  352. $object = new AdherentType($db);
  353. print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
  354. print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
  355. print '<input type="hidden" name="token" value="'.newToken().'">';
  356. print '<input type="hidden" name="action" value="add">';
  357. print dol_get_fiche_head('');
  358. print '<table class="border centpercent">';
  359. print '<tbody>';
  360. print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
  361. print '<tr><td>'.$langs->trans("Status").'</td><td>';
  362. print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
  363. print '</td></tr>';
  364. // Morphy
  365. $morphys = array();
  366. $morphys[""] = $langs->trans("MorAndPhy");
  367. $morphys["phy"] = $langs->trans("Physical");
  368. $morphys["mor"] = $langs->trans("Moral");
  369. print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
  370. print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
  371. print "</td></tr>";
  372. print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
  373. print $form->selectyesno("subscription", 1, 1);
  374. print '</td></tr>';
  375. print '<tr><td>'.$langs->trans("Amount").'</td><td>';
  376. print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
  377. print '</td></tr>';
  378. print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
  379. print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
  380. print '</td></tr>';
  381. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  382. print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
  383. print '</td></tr>';
  384. print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
  385. print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
  386. print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
  387. print '</td></tr>';
  388. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  389. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  390. $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
  391. $doleditor->Create();
  392. print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
  393. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  394. $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
  395. $doleditor->Create();
  396. print '</td></tr>';
  397. // Other attributes
  398. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
  399. print '<tbody>';
  400. print "</table>\n";
  401. print dol_get_fiche_end();
  402. print $form->buttonsSaveCancel();
  403. print "</form>\n";
  404. }
  405. // View
  406. if ($rowid > 0) {
  407. if ($action != 'edit') {
  408. $object = new AdherentType($db);
  409. $object->fetch($rowid);
  410. $object->fetch_optionals();
  411. /*
  412. * Confirmation deletion
  413. */
  414. if ($action == 'delete') {
  415. print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1);
  416. }
  417. $head = member_type_prepare_head($object);
  418. print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
  419. $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  420. dol_banner_tab($object, 'rowid', $linkback);
  421. print '<div class="fichecenter">';
  422. print '<div class="underbanner clearboth"></div>';
  423. print '<table class="tableforfield border centpercent">';
  424. // Morphy
  425. print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
  426. print '</tr>';
  427. print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
  428. print yn($object->subscription);
  429. print '</tr>';
  430. // Amount
  431. print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
  432. print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
  433. print '</tr>';
  434. print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
  435. print yn($object->caneditamount);
  436. print '</td></tr>';
  437. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  438. print yn($object->vote);
  439. print '</tr>';
  440. print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
  441. if ($object->duration_value > 1) {
  442. $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
  443. } elseif ($object->duration_value > 0) {
  444. $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
  445. }
  446. print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
  447. print '</td></tr>';
  448. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  449. print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private));
  450. print "</td></tr>";
  451. print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
  452. print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->mail_valid));
  453. print "</td></tr>";
  454. // Other attributes
  455. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  456. print '</table>';
  457. print '</div>';
  458. print dol_get_fiche_end();
  459. /*
  460. * Buttons
  461. */
  462. print '<div class="tabsAction">';
  463. // Edit
  464. if ($user->hasRight('adherent', 'configurer')) {
  465. print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
  466. }
  467. // Add
  468. if ($object->morphy == 'phy') {
  469. $morphy = 'phy';
  470. } elseif ($object->morphy == 'mor') {
  471. $morphy = 'mor';
  472. } else {
  473. $morphy = '';
  474. }
  475. if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
  476. print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.($morphy ? '&morphy='.urlencode($morphy) : '').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
  477. } else {
  478. print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
  479. }
  480. // Delete
  481. if ($user->hasRight('adherent', 'configurer')) {
  482. print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
  483. }
  484. print "</div>";
  485. // Show list of members (nearly same code than in page list.php)
  486. $membertypestatic = new AdherentType($db);
  487. $now = dol_now();
  488. $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
  489. $sql .= " d.datefin,";
  490. $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
  491. $sql .= " t.libelle as type, t.subscription, t.amount";
  492. $sqlfields = $sql; // $sql fields to remove for count total
  493. $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
  494. $sql .= " WHERE d.fk_adherent_type = t.rowid ";
  495. $sql .= " AND d.entity IN (".getEntity('adherent').")";
  496. $sql .= " AND t.rowid = ".((int) $object->id);
  497. if ($sall) {
  498. $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
  499. }
  500. if ($status != '') {
  501. $sql .= natural_search('d.statut', $status, 2);
  502. }
  503. if ($action == 'search') {
  504. if (GETPOST('search', 'alpha')) {
  505. $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
  506. }
  507. }
  508. if (!empty($search_ref)) {
  509. $sql .= natural_search("d.ref", $search_ref);
  510. }
  511. if (!empty($search_lastname)) {
  512. $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
  513. }
  514. if (!empty($search_login)) {
  515. $sql .= natural_search("d.login", $search_login);
  516. }
  517. if (!empty($search_email)) {
  518. $sql .= natural_search("d.email", $search_email);
  519. }
  520. if ($filter == 'uptodate') {
  521. $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
  522. }
  523. if ($filter == 'outofdate') {
  524. $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
  525. }
  526. // Count total nb of records
  527. $nbtotalofrecords = '';
  528. if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
  529. /* The fast and low memory method to get and count full list converts the sql into a sql count */
  530. $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
  531. $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
  532. $resql = $db->query($sqlforcount);
  533. if ($resql) {
  534. $objforcount = $db->fetch_object($resql);
  535. $nbtotalofrecords = $objforcount->nbtotalofrecords;
  536. } else {
  537. dol_print_error($db);
  538. }
  539. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
  540. $page = 0;
  541. $offset = 0;
  542. }
  543. $db->free($resql);
  544. }
  545. // Complete request and execute it with limit
  546. $sql .= $db->order($sortfield, $sortorder);
  547. if ($limit) {
  548. $sql .= $db->plimit($limit + 1, $offset);
  549. }
  550. $resql = $db->query($sql);
  551. if ($resql) {
  552. $num = $db->num_rows($resql);
  553. $i = 0;
  554. $titre = $langs->trans("MembersList");
  555. if ($status != '') {
  556. if ($status == '-1,1') {
  557. $titre = $langs->trans("MembersListQualified");
  558. } elseif ($status == '-1') {
  559. $titre = $langs->trans("MembersListToValid");
  560. } elseif ($status == '1' && !$filter) {
  561. $titre = $langs->trans("MembersListValid");
  562. } elseif ($status == '1' && $filter == 'uptodate') {
  563. $titre = $langs->trans("MembersListUpToDate");
  564. } elseif ($status == '1' && $filter == 'outofdate') {
  565. $titre = $langs->trans("MembersListNotUpToDate");
  566. } elseif ($status == '0') {
  567. $titre = $langs->trans("MembersListResiliated");
  568. } elseif ($status == '-2') {
  569. $titre = $langs->trans("MembersListExcluded");
  570. }
  571. } elseif ($action == 'search') {
  572. $titre = $langs->trans("MembersListQualified");
  573. }
  574. if ($type > 0) {
  575. $membertype = new AdherentType($db);
  576. $result = $membertype->fetch($type);
  577. $titre .= " (".$membertype->label.")";
  578. }
  579. $param = "&rowid=".urlencode($object->id);
  580. if (!empty($mode)) {
  581. $param .= '&mode='.urlencode($mode);
  582. }
  583. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  584. $param .= '&contextpage='.urlencode($contextpage);
  585. }
  586. if ($limit > 0 && $limit != $conf->liste_limit) {
  587. $param .= '&limit='.((int) $limit);
  588. }
  589. if (!empty($status)) {
  590. $param .= "&status=".urlencode($status);
  591. }
  592. if (!empty($search_ref)) {
  593. $param .= "&search_ref=".urlencode($search_ref);
  594. }
  595. if (!empty($search_lastname)) {
  596. $param .= "&search_lastname=".urlencode($search_lastname);
  597. }
  598. if (!empty($search_firstname)) {
  599. $param .= "&search_firstname=".urlencode($search_firstname);
  600. }
  601. if (!empty($search_login)) {
  602. $param .= "&search_login=".urlencode($search_login);
  603. }
  604. if (!empty($search_email)) {
  605. $param .= "&search_email=".urlencode($search_email);
  606. }
  607. if (!empty($filter)) {
  608. $param .= "&filter=".urlencode($filter);
  609. }
  610. if ($sall) {
  611. print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
  612. }
  613. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
  614. print '<input type="hidden" name="token" value="'.newToken().'">';
  615. print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'"></td>';
  616. print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
  617. $moreforfilter = '';
  618. print '<div class="div-table-responsive">';
  619. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  620. // Fields title search
  621. print '<tr class="liste_titre_filter">';
  622. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  623. print '<td class="liste_titre center maxwidthsearch">';
  624. $searchpicto = $form->showFilterButtons('left');
  625. print $searchpicto;
  626. print '</td>';
  627. }
  628. print '<td class="liste_titre left">';
  629. print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
  630. print '<td class="liste_titre left">';
  631. print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
  632. print '<td class="liste_titre left">';
  633. print '<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
  634. print '<td class="liste_titre">&nbsp;</td>';
  635. print '<td class="liste_titre left">';
  636. print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
  637. print '<td class="liste_titre">&nbsp;</td>';
  638. print '<td class="liste_titre">&nbsp;</td>';
  639. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  640. print '<td class="liste_titre center nowraponall">';
  641. print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
  642. print '&nbsp; ';
  643. print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
  644. print '</td>';
  645. }
  646. print "</tr>\n";
  647. print '<tr class="liste_titre">';
  648. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  649. print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
  650. }
  651. print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder);
  652. print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
  653. print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
  654. print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
  655. print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
  656. print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
  657. print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
  658. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  659. print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
  660. }
  661. print "</tr>\n";
  662. $adh = new Adherent($db);
  663. $imaxinloop = ($limit ? min($num, $limit) : $num);
  664. while ($i < $imaxinloop) {
  665. $objp = $db->fetch_object($resql);
  666. $datefin = $db->jdate($objp->datefin);
  667. $adh->id = $objp->rowid;
  668. $adh->ref = $objp->ref;
  669. $adh->login = $objp->login;
  670. $adh->lastname = $objp->lastname;
  671. $adh->firstname = $objp->firstname;
  672. $adh->datefin = $datefin;
  673. $adh->need_subscription = $objp->subscription;
  674. $adh->statut = $objp->status;
  675. $adh->email = $objp->email;
  676. $adh->photo = $objp->photo;
  677. print '<tr class="oddeven">';
  678. // Actions
  679. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  680. print '<td class="center">';
  681. if ($user->hasRight('adherent', 'creer')) {
  682. print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
  683. }
  684. if ($user->hasRight('adherent', 'supprimer')) {
  685. print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
  686. }
  687. print "</td>";
  688. }
  689. // Ref
  690. print "<td>";
  691. print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
  692. print "</td>\n";
  693. // Lastname
  694. if ($objp->company != '') {
  695. print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
  696. } else {
  697. print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
  698. }
  699. // Login
  700. print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
  701. // Type
  702. /*print '<td class="nowrap">';
  703. $membertypestatic->id=$objp->type_id;
  704. $membertypestatic->label=$objp->type;
  705. print $membertypestatic->getNomUrl(1,12);
  706. print '</td>';
  707. */
  708. // Moral/Physique
  709. print "<td>".$adh->getmorphylib($objp->morphy, 1)."</td>\n";
  710. // EMail
  711. print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
  712. // Status
  713. print '<td class="nowrap">';
  714. print $adh->getLibStatut(2);
  715. print "</td>";
  716. // Date end subscription
  717. if ($datefin) {
  718. print '<td class="nowrap center">';
  719. if ($datefin < dol_now() && $objp->status > 0) {
  720. print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
  721. } else {
  722. print dol_print_date($datefin, 'day');
  723. }
  724. print '</td>';
  725. } else {
  726. print '<td class="nowrap center">';
  727. if (!empty($objp->subscription)) {
  728. print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
  729. if ($objp->status > 0) {
  730. print " ".img_warning();
  731. }
  732. } else {
  733. print '&nbsp;';
  734. }
  735. print '</td>';
  736. }
  737. // Actions
  738. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  739. print '<td class="center">';
  740. if ($user->hasRight('adherent', 'creer')) {
  741. print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
  742. }
  743. if ($user->hasRight('adherent', 'supprimer')) {
  744. print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
  745. }
  746. print "</td>";
  747. }
  748. print "</tr>\n";
  749. $i++;
  750. }
  751. if ($i == 0) {
  752. print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
  753. }
  754. print "</table>\n";
  755. print '</div>';
  756. print '</form>';
  757. } else {
  758. dol_print_error($db);
  759. }
  760. }
  761. /* ************************************************************************** */
  762. /* */
  763. /* Edition mode */
  764. /* */
  765. /* ************************************************************************** */
  766. if ($action == 'edit') {
  767. $object = new AdherentType($db);
  768. $object->fetch($rowid);
  769. $object->fetch_optionals();
  770. $head = member_type_prepare_head($object);
  771. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
  772. print '<input type="hidden" name="token" value="'.newToken().'">';
  773. print '<input type="hidden" name="rowid" value="'.$object->id.'">';
  774. print '<input type="hidden" name="action" value="update">';
  775. print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
  776. print '<table class="border centpercent">';
  777. print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
  778. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
  779. print '<tr><td>'.$langs->trans("Status").'</td><td>';
  780. print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
  781. print '</td></tr>';
  782. // Morphy
  783. $morphys[""] = $langs->trans("MorAndPhy");
  784. $morphys["phy"] = $langs->trans("Physical");
  785. $morphys["mor"] = $langs->trans("Moral");
  786. print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
  787. print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy);
  788. print "</td></tr>";
  789. print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
  790. print $form->selectyesno("subscription", $object->subscription, 1);
  791. print '</td></tr>';
  792. print '<tr><td>'.$langs->trans("Amount").'</td><td>';
  793. print '<input name="amount" size="5" value="';
  794. print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
  795. print '">';
  796. print '</td></tr>';
  797. print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
  798. print $form->selectyesno("caneditamount", $object->caneditamount, 1);
  799. print '</td></tr>';
  800. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  801. print $form->selectyesno("vote", $object->vote, 1);
  802. print '</td></tr>';
  803. print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
  804. print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
  805. print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1);
  806. print '</td></tr>';
  807. print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
  808. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  809. $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
  810. $doleditor->Create();
  811. print "</td></tr>";
  812. print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
  813. $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
  814. $doleditor->Create();
  815. print "</td></tr>";
  816. // Other attributes
  817. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
  818. print '</table>';
  819. print dol_get_fiche_end();
  820. print $form->buttonsSaveCancel();
  821. print "</form>";
  822. }
  823. }
  824. // End of page
  825. llxFooter();
  826. $db->close();