dolibarr/htdocs/public/donations/donateurs_code.php

115 lines
2.8 KiB
PHP
Raw Normal View History

2004-10-20 22:06:49 +02:00
<?php
2002-12-21 20:31:45 +01:00
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
*/
2011-10-18 16:40:44 +02:00
function llxHeaderVierge() { print '<html><title>Export agenda cal</title><body>'; }
2012-01-08 00:52:07 +01:00
/**
* Header function
*
* @return void
*/
function llxFooterVierge() { print '</body></html>'; }
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT .'/compta/dons/class/class/don.class.php';
2009-07-15 15:32:01 +02:00
// Security check
if (empty($conf->don->enabled)) accessforbidden('',1,1,1);
$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)
{
2010-01-12 11:41:29 +01:00
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
2002-12-21 20:31:45 +01:00
2010-01-12 11:41:29 +01:00
print '<TR>';
print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
print "<td>Date</td>";
print "<td align=\"right\">".$langs->trans("Amount")."</TD>";
print "</TR>\n";
2010-01-12 11:41:29 +01:00
$var=True;
$bc[1]='bgcolor="#f5f5f5"';
$bc[0]='bgcolor="#f0f0f0"';
while ($i < $num)
{
2010-08-14 04:44:07 +02:00
$objp = $db->fetch_object($resql);
2010-01-14 20:50:16 +01:00
$var=!$var;
print "<tr ".$bc[$var].">";
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>";
2002-12-21 20:31:45 +01:00
2010-01-12 11:41:29 +01:00
}
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();
2002-12-21 20:31:45 +01:00
?>