card.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  6. * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
  7. * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/compta/paiement/card.php
  24. * \ingroup facture
  25. * \brief Page of a customer payment
  26. * \remarks Nearly same file than fournisseur/paiement/card.php
  27. */
  28. require '../../main.inc.php';
  29. require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
  33. if (isModEnabled('banque')) {
  34. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  35. }
  36. // Load translation files required by the page
  37. $langs->loadLangs(array('bills', 'banks', 'companies'));
  38. $id = GETPOST('id', 'int');
  39. $ref = GETPOST('ref', 'alpha');
  40. $action = GETPOST('action', 'aZ09');
  41. $confirm = GETPOST('confirm', 'alpha');
  42. $backtopage = GETPOST('backtopage', 'alpha');
  43. $object = new Paiement($db);
  44. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  45. $hookmanager->initHooks(array('paymentcard', 'globalcard'));
  46. // Load object
  47. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
  48. $result = restrictedArea($user, $object->element, $object->id, 'paiement');
  49. // Security check
  50. if ($user->socid) {
  51. $socid = $user->socid;
  52. }
  53. // Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
  54. // It should be enough because all payments are done on invoices of the same thirdparty.
  55. if ($socid && $socid != $object->thirdparty->id) {
  56. accessforbidden();
  57. }
  58. $error = 0;
  59. /*
  60. * Actions
  61. */
  62. if ($action == 'setnote' && $user->rights->facture->paiement) {
  63. $db->begin();
  64. $result = $object->update_note(GETPOST('note', 'restricthtml'));
  65. if ($result > 0) {
  66. $db->commit();
  67. $action = '';
  68. } else {
  69. setEventMessages($object->error, $object->errors, 'errors');
  70. $db->rollback();
  71. }
  72. }
  73. if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->paiement) {
  74. $db->begin();
  75. $result = $object->delete();
  76. if ($result > 0) {
  77. $db->commit();
  78. if ($backtopage) {
  79. header("Location: ".$backtopage);
  80. exit;
  81. } else {
  82. header("Location: list.php");
  83. exit;
  84. }
  85. } else {
  86. $langs->load("errors");
  87. setEventMessages($object->error, $object->errors, 'errors');
  88. $db->rollback();
  89. }
  90. }
  91. if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture->paiement) {
  92. $db->begin();
  93. if ($object->validate($user) > 0) {
  94. $db->commit();
  95. // Loop on each invoice linked to this payment to rebuild PDF
  96. if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
  97. $outputlangs = $langs;
  98. if (GETPOST('lang_id', 'aZ09')) {
  99. $outputlangs = new Translate("", $conf);
  100. $outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
  101. }
  102. $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
  103. $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
  104. $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
  105. $sql = 'SELECT f.rowid as facid';
  106. $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
  107. $sql .= ' WHERE pf.fk_facture = f.rowid';
  108. $sql .= ' AND f.fk_soc = s.rowid';
  109. $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
  110. $sql .= ' AND pf.fk_paiement = '.((int) $object->id);
  111. $resql = $db->query($sql);
  112. if ($resql) {
  113. $i = 0;
  114. $num = $db->num_rows($resql);
  115. if ($num > 0) {
  116. while ($i < $num) {
  117. $objp = $db->fetch_object($resql);
  118. $invoice = new Facture($db);
  119. if ($invoice->fetch($objp->facid) <= 0) {
  120. $errors++;
  121. setEventMessages($invoice->error, $invoice->errors, 'errors');
  122. break;
  123. }
  124. if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
  125. $errors++;
  126. setEventMessages($invoice->error, $invoice->errors, 'errors');
  127. break;
  128. }
  129. $i++;
  130. }
  131. }
  132. $db->free($resql);
  133. } else {
  134. $errors++;
  135. setEventMessages($db->error, $db->errors, 'errors');
  136. }
  137. }
  138. if (! $errors) {
  139. header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
  140. exit;
  141. }
  142. } else {
  143. $db->rollback();
  144. $langs->load("errors");
  145. setEventMessages($object->error, $object->errors, 'errors');
  146. }
  147. }
  148. if ($action == 'setnum_paiement' && GETPOST('num_paiement')) {
  149. $res = $object->update_num(GETPOST('num_paiement'));
  150. if ($res === 0) {
  151. setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');
  152. } else {
  153. setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors');
  154. }
  155. }
  156. if ($action == 'setdatep' && GETPOST('datepday')) {
  157. $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'));
  158. $res = $object->update_date($datepaye);
  159. if ($res === 0) {
  160. setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs');
  161. } else {
  162. setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors');
  163. }
  164. }
  165. if ($action == 'createbankpayment' && !empty($user->rights->facture->paiement)) {
  166. $db->begin();
  167. // Create the record into bank for the amount of payment $object
  168. if (!$error) {
  169. $label = '(CustomerInvoicePayment)';
  170. if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
  171. $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
  172. }
  173. $bankaccountid = GETPOST('accountid', 'int');
  174. if ($bankaccountid > 0) {
  175. $object->paiementcode = $object->type_code;
  176. $object->amounts = $object->getAmountsArray();
  177. $result = $object->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
  178. if ($result < 0) {
  179. setEventMessages($object->error, $object->errors, 'errors');
  180. $error++;
  181. }
  182. } else {
  183. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
  184. $error++;
  185. }
  186. }
  187. if (!$error) {
  188. $db->commit();
  189. } else {
  190. $db->rollback();
  191. }
  192. }
  193. /*
  194. * View
  195. */
  196. llxHeader('', $langs->trans("Payment"));
  197. $thirdpartystatic = new Societe($db);
  198. $result = $object->fetch($id, $ref);
  199. if ($result <= 0) {
  200. dol_print_error($db, 'Payement '.$id.' not found in database');
  201. exit;
  202. }
  203. $form = new Form($db);
  204. $head = payment_prepare_head($object);
  205. print dol_get_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment');
  206. // Confirmation of payment delete
  207. if ($action == 'delete') {
  208. print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
  209. }
  210. // Confirmation of payment validation
  211. if ($action == 'valide') {
  212. $facid = $_GET['facid'];
  213. print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_validate', '', 0, 2);
  214. }
  215. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  216. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '');
  217. print '<div class="fichecenter">';
  218. print '<div class="underbanner clearboth"></div>';
  219. print '<table class="border centpercent">'."\n";
  220. // Date payment
  221. print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $user->rights->facture->paiement).'</td><td>';
  222. print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights->facture->paiement, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'), '', 0, '', 'id', 'tzuser');
  223. print '</td></tr>';
  224. // Payment type (VIR, LIQ, ...)
  225. $labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
  226. print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype;
  227. print $object->num_payment ? ' - '.$object->num_payment : '';
  228. print '</td></tr>';
  229. // Amount
  230. print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount, '', $langs, 0, -1, -1, $conf->currency).'</td></tr>';
  231. $disable_delete = 0;
  232. // Bank account
  233. if (isModEnabled('banque')) {
  234. $bankline = new AccountLine($db);
  235. if ($object->fk_account > 0) {
  236. $bankline->fetch($object->bank_line);
  237. if ($bankline->rappro) {
  238. $disable_delete = 1;
  239. $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
  240. }
  241. print '<tr>';
  242. print '<td>'.$langs->trans('BankAccount').'</td>';
  243. print '<td>';
  244. $accountstatic = new Account($db);
  245. $accountstatic->fetch($bankline->fk_account);
  246. print $accountstatic->getNomUrl(1);
  247. print '</td>';
  248. print '</tr>';
  249. }
  250. }
  251. // Payment numero
  252. /*
  253. $titlefield=$langs->trans('Numero').' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
  254. print '<tr><td>'.$form->editfieldkey($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
  255. print $form->editfieldval($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
  256. print '</td></tr>';
  257. // Check transmitter
  258. $titlefield=$langs->trans('CheckTransmitter').' <em>('.$langs->trans("ChequeMaker").')</em>';
  259. print '<tr><td>'.$form->editfieldkey($titlefield,'chqemetteur',$object->,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
  260. print $form->editfieldval($titlefield,'chqemetteur',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeMakeUpdateSucceeded'));
  261. print '</td></tr>';
  262. // Bank name
  263. $titlefield=$langs->trans('Bank').' <em>('.$langs->trans("ChequeBank").')</em>';
  264. print '<tr><td>'.$form->editfieldkey($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
  265. print $form->editfieldval($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeBankUpdateSucceeded'));
  266. print '</td></tr>';
  267. */
  268. // Bank account
  269. if (isModEnabled('banque')) {
  270. if ($object->fk_account > 0) {
  271. if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) {
  272. include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
  273. $bordereau = new RemiseCheque($db);
  274. $bordereau->fetch($bankline->fk_bordereau);
  275. print '<tr>';
  276. print '<td>'.$langs->trans('CheckReceipt').'</td>';
  277. print '<td>';
  278. print $bordereau->getNomUrl(1);
  279. print '</td>';
  280. print '</tr>';
  281. }
  282. }
  283. print '<tr>';
  284. print '<td>'.$langs->trans('BankTransactionLine').'</td>';
  285. print '<td>';
  286. if ($object->fk_account > 0) {
  287. print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
  288. } else {
  289. $langs->load("admin");
  290. print '<span class="opacitymedium">';
  291. print $langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name"));
  292. print '</span>';
  293. if (!empty($user->rights->facture->paiement)) {
  294. // Try to guess $bankaccountidofinvoices that is ID of bank account defined on invoice.
  295. // Return null if not found, return 0 if it has different value for at least 2 invoices, return the value if same on all invoices where a bank is defined.
  296. $amountofpayments = $object->getAmountsArray();
  297. $bankaccountidofinvoices = null;
  298. foreach ($amountofpayments as $idinvoice => $amountofpayment) {
  299. $tmpinvoice = new Facture($db);
  300. $tmpinvoice->fetch($idinvoice);
  301. if ($tmpinvoice->fk_account > 0 && $bankaccountidofinvoices !== 0) {
  302. if (is_null($bankaccountidofinvoices)) {
  303. $bankaccountidofinvoices = $tmpinvoice->fk_account;
  304. } elseif ($bankaccountidofinvoices != $tmpinvoice->fk_account) {
  305. $bankaccountidofinvoices = 0;
  306. }
  307. }
  308. }
  309. print '<form method="POST" name="createbankpayment">';
  310. print '<input type="hidden" name="token" value="'.newToken().'">';
  311. print '<input type="hidden" name="action" value="createbankpayment">';
  312. print '<input type="hidden" name="id" value="'.$object->id.'">';
  313. print ' '.$langs->trans("ToCreateRelatedRecordIntoBank").': ';
  314. print $form->select_comptes($bankaccountidofinvoices, 'accountid', 0, '', 2, '', 0, '', 1);
  315. //print '<span class="opacitymedium">';
  316. print '<input type="submit" class="button small smallpaddingimp" name="createbankpayment" value="'.$langs->trans("ClickHere").'">';
  317. //print '</span>';
  318. print '</form>';
  319. }
  320. }
  321. print '</td>';
  322. print '</tr>';
  323. }
  324. // Comments
  325. print '<tr><td class="tdtop">'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->facture->paiement).'</td><td>';
  326. print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->facture->paiement, 'textarea:'.ROWS_3.':90%');
  327. print '</td></tr>';
  328. // Added by MMI Mathieu Moulin iProspective
  329. $parameters = array();
  330. $reshook = $hookmanager->executeHooks('addMoreInformations', $parameters, $object, $action);
  331. print '</table>';
  332. print '</div>';
  333. print dol_get_fiche_end();
  334. /*
  335. * List of invoices
  336. */
  337. $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.total_ttc, f.paye, f.entity, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
  338. $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
  339. $sql .= ' WHERE pf.fk_facture = f.rowid';
  340. $sql .= ' AND f.fk_soc = s.rowid';
  341. $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
  342. $sql .= ' AND pf.fk_paiement = '.((int) $object->id);
  343. $resql = $db->query($sql);
  344. if ($resql) {
  345. $num = $db->num_rows($resql);
  346. $i = 0;
  347. $total = 0;
  348. $moreforfilter = '';
  349. print '<br>';
  350. print '<div class="div-table-responsive">';
  351. print '<table class="noborder centpercent">';
  352. print '<tr class="liste_titre">';
  353. print '<td>'.$langs->trans('Bill').'</td>';
  354. print '<td>'.$langs->trans('Company').'</td>';
  355. if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
  356. print '<td>'.$langs->trans('Entity').'</td>';
  357. }
  358. print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
  359. print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
  360. print '<td class="right">'.$langs->trans('RemainderToPay').'</td>';
  361. print '<td class="right">'.$langs->trans('Status').'</td>';
  362. print "</tr>\n";
  363. if ($num > 0) {
  364. while ($i < $num) {
  365. $objp = $db->fetch_object($resql);
  366. $thirdpartystatic->fetch($objp->socid);
  367. $invoice = new Facture($db);
  368. $invoice->fetch($objp->facid);
  369. $paiement = $invoice->getSommePaiement();
  370. $creditnotes = $invoice->getSumCreditNotesUsed();
  371. $deposits = $invoice->getSumDepositsUsed();
  372. $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
  373. $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
  374. print '<tr class="oddeven">';
  375. // Invoice
  376. print '<td>';
  377. print $invoice->getNomUrl(1);
  378. print "</td>\n";
  379. // Third party
  380. print '<td class="tdoverflowmax150">';
  381. print $thirdpartystatic->getNomUrl(1);
  382. print '</td>';
  383. // Expected to pay
  384. if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
  385. print '<td>';
  386. $mc->getInfo($objp->entity);
  387. print $mc->label;
  388. print '</td>';
  389. }
  390. // Expected to pay
  391. print '<td class="right"><span class="amount">'.price($objp->total_ttc).'</span></td>';
  392. // Amount payed
  393. print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
  394. // Remain to pay
  395. print '<td class="right"><span class="amount">'.price($remaintopay).'</span></td>';
  396. // Status
  397. print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
  398. print "</tr>\n";
  399. // If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
  400. if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
  401. $disable_delete = 1;
  402. $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
  403. }
  404. $total = $total + $objp->amount;
  405. $i++;
  406. }
  407. }
  408. print "</table>\n";
  409. print '</div>';
  410. $db->free($resql);
  411. } else {
  412. dol_print_error($db);
  413. }
  414. /*
  415. * Actions Buttons
  416. */
  417. print '<div class="tabsAction">';
  418. // Added by MMI Mathieu Moulin iProspective
  419. $parameters = array();
  420. $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
  421. if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
  422. if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '') {
  423. if ($user->rights->facture->paiement) {
  424. print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&facid='.$objp->facid.'&action=valide&token='.newToken().'">'.$langs->trans('Valid').'</a>';
  425. }
  426. }
  427. }
  428. if ($user->socid == 0 && $action == '') {
  429. if ($user->rights->facture->paiement) {
  430. if (!$disable_delete) {
  431. print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
  432. } else {
  433. print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
  434. }
  435. }
  436. }
  437. print '</div>';
  438. // End of page
  439. llxFooter();
  440. $db->close();