2004-10-20 20:06:49 +00:00
|
|
|
<?php
|
2018-09-17 11:12:04 +00:00
|
|
|
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2026-04-07 12:28:41 +00:00
|
|
|
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
|
2025-02-11 21:06:34 +00:00
|
|
|
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
2002-12-21 19:31:45 +00: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
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-12-21 19:31:45 +00: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
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2008-12-03 18:47:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-07-15 13:32:01 +00:00
|
|
|
* \file htdocs/public/donations/donateurs_code.php
|
|
|
|
|
* \ingroup donation
|
|
|
|
|
* \brief Page to list donators
|
2002-12-21 19:31:45 +00:00
|
|
|
*/
|
|
|
|
|
|
2021-02-26 17:58:34 +00:00
|
|
|
if (!defined('NOLOGIN')) {
|
|
|
|
|
define('NOLOGIN', '1');
|
|
|
|
|
}
|
|
|
|
|
if (!defined('NOBROWSERNOTIF')) {
|
|
|
|
|
define('NOBROWSERNOTIF', '1');
|
|
|
|
|
}
|
|
|
|
|
if (!defined('NOIPCHECK')) {
|
|
|
|
|
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
|
|
|
|
}
|
2002-12-21 19:31:45 +00:00
|
|
|
|
2010-02-28 14:16:46 +00:00
|
|
|
// C'est un wrapper, donc header vierge
|
2012-01-07 23:52:07 +00:00
|
|
|
/**
|
2025-02-12 10:24:02 +00:00
|
|
|
* Header function
|
|
|
|
|
*
|
|
|
|
|
* Note: also called by functions.lib:recordNotFound
|
|
|
|
|
*
|
2024-10-04 15:27:19 +00:00
|
|
|
* @param string $title Title
|
|
|
|
|
* @param string $head Head array
|
|
|
|
|
* @param int $disablejs More content into html header
|
|
|
|
|
* @param int $disablehead More content into html header
|
|
|
|
|
* @param string[]|string $arrayofjs Array of complementary js files
|
|
|
|
|
* @param string[]|string $arrayofcss Array of complementary css files
|
2026-04-07 12:28:41 +00:00
|
|
|
* @param string $ws Website ref if we are called from a website
|
2012-01-07 23:52:07 +00:00
|
|
|
* @return void
|
|
|
|
|
*/
|
2026-04-07 12:28:41 +00:00
|
|
|
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $ws = '') // @phan-suppress-current-line PhanRedefineFunction
|
2018-08-15 15:34:35 +00:00
|
|
|
{
|
2020-11-07 11:47:42 +00:00
|
|
|
print '<html><title>List of donators</title><body>';
|
2018-08-15 15:34:35 +00:00
|
|
|
}
|
2012-01-07 23:52:07 +00:00
|
|
|
/**
|
2025-02-12 10:24:02 +00:00
|
|
|
* Footer function
|
|
|
|
|
*
|
|
|
|
|
* Note: also called by functions.lib:recordNotFound
|
2012-01-07 23:52:07 +00:00
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2025-02-12 10:24:02 +00:00
|
|
|
function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
|
2018-08-15 15:34:35 +00:00
|
|
|
{
|
2020-10-31 13:32:18 +00:00
|
|
|
print '</body></html>';
|
2018-08-15 15:34:35 +00:00
|
|
|
}
|
2010-02-28 14:16:46 +00:00
|
|
|
|
2022-09-07 18:08:59 +00:00
|
|
|
// Load Dolibarr environment
|
2012-08-22 21:24:21 +00:00
|
|
|
require '../../main.inc.php';
|
2020-04-10 08:59:32 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
2025-08-27 01:03:58 +00:00
|
|
|
/**
|
|
|
|
|
* @var Conf $conf
|
|
|
|
|
* @var DoliDB $db
|
|
|
|
|
* @var Translate $langs
|
|
|
|
|
*/
|
2009-07-15 13:32:01 +00:00
|
|
|
// Security check
|
2022-09-25 04:18:41 +00:00
|
|
|
if (!isModEnabled('don')) {
|
2022-09-09 11:58:54 +00:00
|
|
|
httponly_accessforbidden('Module Donation not enabled');
|
2021-02-26 17:58:34 +00:00
|
|
|
}
|
2009-07-15 13:32:01 +00:00
|
|
|
|
|
|
|
|
|
2025-02-06 17:13:42 +00:00
|
|
|
$langs->load("donations");
|
2005-03-23 23:06:18 +00:00
|
|
|
|
2009-07-15 13:32:01 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2025-02-12 10:24:02 +00:00
|
|
|
llxHeaderVierge("");
|
2010-02-28 14:16:46 +00:00
|
|
|
|
2013-02-23 15:37:17 +00:00
|
|
|
$sql = "SELECT d.datedon as datedon, d.lastname, d.firstname, d.amount, d.public, d.societe";
|
2020-04-10 08:59:32 +00: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 19:31:45 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
$resql = $db->query($sql);
|
2021-02-26 17:58:34 +00:00
|
|
|
if ($resql) {
|
2010-08-14 02:44:07 +00:00
|
|
|
$num = $db->num_rows($resql);
|
2021-02-26 17:58:34 +00:00
|
|
|
if ($num) {
|
2024-12-15 01:02:14 +00:00
|
|
|
print '<table class="centpercent" cellspacing="0" cellpadding="4">';
|
2002-12-21 19:31:45 +00:00
|
|
|
|
2018-09-17 11:12:04 +00:00
|
|
|
print '<tr>';
|
2010-01-12 10:41:29 +00:00
|
|
|
print "<td>".$langs->trans("Name")." / ".$langs->trans("Company")."</td>";
|
|
|
|
|
print "<td>Date</td>";
|
2019-03-17 09:05:24 +00:00
|
|
|
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
2018-09-17 11:12:04 +00:00
|
|
|
print "</tr>\n";
|
2025-08-27 01:03:58 +00:00
|
|
|
$i = 0;
|
2021-02-26 17:58:34 +00:00
|
|
|
while ($i < $num) {
|
2010-08-14 02:44:07 +00:00
|
|
|
$objp = $db->fetch_object($resql);
|
2010-01-14 19:50:16 +00:00
|
|
|
|
2017-04-14 09:22:48 +00:00
|
|
|
print '<tr class="oddeven">';
|
2021-02-26 17:58:34 +00:00
|
|
|
if ($objp->public) {
|
2020-09-26 10:19:08 +00:00
|
|
|
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".dol_escape_htmltag($objp->societe)."</td>\n";
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2020-09-26 10:19:08 +00:00
|
|
|
print "<td>".$langs->trans("Anonymous")."</td>\n";
|
2010-01-14 19:50:16 +00:00
|
|
|
}
|
|
|
|
|
print "<td>".dol_print_date($db->jdate($objp->datedon))."</td>\n";
|
2025-11-18 11:03:23 +00:00
|
|
|
print '<td class="right">'.price($objp->amount).' '.$langs->trans("Currency".getDolCurrency()).'</td>';
|
2010-01-14 19:50:16 +00:00
|
|
|
print "</tr>";
|
|
|
|
|
$i++;
|
2010-01-12 10:41:29 +00:00
|
|
|
}
|
|
|
|
|
print "</table>";
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2020-09-26 10:19:08 +00:00
|
|
|
print $langs->trans("Donation");
|
2010-01-12 10:41:29 +00:00
|
|
|
}
|
2020-05-21 13:05:19 +00:00
|
|
|
} else {
|
2009-02-20 22:53:15 +00:00
|
|
|
dol_print_error($db);
|
2002-12-21 19:31:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-02-12 10:24:02 +00:00
|
|
|
llxFooterVierge();
|
2025-08-27 01:03:58 +00:00
|
|
|
$db->close();
|