From 84f1b8c02beaf304cc38f1ba5f9318de70c52f14 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Wed, 11 Jun 2014 12:22:24 +0200 Subject: [PATCH 01/16] Add customers/supplier status fo contact export When you export a contact list it's usefull to know if your contact is a prospect, client or supplier --- htdocs/core/modules/modSociete.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 5284f5ef55b39..ef5f73baae5d9 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -320,9 +320,9 @@ function __construct($db) $this->export_label[$r]='ExportDataset_company_2'; $this->export_icon[$r]='contact'; $this->export_permission[$r]=array(array("societe","contact","export")); - $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode"); - $this->export_TypeFields_array[$r]=array('c.civilite'=>"List:c_civilite:civilite:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text"); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company"); // We define here only fields that use another picto + $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1'); + $this->export_TypeFields_array[$r]=array('c.civilite'=>"List:c_civilite:civilite:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean"); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company"); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) { unset($this->export_fields_array[$r]['s.code_fournisseur']); From 81e715f34ca2001df4ac364d5d521a0b12622434 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Wed, 11 Jun 2014 12:26:54 +0200 Subject: [PATCH 02/16] Update modSociete.class.php --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index ef5f73baae5d9..4bc3bfbd139ba 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -321,7 +321,7 @@ function __construct($db) $this->export_icon[$r]='contact'; $this->export_permission[$r]=array(array("societe","contact","export")); $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1'); - $this->export_TypeFields_array[$r]=array('c.civilite'=>"List:c_civilite:civilite:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean"); + $this->export_TypeFields_array[$r]=array('c.civilite'=>"List:c_civilite:civilite:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Text",'s.fournisseur'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company"); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) { From 57b4cb08b7d2f69135316e3f296847b075931b52 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Wed, 11 Jun 2014 13:28:31 +0200 Subject: [PATCH 03/16] Update modSociete.class.php --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4bc3bfbd139ba..ee48e4d7ff727 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -320,7 +320,7 @@ function __construct($db) $this->export_label[$r]='ExportDataset_company_2'; $this->export_icon[$r]='contact'; $this->export_permission[$r]=array(array("societe","contact","export")); - $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1'); + $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'Customer 0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'Supplier 0 or 1'); $this->export_TypeFields_array[$r]=array('c.civilite'=>"List:c_civilite:civilite:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Text",'s.fournisseur'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company"); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) From 088d34b4b2a07f90ac6f46394a3ed499a0695ac1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 14 Jun 2014 06:10:52 +0200 Subject: [PATCH 04/16] Problem of merging --- .../class/bonprelevement.class.php | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 6840fcf139dcb..417f436200091 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1411,32 +1411,32 @@ function Generate() fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - $sql = "SELECT pl.amount"; - $sql.= " FROM"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; - $sql.= " ".MAIN_DB_PREFIX."facture as f,"; - $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; - $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql.= " AND pf.fk_facture = f.rowid"; - - //Lines - $i = 0; - $resql=$this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $this->total = $this->total + $obj->amount; - $i++; - } - } - else - { - $result = -2; + $sql = "SELECT pl.amount"; + $sql.= " FROM"; + $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql.= " ".MAIN_DB_PREFIX."facture as f,"; + $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql.= " AND pf.fk_facture = f.rowid"; + + //Lines + $i = 0; + $resql=$this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->total = $this->total + $obj->amount; + $i++; + } + } + else + { + $result = -2; } } From f4efd3b2e8bd9eea63037afe4f9f8e308c048899 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 15 Jun 2014 22:18:19 +0200 Subject: [PATCH 05/16] Move donation receipt to french model cerfa 11580*03 --- htdocs/admin/dons.php | 140 ++++++++++++++++++ htdocs/core/modules/dons/html_cerfafr.html | 77 ++++++---- .../modules/dons/html_cerfafr.modules.php | 88 ++++++++--- htdocs/core/modules/modDon.class.php | 59 ++++++-- htdocs/langs/fr_FR/donations.lang | 14 +- 5 files changed, 309 insertions(+), 69 deletions(-) diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index fbb89f4bfa20a..c81366bc5e91c 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 @@ } } +// 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 @@ $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 cd4c06e763c00..2dc9c72968c4e 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 e999124300eaa..b4cc2795c1a58 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 @@ function __construct($db) $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 @@ function write_file($don,$outputlangs) 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 @@ function write_file($don,$outputlangs) $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 @@ function write_file($don,$outputlangs) { $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 @@ function write_file($don,$outputlangs) } 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 @@ function write_file($don,$outputlangs) $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); - - // Sauve fichier sur disque + + $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); + + $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 @@ function write_file($don,$outputlangs) 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 931aa2ec325c9..1e4dfd2c9140d 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 @@ function __construct($db) $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 f8a71165842d2..9af7a87a12d6d 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 From ff31fff2d7a5248837d31edd7a6202b595a98d7e Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:34:18 +0200 Subject: [PATCH 06/16] Create box_task.php add boxes of tasks --- htdocs/core/boxes/box_task.php | 128 +++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 htdocs/core/boxes/box_task.php diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php new file mode 100644 index 0000000000000..6e3b73b65dbcc --- /dev/null +++ b/htdocs/core/boxes/box_task.php @@ -0,0 +1,128 @@ + + * 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 3 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, see . + */ + +/** + * \file htdocs/core/boxes/box_task.php + * \ingroup Projet + * \brief Module to Task activity of the current year + * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE + */ + +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); + +class box_task extends ModeleBoxes { + + var $boxcode="projet"; + var $boximg="object_projecttask"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_task() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + $this->boxlabel="Tasks"; + } + + /** + * \brief Charge les donnees en memoire pour affichage ulterieur + * \param $max Nombre maximum d'enregistrements a charger + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalDuree=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php"); + $taskstatic=new Task($db); + + + $textHead = $langs->trans("Tasks")." ".date("Y"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(pt.total_ht) as Mnttot, sum(pt.planned_workload) as Dureetot"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; + $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " GROUP BY pt.fk_statut "; + $sql.= " ORDER BY pt.fk_statut DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); + + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Tasks"), + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + ); + $totalnb += $objp->nb; + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->Dureetot,'all',25200,5)); + $totalDuree += $objp->Dureetot; + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objp->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $totalMnt += $objp->Mnttot; + + $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalDuree,'all',25200,5)); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); + + } + + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} +?> From c963a6d8a15b291522229f45ae3db3d7281bf6a5 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:36:00 +0200 Subject: [PATCH 07/16] Create box_project.php add box for project --- htdocs/core/boxes/box_project.php | 150 ++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 htdocs/core/boxes/box_project.php diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php new file mode 100644 index 0000000000000..206c54aafa055 --- /dev/null +++ b/htdocs/core/boxes/box_project.php @@ -0,0 +1,150 @@ + + * 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 3 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, see . + */ + +/** + * \file htdocs/core/boxes/box_activite.php + * \ingroup projet + * \brief Module to show Projet activity of the current Year + * \version $Id: box_projet.php,v 1.1 2012/09/11 Charles-François BENKE + */ + +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); + +class box_projet extends ModeleBoxes { + + var $boxcode="projet"; + var $boximg="object_projectpub"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_projet() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + + $this->boxlabel="Projet"; + } + + /** + * \brief Charge les donnees en memoire pour affichage ulterieur + * \param $max Nombre maximum d'enregistrements a charger + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalnbTask=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); + require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); + $projectstatic=new Project($db); + + + + $textHead = $langs->trans("Projet")." ".date("Y"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT p.fk_statut, count(p.rowid) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."projet as p"; + $sql.= ")"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND DATE_FORMAT(p.datec,'%Y') = ".date("Y")." "; + $sql.= " GROUP BY p.fk_statut "; + $sql.= " ORDER BY p.fk_statut DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); + + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$langs->trans("Project")." ".$projectstatic->LibStatut($objp->fk_statut,0) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Projects"), + 'url' => DOL_URL_ROOT."/projet/liste.php?mainmenu=project&viewstatut=".$objp->fk_statut + ); + $totalnb += $objp->nb; + + $sql = "SELECT sum(pt.total_ht) as Mnttot, count(*) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; + $sql.= " WHERE pt.fk_projet = p.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND (DATE_FORMAT(p.datec,'%Y') = ".date("Y").")"; + $sql.= " AND p.fk_statut=".$objp->fk_statut; + $resultTask = $db->query($sql); + if ($resultTask) + { + $objTask = $db->fetch_object($resultTask); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb , 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objTask->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + + $totalMnt += $objTask->Mnttot; + $totalnbTask += $objTask->nb; + } + else + { + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_trunc(number_format(0 , 0, ',', ' '),40)." ".$langs->trans("Currency".$conf->currency)); + } + $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $projectstatic->LibStatut($objp->fk_statut,3)); + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); + + } + + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} +?> From 66dc82621dc69a2b0bdd1ee6ca8d6345c841bb38 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:37:56 +0200 Subject: [PATCH 08/16] Update modProjet.class.php add boxe definition on projet module --- htdocs/core/modules/modProjet.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 0d8a09aa7e5aa..d9d2817759fce 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Charles-Fr BENKE * * 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 @@ -116,6 +117,11 @@ function __construct($db) // Boxes $this->boxes = array(); + $r=0; + $this->boxes[$r][1] = "box_project.php"; + $r++; + $this->boxes[$r][1] = "box_task.php"; + $r++; // Permissions $this->rights = array(); From 31c2815d0fee2934f167d19e37ff33d3855c2e87 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:50:17 +0200 Subject: [PATCH 09/16] Update box_task.php --- htdocs/core/boxes/box_task.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 6e3b73b65dbcc..1cdda61b766fc 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -71,9 +71,10 @@ function loadBox($max=5) if ($user->rights->projet->lire) { - $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(pt.total_ht) as Mnttot, sum(pt.planned_workload) as Dureetot"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; + $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " AND pt.rowid = ptt.fk_task"; $sql.= " GROUP BY pt.fk_statut "; $sql.= " ORDER BY pt.fk_statut DESC"; $sql.= $db->plimit($max, 0); @@ -98,10 +99,10 @@ function loadBox($max=5) 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut ); $totalnb += $objp->nb; - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->Dureetot,'all',25200,5)); - $totalDuree += $objp->Dureetot; - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objp->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); - $totalMnt += $objp->Mnttot; + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); + $totalplannedtot += $objp->plannedtot; + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); + $totaldurationtot += $objp->durationtot; $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); @@ -114,8 +115,8 @@ function loadBox($max=5) // Add the sum à the bottom of the boxes $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalDuree,'all',25200,5)); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); } From 754b028ec6c377a5711e72d42fc8d90ff37fd178 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 22:19:28 +0200 Subject: [PATCH 10/16] Update box_project.php --- htdocs/core/boxes/box_project.php | 36 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 206c54aafa055..9e5bca479f4be 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -66,21 +66,20 @@ function loadBox($max=5) - $textHead = $langs->trans("Projet")." ".date("Y"); + $textHead = $langs->trans("Projet"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders if ($user->rights->projet->lire) { - $sql = "SELECT p.fk_statut, count(p.rowid) as nb"; + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."projet as p"; $sql.= ")"; $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND s.entity = ".$conf->entity; - $sql.= " AND DATE_FORMAT(p.datec,'%Y') = ".date("Y")." "; - $sql.= " GROUP BY p.fk_statut "; - $sql.= " ORDER BY p.fk_statut DESC"; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -94,38 +93,36 @@ function loadBox($max=5) $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); $objp = $db->fetch_object($result); + $projectstatic->fetch($objp->rowid); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$langs->trans("Project")." ".$projectstatic->LibStatut($objp->fk_statut,0) + 'text' =>$projectstatic->getNomUrl(1) ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb." ".$langs->trans("Projects"), - 'url' => DOL_URL_ROOT."/projet/liste.php?mainmenu=project&viewstatut=".$objp->fk_statut + $this->info_box_contents[$i][2] = array('td' => 'align="left"', + 'text' => $objp->title ); - $totalnb += $objp->nb; - $sql = "SELECT sum(pt.total_ht) as Mnttot, count(*) as nb"; + $sql = "SELECT count(*) as nb, sum(progress) as totprogress"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE pt.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND (DATE_FORMAT(p.datec,'%Y') = ".date("Y").")"; - $sql.= " AND p.fk_statut=".$objp->fk_statut; $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb , 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objTask->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); - - $totalMnt += $objTask->Mnttot; + if ($objTask->nb > 0 ) + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb) , 0, ',', ' ')." % ".$langs->trans("Progress")); + else + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_trunc(number_format(0 , 0, ',', ' '),40)." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); } - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $projectstatic->LibStatut($objp->fk_statut,3)); $i++; } @@ -135,9 +132,8 @@ function loadBox($max=5) // Add the sum à the bottom of the boxes $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); } From ec1a6e1c29e5b0c316b3974ee840fa1b5f361b75 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:17:26 +0200 Subject: [PATCH 11/16] Update box_task.php --- htdocs/core/boxes/box_task.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 1cdda61b766fc..6dfe65d78d784 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -24,7 +24,11 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); -class box_task extends ModeleBoxes { +/** + * Class to manage the box to show last task + */ +class box_task extends ModeleBoxes +{ var $boxcode="projet"; var $boximg="object_projecttask"; @@ -38,6 +42,7 @@ class box_task extends ModeleBoxes { /** * \brief Constructeur de la classe + * @return void */ function box_task() { From 8070030c4576124f42b7d7d706069271bac10efe Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:19:57 +0200 Subject: [PATCH 12/16] Update box_project.php --- htdocs/core/boxes/box_project.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 9e5bca479f4be..237b5c0406473 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -23,9 +23,13 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); -class box_projet extends ModeleBoxes { +/** + * Class to manage the box to show last projet + */ +class box_project extends ModeleBoxes +{ - var $boxcode="projet"; + var $boxcode="project"; var $boximg="object_projectpub"; var $boxlabel; //var $depends = array("projet"); @@ -38,7 +42,7 @@ class box_projet extends ModeleBoxes { /** * \brief Constructeur de la classe */ - function box_projet() + function box_project() { global $langs; $langs->load("boxes"); @@ -49,7 +53,8 @@ function box_projet() /** * \brief Charge les donnees en memoire pour affichage ulterieur - * \param $max Nombre maximum d'enregistrements a charger + * @param int $max Maximum number of records to load + * @return void */ function loadBox($max=5) { @@ -103,10 +108,10 @@ function loadBox($max=5) 'text' => $objp->title ); - $sql = "SELECT count(*) as nb, sum(progress) as totprogress"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; - $sql.= " WHERE pt.fk_projet = p.rowid"; - $sql.= " AND p.entity = ".$conf->entity; + $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; + $sql.=" FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; + $sql.=" WHERE pt.fk_projet = p.rowid"; + $sql.=" AND p.entity = ".$conf->entity; $resultTask = $db->query($sql); if ($resultTask) { From a31d5cc193b4d880684e547751315c3e431ed831 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:38:15 +0200 Subject: [PATCH 13/16] Update box_project.php --- htdocs/core/boxes/box_project.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 237b5c0406473..2339a63c92f7f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -28,7 +28,6 @@ */ class box_project extends ModeleBoxes { - var $boxcode="project"; var $boximg="object_projectpub"; var $boxlabel; @@ -52,7 +51,8 @@ function box_project() } /** - * \brief Charge les donnees en memoire pour affichage ulterieur + * Load data for box to show them later + * * @param int $max Maximum number of records to load * @return void */ @@ -143,6 +143,13 @@ function loadBox($max=5) } + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ function showBox($head = null, $contents = null) { parent::showBox($this->info_box_head, $this->info_box_contents); From 24e780cb0c3904de1ecd3018a9e64dd2b70b1ce0 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:39:43 +0200 Subject: [PATCH 14/16] Update box_task.php --- htdocs/core/boxes/box_task.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 6dfe65d78d784..d850a7e01074d 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -52,10 +52,12 @@ function box_task() $this->boxlabel="Tasks"; } - /** - * \brief Charge les donnees en memoire pour affichage ulterieur - * \param $max Nombre maximum d'enregistrements a charger - */ + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; @@ -126,6 +128,13 @@ function loadBox($max=5) } + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ function showBox($head = null, $contents = null) { parent::showBox($this->info_box_head, $this->info_box_contents); From 496379ced895a6cee3017cf23f0a3574f218f03c Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:56:03 +0200 Subject: [PATCH 15/16] fix travis error --- htdocs/core/boxes/box_factures.php | 3 +-- htdocs/core/boxes/box_project.php | 14 ++++++-------- htdocs/core/boxes/box_task.php | 23 +++++++++++------------ 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 18d276b013057..23ab2df85569b 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -24,7 +24,6 @@ */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; - /** * Class to manage the box to show last invoices */ @@ -159,4 +158,4 @@ function showBox($head = null, $contents = null) } } - +?> \ No newline at end of file diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 2339a63c92f7f..e9cf2f242020f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -18,15 +18,13 @@ * \file htdocs/core/boxes/box_activite.php * \ingroup projet * \brief Module to show Projet activity of the current Year - * \version $Id: box_projet.php,v 1.1 2012/09/11 Charles-François BENKE */ - include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); /** * Class to manage the box to show last projet */ -class box_project extends ModeleBoxes +class box_project extends ModeleBoxes { var $boxcode="project"; var $boximg="object_projectpub"; @@ -51,11 +49,11 @@ function box_project() } /** - * Load data for box to show them later - * - * @param int $max Maximum number of records to load - * @return void - */ + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d850a7e01074d..a0accd74b3ae8 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -27,9 +27,8 @@ /** * Class to manage the box to show last task */ -class box_task extends ModeleBoxes +class box_task extends ModeleBoxes { - var $boxcode="projet"; var $boximg="object_projecttask"; var $boxlabel; @@ -41,9 +40,9 @@ class box_task extends ModeleBoxes var $info_box_contents = array(); /** - * \brief Constructeur de la classe - * @return void - */ + * \brief Constructeur de la classe + * @return void + */ function box_task() { global $langs; @@ -51,13 +50,13 @@ function box_task() $langs->load("projects"); $this->boxlabel="Tasks"; } - - /** - * Load data for box to show them later - * - * @param int $max Maximum number of records to load - * @return void - */ + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; From b34947b37cd5850ec4d0cb233ce84b642dfe7f2d Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Sat, 21 Jun 2014 00:08:13 +0200 Subject: [PATCH 16/16] fix travis error --- htdocs/core/boxes/box_project.php | 6 +++--- htdocs/core/boxes/box_task.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index e9cf2f242020f..5155c92b2517a 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -114,16 +114,16 @@ function loadBox($max=5) if ($resultTask) { $objTask = $db->fetch_object($resultTask); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb , 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); if ($objTask->nb > 0 ) - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb) , 0, ',', ' ')." % ".$langs->trans("Progress")); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')." % ".$langs->trans("Progress")); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index a0accd74b3ae8..20a0871bc7e42 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -41,6 +41,7 @@ class box_task extends ModeleBoxes /** * \brief Constructeur de la classe + * * @return void */ function box_task()