Gestion de la generation du recu de don.
Possibilit d'avoir des modules de generation HTML plutot que PDF.
This commit is contained in:
parent
4cbf193654
commit
f2a8840a60
@ -418,7 +418,30 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
|||||||
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$don->id&action=delete\">".$langs->trans("Delete")."</a>";
|
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$don->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div><br>";
|
print "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Documents générés
|
||||||
|
*/
|
||||||
|
$filename=sanitize_string($don->id);
|
||||||
|
$filedir=$conf->don->dir_output . '/' . get_exdir($filename);
|
||||||
|
$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;
|
||||||
|
$delallowed=0;
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
$html->show_documents('don',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
||||||
|
|
||||||
|
print '</td><td> </td>';
|
||||||
|
|
||||||
|
print '</tr></table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -339,7 +339,7 @@ if ($socid > 0)
|
|||||||
print "<td align=\"right\">".price($objp->total_ttc)."</td>\n";
|
print "<td align=\"right\">".price($objp->total_ttc)."</td>\n";
|
||||||
|
|
||||||
$fac = new Facture($db);
|
$fac = new Facture($db);
|
||||||
print "<td align=\"center\">".($fac->LibStatut($objp->paye,$objp->statut))."</td>\n";
|
print "<td align=\"center\">".($fac->LibStatut($objp->paye,$objp->statut,1))."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,8 +38,10 @@ function llxHeader() { }
|
|||||||
|
|
||||||
$original_file = urldecode($_GET["file"]);
|
$original_file = urldecode($_GET["file"]);
|
||||||
$modulepart = urldecode($_GET["modulepart"]);
|
$modulepart = urldecode($_GET["modulepart"]);
|
||||||
$type = urldecode($_GET["type"]);
|
// Défini type et attachment
|
||||||
if (! $type) $type='application/pdf';
|
$type = urldecode($_GET["type"]); $attachment = true;
|
||||||
|
if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; }
|
||||||
|
if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; }
|
||||||
|
|
||||||
//Suppression de la chaine de caractère ../ dans $original_file
|
//Suppression de la chaine de caractère ../ dans $original_file
|
||||||
$original_file = str_replace("../","/", "$original_file");
|
$original_file = str_replace("../","/", "$original_file");
|
||||||
@ -171,6 +173,17 @@ if ($modulepart)
|
|||||||
$original_file=$conf->produit->dir_output.'/'.$original_file;
|
$original_file=$conf->produit->dir_output.'/'.$original_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapping pour les factures
|
||||||
|
if ($modulepart == 'don')
|
||||||
|
{
|
||||||
|
$user->getrights('don');
|
||||||
|
if ($user->rights->don->lire)
|
||||||
|
{
|
||||||
|
$accessallowed=1;
|
||||||
|
}
|
||||||
|
$original_file=$conf->don->dir_output.'/'.$original_file;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limite accès si droits non corrects
|
// Limite accès si droits non corrects
|
||||||
@ -195,8 +208,8 @@ if (! file_exists($original_file))
|
|||||||
// Les drois sont ok et fichier trouvé, on l'envoie
|
// Les drois sont ok et fichier trouvé, on l'envoie
|
||||||
dolibarr_syslog("document.php download $filename content-type=$type");
|
dolibarr_syslog("document.php download $filename content-type=$type");
|
||||||
|
|
||||||
header('Content-type: '.$type);
|
if ($type) header('Content-type: '.$type);
|
||||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||||
|
|
||||||
// Ajout directives pour résoudre bug IE
|
// Ajout directives pour résoudre bug IE
|
||||||
header('Cache-Control: Public, must-revalidate');
|
header('Cache-Control: Public, must-revalidate');
|
||||||
|
|||||||
@ -1284,12 +1284,13 @@ class Facture
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
|
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
|
||||||
* \return string Libell
|
* \param mode 0=libellé long, 1=libellé court
|
||||||
*/
|
* \return string Libelle
|
||||||
function getLibStatut()
|
*/
|
||||||
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->paye,$this->statut);
|
return $this->LibStatut($this->paye,$this->statut,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1748,7 +1748,7 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
|
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
|
||||||
* \param modulepart propal=propal, facture=facture, ...
|
* \param modulepart propal=propal, facture=facture, ...
|
||||||
* \param filename Nom fichier
|
* \param filename Nom fichier sans extension
|
||||||
* \param filedir Repertoire à scanner
|
* \param filedir Repertoire à scanner
|
||||||
* \param urlsource Url page origine
|
* \param urlsource Url page origine
|
||||||
* \param genallowed Génération autorisée
|
* \param genallowed Génération autorisée
|
||||||
@ -1765,9 +1765,12 @@ class Form
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$filename = sanitize_string($filename);
|
$filename = sanitize_string($filename);
|
||||||
if ($modulepart != 'expedition') $relativepath = "${filename}/${filename}.pdf";
|
// Par defaut
|
||||||
else $relativepath = get_exdir("${filename}")."${filename}.pdf";
|
$extension = 'pdf'; $relativepath = "${filename}/${filename}.${extension}";
|
||||||
|
// Autre cas
|
||||||
|
if ($modulepart == 'expedition') { $extension='pdf'; $relativepath = get_exdir("${filename}")."${filename}.pdf"; }
|
||||||
|
if ($modulepart == 'don') { $extension='html'; $relativepath = get_exdir("${filename}")."${filename}.html"; }
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
if (is_dir($filedir))
|
if (is_dir($filedir))
|
||||||
{
|
{
|
||||||
@ -1775,9 +1778,8 @@ class Form
|
|||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
// Si fichier non lisible ou non .pdf, on passe au suivant
|
// Si fichier non lisible ou non .pdf, on passe au suivant
|
||||||
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue;
|
if (! is_readable($filedir."/".$file) || ! eregi('\.'.$extension.'$',$file)) continue;
|
||||||
|
|
||||||
|
|
||||||
if ($i==0)
|
if ($i==0)
|
||||||
{
|
{
|
||||||
// Affiche en-tete tableau
|
// Affiche en-tete tableau
|
||||||
@ -1818,9 +1820,11 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>';
|
$mimetype=strtoupper($extension);
|
||||||
else print '<td nowrap>PDF</td>';
|
if ($extension == 'pdf') $mimetype='PDF';
|
||||||
|
if ($extension == 'html') $mimetype='HTML';
|
||||||
|
if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé';
|
||||||
|
print '<td nowrap>'.$mimetype.'</td>';
|
||||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a></td>';
|
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a></td>';
|
||||||
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
|
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
|
||||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
|
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
|
||||||
|
|||||||
187
htdocs/includes/modules/dons/html_cerfafr.html
Normal file
187
htdocs/includes/modules/dons/html_cerfafr.html
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
|
<title>FSFE France - Formulaire</title>
|
||||||
|
</head>
|
||||||
|
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
|
||||||
|
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
|
||||||
|
|
||||||
|
<p></p>
|
||||||
|
<p></p>
|
||||||
|
<p></p>
|
||||||
|
<p></p>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#ffffff">
|
||||||
|
<tr>
|
||||||
|
<td width="20%" nowrap>Cerfa No 11580 01</td>
|
||||||
|
<td nowrap>
|
||||||
|
<center>
|
||||||
|
<font size="+2">Reçu dons aux oeuvres</font>
|
||||||
|
<br>
|
||||||
|
<font size="+1">
|
||||||
|
<b>(Article 200-5 du Code Général des Impôts)</b>
|
||||||
|
</font>
|
||||||
|
<br>
|
||||||
|
+ article 238 bis
|
||||||
|
</center>
|
||||||
|
</td>
|
||||||
|
<td width="15%" nowrap>
|
||||||
|
<center>
|
||||||
|
Numéro d'ordre du reçu<p></p>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom" align="center">
|
||||||
|
<table border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr>
|
||||||
|
<td width="100" height="20">
|
||||||
|
No: __REF__
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p></p>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom">
|
||||||
|
<table width="100%" border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr bgcolor="#e0e0e0" align="center">
|
||||||
|
<td nowrap>
|
||||||
|
<font size="+2">
|
||||||
|
<b>Bénéficiaire des versements</b>
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom">
|
||||||
|
<table width="100%" border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<b>Nom ou dénomination :</b>
|
||||||
|
<br>
|
||||||
|
Free Software Foundation Europe Chapter France (FSF France) <br>
|
||||||
|
<b>Adresse :</b>
|
||||||
|
<br>
|
||||||
|
<b>No</b> 8 <b>Rue</b> de Valois <br>
|
||||||
|
<b>Code postal</b> 75001 <b>Commune</b> Paris <br>
|
||||||
|
<b>Objet</b> : <br>
|
||||||
|
Le soutien à tous les organismes d'Etat et privés dans
|
||||||
|
toutes les questions de Logiciels Libres, la
|
||||||
|
collaboration coordonnée avec les associations
|
||||||
|
nationales poursuivant les mêmes objectifs et avec la
|
||||||
|
FSF Europe, le soutien de projets développant des
|
||||||
|
Logiciels Libres, la dissémination des idéaux
|
||||||
|
philosophiques des Logiciels Libres. La FSF France se
|
||||||
|
dédie aux seules et immédiates finalités scientifiques
|
||||||
|
et d'utilité publique.
|
||||||
|
<p></p>
|
||||||
|
<b>Organisme d'intérêt général ayant un caractère
|
||||||
|
scientifique et éducatif.</b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p></p>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom">
|
||||||
|
<table width="100%" border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr bgcolor="#e0e0e0" align="center">
|
||||||
|
<td nowrap>
|
||||||
|
<font size="+2">
|
||||||
|
<b>Donateur</b>
|
||||||
|
</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom">
|
||||||
|
<table width="100%" border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<b>Nom :</b>
|
||||||
|
aaa aaa aaaa<br>
|
||||||
|
<b>Adresse :</b>aaa<br>
|
||||||
|
<b>No</b> ______ <b>Rue</b> _________________________________<br>
|
||||||
|
<b>Code postal</b> aa <b>Commune</b> aa<br>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p></p>
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom">
|
||||||
|
<table width="100%" border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Le bénéficiaire reconnait avoir reçu au titre des
|
||||||
|
versements ouvrant droit à réduction d'impôt, la
|
||||||
|
somme de : <br>
|
||||||
|
<table width="100%">
|
||||||
|
<tr align="center">
|
||||||
|
<td>
|
||||||
|
50.00 euros
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
Somme en toutes lettres (<b>CurrencyEUR</b>): Cinquante euros <br>
|
||||||
|
Date du paiement : 11 novembre 2005 <br>
|
||||||
|
Mode de versement :
|
||||||
|
<table width="100%">
|
||||||
|
<tr align="center">
|
||||||
|
<td valign="top"><strike>Numéraire</strike> </td>
|
||||||
|
<td valign="top">
|
||||||
|
<strike>Chèque ou virement</strike> </td>
|
||||||
|
<td valign="top">
|
||||||
|
( Autres ) </td>
|
||||||
|
<td align="right">
|
||||||
|
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#000000">
|
||||||
|
<tr>
|
||||||
|
<td valign="bottom" align="center">
|
||||||
|
<table border="0" bgcolor="#ffffff" cellspacing="0" cellpadding="3">
|
||||||
|
<tr>
|
||||||
|
<td width="200" height="100" valign="top">
|
||||||
|
<center>Date et signature</center>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
109
htdocs/includes/modules/dons/html_cerfafr.modules.php
Normal file
109
htdocs/includes/modules/dons/html_cerfafr.modules.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* 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 2 of the License, or
|
||||||
|
* (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
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/includes/dons/html_cerfafr.php
|
||||||
|
\ingroup don
|
||||||
|
\brief Formulaire de don
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/master.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/projetdon.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\class html_cerfafr
|
||||||
|
\brief Classe permettant de générer les propales au modèle Azur
|
||||||
|
*/
|
||||||
|
|
||||||
|
class html_cerfafr extends ModeleDon
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
\brief Constructeur
|
||||||
|
\param db Handler accès base de donnée
|
||||||
|
*/
|
||||||
|
function html_cerfafr($db)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
$this->name = "cerfafr";
|
||||||
|
$this->description = "Modèle de reçu de dons";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Renvoi dernière erreur
|
||||||
|
\return string Dernière erreur
|
||||||
|
*/
|
||||||
|
function pdferror()
|
||||||
|
{
|
||||||
|
return $this->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Fonction générant le recu sur le disque
|
||||||
|
\param id Id du recu à générer
|
||||||
|
\return int >0 si ok, <0 si ko
|
||||||
|
*/
|
||||||
|
function write_file($id)
|
||||||
|
{
|
||||||
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
$don = new Don($this->db);
|
||||||
|
$don->fetch($id);
|
||||||
|
|
||||||
|
$filename = sanitize_string($don->id);
|
||||||
|
$dir = $conf->don->dir_output . "/" . get_exdir("${filename}");
|
||||||
|
$file = $dir . "/" . $filename . ".html";
|
||||||
|
|
||||||
|
if (! is_dir($dir))
|
||||||
|
{
|
||||||
|
if (create_exdir($dir) < 0)
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defini contenu
|
||||||
|
$donmodel=DOL_DOCUMENT_ROOT ."/includes/modules/dons/html_cerfafr.html";
|
||||||
|
$html = implode('', file($donmodel));
|
||||||
|
$html = eregi_replace('__REF__',$this->id,$html);
|
||||||
|
$html = eregi_replace('__DATE__',strftime("%d/%b/%Y %H:%m:%s",mktime()),$html);
|
||||||
|
$html = eregi_replace('__IP__',$user->ip,$html);
|
||||||
|
|
||||||
|
// Sauve fichier sur disque
|
||||||
|
dolibarr_syslog("html_cerfafr::write_file $file");
|
||||||
|
$handle=fopen($file,"w");
|
||||||
|
fwrite($handle,$html);
|
||||||
|
fclose($handle);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
216
htdocs/includes/modules/dons/modules_don.php
Normal file
216
htdocs/includes/modules/dons/modules_don.php
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
|
*
|
||||||
|
* 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 2 of the License, or
|
||||||
|
* (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
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/includes/modules/dons/modules_don.php
|
||||||
|
\ingroup don
|
||||||
|
\brief Fichier contenant la classe mère de generation des dons
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once(FPDF_PATH.'fpdf.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\class ModeleDon
|
||||||
|
\brief Classe mère des modèles de dons
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ModeleDon extends FPDF
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi le dernier message d'erreur de création de facture
|
||||||
|
*/
|
||||||
|
function pdferror()
|
||||||
|
{
|
||||||
|
return $this->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Renvoi la liste des modèles actifs
|
||||||
|
* \param db Handler de base
|
||||||
|
*/
|
||||||
|
function liste_modeles($db)
|
||||||
|
{
|
||||||
|
$liste=array();
|
||||||
|
$sql ="";
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$liste[$row[0]]=$row[1];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\class ModeleNumRefDons
|
||||||
|
\brief Classe mère des modèles de numérotation des références de facture
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ModeleNumRefDons
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||||
|
* \return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("bills");
|
||||||
|
return $langs->trans("NoDescription");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoi un exemple de numérotation
|
||||||
|
* \return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("bills");
|
||||||
|
return $langs->trans("NoExample");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||||
|
* de conflits qui empechera cette numérotation de fonctionner.
|
||||||
|
* \return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoi prochaine valeur attribuée
|
||||||
|
* \return string Valeur
|
||||||
|
*/
|
||||||
|
function getNextValue()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
return $langs->trans("NotAvailable");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Crée un don sur disque en fonction du modèle de DON_ADDON_PDF
|
||||||
|
\param db objet base de donnée
|
||||||
|
\param donid id de la facture à créer
|
||||||
|
\param message message
|
||||||
|
\return int 0 si KO, 1 si OK
|
||||||
|
*/
|
||||||
|
function don_create($db, $donid, $message="")
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
define("DON_ADDON",'html_cerfafr');
|
||||||
|
|
||||||
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/";
|
||||||
|
|
||||||
|
if (defined("DON_ADDON") && DON_ADDON)
|
||||||
|
{
|
||||||
|
$file = DON_ADDON.".modules.php";
|
||||||
|
|
||||||
|
$classname = DON_ADDON;
|
||||||
|
require_once($dir.$file);
|
||||||
|
|
||||||
|
$obj = new $classname($db);
|
||||||
|
|
||||||
|
$obj->message = $message;
|
||||||
|
|
||||||
|
if ( $obj->write_file($donid) > 0)
|
||||||
|
{
|
||||||
|
// Succès de la création de la facture. On génère le fichier meta
|
||||||
|
don_meta_create($db, $donid);
|
||||||
|
|
||||||
|
// et on supprime l'image correspondant au preview
|
||||||
|
don_delete_preview($db, $donid);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Erreur dans don_create");
|
||||||
|
dolibarr_print_error($db,$obj->pdferror());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("Error_DON_ADDON_PDF_NotDefined");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Créé un meta fichier à côté de la facture sur le disque pour faciliter les recherches en texte plein. Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de connexion internet "rapide" pour retrouver en 2 secondes une facture non payée ou compliquée à gérer ... avec un rgrep c'est vite fait bien fait [eric seigne]
|
||||||
|
\param db Objet base de donnée
|
||||||
|
\param donid Id du don à créer
|
||||||
|
\param message Message
|
||||||
|
*/
|
||||||
|
function don_meta_create($db, $donid, $message="")
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
$don = new Don($db);
|
||||||
|
$don->id=$donid;
|
||||||
|
$don->fetch($donid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Supprime l'image de prévisualitation, pour le cas de régénération de facture
|
||||||
|
\param db Objet base de donnée
|
||||||
|
\param donid Id du don
|
||||||
|
*/
|
||||||
|
function don_delete_preview($db, $donid)
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
$don = new Don($db);
|
||||||
|
$don->id=$donid;
|
||||||
|
$don->fetch($donid);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -244,6 +244,8 @@ $conf->banque->dir_output=DOL_DATA_ROOT."/banque";
|
|||||||
$conf->banque->dir_images=DOL_DATA_ROOT."/banque/images";
|
$conf->banque->dir_images=DOL_DATA_ROOT."/banque/images";
|
||||||
$conf->caisse->enabled=defined("MAIN_MODULE_CAISSE")?MAIN_MODULE_CAISSE:0;
|
$conf->caisse->enabled=defined("MAIN_MODULE_CAISSE")?MAIN_MODULE_CAISSE:0;
|
||||||
$conf->don->enabled=defined("MAIN_MODULE_DON")?MAIN_MODULE_DON:0;
|
$conf->don->enabled=defined("MAIN_MODULE_DON")?MAIN_MODULE_DON:0;
|
||||||
|
$conf->don->dir_output=DOL_DATA_ROOT."/dons";
|
||||||
|
$conf->don->dir_images=DOL_DATA_ROOT."/dons/images";
|
||||||
$conf->syslog->enabled=defined("MAIN_MODULE_SYSLOG")?MAIN_MODULE_SYSLOG:0;
|
$conf->syslog->enabled=defined("MAIN_MODULE_SYSLOG")?MAIN_MODULE_SYSLOG:0;
|
||||||
$conf->fournisseur->enabled=defined("MAIN_MODULE_FOURNISSEUR")?MAIN_MODULE_FOURNISSEUR:0;
|
$conf->fournisseur->enabled=defined("MAIN_MODULE_FOURNISSEUR")?MAIN_MODULE_FOURNISSEUR:0;
|
||||||
$conf->fichinter->enabled=defined("MAIN_MODULE_FICHEINTER")?MAIN_MODULE_FICHEINTER:0;
|
$conf->fichinter->enabled=defined("MAIN_MODULE_FICHEINTER")?MAIN_MODULE_FICHEINTER:0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user