dolibarr  16.0.5
tovalidate.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require '../../main.inc.php';
26 
27 // Load translation files required by the page
28 $langs->load("bills");
29 
30 $socid = 0;
31 if ($user->socid > 0) {
32  $action = '';
33  $socid = $user->socid;
34 }
35 
36 
37 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
38 $sortfield = GETPOST('sortfield', 'aZ09comma');
39 $sortorder = GETPOST('sortorder', 'aZ09comma');
40 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
41 if (empty($page) || $page == -1) {
42  $page = 0;
43 } // If $page is not defined, or '' or -1
44 $offset = $limit * $page;
45 $pageprev = $page - 1;
46 $pagenext = $page + 1;
47 if (!$sortorder) {
48  $sortorder = "DESC";
49 }
50 if (!$sortfield) {
51  $sortfield = "p.rowid";
52 }
53 
54 // Security check
55 if (empty($user->rights->facture->lire)) {
57 }
58 
59 
60 /*
61  * Actions
62  */
63 
64 
65 
66 /*
67  * View
68  */
69 
70 llxHeader();
71 
72 $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut";
73 $sql .= ", c.libelle as paiement_type, p.num_paiement as num_payment";
74 $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
75 if ($socid) {
76  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
77  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
78 }
79 $sql .= " WHERE p.entity IN (".getEntity('invoice').')';
80 if ($socid) {
81  $sql .= " AND f.fk_soc = ".((int) $socid);
82 }
83 $sql .= " AND p.statut = 0";
84 
85 $sql .= $db->order($sortfield, $sortorder);
86 
87 // Count total nb of records
88 $nbtotalofrecords = '';
89 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
90  $result = $db->query($sql);
91  $nbtotalofrecords = $db->num_rows($result);
92  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
93  $page = 0;
94  $offset = 0;
95  }
96 }
97 
98 $sql .= $db->plimit($limit + 1, $offset);
99 
100 $resql = $db->query($sql);
101 if ($resql) {
102  $num = $db->num_rows($resql);
103  $i = 0;
104 
105  print_barre_liste($langs->trans("ReceivedCustomersPaymentsToValid"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
106 
107  print '<table class="noborder centpercent">';
108  print '<tr class="liste_titre">';
109  print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.rowid", "", "", 'width="60"', $sortfield, $sortorder);
110  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", "", 'width="80" align="center"', $sortfield, $sortorder);
111  print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", "", "", $sortfield, $sortorder);
112  print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "c.libelle", "", "", 'class="right"', $sortfield, $sortorder);
114  print "</tr>\n";
115 
116  while ($i < min($num, $limit)) {
117  $objp = $db->fetch_object($resql);
118 
119  print '<tr class="oddeven">';
120  print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.'</a></td>';
121  print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
122  print "<td>$objp->paiement_type $objp->num_payment</td>\n";
123  print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
124  print '<td class="center">';
125 
126  if ($objp->statut == 0) {
127  print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">'.$langs->trans("PaymentStatusToValidShort").'</a>';
128  } else {
129  print "-";
130  }
131 
132  print '</td>';
133  print "</tr>";
134  $i++;
135  }
136  print "</table>";
137 }
138 
139 // End of page
140 llxFooter();
141 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
print_barre_liste
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.
Definition: functions.lib.php:5257
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5026
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4211
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59