dolibarr  16.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 Frédéric France <frederic.france@netlogic.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 
25 if (!defined('NOLOGIN')) {
26  define('NOLOGIN', '1');
27 }
28 if (!defined('NOCSRFCHECK')) {
29  define('NOCSRFCHECK', '1');
30 }
31 if (!defined('NOBROWSERNOTIF')) {
32  define('NOBROWSERNOTIF', '1');
33 }
34 if (!defined('NOIPCHECK')) {
35  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
36 }
37 
38 // C'est un wrapper, donc header vierge
44 function llxHeaderVierge()
45 {
46  print '<html><title>List of donators</title><body>';
47 }
53 function llxFooterVierge()
54 {
55  print '</body></html>';
56 }
57 
58 require '../../main.inc.php';
59 require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
60 
61 // Security check
62 if (empty($conf->don->enabled)) {
63  accessforbidden('', 0, 0, 1);
64 }
65 
66 
67 $langs->load("donations");
68 
69 
70 /*
71  * View
72  */
73 
75 
76 $sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
77 $sql .= " FROM ".MAIN_DB_PREFIX."don as d";
78 $sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
79 
80 $resql = $db->query($sql);
81 if ($resql) {
82  $num = $db->num_rows($resql);
83  if ($num) {
84  print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
85 
86  print '<tr>';
87  print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
88  print "<td>Date</td>";
89  print '<td class="right">'.$langs->trans("Amount").'</td>';
90  print "</tr>\n";
91 
92  while ($i < $num) {
93  $objp = $db->fetch_object($resql);
94 
95  print '<tr class="oddeven">';
96  if ($objp->public) {
97  print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
98  } else {
99  print "<td>".$langs->trans("Anonymous")."</td>\n";
100  }
101  print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
102  print '<td class="right">'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
103  print "</tr>";
104  $i++;
105  }
106  print "</table>";
107  } else {
108  print $langs->trans("Donation");
109  }
110 } else {
111  dol_print_error($db);
112 }
113 
114 $db->close();
115 
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
llxFooterVierge
llxFooterVierge()
Header function.
Definition: donateurs_code.php:53
llxHeaderVierge
if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOBROWSERNOTIF')) if(!defined('NOIPCHECK')) llxHeaderVierge()
Header function.
Definition: donateurs_code.php:44
$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