diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index fbb89f4bfa2..c81366bc5e9 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -109,6 +110,63 @@ else if ($action == 'del') } } +// Option +if ($action == 'set_DONATION_MESSAGE') +{ + $freemessage = GETPOST('DONATION_MESSAGE'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "DONATION_MESSAGE",$freemessage,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + +// Activate an article +else if ($action == 'setart200') { + $setart200 = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + + if (! $error) { + setEventMessage($langs->trans("SetupSaved"), 'mesgs'); + } else { + setEventMessage($langs->trans("Error"), 'mesgs'); + } +} +else if ($action == 'setart238') { + $setart238 = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + + if (! $error) { + setEventMessage($langs->trans("SetupSaved"), 'mesgs'); + } else { + setEventMessage($langs->trans("Error"), 'mesgs'); + } +} +else if ($action == 'setart885') { + $setart885 = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + + if (! $error) { + setEventMessage($langs->trans("SetupSaved"), 'mesgs'); + } else { + setEventMessage($langs->trans("Error"), 'mesgs'); + } +} + /* * View */ @@ -121,6 +179,88 @@ llxHeader('',$langs->trans("DonationsSetup"),'DonConfiguration'); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup'); +/* + * Params + */ +print_titre($langs->trans("Options")); + +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$var=! $var; +print ''; +print ''; +print ''; +print '\n"; +print "
'.$langs->trans("Parameter").' 
'; +print $langs->trans("FreeTextOnDonations").'
'; +print ''; +print '
'; +print ''; +print "
\n"; +print ''; + +/* + * French params + */ +if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR") +{ + print '
'; + print_titre($langs->trans("FrenchOptions")); + + print ''; + print ''; + print ''; + print "\n"; + + $var=!$var; + print ""; + print ''; + if (! empty($conf->global->DONATION_ART200)) { + print ''; + } else { + print ''; + } + print ''; + + $var=!$var; + print ""; + print ''; + if (! empty($conf->global->DONATION_ART238)) { + print ''; + } else { + print ''; + } + print ''; + + $var=!$var; + print ""; + print ''; + if (! empty($conf->global->DONATION_ART885)) { + print ''; + } else { + print ''; + } + print ''; + print "
' . $langs->trans('Parameters') . '
' . $langs->trans("DONATION_ART200") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("DONATION_ART238") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("DONATION_ART885") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
\n"; +} + // Document templates print '
'; print_titre($langs->trans("DonationsModels")); diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index cd4c06e763c..2dc9c72968c 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -2,7 +2,7 @@ - __DonationReceipt__ + __DonationTitle__ @@ -11,10 +11,10 @@ - + @@ -25,7 +25,6 @@
Cerfa No 11580 01Cerfa N° 11580*03 - __DonationReceipt__
+ __DonationReceipt__
__FrenchArticle__
-
No: __REF__
@@ -37,9 +36,6 @@
-
-
-
@@ -74,6 +70,10 @@
+ +
+
+ +
@@ -93,25 +93,29 @@ +
- - - - - -
- __Name__ :
- __DONATOR_FIRSTNAME__ __DONATOR_LASTNAME__
- __Address__ :
- __DONATOR_ADDRESS__
- __Zip__ : __DONATOR_ZIP__
- __Town__ : __DONATOR_TOWN__
-
- -
+ + + +
+ __Name__ :
+ __DONATOR_FIRSTNAME__ __DONATOR_LASTNAME__
+ __Address__ :
+ __DONATOR_ADDRESS__
+ __Zip__ : __DONATOR_ZIP__
+ __Town__ : __DONATOR_TOWN__
+
+
+
+
+ +
+
@@ -119,20 +123,31 @@
- __AMOUNT__ __CURRENCY__ + + __AMOUNT__ __CURRENCY__ +
- __DatePayment__ : __DATE__
+ __DonationDatePayment__ : __DATE__
__PaymentMode__ : __PAYMENTMODE_LIB__
- +
+ + + +
+
+ __Message__ : + __DonationMessage__
+
+ + -
-

- __ThankYou__ - +
+ __FrenchEligibility__
+ __ARTICLE200__ __ARTICLE238__ __ARTICLE885__
@@ -142,8 +157,8 @@
-
__Date__ __Signature__
- __NOW__ +
__Date__ & __Signature__
+
__NOW__
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index e999124300e..b4cc2795c1a 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2006 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Marcos García + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -19,9 +20,9 @@ */ /** - * \file htdocs/core/modules/dons/html_cerfafr.modules.php - * \ingroup don - * \brief Formulaire de don + * \file htdocs/core/modules/dons/html_cerfafr.modules.php + * \ingroup don + * \brief Form of donation */ require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php'; require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php'; @@ -44,9 +45,9 @@ class html_cerfafr extends ModeleDon $this->db = $db; $this->name = "cerfafr"; - $this->description = $langs->trans('DonationsReceiptModel'); + $this->description = $langs->trans('DonationsReceiptModel').' - fr_FR - Cerfa 11580*03'; - // Dimension page pour format A4 + // Dimension page for size A4 $this->type = 'html'; } @@ -87,7 +88,7 @@ class html_cerfafr extends ModeleDon if (! empty($conf->don->dir_output)) { - // Definition de l'objet $don (pour compatibilite ascendante) + // Definition of the object don (for upward compatibility) if (! is_object($don)) { $don = new Don($this->db); @@ -95,7 +96,7 @@ class html_cerfafr extends ModeleDon $id=$don->id; } - // Definition de $dir et $file + // Definition of $dir and $file if (! empty($don->specimen)) { $dir = $conf->don->dir_output; @@ -121,8 +122,8 @@ class html_cerfafr extends ModeleDon { $formclass = new Form($this->db); - //This is not the proper way to do it but $formclass->form_modes_reglement - //prints the translation instead of returning it + // This is not the proper way to do it but $formclass->form_modes_reglement + // prints the translation instead of returning it if ($don->modepaiementid) { $formclass->load_cache_types_paiements(); @@ -130,7 +131,7 @@ class html_cerfafr extends ModeleDon } else $paymentmode = ''; - // Defini contenu + // Define contents $donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html"; $form = implode('', file($donmodel)); $form = str_replace('__REF__',$don->id,$form); @@ -143,32 +144,79 @@ class html_cerfafr extends ModeleDon $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form); $form = str_replace('__MAIN_INFO_SOCIETE_ZIP__',$mysoc->zip,$form); $form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form); - $form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form); + $form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form); $form = str_replace('__DONATOR_LASTNAME__',$don->lastname,$form); $form = str_replace('__DONATOR_ADDRESS__',$don->address,$form); $form = str_replace('__DONATOR_ZIP__',$don->zip,$form); $form = str_replace('__DONATOR_TOWN__',$don->town,$form); $form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form); - $form = str_replace('__NOW__',dol_print_date($now,'',false,$outputlangs),$form); + $form = str_replace('__NOW__',dol_print_date($now,'day',false,$outputlangs),$form); $form = str_replace('__DonationRef__',$outputlangs->trans("DonationRef"),$form); + $form = str_replace('__DonationTitle__',$outputlangs->trans("DonationTitle"),$form); $form = str_replace('__DonationReceipt__',$outputlangs->trans("DonationReceipt"),$form); $form = str_replace('__DonationRecipient__',$outputlangs->trans("DonationRecipient"),$form); - $form = str_replace('__DatePayment__',$outputlangs->trans("DatePayment"),$form); - $form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$form); + $form = str_replace('__DonationDatePayment__',$outputlangs->trans("DonationDatePayment"),$form); + $form = str_replace('__PaymentMode__',$outputlangs->trans("PaymentMode"),$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('__Object__',$outputlangs->trans("Object"),$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('__Message__',$outputlangs->trans("Message"),$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('__DonationMessage__',$conf->global->DONATION_MESSAGE,$form); + + $frencharticle=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 885-0 V bis A du code général des impôts (CGI)'; $form = str_replace('__FrenchArticle__',$frencharticle,$form); + + $frencheligibility=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; + $form = str_replace('__FrenchEligibility__',$frencheligibility,$form); + + $art200=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART200 >= 1) + { + $art200='200 du CGI'; + } + else + { + $art200='200 du CGI'; + } + } + $form = str_replace('__ARTICLE200__',$art200,$form); - // Sauve fichier sur disque + $art238=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART238 >= 1) + { + $art238='238 bis du CGI'; + } + else + { + $art238='238 bis du CGI'; + } + } + $form = str_replace('__ARTICLE238__',$art238,$form); + + $art885=''; + if (preg_match('/fr/i',$outputlangs->defaultlang)) { + if ($conf->global->DONATION_ART885 >= 1) + { + $art885='885-0 V bis du CGI'; + } + else + { + $art885='885-0 V bis du CGI'; + } + } + $form = str_replace('__ARTICLE885__',$art885,$form); + + // Save file on disk dol_syslog("html_cerfafr::write_file $file"); $handle=fopen($file,"w"); fwrite($handle,$form); @@ -190,7 +238,7 @@ class html_cerfafr extends ModeleDon return 0; } $this->error=$langs->trans("ErrorUnknown"); - return 0; // Erreur par defaut + return 0; // Error by default } } diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 931aa2ec325..1e4dfd2c914 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -19,17 +20,17 @@ /** * \defgroup don Module donation - * \brief Module pour gerer le suivi des dons + * \brief Module to manage the follow-up of the donations * \file htdocs/core/modules/modDon.class.php * \ingroup don - * \brief Fichier de description et activation du module Don + * \brief Description and activation file for module Donation */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; /** - * Classe de description et activation du module Don + * Class to describe and enable module Donation */ class modDon extends DolibarrModules { @@ -66,15 +67,43 @@ class modDon extends DolibarrModules $this->config_page_url = array("dons.php"); // Constants - $this->const = array(); - $r=0; - - $this->const[$r][0] = "DON_ADDON_MODEL"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "html_cerfafr"; - $this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons'; - $this->const[$r][4] = 0; - $r++; + $this->const = array (); + + $this->const[1] = array ( + "DON_ADDON_MODEL", + "chaine", + "html_cerfafr", + "Nom du gestionnaire de generation de recu de dons", + "0" + ); + $this->const[2] = array ( + "DONATION_ART200", + "yesno", + "0", + "Option Française - Eligibilité Art200 du CGI", + "0" + ); + $this->const[3] = array ( + "DONATION_ART238", + "yesno", + "0", + "Option Française - Eligibilité Art238 bis du CGI", + "0" + ); + $this->const[4] = array ( + "DONATION_ART885", + "yesno", + "0", + "Option Française - Eligibilité Art885-0 V bis du CGI", + "0" + ); + $this->const[5] = array ( + "DONATION_MESSAGE", + "chaine", + "Thank you", + "Message affiché sur le récépissé de versements ou dons", + "0" + ); // Boxes $this->boxes = array(); diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index f8a71165842..9af7a87a12d 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -1,7 +1,7 @@ # Dolibarr language file - Source file is en_US - donations Donation=Don Donations=Dons -DonationRef=Réf. donation +DonationRef=Numéro d'ordre du reçu Donor=Donateur Donors=Donateurs AddDonation=Ajouter don @@ -22,11 +22,19 @@ DonationStatusPromiseNotValidatedShort=Non validée DonationStatusPromiseValidatedShort=Validée DonationStatusPaidShort=Payé ValidPromess=Valider promesse -DonationReceipt=Reçu de dons +DonationTitle=Reçu au titre des dons +DonationReceipt=Reçu au titre des dons
à certains organismes d'intéret général +DonationDatePayment=Date de versement ou du don BuildDonationReceipt=Créer reçu DonationsModels=Modèles de documents de bon de réception de dons LastModifiedDonations=Les %s derniers dons modifiés SearchADonation=Rechercher un don 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 +FreeTextOnDonations=Message affiché sur le récépissé de versements ou dons +IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt, la somme de +# French Options +FrenchOptions=Options éligibles en France +DONATION_ART200=Les dons ou versements reçus sont éligibles à l'article 200 du CGI +DONATION_ART238=Les dons ou versements reçus sont éligibles à l'article 238bis du CGI +DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI \ No newline at end of file