dolibarr  19.0.0-dev
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('NOBROWSERNOTIF')) {
29  define('NOBROWSERNOTIF', '1');
30 }
31 if (!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
41 function llxHeaderVierge()
42 {
43  print '<html><title>List of donators</title><body>';
44 }
50 function llxFooterVierge()
51 {
52  print '</body></html>';
53 }
54 
55 // Load Dolibarr environment
56 require '../../main.inc.php';
57 require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
58 
59 // Security check
60 if (!isModEnabled('don')) {
61  httponly_accessforbidden('Module Donation not enabled');
62 }
63 
64 
65 $langs->load("donations");
66 
67 
68 /*
69  * View
70  */
71 
73 
74 $sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
75 $sql .= " FROM ".MAIN_DB_PREFIX."don as d";
76 $sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
77 
78 $resql = $db->query($sql);
79 if ($resql) {
80  $num = $db->num_rows($resql);
81  if ($num) {
82  print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
83 
84  print '<tr>';
85  print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
86  print "<td>Date</td>";
87  print '<td class="right">'.$langs->trans("Amount").'</td>';
88  print "</tr>\n";
89 
90  while ($i < $num) {
91  $objp = $db->fetch_object($resql);
92 
93  print '<tr class="oddeven">';
94  if ($objp->public) {
95  print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
96  } else {
97  print "<td>".$langs->trans("Anonymous")."</td>\n";
98  }
99  print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
100  print '<td class="right">'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
101  print "</tr>";
102  $i++;
103  }
104  print "</table>";
105  } else {
106  print $langs->trans("Donation");
107  }
108 } else {
109  dol_print_error($db);
110 }
111 
112 $db->close();
113 
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if(!defined('NOLOGIN')) if(!defined('NOBROWSERNOTIF')) if(!defined('NOIPCHECK')) llxHeaderVierge()
Header function.
llxFooterVierge()
Header function.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isModEnabled($module)
Is Dolibarr module enabled.
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...
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.