PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/adherent/admin/adherent.php

https://bitbucket.org/speedealing/speedealing
PHP | 277 lines | 170 code | 56 blank | 51 comment | 22 complexity | e4cfbc2bcb8ea3d8b6568e2228a4b077 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  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@capnetworks.com>
  8. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  9. * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
  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 <http://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/adherents/admin/adherent.php
  26. * \ingroup member
  27. * \brief Page to setup the module Foundation
  28. */
  29. require '../../main.inc.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  32. $langs->load("admin");
  33. $langs->load("members");
  34. if (! $user->admin) accessforbidden();
  35. $type=array('yesno','texte','chaine');
  36. $action = GETPOST('action','alpha');
  37. /*
  38. * Actions
  39. */
  40. // Action mise a jour ou ajout d'une constante
  41. if ($action == 'update' || $action == 'add')
  42. {
  43. $constname=GETPOST('constname','alpha');
  44. $constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
  45. if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
  46. if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
  47. {
  48. if ($constvalue) $constvalue=0;
  49. else $constvalue=1;
  50. }
  51. $consttype=GETPOST('consttype','alpha');
  52. $constnote=GETPOST('constnote');
  53. $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
  54. if (! $res > 0) $error++;
  55. if (! $error)
  56. {
  57. $mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
  58. }
  59. else
  60. {
  61. $mesg = '<div class="error">'.$langs->trans("Error").'</div>';
  62. }
  63. }
  64. // Action activation d'un sous module du module adherent
  65. if ($action == 'set')
  66. {
  67. $result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
  68. if ($result < 0)
  69. {
  70. print $db->error();
  71. }
  72. }
  73. // Action desactivation d'un sous module du module adherent
  74. if ($action == 'unset')
  75. {
  76. $result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
  77. if ($result < 0)
  78. {
  79. print $db->error();
  80. }
  81. }
  82. /*
  83. * View
  84. */
  85. llxHeader('',$langs->trans("MembersSetup"));
  86. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  87. print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup');
  88. $head = member_admin_prepare_head();
  89. dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
  90. dol_htmloutput_mesg($mesg);
  91. print_fiche_titre($langs->trans("MemberMainOptions"),'','');
  92. print '<table class="noborder" width="100%">';
  93. print '<tr class="liste_titre">';
  94. print '<td>'.$langs->trans("Description").'</td>';
  95. print '<td>'.$langs->trans("Value").'</td>';
  96. print '<td align="center">'.$langs->trans("Action").'</td>';
  97. print "</tr>\n";
  98. $var=true;
  99. $form = new Form($db);
  100. // Login/Pass required for members
  101. if ($conf->global->MAIN_FEATURES_LEVEL > 0)
  102. {
  103. $var=!$var;
  104. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  105. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  106. print '<input type="hidden" name="action" value="update">';
  107. print '<input type="hidden" name="constname" value="ADHERENT_LOGIN_NOT_REQUIRED">';
  108. print '<tr '.$bc[$var].'><td>'.$langs->trans("AdherentLoginRequired").'</td><td>';
  109. print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?$conf->global->ADHERENT_LOGIN_NOT_REQUIRED:1),1);
  110. print '</td><td align="center" width="80">';
  111. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  112. print "</td></tr>\n";
  113. print '</form>';
  114. }
  115. // Mail required for members
  116. $var=!$var;
  117. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  118. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  119. print '<input type="hidden" name="action" value="update">';
  120. print '<input type="hidden" name="constname" value="ADHERENT_MAIL_REQUIRED">';
  121. print '<tr '.$bc[$var].'><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
  122. print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1);
  123. print '</td><td align="center" width="80">';
  124. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  125. print "</td></tr>\n";
  126. print '</form>';
  127. // Send mail information is on by default
  128. $var=!$var;
  129. print '<form action="adherent.php" method="POST">';
  130. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  131. print '<input type="hidden" name="action" value="update">';
  132. print '<input type="hidden" name="constname" value="ADHERENT_DEFAULT_SENDINFOBYMAIL">';
  133. print '<tr '.$bc[$var].'><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
  134. print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1);
  135. print '</td><td align="center" width="80">';
  136. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  137. print "</td></tr>\n";
  138. print '</form>';
  139. // Insertion cotisations dans compte financier
  140. $var=!$var;
  141. print '<form action="adherent.php" method="POST">';
  142. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  143. print '<input type="hidden" name="action" value="update">';
  144. print '<input type="hidden" name="constname" value="ADHERENT_BANK_USE">';
  145. print '<tr '.$bc[$var].'><td>'.$langs->trans("AddSubscriptionIntoAccount").'</td>';
  146. if (! empty($conf->banque->enabled))
  147. {
  148. print '<td>';
  149. print $form->selectyesno('constvalue',$conf->global->ADHERENT_BANK_USE,1);
  150. print '</td><td align="center" width="80">';
  151. print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
  152. print '</td>';
  153. }
  154. else
  155. {
  156. print '<td align="right" colspan="2">';
  157. print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")).' '.img_warning("","");
  158. print '</td>';
  159. }
  160. print "</tr>\n";
  161. print '</form>';
  162. print '</table>';
  163. print '<br>';
  164. /*
  165. * Edition info modele document
  166. */
  167. $constantes=array(
  168. 'ADHERENT_CARD_TYPE',
  169. // 'ADHERENT_CARD_BACKGROUND',
  170. 'ADHERENT_CARD_HEADER_TEXT',
  171. 'ADHERENT_CARD_TEXT',
  172. 'ADHERENT_CARD_TEXT_RIGHT',
  173. 'ADHERENT_CARD_FOOTER_TEXT'
  174. );
  175. print_fiche_titre($langs->trans("MembersCards"),'','');
  176. form_constantes($constantes);
  177. print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  178. print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
  179. print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
  180. print '%YEAR%, %MONTH%, %DAY%';
  181. print '<br>';
  182. print '<br>';
  183. /*
  184. * Edition info modele document
  185. */
  186. $constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT');
  187. print_fiche_titre($langs->trans("MembersTickets"),'','');
  188. form_constantes($constantes);
  189. print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  190. print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
  191. print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
  192. print '%YEAR%, %MONTH%, %DAY%';
  193. print '<br>';
  194. print '<br>';
  195. /*
  196. * Edition des variables globales non rattache a un theme specifique
  197. */
  198. $constantes=array(
  199. 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
  200. 'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
  201. 'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
  202. 'ADHERENT_AUTOREGISTER_MAIL',
  203. 'ADHERENT_MAIL_VALID_SUBJECT',
  204. 'ADHERENT_MAIL_VALID',
  205. 'ADHERENT_MAIL_COTIS_SUBJECT',
  206. 'ADHERENT_MAIL_COTIS',
  207. 'ADHERENT_MAIL_RESIL_SUBJECT',
  208. 'ADHERENT_MAIL_RESIL',
  209. 'ADHERENT_MAIL_FROM',
  210. );
  211. print_fiche_titre($langs->trans("Other"),'','');
  212. form_constantes($constantes);
  213. print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  214. print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
  215. print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
  216. //print '%YEAR%, %MONTH%, %DAY%'; // Not supported
  217. print '<br>';
  218. dol_fiche_end();
  219. llxFooter();
  220. $db->close();
  221. ?>