card_subscriptions.php 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103
  1. <?php
  2. /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
  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 3 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/card_subscriptions.php
  22. * \ingroup member
  23. * \brief Onglet d'ajout, edition, suppression des adhesions d'un adherent
  24. */
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
  31. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  33. $langs->load("companies");
  34. $langs->load("bills");
  35. $langs->load("members");
  36. $langs->load("users");
  37. $langs->load("mails");
  38. $action=GETPOST('action','alpha');
  39. $confirm=GETPOST('confirm','alpha');
  40. $rowid=GETPOST('rowid','int');
  41. $typeid=GETPOST('typeid','int');
  42. // Security check
  43. $result=restrictedArea($user,'adherent',$rowid,'','cotisation');
  44. $object = new Adherent($db);
  45. $extrafields = new ExtraFields($db);
  46. $adht = new AdherentType($db);
  47. $errmsg='';
  48. $errmsgs=array();
  49. $defaultdelay=1;
  50. $defaultdelayunit='y';
  51. if ($rowid)
  52. {
  53. // Load member
  54. $result = $object->fetch($rowid);
  55. // Define variables to know what current user can do on users
  56. $canadduser=($user->admin || $user->rights->user->user->creer);
  57. // Define variables to know what current user can do on properties of user linked to edited member
  58. if ($object->user_id)
  59. {
  60. // $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
  61. $caneditfielduser=( (($user->id == $object->user_id) && $user->rights->user->self->creer)
  62. || (($user->id != $object->user_id) && $user->rights->user->user->creer) );
  63. $caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password)
  64. || (($user->id != $object->user_id) && $user->rights->user->user->password) );
  65. }
  66. }
  67. // Define variables to know what current user can do on members
  68. $canaddmember=$user->rights->adherent->creer;
  69. // Define variables to know what current user can do on properties of a member
  70. if ($rowid)
  71. {
  72. $caneditfieldmember=$user->rights->adherent->creer;
  73. }
  74. // PDF
  75. $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
  76. $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
  77. $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
  78. /*
  79. * Actions
  80. */
  81. // Create third party from a member
  82. if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
  83. {
  84. if ($result > 0)
  85. {
  86. // Creation user
  87. $company = new Societe($db);
  88. $result=$company->create_from_member($object,$_POST["companyname"]);
  89. if ($result < 0)
  90. {
  91. $langs->load("errors");
  92. $errmsg=$langs->trans($company->error);
  93. $errmsgs=$company->errors;
  94. }
  95. else
  96. {
  97. $action='addsubscription';
  98. }
  99. }
  100. else
  101. {
  102. $errmsg=$object->error;
  103. }
  104. }
  105. if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
  106. {
  107. $error=0;
  108. if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
  109. {
  110. if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
  111. {
  112. $error++;
  113. $mesg='<div class="error">'.$langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly").'</div>';
  114. }
  115. }
  116. if (! $error)
  117. {
  118. if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
  119. {
  120. $result=$object->setUserId($_POST["userid"]);
  121. if ($result < 0) dol_print_error('',$object->error);
  122. $_POST['action']='';
  123. $action='';
  124. }
  125. }
  126. }
  127. if ($action == 'setsocid')
  128. {
  129. $error=0;
  130. if (! $error)
  131. {
  132. if (GETPOST('socid','int') != $object->fk_soc) // If link differs from currently in database
  133. {
  134. $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
  135. $sql.=" WHERE fk_soc = '".GETPOST('socid','int')."'";
  136. $resql = $db->query($sql);
  137. if ($resql)
  138. {
  139. $obj = $db->fetch_object($resql);
  140. if ($obj && $obj->rowid > 0)
  141. {
  142. $othermember=new Adherent($db);
  143. $othermember->fetch($obj->rowid);
  144. $thirdparty=new Societe($db);
  145. $thirdparty->fetch(GETPOST('socid','int'));
  146. $error++;
  147. $mesg='<div class="error">'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name).'</div>';
  148. }
  149. }
  150. if (! $error)
  151. {
  152. $result=$object->setThirdPartyId(GETPOST('socid','int'));
  153. if ($result < 0) dol_print_error('',$object->error);
  154. $_POST['action']='';
  155. $action='';
  156. }
  157. }
  158. }
  159. }
  160. if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $_POST["cancel"])
  161. {
  162. $error=0;
  163. $langs->load("banks");
  164. $result=$object->fetch($rowid);
  165. $result=$adht->fetch($object->typeid);
  166. // Subscription informations
  167. $datecotisation=0;
  168. $datesubend=0;
  169. $paymentdate=0;
  170. if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"])
  171. {
  172. $datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
  173. }
  174. if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"])
  175. {
  176. $datesubend=dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
  177. }
  178. if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"])
  179. {
  180. $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
  181. }
  182. $cotisation=$_POST["cotisation"]; // Amount of subscription
  183. $label=$_POST["label"];
  184. // Payment informations
  185. $accountid=$_POST["accountid"];
  186. $operation=$_POST["operation"]; // Payment mode
  187. $num_chq=$_POST["num_chq"];
  188. $emetteur_nom=$_POST["chqemetteur"];
  189. $emetteur_banque=$_POST["chqbank"];
  190. $option=$_POST["paymentsave"];
  191. if (empty($option)) $option='none';
  192. // Check parameters
  193. if (! $datecotisation)
  194. {
  195. $error++;
  196. $langs->load("errors");
  197. $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
  198. $action='addsubscription';
  199. }
  200. if (GETPOST('end') && ! $datesubend)
  201. {
  202. $error++;
  203. $langs->load("errors");
  204. $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
  205. $action='addsubscription';
  206. }
  207. if (! $datesubend)
  208. {
  209. $datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d');
  210. }
  211. if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate)
  212. {
  213. $error++;
  214. $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
  215. $action='addsubscription';
  216. }
  217. // Check if a payment is mandatory or not
  218. if (! $error && $adht->cotisation) // Type adherent soumis a cotisation
  219. {
  220. if (! is_numeric($_POST["cotisation"]))
  221. {
  222. // If field is '' or not a numeric value
  223. $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
  224. $error++;
  225. $action='addsubscription';
  226. }
  227. else
  228. {
  229. if (! empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none')
  230. {
  231. if ($_POST["cotisation"])
  232. {
  233. if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
  234. if ($_POST["paymentsave"] != 'invoiceonly' && ! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
  235. if ($_POST["paymentsave"] != 'invoiceonly' && ! $_POST["accountid"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("FinancialAccount"));
  236. }
  237. else
  238. {
  239. if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
  240. }
  241. if ($errmsg) $action='addsubscription';
  242. }
  243. }
  244. }
  245. if (! $error && $action=='cotisation')
  246. {
  247. $db->begin();
  248. // Create subscription
  249. $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $option);
  250. if ($crowid <= 0)
  251. {
  252. $error++;
  253. $errmsg=$object->error;
  254. $errmsgs=$object->errors;
  255. }
  256. if (! $error)
  257. {
  258. // Insert into bank account directlty (if option choosed for) + link to llx_cotisation if option is 'bankdirect'
  259. if ($option == 'bankdirect' && $accountid)
  260. {
  261. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  262. $acct=new Account($db);
  263. $result=$acct->fetch($accountid);
  264. $dateop=$paymentdate;
  265. $insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
  266. if ($insertid > 0)
  267. {
  268. $inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $object->getFullname($langs), 'member');
  269. if ($inserturlid > 0)
  270. {
  271. // Met a jour la table cotisation
  272. $sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid;
  273. $sql.=" WHERE rowid=".$crowid;
  274. dol_syslog("card_subscriptions::cotisation sql=".$sql);
  275. $resql = $db->query($sql);
  276. if (! $resql)
  277. {
  278. $error++;
  279. $errmsg=$db->lasterror();
  280. }
  281. }
  282. else
  283. {
  284. $error++;
  285. $errmsg=$acct->error;
  286. }
  287. }
  288. else
  289. {
  290. $error++;
  291. $errmsg=$acct->error;
  292. }
  293. }
  294. // If option choosed, we create invoice
  295. if (($option == 'bankviainvoice' && $accountid) || $option == 'invoiceonly')
  296. {
  297. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  298. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
  299. $invoice=new Facture($db);
  300. $customer=new Societe($db);
  301. if (! $error)
  302. {
  303. if (! ($object->fk_soc > 0))
  304. {
  305. $langs->load("errors");
  306. $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
  307. $error++;
  308. }
  309. }
  310. if (! $error)
  311. {
  312. $result=$customer->fetch($object->fk_soc);
  313. if ($result <= 0)
  314. {
  315. $errmsg=$customer->error;
  316. $error++;
  317. }
  318. }
  319. if (! $error)
  320. {
  321. // Create draft invoice
  322. $invoice->type= Facture::TYPE_STANDARD;
  323. $invoice->cond_reglement_id=$customer->cond_reglement_id;
  324. if (empty($invoice->cond_reglement_id))
  325. {
  326. $paymenttermstatic=new PaymentTerm($db);
  327. $invoice->cond_reglement_id=$paymenttermstatic->getDefaultId();
  328. if (empty($invoice->cond_reglement_id))
  329. {
  330. $error++;
  331. $errmsg='ErrorNoPaymentTermRECEPFound';
  332. }
  333. }
  334. $invoice->socid=$object->fk_soc;
  335. $invoice->date=$datecotisation;
  336. $result=$invoice->create($user);
  337. if ($result <= 0)
  338. {
  339. $errmsg=$invoice->error;
  340. $error++;
  341. }
  342. }
  343. if (! $error)
  344. {
  345. // Add line to draft invoice
  346. $idprodsubscription=0;
  347. $vattouse=0;
  348. if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry')
  349. {
  350. $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
  351. }
  352. //print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
  353. $result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
  354. if ($result <= 0)
  355. {
  356. $errmsg=$invoice->error;
  357. $error++;
  358. }
  359. }
  360. if (! $error)
  361. {
  362. // Validate invoice
  363. $result=$invoice->validate($user);
  364. if ($result <= 0)
  365. {
  366. $errmsg=$invoice->error;
  367. $error++;
  368. }
  369. }
  370. // Add payment onto invoice
  371. if ($option == 'bankviainvoice' && $accountid)
  372. {
  373. require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
  374. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  375. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
  376. $amounts[$invoice->id] = price2num($cotisation);
  377. $paiement = new Paiement($db);
  378. $paiement->datepaye = $paymentdate;
  379. $paiement->amounts = $amounts;
  380. $paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement');
  381. $paiement->num_paiement = $num_chq;
  382. $paiement->note = $label;
  383. if (! $error)
  384. {
  385. // Create payment line for invoice
  386. $paiement_id = $paiement->create($user);
  387. if (! $paiement_id > 0)
  388. {
  389. $errmsg=$paiement->error;
  390. $error++;
  391. }
  392. }
  393. if (! $error)
  394. {
  395. // Add transaction into bank account
  396. $bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque);
  397. if (! ($bank_line_id > 0))
  398. {
  399. $errmsg=$paiement->error;
  400. $errmsgs=$paiement->errors;
  401. $error++;
  402. }
  403. }
  404. if (! $error)
  405. {
  406. // Update fk_bank into subscription table
  407. $sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id;
  408. $sql.= ' WHERE rowid='.$crowid;
  409. dol_syslog('sql='.$sql);
  410. $result = $db->query($sql);
  411. if (! $result)
  412. {
  413. $error++;
  414. }
  415. }
  416. if (! $error)
  417. {
  418. // Set invoice as paid
  419. $invoice->set_paid($user);
  420. }
  421. if (! $error)
  422. {
  423. // Define output language
  424. $outputlangs = $langs;
  425. $newlang = '';
  426. if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
  427. $newlang = $_REQUEST['lang_id'];
  428. if ($conf->global->MAIN_MULTILANGS && empty($newlang))
  429. $newlang = $customer->default_lang;
  430. if (! empty($newlang)) {
  431. $outputlangs = new Translate("", $conf);
  432. $outputlangs->setDefaultLang($newlang);
  433. }
  434. // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
  435. //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
  436. facture_pdf_create($db, $invoice, $invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
  437. }
  438. }
  439. }
  440. }
  441. if (! $error)
  442. {
  443. $db->commit();
  444. }
  445. else
  446. {
  447. $db->rollback();
  448. $action = 'addsubscription';
  449. }
  450. // Send email
  451. if (! $error)
  452. {
  453. // Send confirmation Email
  454. if ($object->email && $_POST["sendmail"])
  455. {
  456. $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
  457. $texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
  458. $result=$object->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1);
  459. if ($result < 0) $errmsg=$object->error;
  460. }
  461. $_POST["cotisation"]='';
  462. $_POST["accountid"]='';
  463. $_POST["operation"]='';
  464. $_POST["label"]='';
  465. $_POST["num_chq"]='';
  466. }
  467. }
  468. }
  469. /*
  470. * View
  471. */
  472. $form = new Form($db);
  473. $now=dol_now();
  474. llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
  475. if ($rowid)
  476. {
  477. $res=$object->fetch($rowid);
  478. if ($res < 0) { dol_print_error($db,$object->error); exit; }
  479. $adht->fetch($object->typeid);
  480. $head = member_prepare_head($object);
  481. dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
  482. $rowspan=10;
  483. if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
  484. if (! empty($conf->societe->enabled)) $rowspan++;
  485. print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  486. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  487. print '<input type="hidden" name="rowid" value="'.$object->id.'">';
  488. print '<table class="border" width="100%">';
  489. $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/liste.php">'.$langs->trans("BackToList").'</a>';
  490. // Ref
  491. print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
  492. print '<td class="valeur" colspan="2">';
  493. print $form->showrefnav($object, 'rowid', $linkback);
  494. print '</td></tr>';
  495. $showphoto='<td rowspan="'.$rowspan.'" class="hideonsmartphone" align="center" valign="middle" width="25%">'.$form->showphoto('memberphoto',$object).'</td>';
  496. // Login
  497. if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
  498. {
  499. print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td>';
  500. print $showphoto; $showphoto='';
  501. print '</tr>';
  502. }
  503. // Morphy
  504. print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
  505. print $showphoto; $showphoto='';
  506. print '</tr>';
  507. // Type
  508. print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
  509. // Company
  510. print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
  511. // Civility
  512. print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
  513. print '</tr>';
  514. // Lastname
  515. print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td>';
  516. print '</tr>';
  517. // Firstname
  518. print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$object->firstname.'&nbsp;</td>';
  519. print '</tr>';
  520. // EMail
  521. print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
  522. // Status
  523. print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
  524. // Date end subscription
  525. print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
  526. if ($object->datefin)
  527. {
  528. print dol_print_date($object->datefin,'day');
  529. if ($object->datefin < ($now - $conf->adherent->cotisation->warning_delay) && $object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
  530. }
  531. else
  532. {
  533. print $langs->trans("SubscriptionNotReceived");
  534. if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
  535. }
  536. print '</td></tr>';
  537. // Third party Dolibarr
  538. if (! empty($conf->societe->enabled))
  539. {
  540. print '<tr><td>';
  541. print '<table class="nobordernopadding" width="100%"><tr><td>';
  542. print $langs->trans("LinkedToDolibarrThirdParty");
  543. print '</td>';
  544. if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
  545. print '</tr></table>';
  546. print '</td><td class="valeur">';
  547. if ($action == 'editthirdparty')
  548. {
  549. $htmlname='socid';
  550. print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
  551. print '<input type="hidden" name="rowid" value="'.$object->id.'">';
  552. print '<input type="hidden" name="action" value="set'.$htmlname.'">';
  553. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  554. print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
  555. print '<tr><td>';
  556. print $form->select_company($object->fk_soc,'socid','',1);
  557. print '</td>';
  558. print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
  559. print '</tr></table></form>';
  560. }
  561. else
  562. {
  563. if ($object->fk_soc)
  564. {
  565. $company=new Societe($db);
  566. $result=$company->fetch($object->fk_soc);
  567. print $company->getNomUrl(1);
  568. }
  569. else
  570. {
  571. print $langs->trans("NoThirdPartyAssociatedToMember");
  572. }
  573. }
  574. print '</td></tr>';
  575. }
  576. // Login Dolibarr
  577. print '<tr><td>';
  578. print '<table class="nobordernopadding" width="100%"><tr><td>';
  579. print $langs->trans("LinkedToDolibarrUser");
  580. print '</td>';
  581. if ($action != 'editlogin' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a></td>';
  582. print '</tr></table>';
  583. print '</td><td class="valeur">';
  584. if ($action == 'editlogin')
  585. {
  586. /*$include=array();
  587. if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
  588. {
  589. $include=array($object->user_id,$user->id);
  590. }*/
  591. print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
  592. }
  593. else
  594. {
  595. if ($object->user_id)
  596. {
  597. print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
  598. }
  599. else print $langs->trans("NoDolibarrAccess");
  600. }
  601. print '</td></tr>';
  602. print "</table>\n";
  603. print '</form>';
  604. dol_fiche_end();
  605. dol_htmloutput_errors($errmsg,$errmsgs);
  606. /*
  607. * Barre d'actions
  608. */
  609. // Lien nouvelle cotisation si non brouillon et non resilie
  610. if ($user->rights->adherent->cotisation->creer)
  611. {
  612. if ($action != 'addsubscription' && $action != 'create_thirdparty')
  613. {
  614. print '<div class="tabsAction">';
  615. if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
  616. else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
  617. print "<br>\n";
  618. print '</div>';
  619. print '<br>';
  620. }
  621. }
  622. /*
  623. * List of subscriptions
  624. */
  625. if ($action != 'addsubscription' && $action != 'create_thirdparty')
  626. {
  627. $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
  628. $sql.= " c.rowid as crowid, c.cotisation,";
  629. $sql.= " c.datec,";
  630. $sql.= " c.dateadh as dateh,";
  631. $sql.= " c.datef,";
  632. $sql.= " c.fk_bank,";
  633. $sql.= " b.rowid as bid,";
  634. $sql.= " ba.rowid as baid, ba.label, ba.bank";
  635. $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
  636. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
  637. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
  638. $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
  639. $result = $db->query($sql);
  640. if ($result)
  641. {
  642. $cotisationstatic=new Cotisation($db);
  643. $accountstatic=new Account($db);
  644. $num = $db->num_rows($result);
  645. $i = 0;
  646. print "<table class=\"noborder\" width=\"100%\">\n";
  647. print '<tr class="liste_titre">';
  648. print '<td>'.$langs->trans("Ref").'</td>';
  649. print '<td align="center">'.$langs->trans("DateCreation").'</td>';
  650. print '<td align="center">'.$langs->trans("DateStart").'</td>';
  651. print '<td align="center">'.$langs->trans("DateEnd").'</td>';
  652. print '<td align="right">'.$langs->trans("Amount").'</td>';
  653. if (! empty($conf->banque->enabled))
  654. {
  655. print '<td align="right">'.$langs->trans("Account").'</td>';
  656. }
  657. print "</tr>\n";
  658. $var=True;
  659. while ($i < $num)
  660. {
  661. $objp = $db->fetch_object($result);
  662. $var=!$var;
  663. print "<tr ".$bc[$var].">";
  664. $cotisationstatic->ref=$objp->crowid;
  665. $cotisationstatic->id=$objp->crowid;
  666. print '<td>'.$cotisationstatic->getNomUrl(1).'</td>';
  667. print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
  668. print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
  669. print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
  670. print '<td align="right">'.price($objp->cotisation).'</td>';
  671. if (! empty($conf->banque->enabled))
  672. {
  673. print '<td align="right">';
  674. if ($objp->bid)
  675. {
  676. $accountstatic->label=$objp->label;
  677. $accountstatic->id=$objp->baid;
  678. print $accountstatic->getNomUrl(1);
  679. }
  680. else
  681. {
  682. print '&nbsp;';
  683. }
  684. print '</td>';
  685. }
  686. print "</tr>";
  687. $i++;
  688. }
  689. print "</table>";
  690. }
  691. else
  692. {
  693. dol_print_error($db);
  694. }
  695. // Link for paypal payment
  696. if (! empty($conf->paypal->enabled))
  697. {
  698. include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
  699. print showPaypalPaymentUrl('membersubscription',$object->ref);
  700. }
  701. }
  702. /*
  703. * Add new subscription form
  704. */
  705. if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer)
  706. {
  707. print '<br>';
  708. print_fiche_titre($langs->trans("NewCotisation"));
  709. // Define default choice to select
  710. $bankdirect=0; // 1 means option by default is write to bank direct with no invoice
  711. $invoiceonly=0; // 1 means option by default is invoice only
  712. $bankviainvoice=0; // 1 means option by default is write to bank via invoice
  713. if (GETPOST('paymentsave'))
  714. {
  715. if (GETPOST('paymentsave') == 'bankdirect') $bankdirect=1;
  716. if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly=1;
  717. if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice=1;
  718. }
  719. else
  720. {
  721. if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $bankviainvoice=1;
  722. else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1;
  723. else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1;
  724. }
  725. print "\n\n<!-- Form add subscription -->\n";
  726. if ($conf->use_javascript_ajax)
  727. {
  728. //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
  729. print "\n".'<script type="text/javascript" language="javascript">';
  730. print '$(document).ready(function () {
  731. $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect||$bankviainvoice)?'show()':'hide()').';
  732. $("#none, #invoiceonly").click(function() {
  733. $(".bankswitchclass").hide();
  734. $(".bankswitchclass2").hide();
  735. });
  736. $("#bankdirect, #bankviainvoice").click(function() {
  737. $(".bankswitchclass").show();
  738. $(".bankswitchclass2").show();
  739. });
  740. $("#selectoperation").change(function() {
  741. var code = $(this).val();
  742. if (code == "CHQ")
  743. {
  744. $(".fieldrequireddyn").addClass("fieldrequired");
  745. if ($("#fieldchqemetteur").val() == "")
  746. {
  747. $("#fieldchqemetteur").val($("#memberlabel").val());
  748. }
  749. }
  750. else
  751. {
  752. $(".fieldrequireddyn").removeClass("fieldrequired");
  753. }
  754. });
  755. ';
  756. if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").attr("checked",true);';
  757. print '});';
  758. print '</script>'."\n";
  759. }
  760. // Confirm create third party
  761. if ($action == 'create_thirdparty')
  762. {
  763. $name = $object->getFullName($langs);
  764. if (! empty($name))
  765. {
  766. if ($object->societe) $name.=' ('.$object->societe.')';
  767. }
  768. else
  769. {
  770. $name=$object->societe;
  771. }
  772. // Create a form array
  773. $formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
  774. print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
  775. }
  776. print '<form name="cotisation" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  777. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  778. print '<input type="hidden" name="action" value="cotisation">';
  779. print '<input type="hidden" name="rowid" value="'.$rowid.'">';
  780. print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
  781. print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
  782. print "<table class=\"border\" width=\"100%\">\n";
  783. $today=dol_now();
  784. $datefrom=0;
  785. $dateto=0;
  786. $paymentdate=-1;
  787. // Date payment
  788. if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday'))
  789. {
  790. $paymentdate=dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
  791. }
  792. // Date start subscription
  793. print '<tr><td width="30%" class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
  794. if (GETPOST('reday'))
  795. {
  796. $datefrom=dol_mktime(0,0,0,GETPOST('remonth'),GETPOST('reday'),GETPOST('reyear'));
  797. }
  798. if (! $datefrom)
  799. {
  800. if ($object->datefin > 0)
  801. {
  802. $datefrom=dol_time_plus_duree($object->datefin,1,'d');
  803. }
  804. else
  805. {
  806. //$datefrom=dol_now();
  807. $datefrom=$object->datevalid;
  808. }
  809. }
  810. $form->select_date($datefrom,'','','','',"cotisation",1,1);
  811. print "</td></tr>";
  812. // Date end subscription
  813. if (GETPOST('endday'))
  814. {
  815. $dateto=dol_mktime(0,0,0,GETPOST('endmonth'),GETPOST('endday'),GETPOST('endyear'));
  816. }
  817. if (! $dateto)
  818. {
  819. $dateto=-1; // By default, no date is suggested
  820. }
  821. print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
  822. $form->select_date($dateto,'end','','','',"cotisation");
  823. print "</td></tr>";
  824. if ($adht->cotisation)
  825. {
  826. // Amount
  827. print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="cotisation" size="6" value="'.GETPOST('cotisation').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
  828. // Label
  829. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
  830. print '<td><input name="label" type="text" size="32" value="'.$langs->trans("Subscription").' ';
  831. print dol_print_date(($datefrom?$datefrom:time()),"%Y").'" ></td></tr>';
  832. // Complementary action
  833. if (! empty($conf->banque->enabled) || ! empty($conf->facture->enabled))
  834. {
  835. $company=new Societe($db);
  836. if ($object->fk_soc)
  837. {
  838. $result=$company->fetch($object->fk_soc);
  839. }
  840. // Title payments
  841. //print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
  842. // No more action
  843. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('MoreActions');
  844. print '</td>';
  845. print '<td>';
  846. print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice)?' checked="checked"':'').'> '.$langs->trans("None").'<br>';
  847. // Add entry into bank accoun
  848. if (! empty($conf->banque->enabled))
  849. {
  850. print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(! empty($bankdirect)?' checked="checked"':'');
  851. print '> '.$langs->trans("MoreActionBankDirect").'<br>';
  852. }
  853. // Add invoice with no payments
  854. if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
  855. {
  856. print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(! empty($invoiceonly)?' checked="checked"':'');
  857. //if (empty($object->fk_soc)) print ' disabled="disabled"';
  858. print '> '.$langs->trans("MoreActionInvoiceOnly");
  859. if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
  860. else
  861. {
  862. print ' (';
  863. if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
  864. print $langs->trans("NoThirdPartyAssociatedToMember");
  865. print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
  866. print $langs->trans("CreateDolibarrThirdParty");
  867. print '</a>)';
  868. }
  869. if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
  870. print '<br>';
  871. }
  872. // Add invoice with payments
  873. if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
  874. {
  875. print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(! empty($bankviainvoice)?' checked="checked"':'');
  876. //if (empty($object->fk_soc)) print ' disabled="disabled"';
  877. print '> '.$langs->trans("MoreActionBankViaInvoice");
  878. if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
  879. else
  880. {
  881. print ' (';
  882. if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
  883. print $langs->trans("NoThirdPartyAssociatedToMember");
  884. print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
  885. print $langs->trans("CreateDolibarrThirdParty");
  886. print '</a>)';
  887. }
  888. if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
  889. print '<br>';
  890. }
  891. print '</td></tr>';
  892. // Bank account
  893. print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
  894. $form->select_comptes(GETPOST('accountid'),'accountid',0,'',1);
  895. print "</td></tr>\n";
  896. // Payment mode
  897. print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
  898. $form->select_types_paiements(GETPOST('operation'),'operation','',2);
  899. print "</td></tr>\n";
  900. // Date of payment
  901. print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
  902. $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1);
  903. print "</td></tr>\n";
  904. print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
  905. print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
  906. print '</td>';
  907. print '<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(! GETPOST('num_chq')?'':GETPOST('num_chq')).'"></td></tr>';
  908. print '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter');
  909. print ' <em>('.$langs->trans("ChequeMaker").')</em>';
  910. print '</td>';
  911. print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(! GETPOST('chqemetteur')?'':GETPOST('chqemetteur')).'"></td></tr>';
  912. print '<tr class="bankswitchclass2"><td>'.$langs->trans('Bank');
  913. print ' <em>('.$langs->trans("ChequeBank").')</em>';
  914. print '</td>';
  915. print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(! GETPOST('chqbank')?'':GETPOST('chqbank')).'"></td></tr>';
  916. }
  917. }
  918. print '<tr><td colspan="2">&nbsp;</td>';
  919. print '<tr><td width="30%">'.$langs->trans("SendAcknowledgementByMail").'</td>';
  920. print '<td>';
  921. if (! $object->email)
  922. {
  923. print $langs->trans("NoEMail");
  924. }
  925. else
  926. {
  927. $adht = new AdherentType($db);
  928. $adht->fetch($object->typeid);
  929. $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
  930. $texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
  931. $tmp='<input name="sendmail" type="checkbox"'.(GETPOST('sendmail')?GETPOST('sendmail'):(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked="checked"':'')).'>';
  932. $helpcontent='';
  933. $helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
  934. $helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
  935. $helpcontent.='<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
  936. $helpcontent.=$subjecttosend."\n";
  937. $helpcontent.="<br>";
  938. $helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
  939. $helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
  940. print $form->textwithpicto($tmp,$helpcontent,1,'help');
  941. }
  942. print '</td></tr>';
  943. print '</table>';
  944. print '<br>';
  945. print '<center>';
  946. print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
  947. print ' &nbsp; &nbsp; ';
  948. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  949. print '</center>';
  950. print '</form>';
  951. print "\n<!-- End form subscription -->\n\n";
  952. }
  953. //print '</td></tr>';
  954. //print '</table>';
  955. }
  956. else
  957. {
  958. $langs->load("errors");
  959. print $langs->trans("ErrorRecordNotFound");
  960. }
  961. llxFooter();
  962. $db->close();