dolibarr/htdocs/public/donations/donateurs_code.php

116 lines
2.8 KiB
PHP
Raw Normal View History

2004-10-20 22:06:49 +02:00
<?php
2018-09-17 13:12:04 +02:00
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
2002-12-21 20:31:45 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
2002-12-21 20:31:45 +01:00
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
2009-07-15 15:32:01 +02:00
* \file htdocs/public/donations/donateurs_code.php
* \ingroup donation
* \brief Page to list donators
2002-12-21 20:31:45 +01:00
*/
define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
2002-12-21 20:31:45 +01:00
// C'est un wrapper, donc header vierge
2012-01-08 00:52:07 +01:00
/**
* Header function
*
* @return void
*/
2018-08-15 17:34:35 +02:00
function llxHeaderVierge()
{
print '<html><title>Export agenda cal</title><body>';
}
2012-01-08 00:52:07 +01:00
/**
* Header function
*
* @return void
*/
2018-08-15 17:34:35 +02:00
function llxFooterVierge()
{
print '</body></html>';
}
require '../../main.inc.php';
2015-03-26 21:03:56 +01:00
require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php';
2009-07-15 15:32:01 +02:00
// Security check
2018-09-17 13:12:04 +02:00
if (empty($conf->don->enabled)) accessforbidden('', 0, 0, 1);
2009-07-15 15:32:01 +02:00
$langs->load("donations");
2009-07-15 15:32:01 +02:00
/*
* View
*/
llxHeaderVierge();
2013-02-23 16:37:17 +01:00
$sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
2010-01-13 19:51:19 +01:00
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC";
2002-12-21 20:31:45 +01:00
2010-08-14 04:44:07 +02:00
$resql=$db->query($sql);
if ($resql)
2002-12-21 20:31:45 +01:00
{
2010-08-14 04:44:07 +02:00
$num = $db->num_rows($resql);
2010-01-12 11:41:29 +01:00
if ($num)
{
2018-09-17 13:12:04 +02:00
print "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
2002-12-21 20:31:45 +01:00
2018-09-17 13:12:04 +02:00
print '<tr>';
2010-01-12 11:41:29 +01:00
print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
print "<td>Date</td>";
2018-09-17 13:12:04 +02:00
print "<td align=\"right\">".$langs->trans("Amount")."</td>";
print "</tr>\n";
2010-01-12 11:41:29 +01:00
while ($i < $num)
{
2010-08-14 04:44:07 +02:00
$objp = $db->fetch_object($resql);
2010-01-14 20:50:16 +01:00
print '<tr class="oddeven">';
2010-01-14 20:50:16 +01:00
if ($objp->public)
{
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."</td>\n";
2010-01-14 20:50:16 +01:00
}
else
{
print "<td>Anonyme Anonyme</td>\n";
}
print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
print '<td align="right">'.number_format($objp->amount,2,'.',' ').' '.$langs->trans("Currency".$conf->currency).'</td>';
2010-01-14 20:50:16 +01:00
print "</tr>";
$i++;
2010-01-12 11:41:29 +01:00
}
print "</table>";
}
else
{
print "Aucun don publique";
}
2002-12-21 20:31:45 +01:00
}
else
{
dol_print_error($db);
2002-12-21 20:31:45 +01:00
}
$db->close();
llxFooterVierge();