member.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
  6. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  7. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  8. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  9. * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
  10. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  11. * Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.fr>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  25. */
  26. /**
  27. * \file htdocs/adherents/admin/member.php
  28. * \ingroup member
  29. * \brief Page to setup the module Foundation
  30. */
  31. // Load Dolibarr environment
  32. require '../../main.inc.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  35. // Load translation files required by the page
  36. $langs->loadLangs(array("admin", "members"));
  37. if (!$user->admin) {
  38. accessforbidden();
  39. }
  40. $choices = array('yesno', 'texte', 'chaine');
  41. $value = GETPOST('value', 'alpha');
  42. $label = GETPOST('label', 'alpha');
  43. $scandir = GETPOST('scandir', 'alpha');
  44. $type = 'member';
  45. $action = GETPOST('action', 'aZ09');
  46. /*
  47. * Actions
  48. */
  49. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  50. if ($action == 'set_default') {
  51. $ret = addDocumentModel($value, $type, $label, $scandir);
  52. $res = true;
  53. } elseif ($action == 'del_default') {
  54. $ret = delDocumentModel($value, $type);
  55. if ($ret > 0) {
  56. if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
  57. dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
  58. }
  59. }
  60. $res = true;
  61. } elseif ($action == 'setdoc') {
  62. // Set default model
  63. if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) {
  64. // The constant that was read ahead of the new set
  65. // we therefore go through a variable to have a consistent display
  66. $conf->global->MEMBER_ADDON_PDF_ODT = $value;
  67. }
  68. // We activate the model
  69. $ret = delDocumentModel($value, $type);
  70. if ($ret > 0) {
  71. $ret = addDocumentModel($value, $type, $label, $scandir);
  72. }
  73. $res = true;
  74. } elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
  75. $code = $reg[1];
  76. if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
  77. header("Location: ".$_SERVER["PHP_SELF"]);
  78. exit;
  79. } else {
  80. dol_print_error($db);
  81. }
  82. } elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
  83. $code = $reg[1];
  84. if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
  85. header("Location: ".$_SERVER["PHP_SELF"]);
  86. exit;
  87. } else {
  88. dol_print_error($db);
  89. }
  90. } elseif ($action == 'updatemainoptions') {
  91. $db->begin();
  92. $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = 0;
  93. $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
  94. $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
  95. $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
  96. $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
  97. $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
  98. // Use vat for invoice creation
  99. if (isModEnabled('facture')) {
  100. $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
  101. $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
  102. if (isModEnabled("product") || isModEnabled("service")) {
  103. $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
  104. }
  105. }
  106. if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
  107. setEventMessages('ErrorFailedToSaveDate', null, 'errors');
  108. $db->rollback();
  109. } else {
  110. setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
  111. $db->commit();
  112. }
  113. } elseif ($action == 'updatememberscards') {
  114. $db->begin();
  115. $res1 = $res2 = $res3 = $res4 = 0;
  116. $res1 = dolibarr_set_const($db, 'ADHERENT_CARD_TYPE', GETPOST('ADHERENT_CARD_TYPE'), 'chaine', 0, '', $conf->entity);
  117. $res2 = dolibarr_set_const($db, 'ADHERENT_CARD_HEADER_TEXT', GETPOST('ADHERENT_CARD_HEADER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
  118. $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT', GETPOST('ADHERENT_CARD_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
  119. $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT_RIGHT', GETPOST('ADHERENT_CARD_TEXT_RIGHT', 'alpha'), 'chaine', 0, '', $conf->entity);
  120. $res4 = dolibarr_set_const($db, 'ADHERENT_CARD_FOOTER_TEXT', GETPOST('ADHERENT_CARD_FOOTER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
  121. if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) {
  122. setEventMessages('ErrorFailedToSaveDate', null, 'errors');
  123. $db->rollback();
  124. } else {
  125. setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
  126. $db->commit();
  127. }
  128. } elseif ($action == 'updatememberstickets') {
  129. $db->begin();
  130. $res1 = $res2 = 0;
  131. $res1 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TYPE', GETPOST('ADHERENT_ETIQUETTE_TYPE'), 'chaine', 0, '', $conf->entity);
  132. $res2 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TEXT', GETPOST('ADHERENT_ETIQUETTE_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
  133. if ($res1 < 0 || $res2 < 0) {
  134. setEventMessages('ErrorFailedToSaveDate', null, 'errors');
  135. $db->rollback();
  136. } else {
  137. setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
  138. $db->commit();
  139. }
  140. }
  141. // Action to update or add a constant
  142. if ($action == 'update' || $action == 'add') {
  143. $constname = GETPOST('constname', 'alpha');
  144. $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
  145. if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
  146. $constvalue = '';
  147. }
  148. if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
  149. if ($constvalue) {
  150. $constvalue = 0;
  151. } else {
  152. $constvalue = 1;
  153. }
  154. }
  155. $consttype = GETPOST('consttype', 'alpha');
  156. $constnote = GETPOST('constnote');
  157. $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
  158. if (!($res > 0)) {
  159. $error++;
  160. }
  161. if (!$error) {
  162. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  163. } else {
  164. setEventMessages($langs->trans("Error"), null, 'errors');
  165. }
  166. }
  167. // Action to enable of a submodule of the adherent module
  168. if ($action == 'set') {
  169. $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
  170. if ($result < 0) {
  171. print $db->error();
  172. }
  173. }
  174. // Action to disable a submodule of the adherent module
  175. if ($action == 'unset') {
  176. $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
  177. if ($result < 0) {
  178. print $db->error();
  179. }
  180. }
  181. /*
  182. * View
  183. */
  184. $form = new Form($db);
  185. $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
  186. llxHeader('', $langs->trans("MembersSetup"), $help_url);
  187. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  188. print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
  189. $head = member_admin_prepare_head();
  190. print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
  191. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  192. print '<input type="hidden" name="token" value="'.newToken().'">';
  193. print '<input type="hidden" name="action" value="updatemainoptions">';
  194. // Main options
  195. print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
  196. print '<div class="div-table-responsive-no-min">';
  197. print '<table class="noborder centpercent">';
  198. print '<tr class="liste_titre">';
  199. print '<td>'.$langs->trans("Description").'</td>';
  200. print '<td>'.$langs->trans("Value").'</td>';
  201. print "</tr>\n";
  202. // Mail required for members
  203. print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
  204. print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
  205. print "</td></tr>\n";
  206. // Login/Pass required for members
  207. print '<tr class="oddeven"><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
  208. print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
  209. print "</td></tr>\n";
  210. // Send mail information is on by default
  211. print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
  212. print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
  213. print "</td></tr>\n";
  214. // Create an external user login for each new member subscription validated
  215. print '<tr class="oddeven"><td>'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").'</td><td>';
  216. print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (!empty($conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN) ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1);
  217. print "</td></tr>\n";
  218. // Allow members to change type on renewal forms
  219. /* To test during next beta
  220. print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
  221. print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
  222. print "</td></tr>\n";
  223. */
  224. // Insert subscription into bank account
  225. print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
  226. $arraychoices = array('0'=>$langs->trans("None"));
  227. if (isModEnabled("banque")) {
  228. $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
  229. }
  230. if (isModEnabled("banque") && isModEnabled("societe") && isModEnabled('facture')) {
  231. $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
  232. }
  233. if (isModEnabled("banque") && isModEnabled("societe") && isModEnabled('facture')) {
  234. $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
  235. }
  236. print '<td>';
  237. print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
  238. if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
  239. print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
  240. }
  241. print '</td>';
  242. print "</tr>\n";
  243. // Use vat for invoice creation
  244. if (isModEnabled('facture')) {
  245. print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
  246. if (isModEnabled("banque")) {
  247. print '<td>';
  248. print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
  249. print '</td>';
  250. } else {
  251. print '<td class="right">';
  252. print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name"));
  253. print '</td>';
  254. }
  255. print "</tr>\n";
  256. if (isModEnabled("product") || isModEnabled("service")) {
  257. print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
  258. print '<td>';
  259. $selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
  260. print img_picto('', 'product', 'class="pictofixedwidth"');
  261. $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);
  262. print '</td>';
  263. }
  264. print "</tr>\n";
  265. }
  266. print '</table>';
  267. print '</div>';
  268. print '<div class="center">';
  269. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  270. print '</div>';
  271. print '</form>';
  272. print '<br>';
  273. // Document templates for documents generated from member record
  274. $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
  275. // Defined model definition table
  276. $def = array();
  277. $sql = "SELECT nom as name";
  278. $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
  279. $sql .= " WHERE type = '".$db->escape($type)."'";
  280. $sql .= " AND entity = ".$conf->entity;
  281. $resql = $db->query($sql);
  282. if ($resql) {
  283. $i = 0;
  284. $num_rows = $db->num_rows($resql);
  285. while ($i < $num_rows) {
  286. $obj = $db->fetch_object($resql);
  287. array_push($def, $obj->name);
  288. $i++;
  289. }
  290. } else {
  291. dol_print_error($db);
  292. }
  293. print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
  294. print '<div class="div-table-responsive-no-min">';
  295. print '<table class="noborder centpercent">';
  296. print '<tr class="liste_titre">';
  297. print '<td>'.$langs->trans("Name").'</td>';
  298. print '<td>'.$langs->trans("Description").'</td>';
  299. print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
  300. print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
  301. print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
  302. print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
  303. print "</tr>\n";
  304. clearstatcache();
  305. foreach ($dirmodels as $reldir) {
  306. foreach (array('', '/doc') as $valdir) {
  307. $dir = dol_buildpath($reldir."core/modules/member".$valdir);
  308. if (is_dir($dir)) {
  309. $handle = opendir($dir);
  310. if (is_resource($handle)) {
  311. while (($file = readdir($handle)) !== false) {
  312. $filelist[] = $file;
  313. }
  314. closedir($handle);
  315. arsort($filelist);
  316. foreach ($filelist as $file) {
  317. if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
  318. if (file_exists($dir.'/'.$file)) {
  319. $name = substr($file, 4, dol_strlen($file) - 14);
  320. $classname = substr($file, 0, dol_strlen($file) - 10);
  321. require_once $dir.'/'.$file;
  322. $module = new $classname($db);
  323. $modulequalified = 1;
  324. if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
  325. $modulequalified = 0;
  326. }
  327. if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
  328. $modulequalified = 0;
  329. }
  330. if ($modulequalified) {
  331. print '<tr class="oddeven"><td width="100">';
  332. print (empty($module->name) ? $name : $module->name);
  333. print "</td><td>\n";
  334. if (method_exists($module, 'info')) {
  335. print $module->info($langs);
  336. } else {
  337. print $module->description;
  338. }
  339. print '</td>';
  340. // Active
  341. if (in_array($name, $def)) {
  342. print '<td class="center">'."\n";
  343. print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&token='.newToken().'&value='.$name.'">';
  344. print img_picto($langs->trans("Enabled"), 'switch_on');
  345. print '</a>';
  346. print '</td>';
  347. } else {
  348. print '<td class="center">'."\n";
  349. print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
  350. print "</td>";
  351. }
  352. // Defaut
  353. print '<td class="center">';
  354. if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
  355. print img_picto($langs->trans("Default"), 'on');
  356. } else {
  357. print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  358. }
  359. print '</td>';
  360. // Info
  361. $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
  362. $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
  363. if ($module->type == 'pdf') {
  364. $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
  365. }
  366. $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
  367. $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
  368. $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
  369. print '<td class="center">';
  370. print $form->textwithpicto('', $htmltooltip, 1, 0);
  371. print '</td>';
  372. // Preview
  373. print '<td class="center">';
  374. if ($module->type == 'pdf') {
  375. print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
  376. } else {
  377. print img_object($langs->trans("PreviewNotAvailable"), 'generic');
  378. }
  379. print '</td>';
  380. print "</tr>\n";
  381. }
  382. }
  383. }
  384. }
  385. }
  386. }
  387. }
  388. }
  389. print '</table>';
  390. print '</div>';
  391. // Generation of cards for members
  392. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  393. print '<input type="hidden" name="token" value="'.newToken().'">';
  394. print '<input type="hidden" name="action" value="updatememberscards">';
  395. print load_fiche_titre($langs->trans("MembersCards"), '', '');
  396. $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  397. $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
  398. $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
  399. $helptext .= '__YEAR__, __MONTH__, __DAY__';
  400. print '<div class="div-table-responsive-no-min">';
  401. print '<table class="noborder centpercent">';
  402. print '<tr class="liste_titre">';
  403. print '<td>'.$langs->trans("Description").'</td>';
  404. print '<td>'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
  405. print "</tr>\n";
  406. // Format of cards page
  407. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TYPE").'</td><td>';
  408. require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
  409. $arrayoflabels = array();
  410. foreach (array_keys($_Avery_Labels) as $codecards) {
  411. $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
  412. }
  413. print $form->selectarray('ADHERENT_CARD_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_CARD_TYPE') ? getDolGlobalString('ADHERENT_CARD_TYPE') : 'CARD', 1, 0, 0);
  414. print "</td></tr>\n";
  415. // Text printed on top of member cards
  416. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_HEADER_TEXT").'</td><td>';
  417. print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_HEADER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT')).'">';
  418. print "</td></tr>\n";
  419. // Text printed on member cards (align on left)
  420. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT").'</td><td>';
  421. print '<textarea class="flat" name="ADHERENT_CARD_TEXT" cols="50" rows="5" wrap="soft">'."\n";
  422. print getDolGlobalString('ADHERENT_CARD_TEXT');
  423. print '</textarea>';
  424. print "</td></tr>\n";
  425. // Text printed on member cards (align on right)
  426. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT_RIGHT").'</td><td>';
  427. print '<textarea class="flat" name="ADHERENT_CARD_TEXT_RIGHT" cols="50" rows="5" wrap="soft">'."\n";
  428. print getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT');
  429. print '</textarea>';
  430. print "</td></tr>\n";
  431. // Text printed on bottom of member cards
  432. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_FOOTER_TEXT").'</td><td>';
  433. print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_FOOTER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT')).'">';
  434. print "</td></tr>\n";
  435. print '</table>';
  436. print '</div>';
  437. print '<div class="center">';
  438. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  439. print '</div>';
  440. print '</form>';
  441. print '<br>';
  442. // Membership address sheet
  443. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  444. print '<input type="hidden" name="token" value="'.newToken().'">';
  445. print '<input type="hidden" name="action" value="updatememberstickets">';
  446. print load_fiche_titre($langs->trans("MembersTickets"), '', '');
  447. $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  448. $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
  449. $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
  450. $helptext .= '__YEAR__, __MONTH__, __DAY__';
  451. print '<div class="div-table-responsive-no-min">';
  452. print '<table class="noborder centpercent">';
  453. print '<tr class="liste_titre">';
  454. print '<td>'.$langs->trans("Description").'</td>';
  455. print '<td>'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
  456. print "</tr>\n";
  457. // Format of labels page
  458. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TYPE").'</td><td>';
  459. require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
  460. $arrayoflabels = array();
  461. foreach (array_keys($_Avery_Labels) as $codecards) {
  462. $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
  463. }
  464. print $form->selectarray('ADHERENT_ETIQUETTE_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') : 'CARD', 1, 0, 0);
  465. print "</td></tr>\n";
  466. // Text printed on member address sheets
  467. print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TEXT").'</td><td>';
  468. print '<textarea class="flat" name="ADHERENT_ETIQUETTE_TEXT" cols="50" rows="5" wrap="soft">'."\n";
  469. print getDolGlobalString('ADHERENT_ETIQUETTE_TEXT');
  470. print '</textarea>';
  471. print "</td></tr>\n";
  472. print '</table>';
  473. print '</div>';
  474. print '<div class="center">';
  475. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  476. print '</div>';
  477. print '</form>';
  478. print '<br>';
  479. print "<br>";
  480. print dol_get_fiche_end();
  481. // End of page
  482. llxFooter();
  483. $db->close();