dolibarr 21.0.0-beta
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-2024 Frédéric France <frederic.france@free.fr>
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
25if (!defined('NOLOGIN')) {
26 define('NOLOGIN', '1');
27}
28if (!defined('NOBROWSERNOTIF')) {
29 define('NOBROWSERNOTIF', '1');
30}
31if (!defined('NOIPCHECK')) {
32 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
33}
34
35// C'est un wrapper, donc header vierge
46function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
47{
48 print '<html><title>List of donators</title><body>';
49}
56{
57 print '</body></html>';
58}
59
60// Load Dolibarr environment
61require '../../main.inc.php';
62require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
63
64// Security check
65if (!isModEnabled('don')) {
66 httponly_accessforbidden('Module Donation not enabled');
67}
68
69
70$langs->load("donations");
71
72
73/*
74 * View
75 */
76
78
79$sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
80$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
81$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
82
83$resql = $db->query($sql);
84if ($resql) {
85 $num = $db->num_rows($resql);
86 if ($num) {
87 print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
88
89 print '<tr>';
90 print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
91 print "<td>Date</td>";
92 print '<td class="right">'.$langs->trans("Amount").'</td>';
93 print "</tr>\n";
94
95 while ($i < $num) {
96 $objp = $db->fetch_object($resql);
97
98 print '<tr class="oddeven">';
99 if ($objp->public) {
100 print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
101 } else {
102 print "<td>".$langs->trans("Anonymous")."</td>\n";
103 }
104 print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
105 print '<td class="right">'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
106 print "</tr>";
107 $i++;
108 }
109 print "</table>";
110 } else {
111 print $langs->trans("Donation");
112 }
113} else {
114 dol_print_error($db);
115}
116
117$db->close();
118
llxFooterVierge()
Header function.
if(!defined( 'NOLOGIN')) if(!defined('NOBROWSERNOTIF')) if(!defined( 'NOIPCHECK')) llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
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.