type.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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-2011 Regis Houssin <regis@dolibarr.fr>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/adherents/type.php
  22. * \ingroup member
  23. * \brief Page de configuration des types d'adherents
  24. */
  25. require("../main.inc.php");
  26. require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
  27. require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
  28. $langs->load("members");
  29. $rowid=GETPOST("rowid");
  30. $sortfield = GETPOST("sortfield",'alpha');
  31. $sortorder = GETPOST("sortorder",'alpha');
  32. $page = GETPOST("page",'int');
  33. if ($page == -1) { $page = 0 ; }
  34. $offset = $conf->liste_limit * $page ;
  35. $pageprev = $page - 1;
  36. $pagenext = $page + 1;
  37. if (! $sortorder) { $sortorder="DESC"; }
  38. if (! $sortfield) { $sortfield="d.nom"; }
  39. // Security check
  40. if (! $user->rights->adherent->lire) accessforbidden();
  41. if ($_REQUEST["button_removefilter"])
  42. {
  43. $_GET["search_nom"]="";
  44. $_REQUEST["search_nom"]="";
  45. $_GET["search_prenom"]="";
  46. $_REQUEST["search_prenom"]="";
  47. $_GET["type"]="";
  48. $_REQUEST["type"]="";
  49. $_GET["search_email"]="";
  50. $_REQUEST["search_email"]="";
  51. $sall="";
  52. }
  53. /*
  54. * Actions
  55. */
  56. if ($user->rights->adherent->configurer && $_POST["action"] == 'add')
  57. {
  58. if ($_POST["button"] != $langs->trans("Cancel"))
  59. {
  60. $adht = new AdherentType($db);
  61. $adht->libelle = trim($_POST["libelle"]);
  62. $adht->cotisation = trim($_POST["cotisation"]);
  63. $adht->note = trim($_POST["comment"]);
  64. $adht->mail_valid = trim($_POST["mail_valid"]);
  65. $adht->vote = trim($_POST["vote"]);
  66. if ($adht->libelle)
  67. {
  68. $id=$adht->create($user->id);
  69. if ($id > 0)
  70. {
  71. Header("Location: type.php");
  72. exit;
  73. }
  74. else
  75. {
  76. $mesg=$adht->error;
  77. $_GET["action"] = 'create';
  78. }
  79. }
  80. else
  81. {
  82. $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
  83. $_GET["action"] = 'create';
  84. }
  85. }
  86. }
  87. if ($user->rights->adherent->configurer && $_POST["action"] == 'update')
  88. {
  89. if ($_POST["button"] != $langs->trans("Cancel"))
  90. {
  91. $adht = new AdherentType($db);
  92. $adht->id = $_POST["rowid"];
  93. $adht->libelle = trim($_POST["libelle"]);
  94. $adht->cotisation = trim($_POST["cotisation"]);
  95. $adht->note = trim($_POST["comment"]);
  96. $adht->mail_valid = trim($_POST["mail_valid"]);
  97. $adht->vote = trim($_POST["vote"]);
  98. $adht->update($user->id);
  99. Header("Location: type.php?rowid=".$_POST["rowid"]);
  100. exit;
  101. }
  102. }
  103. if ($user->rights->adherent->configurer && $_GET["action"] == 'delete')
  104. {
  105. $adht = new AdherentType($db);
  106. $adht->delete($rowid);
  107. Header("Location: ".$_SERVER["PHP_SELF"]);
  108. exit;
  109. }
  110. if ($user->rights->adherent->configurer && $_GET["action"] == 'commentaire')
  111. {
  112. $don = new Don($db);
  113. $don->fetch($rowid);
  114. $don->update_note($_POST["commentaire"]);
  115. }
  116. /*
  117. * View
  118. */
  119. llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
  120. $form=new Form($db);
  121. // Liste of members type
  122. if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
  123. {
  124. print_fiche_titre($langs->trans("MembersTypes"));
  125. $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
  126. $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
  127. $result = $db->query($sql);
  128. if ($result)
  129. {
  130. $num = $db->num_rows($result);
  131. $i = 0;
  132. print '<table class="noborder" width="100%">';
  133. print '<tr class="liste_titre">';
  134. print '<td>'.$langs->trans("Ref").'</td>';
  135. print '<td>'.$langs->trans("Label").'</td>';
  136. print '<td align="center">'.$langs->trans("SubscriptionRequired").'</td>';
  137. print '<td align="center">'.$langs->trans("VoteAllowed").'</td>';
  138. print '<td>&nbsp;</td>';
  139. print "</tr>\n";
  140. $var=True;
  141. while ($i < $num)
  142. {
  143. $objp = $db->fetch_object($result);
  144. $var=!$var;
  145. print "<tr ".$bc[$var].">";
  146. print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
  147. print '<td>'.$objp->libelle.'</td>';
  148. print '<td align="center">'.yn($objp->cotisation).'</td>';
  149. print '<td align="center">'.yn($objp->vote).'</td>';
  150. print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
  151. print "</tr>";
  152. $i++;
  153. }
  154. print "</table>";
  155. }
  156. else
  157. {
  158. dol_print_error($db);
  159. }
  160. /*
  161. * Barre d'actions
  162. *
  163. */
  164. print '<div class="tabsAction">';
  165. // New type
  166. if ($user->rights->adherent->configurer)
  167. {
  168. print "<a class=\"butAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>";
  169. }
  170. print "</div>";
  171. }
  172. /* ************************************************************************** */
  173. /* */
  174. /* Creation d'un type adherent */
  175. /* */
  176. /* ************************************************************************** */
  177. if ($_GET["action"] == 'create')
  178. {
  179. $htmls = new Form($db);
  180. print_fiche_titre($langs->trans("NewMemberType"));
  181. if ($mesg) print '<div class="error">'.$mesg.'</div>';
  182. print "<form action=\"type.php\" method=\"post\">";
  183. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  184. print '<table class="border" width="100%">';
  185. print '<input type="hidden" name="action" value="add">';
  186. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
  187. print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
  188. print $htmls->selectyesno("cotisation",1,1);
  189. print '</td></tr>';
  190. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  191. print $htmls->selectyesno("vote",0,1);
  192. print '</td></tr>';
  193. print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
  194. print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\"></textarea></td></tr>";
  195. print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
  196. require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
  197. $doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
  198. $doleditor->Create();
  199. print '</td></tr>';
  200. print "</table>\n";
  201. print '<br>';
  202. print '<center><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp; &nbsp; ';
  203. print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></center>';
  204. print "</form>\n";
  205. }
  206. /* ************************************************************************** */
  207. /* */
  208. /* Edition de la fiche */
  209. /* */
  210. /* ************************************************************************** */
  211. if ($rowid > 0)
  212. {
  213. if ($_GET["action"] != 'edit')
  214. {
  215. $adht = new AdherentType($db);
  216. $adht->id = $rowid;
  217. $adht->fetch($rowid);
  218. $h=0;
  219. $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
  220. $head[$h][1] = $langs->trans("Card");
  221. $head[$h][2] = 'card';
  222. $h++;
  223. dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
  224. print '<table class="border" width="100%">';
  225. // Ref
  226. print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
  227. print '<td>';
  228. print $form->showrefnav($adht,'rowid');
  229. print '</td></tr>';
  230. // Label
  231. print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
  232. print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
  233. print yn($adht->cotisation);
  234. print '</tr>';
  235. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  236. print yn($adht->vote);
  237. print '</tr>';
  238. print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
  239. print nl2br($adht->note)."</td></tr>";
  240. print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
  241. print nl2br($adht->mail_valid)."</td></tr>";
  242. print '</table>';
  243. print '</div>';
  244. /*
  245. * Barre d'actions
  246. *
  247. */
  248. print '<div class="tabsAction">';
  249. // Edit
  250. if ($user->rights->adherent->configurer)
  251. {
  252. print "<a class=\"butAction\" href=\"type.php?action=edit&amp;rowid=".$adht->id."\">".$langs->trans("Modify")."</a>";
  253. }
  254. // Add
  255. print "<a class=\"butAction\" href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>";
  256. // Delete
  257. if ($user->rights->adherent->configurer)
  258. {
  259. print "<a class=\"butActionDelete\" href=\"type.php?action=delete&rowid=".$adht->id."\">".$langs->trans("DeleteType")."</a>";
  260. }
  261. print "</div>";
  262. // Show list of members (nearly same code than in page liste.php)
  263. $membertypestatic=new AdherentType($db);
  264. $sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe, ";
  265. $sql.= " d.datefin,";
  266. $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
  267. $sql.= " t.libelle as type, t.cotisation";
  268. $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
  269. $sql.= " WHERE d.fk_adherent_type = t.rowid ";
  270. $sql.= " AND d.entity = ".$conf->entity;
  271. if ($sall)
  272. {
  273. $sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR d.societe like '%".$sall."%'";
  274. $sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'";
  275. $sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')";
  276. }
  277. //if ($_REQUEST["type"] > 0)
  278. //{
  279. //$sql.=" AND t.rowid=".$_REQUEST["type"];
  280. $sql.=" AND t.rowid=".$adht->id;
  281. //}
  282. if (isset($_GET["statut"]))
  283. {
  284. $sql.=" AND d.statut in ($statut)"; // Peut valoir un nombre ou liste de nombre separes par virgules
  285. }
  286. if ( $_POST["action"] == 'search')
  287. {
  288. if (isset($_POST['search']) && $_POST['search'] != ''){
  289. $sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
  290. }
  291. }
  292. if ($_GET["search_nom"])
  293. {
  294. $sql.= " AND (d.prenom LIKE '%".$_GET["search_nom"]."%' OR d.nom LIKE '%".$_GET["search_nom"]."%')";
  295. }
  296. if ($_GET["search_login"])
  297. {
  298. $sql.= " AND d.login LIKE '%".$_GET["search_login"]."%'";
  299. }
  300. if ($_GET["search_email"])
  301. {
  302. $sql.= " AND (d.email LIKE '%".$_GET["search_email"]."%')";
  303. }
  304. if ($filter == 'uptodate')
  305. {
  306. $sql.=" AND datefin >= ".$db->idate(mktime());
  307. }
  308. if ($filter == 'outofdate')
  309. {
  310. $sql.=" AND datefin < ".$db->idate(mktime());
  311. }
  312. // Count total nb of records
  313. $nbtotalofrecords = 0;
  314. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
  315. {
  316. $resql = $db->query($sql);
  317. if ($resql) $nbtotalofrecords = $db->num_rows($result);
  318. else dol_print_error($db);
  319. }
  320. // Add order and limit
  321. $sql.= " ".$db->order($sortfield,$sortorder);
  322. $sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
  323. $resql = $db->query($sql);
  324. if ($resql)
  325. {
  326. $num = $db->num_rows($resql);
  327. $i = 0;
  328. $titre=$langs->trans("MembersList");
  329. if (isset($_GET["statut"]))
  330. {
  331. if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
  332. if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
  333. if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
  334. if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
  335. if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
  336. if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
  337. }
  338. elseif ($_POST["action"] == 'search') {
  339. $titre=$langs->trans("MembersListQualified");
  340. }
  341. if ($_REQUEST["type"] > 0)
  342. {
  343. $membertype=new AdherentType($db);
  344. $result=$membertype->fetch($_REQUEST["type"]);
  345. $titre.=" (".$membertype->libelle.")";
  346. }
  347. $param="&rowid=".$rowid;
  348. if (isset($_GET["statut"])) $param.="&statut=".$_GET["statut"];
  349. if (isset($_GET["search_nom"])) $param.="&search_nom=".$_GET["search_nom"];
  350. if (isset($_GET["search_login"])) $param.="&search_login=".$_GET["search_login"];
  351. if (isset($_GET["search_email"])) $param.="&search_email=".$_GET["search_email"];
  352. if (isset($_GET["filter"])) $param.="&filter=".$_GET["filter"];
  353. if ($sall)
  354. {
  355. print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
  356. }
  357. print '<br>';
  358. print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
  359. print "<table class=\"noborder\" width=\"100%\">";
  360. print '<tr class="liste_titre">';
  361. print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.nom",$param,"","",$sortfield,$sortorder);
  362. print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
  363. print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
  364. print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
  365. print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
  366. print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
  367. print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
  368. print "</tr>\n";
  369. // Lignes des champs de filtre
  370. print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
  371. print '<input class="flat" type="hidden" name="rowid" value="'.$rowid.'" size="12"></td>';
  372. print '<tr class="liste_titre">';
  373. print '<td class="liste_titre" align="left">';
  374. print '<input class="flat" type="text" name="search_nom" value="'.$_REQUEST["search_nom"].'" size="12"></td>';
  375. print '<td class="liste_titre" align="left">';
  376. print '<input class="flat" type="text" name="search_login" value="'.$_REQUEST["search_login"].'" size="7"></td>';
  377. print '<td class="liste_titre">&nbsp;</td>';
  378. print '<td class="liste_titre" align="left">';
  379. print '<input class="flat" type="text" name="search_email" value="'.$_REQUEST["search_email"].'" size="12"></td>';
  380. print '<td class="liste_titre">&nbsp;</td>';
  381. print '<td align="right" colspan="2" class="liste_titre">';
  382. 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")).'">';
  383. print '&nbsp; ';
  384. 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")).'">';
  385. print '</td>';
  386. print "</tr>\n";
  387. print '</form>';
  388. $var=True;
  389. while ($i < $num && $i < $conf->liste_limit)
  390. {
  391. $objp = $db->fetch_object($resql);
  392. $datefin=$db->jdate($objp->datefin);
  393. $adh=new Adherent($db);
  394. // Nom
  395. $var=!$var;
  396. print "<tr $bc[$var]>";
  397. if ($objp->societe != '')
  398. {
  399. print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom,12)." / ".dol_trunc($objp->societe,12)."</a></td>\n";
  400. }
  401. else
  402. {
  403. print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom)."</a></td>\n";
  404. }
  405. // Login
  406. print "<td>".$objp->login."</td>\n";
  407. // Type
  408. /*print '<td nowrap="nowrap">';
  409. $membertypestatic->id=$objp->type_id;
  410. $membertypestatic->libelle=$objp->type;
  411. print $membertypestatic->getNomUrl(1,12);
  412. print '</td>';
  413. */
  414. // Moral/Physique
  415. print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
  416. // EMail
  417. print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
  418. // Statut
  419. print '<td nowrap="nowrap">';
  420. print $adh->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
  421. print "</td>";
  422. // Date fin cotisation
  423. if ($datefin)
  424. {
  425. print '<td align="center" nowrap="nowrap">';
  426. if ($datefin < time() && $objp->statut > 0)
  427. {
  428. print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
  429. }
  430. else
  431. {
  432. print dol_print_date($datefin,'day');
  433. }
  434. print '</td>';
  435. }
  436. else
  437. {
  438. print '<td align="left" nowrap="nowrap">';
  439. if ($objp->cotisation == 'yes')
  440. {
  441. print $langs->trans("SubscriptionNotReceived");
  442. if ($objp->statut > 0) print " ".img_warning();
  443. }
  444. else
  445. {
  446. print '&nbsp;';
  447. }
  448. print '</td>';
  449. }
  450. // Actions
  451. print '<td align="center">';
  452. if ($user->rights->adherent->creer)
  453. {
  454. print "<a href=\"fiche.php?rowid=$objp->rowid&action=edit&return=liste.php\">".img_edit()."</a>";
  455. }
  456. print '&nbsp;';
  457. if ($user->rights->adherent->supprimer)
  458. {
  459. print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign&return=liste.php\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
  460. }
  461. print "</td>";
  462. print "</tr>\n";
  463. $i++;
  464. }
  465. print "</table>\n";
  466. if ($num > $conf->liste_limit)
  467. {
  468. print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
  469. }
  470. }
  471. else
  472. {
  473. dol_print_error($db);
  474. }
  475. }
  476. if ($_GET["action"] == 'edit')
  477. {
  478. $htmls = new Form($db);
  479. $adht = new AdherentType($db);
  480. $adht->id = $rowid;
  481. $adht->fetch($rowid);
  482. $h=0;
  483. $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
  484. $head[$h][1] = $langs->trans("Card");
  485. $head[$h][2] = 'card';
  486. $h++;
  487. dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
  488. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
  489. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  490. print '<input type="hidden" name="rowid" value="'.$rowid.'">';
  491. print '<input type="hidden" name="action" value="update">';
  492. print '<table class="border" width="100%">';
  493. print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
  494. print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
  495. print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
  496. print $htmls->selectyesno("cotisation",$adht->cotisation,1);
  497. print '</td></tr>';
  498. print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
  499. print $htmls->selectyesno("vote",$adht->vote,1);
  500. print '</td></tr>';
  501. print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
  502. print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->note."</textarea></td></tr>";
  503. print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
  504. require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
  505. $doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
  506. $doleditor->Create();
  507. print "</td></tr>";
  508. print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp;';
  509. print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>';
  510. print '</table>';
  511. print "</form>";
  512. }
  513. }
  514. $db->close();
  515. llxFooter();
  516. ?>