dolibarr 19.0.3
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// Load Dolibarr environment
26require '../../main.inc.php';
27
28// Load translation files required by the page
29$langs->load("bills");
30
31$socid = 0;
32if ($user->socid > 0) {
33 $action = '';
34 $socid = $user->socid;
35}
36
37
38$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
39$sortfield = GETPOST('sortfield', 'aZ09comma');
40$sortorder = GETPOST('sortorder', 'aZ09comma');
41$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
42if (empty($page) || $page == -1) {
43 $page = 0;
44} // If $page is not defined, or '' or -1
45$offset = $limit * $page;
46$pageprev = $page - 1;
47$pagenext = $page + 1;
48if (!$sortorder) {
49 $sortorder = "DESC";
50}
51if (!$sortfield) {
52 $sortfield = "p.rowid";
53}
54
55// Security check
56if (!$user->hasRight('facture', 'lire')) {
58}
59
60
61/*
62 * Actions
63 */
64
65
66
67/*
68 * View
69 */
70
71llxHeader();
72
73$sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut";
74$sql .= ", c.libelle as paiement_type, p.num_paiement as num_payment";
75$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
76if ($socid) {
77 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
78 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
79}
80$sql .= " WHERE p.entity IN (".getEntity('invoice').')';
81if ($socid) {
82 $sql .= " AND f.fk_soc = ".((int) $socid);
83}
84$sql .= " AND p.statut = 0";
85
86$sql .= $db->order($sortfield, $sortorder);
87
88// Count total nb of records
89$nbtotalofrecords = '';
90if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
91 $result = $db->query($sql);
92 $nbtotalofrecords = $db->num_rows($result);
93 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
94 $page = 0;
95 $offset = 0;
96 }
97}
98
99$sql .= $db->plimit($limit + 1, $offset);
100
101$resql = $db->query($sql);
102if ($resql) {
103 $num = $db->num_rows($resql);
104 $i = 0;
105
106 print_barre_liste($langs->trans("ReceivedCustomersPaymentsToValid"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
107
108 print '<table class="noborder centpercent">';
109 print '<tr class="liste_titre">';
110 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.rowid", "", "", 'width="60"', $sortfield, $sortorder);
111 print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", "", 'width="80" align="center"', $sortfield, $sortorder);
112 print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", "", "", $sortfield, $sortorder);
113 print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "c.libelle", "", "", 'class="right"', $sortfield, $sortorder);
115 print "</tr>\n";
116
117 while ($i < min($num, $limit)) {
118 $objp = $db->fetch_object($resql);
119
120 print '<tr class="oddeven">';
121 print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.'</a></td>';
122 print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
123 print "<td>$objp->paiement_type $objp->num_payment</td>\n";
124 print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
125 print '<td class="center">';
126
127 if ($objp->statut == 0) {
128 print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">'.$langs->trans("PaymentStatusToValidShort").'</a>';
129 } else {
130 print "-";
131 }
132
133 print '</td>';
134 print "</tr>";
135 $i++;
136 }
137 print "</table>";
138}
139
140// End of page
141llxFooter();
142$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:55
llxFooter()
Empty footer.
Definition wrapper.php:69
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.