dolibarr  19.0.0-dev
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.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 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 <https://www.gnu.org/licenses/>.
19  */
20 
27 // Load Dolibarr environment
28 require '../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals'));
37 
38 // Get supervariables
39 $action = GETPOST('action', 'aZ09');
40 $id = GETPOST('id', 'int');
41 $ref = GETPOST('ref', 'alpha');
42 $socid = GETPOST('socid', 'int');
43 $type = GETPOST('type', 'aZ09');
44 
45 // Load variable for pagination
46 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
47 $sortfield = GETPOST('sortfield', 'aZ09comma');
48 $sortorder = GETPOST('sortorder', 'aZ09comma');
49 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
50 if (empty($page) || $page == -1) {
51  $page = 0;
52 } // If $page is not defined, or '' or -1
53 $offset = $limit * $page;
54 $pageprev = $page - 1;
55 $pagenext = $page + 1;
56 
57 if (!$sortfield) {
58  $sortfield = 'pl.rowid';
59 }
60 if (!$sortorder) {
61  $sortorder = 'ASC';
62 }
63 
64 $object = new BonPrelevement($db);
65 
66 // Load object
67 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
68 
69 $hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
70 
71 $type = $object->type;
72 
73 if ($type == 'bank-transfer') {
74  $result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
75 
76  $permissiontoadd = $user->hasRight('paymentbybanktransfer', 'read');
77  $permissiontosend = $user->hasRight('paymentbybanktransfer', 'send');
78  $permissiontocreditdebit = $user->hasRight('paymentbybanktransfer', 'debit');
79  $permissiontodelete = $user->hasRight('paymentbybanktransfer', 'read');
80 } else {
81  $result = restrictedArea($user, 'prelevement', '', '', 'bons');
82 
83  $permissiontoadd = $user->hasRight('prelevement', 'bons', 'read');
84  $permissiontosend = $user->hasRight('prelevement', 'bons', 'send');
85  $permissiontocreditdebit = $user->hasRight('prelevement', 'bons', 'credit');
86  $permissiontodelete = $user->hasRight('prelevement', 'bons', 'read');
87 }
88 
89 
90 
91 /*
92  * Actions
93  */
94 
95 $parameters = array('socid' => $socid);
96 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
97 if ($reshook < 0) {
98  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
99 }
100 
101 if (empty($reshook)) {
102  if ($action == 'setbankaccount' && $permissiontoadd) {
103  $object->oldcopy = dol_clone($object);
104  $object->fk_bank_account = GETPOST('fk_bank_account', 'int');
105  $object->update($user);
106  }
107 
108  if ($action == 'infotrans' && $permissiontosend) {
109  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
110 
111  $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
112 
113  /*
114  if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
115  {
116  $dir = $conf->prelevement->dir_output.'/receipts';
117 
118  if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
119  {
120  $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
121  }
122 
123  header("Location: card.php?id=".$id);
124  exit;
125  }
126  else
127  {
128  dol_syslog("Fichier invalide",LOG_WARNING);
129  $mesg='BadFile';
130  }*/
131 
132  $error = $object->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
133 
134  if ($error) {
135  header("Location: card.php?id=".$id."&error=$error");
136  exit;
137  }
138  }
139 
140  // Set direct debit order to credited, create payment and close invoices
141  if ($action == 'infocredit' && $permissiontocreditdebit) {
142  $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
143 
144  if (($object->type != 'bank-transfer' && $object->statut == BonPrelevement::STATUS_CREDITED) || ($object->type == 'bank-transfer' && $object->statut == BonPrelevement::STATUS_DEBITED)) {
145  $error = 1;
146  setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
147  } else {
148  $error = $object->set_infocredit($user, $dt);
149  }
150 
151  if ($error) {
152  setEventMessages($object->error, $object->errors, 'errors');
153  }
154  }
155 
156  if ($action == 'confirm_delete' && $permissiontodelete) {
157  $savtype = $object->type;
158  $res = $object->delete($user);
159  if ($res > 0) {
160  if ($savtype == 'bank-transfer') {
161  header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
162  } else {
163  header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
164  }
165  exit;
166  }
167  }
168 }
169 
170 
171 
172 /*
173  * View
174  */
175 
176 $form = new Form($db);
177 
178 llxHeader('', $langs->trans("WithdrawalsReceipts"));
179 
180 if ($id > 0 || $ref) {
181  $head = prelevement_prepare_head($object);
182  print dol_get_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
183 
184  if (GETPOST('error', 'alpha') != '') {
185  print '<div class="error">'.$object->getErrorString(GETPOST('error', 'alpha')).'</div>';
186  }
187 
188  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
189 
190  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
191 
192  print '<div class="fichecenter">';
193  print '<div class="underbanner clearboth"></div>';
194  print '<table class="border centpercent tableforfield">';
195 
196  print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
197 
198  print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
199 
200  if (!empty($object->date_trans)) {
201  $muser = new User($db);
202  $muser->fetch($object->user_trans);
203 
204  print '<tr><td>'.$langs->trans("TransData").'</td><td>';
205  print dol_print_date($object->date_trans, 'day');
206  print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
207  print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
208  print $object->methodes_trans[$object->method_trans];
209  print '</td></tr>';
210  }
211  if (!empty($object->date_credit)) {
212  print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
213  print dol_print_date($object->date_credit, 'day');
214  print '</td></tr>';
215  }
216 
217  print '</table>';
218 
219  print '<br>';
220 
221  print '<div class="underbanner clearboth"></div>';
222  print '<table class="border centpercent tableforfield">';
223 
224  // Get bank account for the payment
225  $acc = new Account($db);
226  $fk_bank_account = $object->fk_bank_account;
227  if (empty($fk_bank_account)) {
228  $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT'));
229  }
230  if ($fk_bank_account > 0) {
231  $result = $acc->fetch($fk_bank_account);
232  }
233 
234  // Bank account
235  $labelofbankfield = "BankToReceiveWithdraw";
236  if ($object->type == 'bank-transfer') {
237  $labelofbankfield = 'BankToPayCreditTransfer';
238  }
239  //print $langs->trans($labelofbankfield);
240  $caneditbank = $permissiontoadd;
241  if ($object->status != $object::STATUS_DRAFT) {
242  $caneditbank = 0;
243  }
244  /*
245  print '<tr><td class="titlefieldcreate">';
246  print $form->editfieldkey($langs->trans($labelofbankfield), 'fk_bank_account', $acc->id, $object, $caneditbank);
247  print '</td>';
248  print '<td>';
249  print $form->editfieldval($langs->trans($labelofbankfield), 'fk_bank_account', $acc->id, $acc, $caneditbank, 'string', '', null, null, '', 1, 'getNomUrl');
250  print '</td>';
251  print '</tr>';
252  */
253  print '<tr><td class="titlefieldcreate">';
254  print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
255  print $form->textwithpicto($langs->trans("BankAccount"), $langs->trans($labelofbankfield));
256  print '<td>';
257  if (($action != 'editbankaccount') && $caneditbank) {
258  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfkbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
259  }
260  print '</tr></table>';
261  print '</td><td>';
262  if ($action == 'editfkbankaccount') {
263  $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $fk_bank_account, 'fk_bank_account', 0);
264  } else {
265  $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $fk_bank_account, 'none');
266  }
267  print "</td>";
268  print '</tr>';
269 
270  // Donwload file
271  print '<tr><td class="titlefieldcreate">';
272  $labelfororderfield = 'WithdrawalFile';
273  if ($object->type == 'bank-transfer') {
274  $labelfororderfield = 'CreditTransferFile';
275  }
276  print $langs->trans($labelfororderfield).'</td><td>';
277 
278  $modulepart = 'prelevement';
279  if ($object->type == 'bank-transfer') {
280  $modulepart = 'paymentbybanktransfer';
281  }
282 
283  if (isModEnabled('multicompany')) {
284  $labelentity = $conf->entity;
285  $relativepath = 'receipts/'.$object->ref.'-'.$labelentity.'.xml';
286 
287  if ($type != 'bank-transfer') {
288  $dir = $conf->prelevement->dir_output;
289  } else {
290  $dir = $conf->paymentbybanktransfer->dir_output;
291  }
292  if (!dol_is_file($dir.'/'.$relativepath)) { // For backward compatibility
293  $relativepath = 'receipts/'.$object->ref.'.xml';
294  }
295  } else {
296  $relativepath = 'receipts/'.$object->ref.'.xml';
297  }
298 
299  print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">'.$relativepath;
300  print img_picto('', 'download', 'class="paddingleft"');
301  print '</a>';
302  print '</td></tr>';
303 
304  // Other attributes
305  $parameters = array();
306  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
307  print $hookmanager->resPrint;
308 
309  print '</table>';
310 
311  print '</div>';
312 
313  print dol_get_fiche_end();
314 
315 
316  $formconfirm = '';
317 
318  // Confirmation to delete
319  if ($action == 'delete') {
320  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Delete'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
321  }
322 
323  // Call Hook formConfirm
324  /*$parameters = array('formConfirm' => $formconfirm);
325  $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
326  if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
327  elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;*/
328 
329  // Print form confirm
330  print $formconfirm;
331 
332 
333  if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
334  print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
335  print '<input type="hidden" name="token" value="'.newToken().'">';
336  print '<input type="hidden" name="action" value="infotrans">';
337  print '<table class="noborder centpercent">';
338  print '<tr class="liste_titre">';
339  print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
340  print '<tr class="oddeven"><td>'.$langs->trans("TransData").'</td><td>';
341  print $form->selectDate('', '', '', '', '', "userfile", 1, 1);
342  print '</td></tr>';
343  print '<tr class="oddeven"><td>'.$langs->trans("TransMetod").'</td><td>';
344  print $form->selectarray("methode", $object->methodes_trans);
345  print '</td></tr>';
346  print '</table>';
347  print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("SetToStatusSent")).'"></div>';
348  print '</form>';
349  print '<br>';
350  }
351 
352  if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') {
353  $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
354  print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
355  print '<input type="hidden" name="token" value="'.newToken().'">';
356  print '<input type="hidden" name="action" value="infocredit">';
357  print '<table class="noborder centpercent">';
358  print '<tr class="liste_titre">';
359  print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
360  print '<tr class="oddeven"><td>'.$langs->trans('CreditDate').'</td><td>';
361  print $form->selectDate(-1, '', '', '', '', "infocredit", 1, 1);
362  print '</td></tr>';
363  print '</table>';
364  print '<br><div class="center"><span class="opacitymedium">'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'</span></div>';
365  print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($btnLabel).'"></div>';
366  print '</form>';
367  print '<br>';
368  }
369 
370  // Actions
371  if ($action != 'settransmitted' && $action != 'setcredited') {
372  print "\n".'<div class="tabsAction">'."\n";
373  $parameters = array();
374  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
375  if (empty($reshook)) {
376  if (empty($object->date_trans)) {
377  if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
378  else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
379  }
380  if (!empty($object->date_trans) && empty($object->date_credit)) {
381  if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit);
382  else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit);
383  }
384 
385  if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
386  else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
387  }
388  print '</div>';
389  }
390 
391 
392  $ligne = new LignePrelevement($db);
393 
394  /*
395  * Lines into withdraw request
396  */
397  $sql = "SELECT pl.rowid, pl.statut, pl.amount,";
398  $sql .= " s.rowid as socid, s.nom as name";
399  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
400  $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
401  $sql .= ", ".MAIN_DB_PREFIX."societe as s";
402  $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id);
403  $sql .= " AND pl.fk_prelevement_bons = pb.rowid";
404  $sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here
405  $sql .= " AND pl.fk_soc = s.rowid";
406  if ($socid) {
407  $sql .= " AND s.rowid = ".((int) $socid);
408  }
409  $sql .= $db->order($sortfield, $sortorder);
410 
411  // Count total nb of records
412  $nbtotalofrecords = '';
413  if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
414  $result = $db->query($sql);
415  $nbtotalofrecords = $db->num_rows($result);
416  if (($page * $limit) > $nbtotalofrecords) {
417  // if total resultset is smaller then paging size (filtering), goto and load page 0
418  $page = 0;
419  $offset = 0;
420  }
421  }
422 
423  $sql .= $db->plimit($limit + 1, $offset);
424 
425  $result = $db->query($sql);
426 
427  if ($result) {
428  $num = $db->num_rows($result);
429  $i = 0;
430 
431  $urladd = "&id=".urlencode($id);
432  if ($limit > 0 && $limit != $conf->liste_limit) {
433  $urladd .= '&limit='.((int) $limit);
434  }
435 
436  print '<form method="POST" action="'.$_SERVER ['PHP_SELF'].'" name="search_form">'."\n";
437  print '<input type="hidden" name="token" value="'.newToken().'"/>';
438  print '<input type="hidden" name="id" value="'.$id.'"/>';
439  print '<input type="hidden" name="socid" value="'.$socid.'"/>';
440  if (!empty($page)) {
441  print '<input type="hidden" name="page" value="'.$page.'"/>';
442  }
443  if (!empty($limit)) {
444  print '<input type="hidden" name="limit" value="'.$limit.'"/>';
445  }
446  if (!empty($sortfield)) {
447  print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
448  }
449  if (!empty($sortorder)) {
450  print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
451  }
452  print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
453 
454  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
455  print '<table class="noborder liste centpercent">';
456  print '<tr class="liste_titre">';
457  print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd, '', $sortfield, $sortorder);
458  print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd, '', $sortfield, $sortorder);
459  print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $urladd, 'class="right"', $sortfield, $sortorder);
461  print "</tr>\n";
462 
463  $total = 0;
464 
465  while ($i < min($num, $limit)) {
466  $obj = $db->fetch_object($result);
467 
468  print '<tr class="oddeven">';
469 
470  // Status of line
471  print "<td>";
472  print '<a class="valignmiddle" href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'&type='.$object->type.'&token='.newToken().'">';
473  print $ligne->LibStatut($obj->statut, 2);
474  print '<span class="paddingleft">'.$obj->rowid.'</span>';
475  print '</a></td>';
476 
477  $thirdparty = new Societe($db);
478  $thirdparty->fetch($obj->socid);
479  print '<td>';
480  print $thirdparty->getNomUrl(1);
481  print "</td>\n";
482 
483  print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
484 
485  print '<td class="right">';
486 
487  if ($obj->statut == 3) {
488  print '<b>'.$langs->trans("StatusRefused").'</b>';
489  } else {
490  if ($object->statut == BonPrelevement::STATUS_CREDITED) {
491  if ($obj->statut == 2) {
492  if ($user->rights->prelevement->bons->credit) {
493  //print '<a class="butActionDelete" href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
494  print '<a href="line.php?action=rejet&type='.$object->type.'&id='.$obj->rowid.'&token='.newToken().'">'.$langs->trans("StandingOrderReject").'</a>';
495  } else {
496  //print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
497  }
498  }
499  } else {
500  //print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine").'">'.$langs->trans("StandingOrderReject").'</a>';
501  }
502  }
503 
504  print '</td></tr>';
505 
506  $total += $obj->amount;
507 
508  $i++;
509  }
510 
511  if ($num > 0) {
512  $total = price2num($total, 'MT');
513 
514  print '<tr class="liste_total">';
515  print '<td>'.$langs->trans("Total").'</td>';
516  print '<td>&nbsp;</td>';
517  print '<td class="right">';
518  if (empty($offset) && $num <= $limit) {
519  // If we have all record on same page, then the following test/warning can be done
520  if ($total != $object->amount) {
521  print img_warning($langs->trans("TotalAmountOfdirectDebitOrderDiffersFromSumOfLines"));
522  }
523  }
524  print price($total);
525  print "</td>\n";
526  print '<td>&nbsp;</td>';
527  print "</tr>\n";
528  }
529 
530  print "</table>";
531  print '</div>';
532  print '</form>';
533 
534  $db->free($result);
535  } else {
536  dol_print_error($db);
537  }
538 }
539 
540 // End of page
541 llxFooter();
542 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage bank accounts.
Class to manage withdrawal receipts.
Class to manage generation of HTML components Only common components must be here.
Class to manage withdrawals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
Definition: user.class.php:48
$parameters
Actions.
Definition: card.php:83
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_is_file($pathoffile)
Return if path is a file.
Definition: files.lib.php:483
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
$formconfirm
if ($action == 'delbookkeepingyear') {
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.