diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index 8031c2519dc..bf8a0afbd76 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -14,13 +14,12 @@ Cerfa No 11580 01 - Reçu de dons
- (Article 200-5 du Code Général des Impôts)
- + article 238 bis + __DonationReceipt__
+ __FrenchArticle__ - Numéro de référence du reçu + __DonationRef__ @@ -63,12 +62,12 @@
@@ -48,7 +47,7 @@
- Bénéficiaire des versements + __DonationRecipient__
- Nom ou dénomination :
+ __Name__ :
__MAIN_INFO_SOCIETE_NOM__
- Adresse :
+ __Address__ :
__MAIN_INFO_SOCIETE_ADRESSE__
- Code postal : __MAIN_INFO_SOCIETE_CP__
- Commune : __MAIN_INFO_SOCIETE_VILLE__
+ __Zip__ : __MAIN_INFO_SOCIETE_CP__
+ __Town__ : __MAIN_INFO_SOCIETE_VILLE__
@@ -82,7 +81,7 @@ - Donateur + __Donor__ @@ -98,12 +97,12 @@
- Nom :
+ __Name__ :
__DONATOR_NAME__
- Adresse :
+ __Address__ :
__DONATOR_ADDRESS__
- Code postal : __DONATOR_ZIP__
- Commune : __DONATOR_TOWN__
+ __Zip__ : __DONATOR_ZIP__
+ __Town__ : __DONATOR_TOWN__
@@ -116,9 +115,7 @@
- Le bénéficiaire reconnait avoir reçu au titre des - versements ouvrant droit à réduction d'impôt, la - somme de :
+ __IConfirmDonationReception__ :
@@ -126,15 +123,15 @@
- Date du versement : __DATE__
- Mode de versement : __PAYMENTMODE_LIB__
+ __DonationPaymentDate__ : __DATE__
+ __DonationPaymentMode__ : __PAYMENTMODE_LIB__
@@ -145,7 +142,7 @@


- Merci pour votre don. + __ThankYou__
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 9eed69b5637..e3e39d92322 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -82,6 +82,7 @@ class html_cerfafr extends ModeleDon $outputlangs->load("companies"); $outputlangs->load("bills"); $outputlangs->load("products"); + $outputlangs->load("donations"); if (! empty($conf->don->dir_output)) { @@ -136,6 +137,23 @@ class html_cerfafr extends ModeleDon $form = str_replace('__DONATOR_TOWN__',$don->ville,$form); $form = str_replace('__PAYMENTMODE_LIB__ ',$don->modepaiement,$form); $form = str_replace('__NOW__',dol_print_date($now,'',false,$outputlangs),$form); + $form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form); + $form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form); + $form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form); + $form = str_replace('__DonationPaymentDate__',$outputlangs->trans("DonationPaymentDate"),$form); + $form = str_replace('__DonationPaymentMode__',$outputlangs->trans("DonationPaymentMode"),$form); + $form = str_replace('__Name__',$outputlangs->trans("Name"),$form); + $form = str_replace('__Address__',$outputlangs->trans("Address"),$form); + $form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form); + $form = str_replace('__Town__',$outputlangs->trans("Town"),$form); + $form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form); + $form = str_replace('__Date__',$outputlangs->trans("Date"),$form); + $form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form); + $form = str_replace('__ThankYou__',$outputlangs->trans("ThankYou"),$form); + $form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form); + $frencharticle=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='(Article 200-5 du Code Général des Impôts)
+ article 238 bis'; + $form = str_replace('__FrenchArticle__',$frencharticle,$form); // Sauve fichier sur disque dol_syslog("html_cerfafr::write_file $file"); diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 73f6bdf2052..1f7d3f5c965 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -154,7 +154,15 @@ function don_create($db, $id, $message, $modele, $outputlangs) global $conf, $langs; $langs->load("bills"); - $dir = DOL_DOCUMENT_ROOT . "/core/modules/dons/"; + $eror=0; + + // Increase limit for PDF build + $err=error_reporting(); + error_reporting(0); + @set_time_limit(120); + error_reporting($err); + + $srctemplatepath=''; // Set template to use if (! dol_strlen($modele)) @@ -170,22 +178,51 @@ function don_create($db, $id, $message, $modele, $outputlangs) } } + // If selected modele is a filename template (then $modele="modelname:filename") + $tmp=explode(':',$modele,2); + if (! empty($tmp[1])) + { + $modele=$tmp[0]; + $srctemplatepath=$tmp[1]; + } + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array('/'); + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + foreach(array('html','doc','pdf') as $prefix) + { + $file = $prefix."_".preg_replace('/^html_/','',$modele).".modules.php"; + + // On verifie l'emplacement du modele + $file=dol_buildpath($reldir."core/modules/dons/".$file,0); + if (file_exists($file)) + { + $filefound=1; + $classname=$prefix.'_'.$modele; + break; + } + } + if ($filefound) break; + } + // Charge le modele - $file = $modele.".modules.php"; - if (file_exists($dir.$file)) - { + if ($filefound) + { + require_once $file; + $object=new Don($db); $object->fetch($id); - - require_once $dir.$file; $classname = $modele; - $module = new $classname($db); + $obj = new $classname($db); // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if ($module->write_file($object,$outputlangs) > 0) + if ($obj->write_file($object,$outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0) { $outputlangs->charset_output=$sav_charset_output; @@ -198,7 +235,7 @@ function don_create($db, $id, $message, $modele, $outputlangs) { $outputlangs->charset_output=$sav_charset_output; dol_syslog("Erreur dans don_create"); - dol_print_error($db,$module->error); + dol_print_error($db,$obj->error); return 0; } } diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 1bfb0a5d084..0618c99e695 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -2,6 +2,7 @@ CHARSET=UTF-8 Donation=Donation Donations=Donations +DonationRef=Donation ref. Donor=Donor Donors=Donors AddDonation=Add a donation @@ -21,7 +22,13 @@ DonationStatusPromiseNotValidatedShort=Draft DonationStatusPromiseValidatedShort=Validated DonationStatusPaidShort=Received ValidPromess=Validate promise +DonationReceipt=Donation receipt BuildDonationReceipt=Build receipt DonationsModels=Documents models for donation receipts LastModifiedDonations=Last %s modified donations -SearchADonation=Search a donation \ No newline at end of file +SearchADonation=Search a donation +DonationPaymentDate=Donation payment date +DonationPaymentMode=Donation payment mode +DonationRecipient=Donation recipient +ThankYou=Thank You +IConfirmDonationReception=The recipient declare reception, as a donation, of the following amount \ No newline at end of file diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index e78e254ae75..1e270d17f0b 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -2,6 +2,7 @@ CHARSET=UTF-8 Donation=Don Donations=Dons +DonationRef=Réf. donation Donor=Donateur Donors=Donateurs AddDonation=Ajouter don @@ -21,7 +22,13 @@ DonationStatusPromiseNotValidatedShort=Non validée DonationStatusPromiseValidatedShort=Validée DonationStatusPaidShort=Payé ValidPromess=Valider promesse +DonationReceipt=Reçu de dons BuildDonationReceipt=Créer reçu DonationsModels=Modèle de document de bon de réception de dons LastModifiedDonations=Les %s derniers dons modifiés -SearchADonation=Rechercher un don \ No newline at end of file +SearchADonation=Rechercher un don +DonationPaymentDate=Date du versement +DonationPaymentMode=Mode de versement +DonationRecipient=Bénéficiaire des versements +ThankYou=Merci +IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des versements ouvrant droit à réduction d'impôt, la somme de \ No newline at end of file
-
Date et signature
+
__Date__ __Signature__
__NOW__