Fix: Generation of donation receipts
This commit is contained in:
parent
b7e9ae5aaa
commit
8c870e6185
@ -15,18 +15,17 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/dons/fiche.php
|
||||
\ingroup don
|
||||
\brief Page de fiche de don
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/compta/dons/fiche.php
|
||||
* \ingroup don
|
||||
* \brief Page de fiche de don
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/dons/modules_don.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
@ -45,7 +44,6 @@ $mesg="";
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
|
||||
if ($_POST["amount"] > 0)
|
||||
{
|
||||
|
||||
@ -83,7 +81,6 @@ if ($_POST["action"] == 'update')
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
|
||||
if ($_POST["amount"] > 0)
|
||||
{
|
||||
$don = new Don($db);
|
||||
@ -162,13 +159,39 @@ if ($_GET["action"] == 'set_encaisse')
|
||||
/*
|
||||
* Générer ou regénérer le document
|
||||
*/
|
||||
if ($_GET['action'] == 'builddoc')
|
||||
if ($_REQUEST['action'] == 'builddoc')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/dons/modules_don.php");
|
||||
$result=don_create($db, $_GET['rowid']);
|
||||
$donation = new Don($db, 0, $_GET['rowid']);
|
||||
$donation->fetch($_GET['rowid']);
|
||||
|
||||
if ($_REQUEST['model'])
|
||||
{
|
||||
$donation->setDocModel($user, $_REQUEST['model']);
|
||||
}
|
||||
|
||||
$outputlangs = $langs;
|
||||
if (! empty($_REQUEST['lang_id']))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=don_create($db, $donation->id, '', $donation->modelpdf, $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dolibarr_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?rowid='.$donation->id.'#builddoc');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
@ -427,13 +450,13 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
|
||||
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
|
||||
// $delallowed=$user->rights->facture->supprimer;
|
||||
$genallowed=0;
|
||||
$genallowed=1;
|
||||
$delallowed=0;
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<br>';
|
||||
$formfile->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
||||
$formfile->show_documents('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
||||
|
||||
print '</td><td> </td>';
|
||||
|
||||
@ -446,5 +469,4 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@ -1261,6 +1261,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
else
|
||||
{
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'#builddoc');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -335,7 +335,7 @@ if ($modulepart)
|
||||
}
|
||||
|
||||
// Wrapping pour les dons
|
||||
if ($modulepart == 'don')
|
||||
if ($modulepart == 'donation')
|
||||
{
|
||||
$user->getrights('don');
|
||||
if ($user->rights->don->lire || eregi('^specimen',$original_file))
|
||||
|
||||
@ -259,6 +259,16 @@ class FormFile
|
||||
// ??
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'donation')
|
||||
{
|
||||
if (is_array($genallowed)) $modellist=$genallowed;
|
||||
else
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/dons/modules_don.php');
|
||||
$model=new ModeleDon();
|
||||
$modellist=$model->liste_modeles($this->db);
|
||||
}
|
||||
}
|
||||
else if ($modulepart == 'unpayed')
|
||||
{
|
||||
$modellist='';
|
||||
@ -337,7 +347,7 @@ class FormFile
|
||||
$relativepath=$file["name"]; // Cas general
|
||||
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture...
|
||||
// Autre cas
|
||||
if ($modulepart == 'don') { $relativepath = get_exdir($filename,2).$file["name"]; }
|
||||
if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; }
|
||||
if ($modulepart == 'export') { $relativepath = $file["name"]; }
|
||||
|
||||
if (!$iconPDF) print "<tr ".$bc[$var].">";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user