dolibarr 22.0.5
donateurs_code.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOLOGIN')) {
27 define('NOLOGIN', '1');
28}
29if (!defined('NOBROWSERNOTIF')) {
30 define('NOBROWSERNOTIF', '1');
31}
32if (!defined('NOIPCHECK')) {
33 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34}
35
36// C'est un wrapper, donc header vierge
50function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
51{
52 print '<html><title>List of donators</title><body>';
53}
61function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
62{
63 print '</body></html>';
64}
65
66// Load Dolibarr environment
67require '../../main.inc.php';
68require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
69
70// Security check
71if (!isModEnabled('don')) {
72 httponly_accessforbidden('Module Donation not enabled');
73}
74
75
76$langs->load("donations");
77
78
79/*
80 * View
81 */
82
84
85$sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
86$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
87$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
88
89$resql = $db->query($sql);
90if ($resql) {
91 $num = $db->num_rows($resql);
92 if ($num) {
93 print '<table class="centpercent" cellspacing="0" cellpadding="4">';
94
95 print '<tr>';
96 print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
97 print "<td>Date</td>";
98 print '<td class="right">'.$langs->trans("Amount").'</td>';
99 print "</tr>\n";
100
101 while ($i < $num) {
102 $objp = $db->fetch_object($resql);
103
104 print '<tr class="oddeven">';
105 if ($objp->public) {
106 print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
107 } else {
108 print "<td>".$langs->trans("Anonymous")."</td>\n";
109 }
110 print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
111 print '<td class="right">'.price($objp->amount).' '.$langs->trans("Currency".$conf->currency).'</td>';
112 print "</tr>";
113 $i++;
114 }
115 print "</table>";
116 } else {
117 print $langs->trans("Donation");
118 }
119} else {
120 dol_print_error($db);
121}
122
123$db->close();
124
llxFooterVierge()
Footer function.
if(!defined( 'NOLOGIN')) if(!defined('NOBROWSERNOTIF')) if(!defined( 'NOIPCHECK')) llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Header function.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.