dolibarr  13.0.2
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')) define('NOLOGIN', '1');
26 if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
27 if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
28 if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
29 
30 // C'est un wrapper, donc header vierge
36 function llxHeaderVierge()
37 {
38  print '<html><title>List of donators</title><body>';
39 }
45 function llxFooterVierge()
46 {
47  print '</body></html>';
48 }
49 
50 require '../../main.inc.php';
51 require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
52 
53 // Security check
54 if (empty($conf->don->enabled)) accessforbidden('', 0, 0, 1);
55 
56 
57 $langs->load("donations");
58 
59 
60 /*
61  * View
62  */
63 
65 
66 $sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
67 $sql .= " FROM ".MAIN_DB_PREFIX."don as d";
68 $sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
69 
70 $resql = $db->query($sql);
71 if ($resql)
72 {
73  $num = $db->num_rows($resql);
74  if ($num)
75  {
76  print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
77 
78  print '<tr>';
79  print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
80  print "<td>Date</td>";
81  print '<td class="right">'.$langs->trans("Amount").'</td>';
82  print "</tr>\n";
83 
84  while ($i < $num)
85  {
86  $objp = $db->fetch_object($resql);
87 
88  print '<tr class="oddeven">';
89  if ($objp->public)
90  {
91  print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
92  } else {
93  print "<td>".$langs->trans("Anonymous")."</td>\n";
94  }
95  print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
96  print '<td class="right">'.number_format($objp->amount, 2, '.', ' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
97  print "</tr>";
98  $i++;
99  }
100  print "</table>";
101  } else {
102  print $langs->trans("Donation");
103  }
104 } else {
105  dol_print_error($db);
106 }
107 
108 $db->close();
109 
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 ...
llxHeaderVierge()
Header function.
print
Draft customers invoices.
Definition: index.php:89
llxFooterVierge()
Footer function.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $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, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...