From 7f5933adbc9f839d7f5be7a7df002743fed3357c Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Wed, 23 Oct 2019 15:57:56 +0200 Subject: [PATCH 01/82] FIX shipping extrafields line --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e24198b9920..be5ed4c757a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -306,7 +306,7 @@ if (empty($reshook)) // Extrafields $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options[$i] = $extrafieldsline->getOptionalsFromPost($extralabelsline, $i); + $array_options[$i] = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $i); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -632,7 +632,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $line->array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $line->array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { From dae475bac1164e09882664c6b1596c0e16121c95 Mon Sep 17 00:00:00 2001 From: com4WEB <42214196+com4WEB@users.noreply.github.com> Date: Tue, 29 Oct 2019 12:37:08 +0100 Subject: [PATCH 02/82] Update ChangeLog some text erros in changelog --- ChangeLog | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c430b258cda..9cb2225cd08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,7 +22,6 @@ FIX: Clean the + of categories on the product view only in POS module FIX: access to public interface when origin email has an alias. FIX: Alias name is not into the email recipient label. FIX: allow standalone credit note even if no invoice -FIX: an admin can not access his own permissions after enabling advanced FIX: an admin can not access his own permissions after enabling advanced permissions FIX: Attachement of linked files on ticket when sending a message FIX: avoid non numeric warning @@ -91,17 +90,17 @@ FIX: #11752 FIX: #11789 FIX: #11790 FIX: #11804 list of tickets from a customer card display ALL tickets FIX: #11834 -FIX: Add char $ and ; in sanitizing of filenames. -FIX: Add comment before protected functions -FIX: Add log and type of content in dolWebsiteOutput and -FIX: Add repair.php option 'restore' to restore user picture after v10 +FIX: add char $ and ; in sanitizing of filenames +FIX: add comment before protected functions +FIX: add log and type of content in dolWebsiteOutput and +FIX: add repair.php option 'restore' to restore user picture after v10 FIX: amount opened on thirdparty card dont care of credit note not converted -FIX: Api of documents work with value 'thirdparty' +FIX: API of documents work with value 'thirdparty' FIX: author in message / ticket API -FIX: avoid sql error if fk_project is empty during update +FIX: avoid SQL error if fk_project is empty during update FIX: avoid Warning: A non-numeric value encountered -FIX: bad consistency in list of invoice for direct debit order. -FIX: Bad error management in zip compress and web site export +FIX: bad consistency in list of invoice for direct debit order +FIX: bad error management in zip compress and web site export FIX: bad substitution for extrafields type checkbox FIX: better help message with multicompany FIX: calculation of $products_dispatched @@ -110,11 +109,11 @@ FIX: Can't delete a draft leave even if it should FIX: Can't save setup of mailman module FIX: column jabberid missing FIX: Confirmation of deletion -FIX: Consistency in direct debit order lists. +FIX: Consistency in direct debit order lists FIX: Content send before header warning FIX: credit note can be split FIX: credit note used on list -FIX: Css was saved on wrong website. +FIX: CSS was saved on wrong website FIX: delivery extrafields FIX: Disabling a website does not put it offline FIX: display only stripe sources for customer @@ -131,13 +130,13 @@ FIX: Fatal situation if payment removed on expense report. Action FIX: filepath of generated documents doesn't handle products with special characters FIX: for MAIN_MAXTABS_IN_CARD = $i card FIX: gzip and bzip2 must use option -f -FIX: It was possible to create cashfence without entering data. +FIX: it was possible to create cashfence without entering data FIX: javascript error when using dol_use_jmobile=1 FIX: logout redirect to takepos.php FIX: Look and feel v10 FIX: Make protected all pfd models functions FIX: management of extrafields in modulebuilder -FIX: Missing div for buttons in tax, loan, various payment modules +FIX: missing div for buttons in tax, loan, various payment modules FIX: missing include (dol_convert_file not found) FIX: Missing some replacements in website module FIX: missing test on permission on button to delete ledger record @@ -161,13 +160,13 @@ FIX: Return code of pdf_einstein.modules.php and proformat FIX: round for application fee in stripe FIX: Sens of the balance (Debit - Credit in accountancy not contrary) FIX: Several pb in export of documents -FIX: SQL syntax error and CSRF check on vat reports +FIX: SQL syntax error and CSRF check on VAT reports FIX: takepos layout clear or focus search -FIX: too many record in sql request. Whena criteria is a filter, we must +FIX: too many record in sql request. When a criteria is a filter, we must FIX: Translation of month FIX: USEDOLIBARREDITOR not always set FIX: VAT number for Monaco (it uses FR) -FIX: vulenrability in uploading file found by 美创科技安全实验室 +FIX: vulnerability in uploading file found by 美创科技安全实验室 FIX: wrong display (and hidden input) for already dispatched quantity FIX: wrong parameters (same error in branch 9, 10, develop) FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES From db86dff7d16bd7d03ae92ae8dff0e0dfd08af55e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 29 Oct 2019 17:10:10 +0100 Subject: [PATCH 03/82] Fix sign for VAT repaid in report --- htdocs/compta/resultat/clientfourn.php | 10 +++++----- htdocs/compta/resultat/index.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index efeffeb9b8c..2b74c167d83 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1132,11 +1132,11 @@ else while ($i < $num) { $obj = $db->fetch_object($result); - $amount += $obj->amount; - $total_ht += $obj->amount; - $total_ttc += $obj->amount; - $subtotal_ht += $obj->amount; - $subtotal_ttc += $obj->amount; + $amount += -$obj->amount; + $total_ht += -$obj->amount; + $total_ttc += -$obj->amount; + $subtotal_ht += -$obj->amount; + $subtotal_ttc += -$obj->amount; $i++; } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 70129e80403..d12587eea6e 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -480,10 +480,10 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $obj = $db->fetch_object($result); if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; - $encaiss[$obj->dm] += $obj->amount; + $encaiss[$obj->dm] += -$obj->amount; if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; - $encaiss_ttc[$obj->dm] += $obj->amount; + $encaiss_ttc[$obj->dm] +=-$obj->amount; $i++; } From 1b7e138e0169928c0857cc1b2a655beb993a8a8f Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Tue, 29 Oct 2019 17:27:30 +0100 Subject: [PATCH 04/82] fix: delete function optional and id value --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index fb9539f6e62..6c743e32da9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3585,7 +3585,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * @param int $notrigger 1=Disable call to triggers * @return int <0 if KO, >0 if OK */ - public function delete($notrigger) + public function delete($notrigger = 0) { global $user; @@ -3593,7 +3593,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->db->begin(); - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->rowid; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); From 8849cd9897a0cface1198a6108c12820b75b3ad0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2019 02:19:32 +0100 Subject: [PATCH 05/82] Update index.php --- htdocs/compta/resultat/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index d12587eea6e..d40f00a9c42 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -483,7 +483,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $encaiss[$obj->dm] += -$obj->amount; if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; - $encaiss_ttc[$obj->dm] +=-$obj->amount; + $encaiss_ttc[$obj->dm] += -$obj->amount; $i++; } From 15d0d6e2717006575d14a70bad970725eb50dea0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Oct 2019 02:39:51 +0100 Subject: [PATCH 06/82] FIX #12258 --- htdocs/contact/card.php | 12 ++++++------ htdocs/contact/class/contact.class.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index aaf1cd0a2b9..12e7db0f2b4 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) $object->socid = GETPOST("socid", 'int'); $object->lastname = GETPOST("lastname", 'alpha'); $object->firstname = GETPOST("firstname", 'alpha'); - $object->civility_id = GETPOST("civility_id", 'alpha'); + $object->civility_code = GETPOST("civility_code", 'alpha'); $object->poste = GETPOST("poste", 'alpha'); $object->address = GETPOST("address", 'alpha'); $object->zip = GETPOST("zipcode", 'alpha'); @@ -366,7 +366,7 @@ if (empty($reshook)) $object->socid = GETPOST("socid", 'int'); $object->lastname = GETPOST("lastname", 'alpha'); $object->firstname = GETPOST("firstname", 'alpha'); - $object->civility_id = GETPOST("civility_id", 'alpha'); + $object->civility_code = GETPOST("civility_code", 'alpha'); $object->poste = GETPOST("poste", 'alpha'); $object->address = GETPOST("address", 'alpha'); @@ -619,8 +619,8 @@ else } // Civility - print ''; - print $formcompany->select_civility(GETPOST("civility", 'alpha')?GETPOST("civility", 'alpha'):$object->civility_code); + print ''; + print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility_code", 'alpha'):$object->civility_code, 'civility_code'); print ''; print ''; @@ -918,8 +918,8 @@ else } // Civility - print ''; - print $formcompany->select_civility(isset($_POST["civility"])?GETPOST("civility"):$object->civility_code); + print ''; + print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility", "aZ09"):$object->civility_code, 'civility_code'); print ''; print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index eb25d0ad712..109b6298499 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -325,13 +325,13 @@ class Contact extends CommonObject $this->town=(empty($this->town)?'':$this->town); $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); if (empty($this->statut)) $this->statut = 0; - + if (empty($this->civility_code) && ! is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET "; if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',"; elseif ($this->socid == -1) $sql .= " fk_soc=null,"; - $sql .= " civility='".$this->db->escape($this->civility_id)."'"; + $sql .= " civility='".$this->db->escape($this->civility_code)."'"; $sql .= ", lastname='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; $sql .= ", address='".$this->db->escape($this->address)."'"; From 1963e5c95917a72380ac907b14db00b1a36991ba Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 09:35:45 +0100 Subject: [PATCH 07/82] add comment --- htdocs/holiday/class/holiday.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0eb02e006e5..ffb727120aa 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -53,7 +53,10 @@ class Holiday extends CommonObject * @var int Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_holiday'; - + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'holiday'; /** From 345a060bbe6abd9d119f108a818c04630025932d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Oct 2019 08:36:59 +0000 Subject: [PATCH 08/82] Fixing style errors. --- htdocs/holiday/class/holiday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index ffb727120aa..7a86d471948 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -53,7 +53,7 @@ class Holiday extends CommonObject * @var int Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_holiday'; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ From a80243e5282db20ca9dbd760a7f65380ead6f78d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 09:48:34 +0100 Subject: [PATCH 09/82] add comment --- htdocs/core/modules/mailings/advthirdparties.modules.php | 4 ++++ htdocs/core/modules/mailings/contacts1.modules.php | 4 ++++ htdocs/core/modules/mailings/example.modules.php | 4 ++++ htdocs/core/modules/mailings/fraise.modules.php | 4 ++++ htdocs/core/modules/mailings/pomme.modules.php | 4 ++++ htdocs/core/modules/mailings/thirdparties.modules.php | 4 ++++ .../mailings/thirdparties_services_expired.modules.php | 4 ++++ htdocs/core/modules/mailings/xinputfile.modules.php | 4 ++++ htdocs/core/modules/mailings/xinputuser.modules.php | 4 ++++ 9 files changed, 36 insertions(+) diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 581fca03f8b..2e4f0be6ed8 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -31,6 +31,10 @@ class mailing_advthirdparties extends MailingTargets public $require_admin=0; public $require_module=array("none"); // This module should not be displayed as Selector in mailling + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index aa951426a12..4ec70504e4d 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -37,6 +37,10 @@ class mailing_contacts1 extends MailingTargets public $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; public $require_module=array("societe"); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='contact'; /** diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index a96457c2625..394def035b0 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -36,6 +36,10 @@ class mailing_example extends MailingTargets public $tooltip='MyTooltipLangKey'; public $require_module=array(); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto=''; /** diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 25ffcb717fd..74a2d5b3296 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -40,6 +40,10 @@ class mailing_fraise extends MailingTargets public $require_admin=0; public $require_module=array('adherent'); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='user'; /** diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 970339e4dbb..36708ae34e4 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -35,6 +35,10 @@ class mailing_pomme extends MailingTargets public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=1; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='user'; /** diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 68cb49e10d9..97b744ca977 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -30,6 +30,10 @@ class mailing_thirdparties extends MailingTargets public $require_admin=0; public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 75dc4b9499b..1af4ba0961d 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -28,6 +28,10 @@ class mailing_thirdparties_services_expired extends MailingTargets public $require_admin=0; public $require_module=array('contrat'); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 4987c9ebc17..172d29cf957 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -35,6 +35,10 @@ class mailing_xinputfile extends MailingTargets public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='generic'; public $tooltip='UseFormatFileEmailToTarget'; diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 8d4ecf0b72e..01f89f31e6d 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -35,6 +35,10 @@ class mailing_xinputuser extends MailingTargets public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='generic'; public $tooltip='UseFormatInputEmailToTarget'; From 445d09cf8ae10a03efeb95ee9f8605b28ff084e5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 09:50:06 +0100 Subject: [PATCH 10/82] add comment --- htdocs/core/modules/printing/printgcp.modules.php | 4 ++++ htdocs/core/modules/printing/printipp.modules.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index eeef6ab34e5..6d842244fbf 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -37,6 +37,10 @@ class printing_printgcp extends PrintingDriver { public $name = 'printgcp'; public $desc = 'PrintGCPDesc'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'printer'; public $active = 'PRINTING_PRINTGCP'; public $conf = array(); diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 1d76fe6f574..9b67ea05c1e 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -32,6 +32,10 @@ class printing_printipp extends PrintingDriver { public $name = 'printipp'; public $desc = 'PrintIPPDesc'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'printer'; public $active = 'PRINTING_PRINTIPP'; public $conf = array(); From 2fc09b3530008be8ec712b2e8cb0b947a0a669d9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 09:52:25 +0100 Subject: [PATCH 11/82] add comment --- htdocs/expensereport/class/expensereport.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 485373c5840..0b91f2c2699 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -46,6 +46,10 @@ class ExpenseReport extends CommonObject public $table_element_line = 'expensereport_det'; public $fk_element = 'fk_expensereport'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'trip'; public $lines=array(); From af288e1fc61b7f360e928a44db075c595a633834 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 09:53:12 +0100 Subject: [PATCH 12/82] add comment --- htdocs/fichinter/class/fichinterrec.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index f88653e70eb..9d7173b578b 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -42,6 +42,10 @@ class FichinterRec extends Fichinter public $table_element = 'fichinter_rec'; public $table_element_line = 'fichinter_rec'; public $fk_element = 'fk_fichinter'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'intervention'; public $title; From ed9a13621187d25e1bbab3eed43eb7f013a5d9a5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Oct 2019 08:58:19 +0000 Subject: [PATCH 13/82] Fixing style errors. --- htdocs/core/modules/mailings/advthirdparties.modules.php | 2 +- htdocs/core/modules/mailings/contacts1.modules.php | 2 +- htdocs/core/modules/mailings/example.modules.php | 2 +- htdocs/core/modules/mailings/fraise.modules.php | 2 +- htdocs/core/modules/mailings/pomme.modules.php | 2 +- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- .../modules/mailings/thirdparties_services_expired.modules.php | 2 +- htdocs/core/modules/mailings/xinputfile.modules.php | 2 +- htdocs/core/modules/mailings/xinputuser.modules.php | 2 +- htdocs/core/modules/printing/printgcp.modules.php | 2 +- htdocs/core/modules/printing/printipp.modules.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 2e4f0be6ed8..558744d87e8 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -31,7 +31,7 @@ class mailing_advthirdparties extends MailingTargets public $require_admin=0; public $require_module=array("none"); // This module should not be displayed as Selector in mailling - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 4ec70504e4d..b3687e4f603 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -37,7 +37,7 @@ class mailing_contacts1 extends MailingTargets public $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; public $require_module=array("societe"); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index 394def035b0..88af802ecfe 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -36,7 +36,7 @@ class mailing_example extends MailingTargets public $tooltip='MyTooltipLangKey'; public $require_module=array(); - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 74a2d5b3296..7dc4bf78121 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -40,7 +40,7 @@ class mailing_fraise extends MailingTargets public $require_admin=0; public $require_module=array('adherent'); - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 36708ae34e4..8d55bd86adc 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -35,7 +35,7 @@ class mailing_pomme extends MailingTargets public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=1; // Module mailing actif pour user admin ou non - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 97b744ca977..e0c148e4f9f 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -30,7 +30,7 @@ class mailing_thirdparties extends MailingTargets public $require_admin=0; public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 1af4ba0961d..7e3b468fc6d 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -28,7 +28,7 @@ class mailing_thirdparties_services_expired extends MailingTargets public $require_admin=0; public $require_module=array('contrat'); - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 172d29cf957..a69800230b1 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -35,7 +35,7 @@ class mailing_xinputfile extends MailingTargets public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 01f89f31e6d..7014f5f894d 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -35,7 +35,7 @@ class mailing_xinputuser extends MailingTargets public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 6d842244fbf..1477f4d65f3 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -37,7 +37,7 @@ class printing_printgcp extends PrintingDriver { public $name = 'printgcp'; public $desc = 'PrintGCPDesc'; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 9b67ea05c1e..37659cec199 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -32,7 +32,7 @@ class printing_printipp extends PrintingDriver { public $name = 'printipp'; public $desc = 'PrintIPPDesc'; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0b91f2c2699..572d1345824 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -46,7 +46,7 @@ class ExpenseReport extends CommonObject public $table_element_line = 'expensereport_det'; public $fk_element = 'fk_expensereport'; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 9d7173b578b..783faac70f8 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -42,7 +42,7 @@ class FichinterRec extends Fichinter public $table_element = 'fichinter_rec'; public $table_element_line = 'fichinter_rec'; public $fk_element = 'fk_fichinter'; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ From ccb957623cea9c1c73c89fa3f205167a6282a200 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:00:52 +0100 Subject: [PATCH 14/82] add some comment --- htdocs/fourn/class/fournisseur.commande.class.php | 5 ++++- htdocs/fourn/class/fournisseur.facture.class.php | 3 +++ htdocs/fourn/class/paiementfourn.class.php | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a6d4751169e..4ef407c4a0e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -62,7 +62,10 @@ class CommandeFournisseur extends CommonOrder */ public $fk_element = 'fk_commande'; - public $picto='order'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='order'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 0e28c5302ce..ca207ad4e73 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -63,6 +63,9 @@ class FactureFournisseur extends CommonInvoice */ public $fk_element='fk_facture_fourn'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='bill'; /** diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 14d09c20d6e..979c7803dc4 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -46,6 +46,9 @@ class PaiementFourn extends Paiement */ public $table_element='paiementfourn'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'payment'; public $statut; //Status of payment. 0 = unvalidated; 1 = validated From 991e1b8767542844ea83a5317bf72c28feda78ba Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:02:44 +0100 Subject: [PATCH 15/82] add some comment --- htdocs/hrm/class/establishment.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 863f519231d..20c80d07981 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -55,7 +55,10 @@ class Establishment extends CommonObject */ public $ismultientitymanaged = 1; - public $picto='building'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='building'; /** * @var int ID From 3f15c4e3a9f3bb05a013f907821e86cd3ddcd49d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:03:15 +0100 Subject: [PATCH 16/82] add some comment --- htdocs/loan/class/loan.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index c8e241186d2..f54375135a8 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -41,6 +41,9 @@ class Loan extends CommonObject */ public $table_element='loan'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'bill'; /** From a1bd895e4170154a4ed3a8557eec9e077230310b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:04:03 +0100 Subject: [PATCH 17/82] add some comment --- .../mailings/mailinglist_mymodule_myobject.modules.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 854e7f37bd5..7ebd90a3298 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -26,6 +26,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets public $enabled=0; public $require_module=array(); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='mymodule@mymodule'; /** From ae2dc713c48888fed88a429f400c118f42563916 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Oct 2019 09:03:43 +0000 Subject: [PATCH 18/82] Fixing style errors. --- .../modules/mailings/mailinglist_mymodule_myobject.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 7ebd90a3298..43970122919 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -26,7 +26,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets public $enabled=0; public $require_module=array(); - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ From 99a41604b81e93e73802b67c2a377e1ed07c2a4d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:06:45 +0100 Subject: [PATCH 19/82] add some comment --- htdocs/opensurvey/class/opensurveysondage.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 786ed7220b5..b1cdeac1f36 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -44,6 +44,9 @@ class Opensurveysondage extends CommonObject */ public $table_element='opensurvey_sondage'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'opensurvey'; public $id_sondage; From b029febff13439443e0a8b77437504ff2c48b84b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:07:54 +0100 Subject: [PATCH 20/82] add some comment --- htdocs/product/stock/class/entrepot.class.php | 3 +++ htdocs/product/stock/class/productlot.class.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 35b433c5a28..d84d33cd116 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -44,6 +44,9 @@ class Entrepot extends CommonObject */ public $table_element='entrepot'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='stock'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 3848a592f21..bcac4bb9a36 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -45,6 +45,9 @@ class Productlot extends CommonObject */ public $table_element = 'product_lot'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='barcode'; /** From e02da55c2d65575d1ba2fa380af220ea4eb99120 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:08:36 +0100 Subject: [PATCH 21/82] add some comment --- htdocs/projet/class/project.class.php | 3 +++ htdocs/projet/class/task.class.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a873b53dbc0..0848f87ed19 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -60,6 +60,9 @@ class Project extends CommonObject */ public $ismultientitymanaged = 1; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'projectpub'; /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1bd044bc985..b4d556cda78 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -47,6 +47,9 @@ class Task extends CommonObject */ public $fk_element='fk_task'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'task'; /** From 7eb3e2ff3cd36ae1a866b23c6df25da69a02c19d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:09:08 +0100 Subject: [PATCH 22/82] add some comment --- htdocs/reception/class/reception.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index dd819adff0a..72c5187b307 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -48,7 +48,11 @@ class Reception extends CommonObject public $table_element="reception"; public $table_element_line="commande_fournisseur_dispatch"; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - public $picto = 'reception'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'reception'; public $socid; public $ref_supplier; From 9407afcacb12890ac8d1bba72ba0a7427678dfaa Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:09:37 +0100 Subject: [PATCH 23/82] add some comment --- htdocs/resource/class/dolresource.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index c85f040f896..db64c635fd5 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -39,7 +39,10 @@ class Dolresource extends CommonObject */ public $table_element='resource'; - public $picto = 'resource'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'resource'; public $resource_id; public $resource_type; From d0a468e11bee845682b6d5c7fe10c1987a150577 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Oct 2019 09:10:12 +0000 Subject: [PATCH 24/82] Fixing style errors. --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 72c5187b307..820e39d78f4 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -48,7 +48,7 @@ class Reception extends CommonObject public $table_element="reception"; public $table_element_line="commande_fournisseur_dispatch"; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ From 502d08af0cc9277e8645107ad4767752475c0de0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:10:22 +0100 Subject: [PATCH 25/82] add some comment --- htdocs/societe/class/societe.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index b20f80f5439..74288d54e08 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -69,6 +69,9 @@ class Societe extends CommonObject */ protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'company'; /** From 213f40f4804409abe94130e1efae3590732fb01b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:12:15 +0100 Subject: [PATCH 26/82] add some comment --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index be272ee2d36..0aef06f58c6 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -66,6 +66,9 @@ class SupplierProposal extends CommonObject */ public $fk_element='fk_supplier_proposal'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='propal'; /** From 1a0723c1cdd1cc260f68d8a8e7e1b7eb74e7cbcf Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 10:13:57 +0100 Subject: [PATCH 27/82] add some comment --- htdocs/user/class/usergroup.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b624bdb34d9..40bc6c08fb7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -52,7 +52,10 @@ class UserGroup extends CommonObject */ public $ismultientitymanaged = 1; - public $picto='group'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='group'; /** * @var int Entity of group From b7e1a849a031a0fa567d9edd1fdb99fb48fa84cc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 30 Oct 2019 15:23:24 +0100 Subject: [PATCH 28/82] fix payment mode issue --- htdocs/don/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 54d4e392f61..133b533cc71 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -564,7 +564,7 @@ if (! empty($id) && $action == 'edit') } // Payment mode print "".$langs->trans("PaymentMode")."\n"; - if ($object->modepaymentid) $selected = $object->modepaymentid; + if ($object->mode_reglement_id) $selected = $object->mode_reglement_id; else $selected = ''; $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); print "\n"; @@ -708,7 +708,7 @@ if (! empty($id) && $action != 'edit') // Payment mode print "".$langs->trans("PaymentMode").""; - $form->form_modes_reglement(null, $object->modepaymentid, 'none'); + $form->form_modes_reglement(null, $object->mode_reglement_id, 'none'); print "\n"; // Other attributes From 78c1e8dfbe3d1961f1f4b6c1bb5cd9fb1018de3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 08:25:58 +0100 Subject: [PATCH 29/82] Update define_holiday.php --- htdocs/holiday/define_holiday.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 9add71da395..ec2b12f9bf5 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -173,6 +173,10 @@ llxHeader('', $langs->trans('CPTitreMenu')); $typeleaves=$holiday->getTypes(1, 1); +$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user. +if ($result < 0) { + setEventMessages($holiday->error, $holiday->errors, 'errors'); +} print '
'; @@ -189,14 +193,12 @@ print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png'); print '
'.$langs->trans('LastUpdateCP').': '."\n"; $lastUpdate = $holiday->getConfCP('lastUpdate'); -if ($lastUpdate) -{ - $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; - $yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3]; - print ''.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')), 'dayhour', 'tzuser').''; - print '
'.$langs->trans("MonthOfLastMonthlyUpdate").': '.$yearLastUpdate.'-'.$monthLastUpdate.''."\n"; +if ($lastUpdate) { + print ''.dol_print_date($db->jdate($lastUpdate), 'dayhour').''; + print '
'.$langs->trans("MonthOfLastMonthlyUpdate").': '.$langs->trans('Month'.substr($lastUpdate, 4, 2)).' '.substr($lastUpdate, 0, 4).''."\n"; +} else { + print $langs->trans('None'); } -else print $langs->trans('None'); print "

\n"; $result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user. From e684c1c4504d920b4db4f3b8c668bd2b102ff534 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 12:11:29 +0100 Subject: [PATCH 30/82] Look and feel v11 --- .../class/expensereport.class.php | 31 ++------ htdocs/holiday/class/holiday.class.php | 78 ++++++------------- htdocs/hrm/index.php | 76 +----------------- 3 files changed, 34 insertions(+), 151 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 485373c5840..52072b63578 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -101,9 +101,6 @@ class ExpenseReport extends CommonObject // Paiement public $user_paid_infos; - /* - END ACTIONS - */ /** * Draft status @@ -198,7 +195,7 @@ class ExpenseReport extends CommonObject // List of language codes for status $this->statuts_short = array(0 => 'Draft', 2 => 'Validated', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); $this->statuts = array(0 => 'Draft', 2 => 'ValidatedWaitingApproval', 4 => 'Canceled', 5 => 'Approved', 6 => 'Paid', 99 => 'Refused'); - $this->statuts_logo = array(0 => 'statut0', 2 => 'statut1', 4 => 'statut5', 5 => 'statut3', 6 => 'statut6', 99 => 'statut5'); + $this->statuts_logo = array(0 => 'status0', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); } /** @@ -683,29 +680,15 @@ class ExpenseReport extends CommonObject */ public function LibStatut($status, $mode = 0) { - // phpcs:enable - global $langs; + // phpcs:enable + global $langs; - if ($mode == 0) - return $langs->transnoentities($this->statuts[$status]); + $labelstatus = $langs->trans($this->statuts[$status]); + $labelstatusshort = $langs->trans($this->statuts_short[$status]); - elseif ($mode == 1) - return $langs->transnoentities($this->statuts_short[$status]); + $statusType = $this->statuts_logo[$status]; - elseif ($mode == 2) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]); - - elseif ($mode == 3) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - - elseif ($mode == 4) - return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]); - - elseif ($mode == 5) - return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - - elseif ($mode == 6) - return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); + return dolGetStatus($labelstatus, $labelstatusshort, '', $statusType, $mode); } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0eb02e006e5..8fe5f0570fe 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1217,68 +1217,40 @@ class Holiday extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns the label of a statut + * Returns the label of a status * - * @param int $statut id statut + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param integer $startdate Date holiday should start * @return string Label */ - public function LibStatut($statut, $mode = 0, $startdate = '') + public function LibStatut($status, $mode = 0, $startdate = '') { - // phpcs:enable - global $langs; - - if ($mode == 0) + // phpcs:enable + if (empty($this->labelstatus) || empty($this->labelstatusshort)) { - if ($statut == 1) return $langs->trans('DraftCP'); - elseif ($statut == 2) return $langs->trans('ToReviewCP'); - elseif ($statut == 3) return $langs->trans('ApprovedCP'); - elseif ($statut == 4) return $langs->trans('CancelCP'); - elseif ($statut == 5) return $langs->trans('RefuseCP'); - } - elseif ($mode == 2) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0').' '.$langs->trans('DraftCP'); // Draft - elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1').' '.$langs->trans('ToReviewCP'); // Waiting approval - elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved).' '.$langs->trans('ApprovedCP'); - elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5').' '.$langs->trans('CancelCP'); - elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5').' '.$langs->trans('RefuseCP'); - } - elseif ($mode == 3) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return img_picto($langs->trans('DraftCP'), 'statut0'); - elseif ($statut == 2) return img_picto($langs->trans('ToReviewCP'), 'statut1'); - elseif ($statut == 3) return img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return img_picto($langs->trans('RefuseCP'), 'statut5'); - } - elseif ($mode == 5) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft - elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval - elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5'); - } - elseif ($mode == 6) - { - $pictoapproved='statut6'; - if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; - if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'), 'statut0'); // Draft - elseif ($statut == 2) return $langs->trans('ToReviewCP').' '.img_picto($langs->trans('ToReviewCP'), 'statut1'); // Waiting approval - elseif ($statut == 3) return $langs->trans('ApprovedCP').' '.img_picto($langs->trans('ApprovedCP'), $pictoapproved); - elseif ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'), 'statut5'); - elseif ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'), 'statut5'); + global $langs; + //$langs->load("mymodule"); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelstatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelstatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); + $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelstatusshort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelstatusshort[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); } - else return $statut; + $statusType = 'status6'; + if (! empty($startdate) && $startdate > dol_now()) $statusType = 'status4'; + if ($status == self::STATUS_DRAFT) $statusType = 'status0'; + if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; + if ($status == self::STATUS_CANCELED) $statusType = 'status5'; + if ($status == self::STATUS_REFUSED) $statusType = 'status5'; + + return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); } diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 9d9d2fcd632..9fa758f8338 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -248,84 +248,13 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) } print ''; print ''; + print '
'; } else dol_print_error($db); } -// Last expense report (old module) -if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) -{ - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; - $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE u.rowid = d.fk_user"; - $sql.= " AND d.entity = ".$conf->entity; - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')'; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid; - $sql.= $db->order("d.tms", "DESC"); - $sql.= $db->plimit($max, 0); - - $result = $db->query($sql); - if ($result) - { - $var=false; - $num = $db->num_rows($result); - - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($num) - { - $total_ttc = $totalam = $total = 0; - - $deplacementstatic=new Deplacement($db); - $userstatic=new User($db); - while ($i < $num && $i < $max) - { - $obj = $db->fetch_object($result); - - $deplacementstatic->ref=$obj->rowid; - $deplacementstatic->id=$obj->rowid; - - $userstatic->id=$obj->uid; - $userstatic->lastname=$obj->lastname; - $userstatic->firstname=$obj->firstname; - $userstatic->login=$obj->login; - $userstatic->email=$obj->email; - $userstatic->statut=$obj->statut; - $userstatic->photo=$obj->photo; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - } - else - { - print ''; - } - print '
'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$deplacementstatic->LibStatut($obj->fk_statut, 3).'
'.$langs->trans("None").'
'; - print '
'; - } - else dol_print_error($db); -} - -// Last expense report (new module) +// Latest expense report if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; @@ -342,7 +271,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire $result = $db->query($sql); if ($result) { - $var=false; $num = $db->num_rows($result); $i = 0; From 1821fa6317c200dac86693ed23a18e62f90722ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 12:48:09 +0100 Subject: [PATCH 31/82] Fix translation of "Terminal" --- htdocs/takepos/takepos.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index dd65469ec05..001fd842165 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -562,23 +562,23 @@ function MoreActions(totalactions){ } } +// Popup to select the terminal to use function TerminalsDialog() { jQuery("#dialog-info").dialog({ resizable: false, - height:220, - width:400, + height: global->TAKEPOS_NUM_TERMINALS / 3 * 20); ?>, + width: dol_optimize_smallscreen ? 316 : 400); ?>, modal: true, buttons: { - Terminal1: function() { + 'trans("Terminal")) ?> 1': function() { location.href='takepos.php?setterminal=1'; } global->TAKEPOS_NUM_TERMINALS; $i++) { - print " - , - Terminal".$i.": function() { + print ", + '".dol_escape_js($langs->trans("Terminal"))." ".$i."': function() { location.href='takepos.php?setterminal=".$i."'; } "; From e3b5be7475467f680247859b93e834ba3398b280 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 12:52:03 +0100 Subject: [PATCH 32/82] All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'. All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'. --- ChangeLog | 3 +- htdocs/adherents/class/adherent.class.php | 30 ++++++------- htdocs/adherents/index.php | 8 ++-- htdocs/api/class/api.class.php | 4 +- htdocs/bom/class/bom.class.php | 10 ++--- htdocs/comm/propal/class/propal.class.php | 28 ++++++------- htdocs/commande/class/commande.class.php | 34 +++++++-------- .../cashcontrol/class/cashcontrol.class.php | 12 +++--- .../class/bonprelevement.class.php | 42 +++++++++---------- htdocs/contact/class/contact.class.php | 8 ++-- htdocs/core/class/commoninvoice.class.php | 34 +++++++-------- htdocs/core/lib/functions.lib.php | 3 +- htdocs/don/class/don.class.php | 24 +++++------ .../class/emailcollector.class.php | 30 ++++++------- .../class/emailcollectoraction.class.php | 30 ++++++------- .../class/emailcollectorfilter.class.php | 30 ++++++------- .../class/expensereport.class.php | 6 +-- htdocs/holiday/class/holiday.class.php | 24 +++++------ .../template/class/myobject.class.php | 16 +++---- htdocs/mrp/class/mo.class.php | 14 +++---- htdocs/product/class/product.class.php | 28 ++++++------- htdocs/product/index.php | 14 +++---- .../inventory/class/inventory.class.php | 10 ++--- htdocs/projet/graph_opportunities.inc.php | 14 +++---- htdocs/societe/class/societe.class.php | 12 +++--- htdocs/societe/index.php | 4 +- .../class/supplier_proposal.class.php | 28 ++++++------- htdocs/user/class/user.class.php | 12 +++--- htdocs/website/class/website.class.php | 12 +++--- htdocs/website/class/websitepage.class.php | 12 +++--- htdocs/zapier/class/hook.class.php | 30 ++++++------- 31 files changed, 284 insertions(+), 282 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6a1c949bf5..ab23a79d299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,7 +25,8 @@ Following changes may create regressions for some external modules, but were nec * The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE. * The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS. * If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu. - +* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'. +* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'. ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 8f546b3d3c2..9d0e0fa47dc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2181,48 +2181,48 @@ class Adherent extends CommonObject $langs->load("members"); $statusType = ''; - $labelstatut = ''; - $labelstatutShort = ''; + $labelStatus = ''; + $labelStatusShort = ''; if ($statut == -1) { $statusType = 'status0'; - $labelstatut = $langs->trans("MemberStatusDraft"); - $labelstatutShort = $langs->trans("MemberStatusDraftShort"); + $labelStatus = $langs->trans("MemberStatusDraft"); + $labelStatusShort = $langs->trans("MemberStatusDraftShort"); } elseif ($statut >= 1) { if ($need_subscription == 0) { $statusType = 'status4'; - $labelstatut = $langs->trans("MemberStatusNoSubscription"); - $labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort"); + $labelStatus = $langs->trans("MemberStatusNoSubscription"); + $labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort"); } elseif (! $date_end_subscription) { $statusType = 'status1'; - $labelstatut = $langs->trans("MemberStatusActive"); - $labelstatutShort = $langs->trans("MemberStatusActiveShort"); + $labelStatus = $langs->trans("MemberStatusActive"); + $labelStatusShort = $langs->trans("MemberStatusActiveShort"); } elseif ($date_end_subscription < time()) { $statusType = 'status3'; - $labelstatut = $langs->trans("MemberStatusActiveLate"); - $labelstatutShort = $langs->trans("MemberStatusActiveLateShort"); + $labelStatus = $langs->trans("MemberStatusActiveLate"); + $labelStatusShort = $langs->trans("MemberStatusActiveLateShort"); } else { $statusType = 'status4'; - $labelstatut = $langs->trans("MemberStatusPaid"); - $labelstatutShort = $langs->trans("MemberStatusPaidShort"); + $labelStatus = $langs->trans("MemberStatusPaid"); + $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } } elseif ($statut == 0) { $statusType = 'status6'; - $labelstatut = $langs->trans("MemberStatusResiliated"); - $labelstatutShort = $langs->trans("MemberStatusResiliatedShort"); + $labelStatus = $langs->trans("MemberStatusResiliated"); + $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); } - return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 3f3c77568c2..a0dc9b81a86 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -61,7 +61,7 @@ $AdherentsResilies=array(); $AdherentType=array(); -// Members list +// Type of membership $sql = "SELECT t.rowid, t.libelle as label, t.subscription,"; $sql.= " d.statut, count(d.rowid) as somme"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; @@ -71,7 +71,7 @@ $sql.= " AND d.entity IN (".getEntity('adherent').")"; $sql.= " WHERE t.entity IN (".getEntity('member_type').")"; $sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut"; -dol_syslog("index.php::select nb of members by type", LOG_DEBUG); +dol_syslog("index.php::select nb of members per type", LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -294,7 +294,7 @@ print "
\n"; print '
'; /* - * Last modified members + * Latest modified members */ $max=5; @@ -342,7 +342,7 @@ if ($resql) print ''.$staticmember->getNomUrl(1, 32).''; print ''.$statictype->getNomUrl(1, 32).''; print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').''; - print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 5).''; + print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).''; print ''; $i++; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 074216dee3e..0d054402b7a 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -132,8 +132,8 @@ class DolibarrApi unset($object->statuts_short); unset($object->statuts_logo); unset($object->statuts_long); - unset($object->labelstatut); - unset($object->labelstatut_short); + unset($object->labelStatus); + unset($object->labelStatusShort); unset($object->element); unset($object->fk_element); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 444caa2a4da..bd5eb4513d2 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -809,19 +809,19 @@ class BOM extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("mrp"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); } $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode); } /** diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a2b89dedb11..8d84d1f4820 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -192,8 +192,8 @@ class Propal extends CommonObject public $lines = array(); public $line; - public $labelstatut=array(); - public $labelstatut_short=array(); + public $labelStatus=array(); + public $labelStatusShort=array(); public $specimen; @@ -3210,20 +3210,20 @@ class Propal extends CommonObject global $conf; // Init/load array of translation of status - if (empty($this->labelstatut) || empty($this->labelstatut_short)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load("propal"); - $this->labelstatut[0]=$langs->trans("PropalStatusDraft"); - $this->labelstatut[1]=$langs->trans("PropalStatusValidated"); - $this->labelstatut[2]=$langs->trans("PropalStatusSigned"); - $this->labelstatut[3]=$langs->trans("PropalStatusNotSigned"); - $this->labelstatut[4]=$langs->trans("PropalStatusBilled"); - $this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort"); - $this->labelstatut_short[1]=$langs->trans("PropalStatusValidatedShort"); - $this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort"); - $this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort"); - $this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort"); + $this->labelStatus[0]=$langs->trans("PropalStatusDraft"); + $this->labelStatus[1]=$langs->trans("PropalStatusValidated"); + $this->labelStatus[2]=$langs->trans("PropalStatusSigned"); + $this->labelStatus[3]=$langs->trans("PropalStatusNotSigned"); + $this->labelStatus[4]=$langs->trans("PropalStatusBilled"); + $this->labelStatusShort[0]=$langs->trans("PropalStatusDraftShort"); + $this->labelStatusShort[1]=$langs->trans("PropalStatusValidatedShort"); + $this->labelStatusShort[2]=$langs->trans("PropalStatusSignedShort"); + $this->labelStatusShort[3]=$langs->trans("PropalStatusNotSignedShort"); + $this->labelStatusShort[4]=$langs->trans("PropalStatusBilledShort"); } $statusType=''; @@ -3233,7 +3233,7 @@ class Propal extends CommonObject elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5'; elseif ($statut==self::STATUS_BILLED) $statusType='status6'; - return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$statut], $this->labelStatusShort[$statut], '', $statusType, $mode); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4cc922a8cbf..261190a747e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3484,48 +3484,48 @@ class Commande extends CommonOrder if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); if ($statut==self::STATUS_CANCELED){ - $labelstatut = $langs->trans('StatusOrderCanceled'); - $labelstatutShort = $langs->trans('StatusOrderCanceledShort'); + $labelStatus = $langs->trans('StatusOrderCanceled'); + $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); $statusType='status5'; } elseif ($statut==self::STATUS_DRAFT){ - $labelstatut = $langs->trans('StatusOrderDraft'); - $labelstatutShort = $langs->trans('StatusOrderDraftShort'); + $labelStatus = $langs->trans('StatusOrderDraft'); + $labelStatusShort = $langs->trans('StatusOrderDraftShort'); $statusType='status0'; } elseif ($statut==self::STATUS_VALIDATED){ - $labelstatut = $langs->trans('StatusOrderValidated').$billedtext; - $labelstatutShort = $langs->trans('StatusOrderValidatedShort').$billedtext; + $labelStatus = $langs->trans('StatusOrderValidated').$billedtext; + $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; $statusType='status1'; } elseif ($statut==self::STATUS_SHIPMENTONPROCESS){ - $labelstatut = $langs->trans('StatusOrderSentShort').$billedtext; - $labelstatutShort = $langs->trans('StatusOrderSentShort').$billedtext; + $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; + $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; $statusType='status3'; } elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ - $labelstatut = $langs->trans('StatusOrderToBill'); - $labelstatutShort = $langs->trans('StatusOrderToBillShort'); + $labelStatus = $langs->trans('StatusOrderToBill'); + $labelStatusShort = $langs->trans('StatusOrderToBillShort'); $statusType='status4'; } elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ - $labelstatut = $langs->trans('StatusOrderProcessed').$billedtext; - $labelstatutShort = $langs->trans('StatusOrderProcessed').$billedtext; + $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; + $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; $statusType='status6'; } elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ - $labelstatut = $langs->trans('StatusOrderDelivered'); - $labelstatutShort = $langs->trans('StatusOrderDelivered'); + $labelStatus = $langs->trans('StatusOrderDelivered'); + $labelStatusShort = $langs->trans('StatusOrderDelivered'); $statusType='status6'; } else{ - $labelstatut = $langs->trans('Unknown'); - $labelstatutShort = ''; + $labelStatus = $langs->trans('Unknown'); + $labelStatusShort = ''; $statusType=''; $mode = 0; } - return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 354b50365ca..06331dc0f2b 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -311,20 +311,20 @@ class CashControl extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[0] = $langs->trans('Draft'); - $this->labelstatus[1] = $langs->trans('Closed'); - $this->labelstatusshort[0] = $langs->trans('Draft'); - $this->labelstatusshort[1] = $langs->trans('Closed'); + $this->labelStatus[0] = $langs->trans('Draft'); + $this->labelStatus[1] = $langs->trans('Closed'); + $this->labelStatusShort[0] = $langs->trans('Draft'); + $this->labelStatusShort[1] = $langs->trans('Closed'); } $statusType = 'status0'; if ($status == self::STATUS_VALIDATED) $statusType = 'status6'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 4016ebdc813..3058d418237 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -69,7 +69,7 @@ class BonPrelevement extends CommonObject public $total; public $fetched; public $statut; // 0-Wait, 1-Trans, 2-Done - public $labelstatut=array(); + public $labelStatus=array(); public $invoice_in_error=array(); public $thirdparty_in_error=array(); @@ -2002,48 +2002,48 @@ class BonPrelevement extends CommonObject public function LibStatut($statut, $mode = 0) { // phpcs:enable - if (empty($this->labelstatut)) + if (empty($this->labelStatus)) { global $langs; $langs->load("withdrawals"); - $this->labelstatut[0]=$langs->trans("StatusWaiting"); - $this->labelstatut[1]=$langs->trans("StatusTrans"); - $this->labelstatut[2]=$langs->trans("StatusCredited"); + $this->labelStatus[0]=$langs->trans("StatusWaiting"); + $this->labelStatus[1]=$langs->trans("StatusTrans"); + $this->labelStatus[2]=$langs->trans("StatusCredited"); } if ($mode == 0 || $mode == 1) { - return $this->labelstatut[$statut]; + return $this->labelStatus[$statut]; } elseif ($mode == 2) { - if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; - elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; - elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; + if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut]; + elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut]; + elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut]; } elseif ($mode == 3) { - if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1'); - elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3'); - elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6'); + if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1'); + elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3'); + elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; - elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; - elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; + if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut]; + elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut]; + elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut]; } elseif ($mode == 5) { - if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); - elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); - elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); + if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1'); + elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3'); + elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6'); } elseif ($mode == 6) { - if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); - elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); - elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); + if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1'); + elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3'); + elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6'); } } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 895293efaf7..6b738719cf5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1264,13 +1264,13 @@ class Contact extends CommonObject // phpcs:enable global $langs; - $labelstatus = array( + $labelStatus = array( 0 => 'ActivityCeased', 1 => 'InActivity', 4 => 'InActivity', 5 => 'ActivityCeased', ); - $labelstatusshort = array( + $labelStatusShort = array( 0 => 'ActivityCeased', 1 => 'InActivity', 4 => 'InActivity', @@ -1280,8 +1280,8 @@ class Contact extends CommonObject $statusType = 'status4'; if ($status==0 || $status==5) $statusType = 'status5'; - $label = $langs->trans($labelstatus[$status]); - $labelshort = $langs->trans($labelstatusshort[$status]); + $label = $langs->trans($labelStatus[$status]); + $labelshort = $langs->trans($labelStatusShort[$status]); return dolGetStatus($label, $labelshort, '', $statusType, $mode); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index ec27b83e0a0..b6381ccc7ca 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -496,27 +496,27 @@ abstract class CommonInvoice extends CommonObject $prefix='Short'; if (! $paye){ if ($status == 0) { - $labelstatut = $langs->trans('BillStatusDraft'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusDraft'); + $labelStatus = $langs->trans('BillStatusDraft'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusDraft'); } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) { - $labelstatut = $langs->trans('BillStatusClosedUnpaid'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); + $labelStatus = $langs->trans('BillStatusClosedUnpaid'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); $statusType='status5'; } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) { - $labelstatut = $langs->trans('BillStatusClosedPaidPartially'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + $labelStatus = $langs->trans('BillStatusClosedPaidPartially'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType='status9'; } elseif ($alreadypaid <= 0) { - $labelstatut = $langs->trans('BillStatusNotPaid'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusNotPaid'); + $labelStatus = $langs->trans('BillStatusNotPaid'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusNotPaid'); $statusType='status1'; } else { - $labelstatut = $langs->trans('BillStatusStarted'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusStarted'); + $labelStatus = $langs->trans('BillStatusStarted'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusStarted'); $statusType='status3'; } } @@ -525,20 +525,20 @@ abstract class CommonInvoice extends CommonObject $statusType='status6'; if ($type == self::TYPE_CREDIT_NOTE){ - $labelstatut = $langs->trans('BillStatusPaidBackOrConverted'); // credit note - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note + $labelStatus = $langs->trans('BillStatusPaidBackOrConverted'); // credit note + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note } elseif ($type == self::TYPE_DEPOSIT){ - $labelstatut = $langs->trans('BillStatusConverted'); // deposit invoice - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice + $labelStatus = $langs->trans('BillStatusConverted'); // deposit invoice + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice } else{ - $labelstatut = $langs->trans('BillStatusPaid'); - $labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaid'); + $labelStatus = $langs->trans('BillStatusPaid'); + $labelStatusShort = $langs->trans('Bill'.$prefix.'StatusPaid'); } } - return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 943afe69a1a..56b0dc93c35 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8182,7 +8182,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st elseif ($displayMode == 6) $displayMode = 5; } - // image's filename are still in French, so we use this array to convert + // For backward compatibility. Image's filename are still in French, so we use this array to convert $statusImg=array( 'status0' => 'statut0' ,'status1' => 'statut1' @@ -8212,6 +8212,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = $htmlImg .' '. $htmlLabel; } elseif ($displayMode === 5) { + // Add here a span class="hideonsmartphone ? $return = $htmlLabelShort .' '. $htmlImg; } else { // $displayMode >= 6 diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index b24213d5c70..4c8c5f73d9b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -116,12 +116,12 @@ class Don extends CommonObject /** * @var array Array of status label */ - public $labelstatut; + public $labelStatus; /** * @var array Array of status label short */ - public $labelstatutshort; + public $labelStatusShort; const STATUS_DRAFT = 0; @@ -163,25 +163,25 @@ class Don extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatut) || empty($this->labelstatutshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load("donations"); - $this->labelstatut[-1]=$langs->trans("Canceled"); - $this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated"); - $this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated"); - $this->labelstatut[2]=$langs->trans("DonationStatusPaid"); - $this->labelstatutshort[-1]=$langs->trans("Canceled"); - $this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort"); - $this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort"); - $this->labelstatutshort[2]=$langs->trans("DonationStatusPaidShort"); + $this->labelStatus[-1]=$langs->trans("Canceled"); + $this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated"); + $this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated"); + $this->labelStatus[2]=$langs->trans("DonationStatusPaid"); + $this->labelStatusShort[-1]=$langs->trans("Canceled"); + $this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort"); + $this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort"); + $this->labelStatusShort[2]=$langs->trans("DonationStatusPaidShort"); } $statusType = 'status'.$status; if ($status == self::STATUS_CANCELED) $statusType = 'status5'; if ($status == self::STATUS_PAID) $statusType = 'status6'; - return dolGetStatus($this->labelstatut[$status], $this->labelstatutshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7469faaa356..6717b42609b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -506,46 +506,46 @@ class EmailCollector extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelStatus[1] = $langs->trans('Enabled'); + $this->labelStatus[0] = $langs->trans('Disabled'); } if ($mode == 0) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 1) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } } diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 0033b615f8a..7f7360b49f1 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -408,46 +408,46 @@ class EmailCollectorAction extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("emailcollector"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelStatus[1] = $langs->trans('Enabled'); + $this->labelStatus[0] = $langs->trans('Disabled'); } if ($mode == 0) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 1) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } } diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 5a8f3003c84..43eb9d1cb65 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -383,46 +383,46 @@ class EmailCollectorFilter extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("emailcollector"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelStatus[1] = $langs->trans('Enabled'); + $this->labelStatus[0] = $langs->trans('Disabled'); } if ($mode == 0) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 1) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 52072b63578..fffde04ac3d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -683,12 +683,12 @@ class ExpenseReport extends CommonObject // phpcs:enable global $langs; - $labelstatus = $langs->trans($this->statuts[$status]); - $labelstatusshort = $langs->trans($this->statuts_short[$status]); + $labelStatus = $langs->trans($this->statuts[$status]); + $labelStatusShort = $langs->trans($this->statuts_short[$status]); $statusType = $this->statuts_logo[$status]; - return dolGetStatus($labelstatus, $labelstatusshort, '', $statusType, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 8fe5f0570fe..b75eec43eac 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1227,20 +1227,20 @@ class Holiday extends CommonObject public function LibStatut($status, $mode = 0, $startdate = '') { // phpcs:enable - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('DraftCP'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); - $this->labelstatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); - $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('CancelCP'); - $this->labelstatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); - $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('DraftCP'); - $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); - $this->labelstatusshort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); - $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('CancelCP'); - $this->labelstatusshort[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelStatus[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('DraftCP'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ToReviewCP'); + $this->labelStatusShort[self::STATUS_APPROVED] = $langs->trans('ApprovedCP'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('CancelCP'); + $this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('RefuseCP'); } $statusType = 'status6'; @@ -1250,7 +1250,7 @@ class Holiday extends CommonObject if ($status == self::STATUS_CANCELED) $statusType = 'status5'; if ($status == self::STATUS_REFUSED) $statusType = 'status5'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 41d0af33d46..43488429807 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -656,22 +656,22 @@ class MyObject extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); - $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled'); } $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 71a743eb071..49160092b63 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -546,21 +546,21 @@ class Mo extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("mrp"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Validated'); - $this->labelstatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress'); - $this->labelstatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced'); - $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated'); + $this->labelStatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress'); + $this->labelStatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); } $statusType = 'status'.$status; //if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode); } /** diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bf2b3a0e410..5243e84e4de 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4390,7 +4390,7 @@ class Product extends CommonObject // phpcs:enable global $conf, $langs; - $labelstatut = $labelstatutShort = ''; + $labelStatus = $labelStatusShort = ''; $langs->load('products'); if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch"); @@ -4423,31 +4423,31 @@ class Product extends CommonObject if ($status == 0) { // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" if($type==0) { - $labelstatut = $langs->trans('ProductStatusNotOnSellShort'); - $labelstatutShort = $langs->trans('ProductStatusNotOnSell'); + $labelStatus = $langs->trans('ProductStatusNotOnSellShort'); + $labelStatusShort = $langs->trans('ProductStatusNotOnSell'); } elseif($type == 1) { - $labelstatut = $langs->trans('ProductStatusNotOnBuyShort'); - $labelstatutShort = $langs->trans('ProductStatusNotOnBuy'); + $labelStatus = $langs->trans('ProductStatusNotOnBuyShort'); + $labelStatusShort = $langs->trans('ProductStatusNotOnBuy'); } elseif($type == 2) { - $labelstatut = $langs->trans('ProductStatusNotOnBatch'); - $labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort'); + $labelStatus = $langs->trans('ProductStatusNotOnBatch'); + $labelStatusShort = $langs->trans('ProductStatusNotOnBatchShort'); } } elseif ($status == 1) { // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" if ($type==0) { - $labelstatut = $langs->trans('ProductStatusOnSellShort'); - $labelstatutShort = $langs->trans('ProductStatusOnSell'); + $labelStatus = $langs->trans('ProductStatusOnSellShort'); + $labelStatusShort = $langs->trans('ProductStatusOnSell'); } elseif ($type == 1) { - $labelstatut = $langs->trans('ProductStatusOnBuyShort'); - $labelstatutShort = $langs->trans('ProductStatusOnBuy'); + $labelStatus = $langs->trans('ProductStatusOnBuyShort'); + $labelStatusShort = $langs->trans('ProductStatusOnBuy'); } elseif ($type == 2) { - $labelstatut = $langs->trans('ProductStatusOnBatch'); - $labelstatutShort = $langs->trans('ProductStatusOnBatchShort'); + $labelStatus = $langs->trans('ProductStatusOnBatch'); + $labelStatusShort = $langs->trans('ProductStatusOnBatchShort'); } } @@ -4455,7 +4455,7 @@ class Product extends CommonObject if ($mode > 6) { return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0); } else { - return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode); + return dolGetStatus($labelStatus, $labelStatusShort, '', $statuttrans, $mode); } } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 477dcc20b0c..ff5e83b9410 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -266,7 +266,7 @@ print '
'; /* - * Last modified products + * Latest modified products */ $max=15; $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,"; @@ -299,11 +299,11 @@ if ($result) print '
'; print ''; - $colnb=4; + $colnb=2; if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++; print ''; - print ''; while ($i < $num) @@ -359,11 +359,11 @@ if ($result) else print price($objp->price).' '.$langs->trans("HT"); print ''; } - print '"; - print '"; print "\n"; $i++; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 775ffcf3e5c..4434f82fbcf 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -396,16 +396,16 @@ class Inventory extends CommonObject // phpcs:enable global $langs; - if (empty($this->labelstatus)) + if (empty($this->labelStatus)) { global $langs; //$langs->load("mrp"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); } - return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', 'status'.$status, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', 'status'.$status, $mode); } /** diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 7d75544ef93..0987a47e507 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -55,20 +55,20 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $listofstatus=array_keys($listofoppstatus); foreach ($listofstatus as $status) { - $labelstatus = ''; + $labelStatus = ''; $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); - if ($code) $labelstatus = $langs->trans("OppStatus".$code); - if (empty($labelstatus)) $labelstatus=$listofopplabel[$status]; + if ($code) $labelStatus = $langs->trans("OppStatus".$code); + if (empty($labelStatus)) $labelStatus=$listofopplabel[$status]; - //$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; - //$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%'; + //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; + //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%'; - $dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0)); + $dataseries[]=array($labelStatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0)); if (! $conf->use_javascript_ajax) { print ''; - print ''; + print ''; print ''; print "\n"; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fe8c78c7aa2..ca17077a47b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2283,15 +2283,15 @@ class Societe extends CommonObject $statusType = 'status4'; if ($status == 0) $statusType = 'status5'; - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - $this->labelstatus[0] = $langs->trans("ActivityCeased"); - $this->labelstatus[1] = $langs->trans("InActivity"); - $this->labelstatusshort[0] = $langs->trans("ActivityCeased"); - $this->labelstatusshort[1] = $langs->trans("InActivity"); + $this->labelStatus[0] = $langs->trans("ActivityCeased"); + $this->labelStatus[1] = $langs->trans("InActivity"); + $this->labelStatusShort[0] = $langs->trans("ActivityCeased"); + $this->labelStatusShort[1] = $langs->trans("InActivity"); } - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b2962478b17..a422e199e55 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -232,7 +232,7 @@ print '
'; /* - * Last third parties modified + * Latest modified third parties */ $max=15; $sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur"; @@ -316,7 +316,7 @@ if ($result) print dol_print_date($thirdparty_static->datem, 'day'); print ""; print '
"; print "\n"; $i++; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index be272ee2d36..aa78324ad37 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -158,8 +158,8 @@ class SupplierProposal extends CommonObject public $lines = array(); public $line; - public $labelstatut=array(); - public $labelstatut_short=array(); + public $labelStatus=array(); + public $labelStatusShort=array(); public $nbtodo; public $nbtodolate; @@ -2196,20 +2196,20 @@ class SupplierProposal extends CommonObject // phpcs:enable // Init/load array of translation of status - if (empty($this->labelstatut) || empty($this->labelstatut_short)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load("supplier_proposal"); - $this->labelstatut[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft"); - $this->labelstatut[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated"); - $this->labelstatut[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned"); - $this->labelstatut[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned"); - $this->labelstatut[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed"); - $this->labelstatut_short[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort"); - $this->labelstatut_short[self::STATUS_VALIDATED]=$langs->trans("Opened"); - $this->labelstatut_short[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort"); - $this->labelstatut_short[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort"); - $this->labelstatut_short[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort"); + $this->labelStatus[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraft"); + $this->labelStatus[self::STATUS_VALIDATED]=$langs->trans("SupplierProposalStatusValidated"); + $this->labelStatus[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSigned"); + $this->labelStatus[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSigned"); + $this->labelStatus[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosed"); + $this->labelStatusShort[self::STATUS_DRAFT]=$langs->trans("SupplierProposalStatusDraftShort"); + $this->labelStatusShort[self::STATUS_VALIDATED]=$langs->trans("Opened"); + $this->labelStatusShort[self::STATUS_SIGNED]=$langs->trans("SupplierProposalStatusSignedShort"); + $this->labelStatusShort[self::STATUS_NOTSIGNED]=$langs->trans("SupplierProposalStatusNotSignedShort"); + $this->labelStatusShort[self::STATUS_CLOSE]=$langs->trans("SupplierProposalStatusClosedShort"); } $statusnew=''; @@ -2219,7 +2219,7 @@ class SupplierProposal extends CommonObject elseif ($status==self::STATUS_NOTSIGNED) $statusnew='status5'; elseif ($status==self::STATUS_CLOSE) $statusnew='status6'; - return dolGetStatus($this->labelstatut[$status], $this->labelstatut_short[$status], '', $statusnew, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6e7d2540d32..6baffc74a73 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2495,20 +2495,20 @@ class User extends CommonObject // phpcs:enable global $langs; - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[self::STATUS_ENABLED] = $langs->trans('Enabled'); - $this->labelstatus[self::STATUS_DISABLED] = $langs->trans('Disabled'); - $this->labelstatusshort[self::STATUS_ENABLED] = $langs->trans('Enabled'); - $this->labelstatusshort[self::STATUS_DISABLED] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled'); } $statusType = 'status5'; if ($status == self::STATUS_ENABLED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index ac99001bf4b..d84b5232773 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -745,20 +745,20 @@ class Website extends CommonObject // phpcs:enable global $langs; - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Disabled'); - $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); } $statusType = 'status5'; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index e85af6244e3..0258198ba10 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -545,20 +545,20 @@ class WebsitePage extends CommonObject // phpcs:enable global $langs; - if (empty($this->labelstatus) || empty($this->labelstatusshort)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); - $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Disabled'); - $this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); } $statusType = 'status5'; if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; - return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 81b76b1c81f..5c79d68aefe 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -633,37 +633,37 @@ class Hook extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelstatus)) { + if (empty($this->labelStatus)) { global $langs; //$langs->load("zapier@zapier"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelStatus[1] = $langs->trans('Enabled'); + $this->labelStatus[0] = $langs->trans('Disabled'); } if ($mode == 0) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 1) { - return $this->labelstatus[$status]; + return $this->labelStatus[$status]; } elseif ($mode == 2) { if ($status == 1) { - return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($status == 0) { - return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; + elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { if ($status == 1) { - return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); } elseif ($status == 0) { - return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); } } } From 400defd93d1943dfb62ce0016709403364f0fa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:04:37 +0100 Subject: [PATCH 33/82] form_select_status_action returns void --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 1b33e5da9b8..ac474881732 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -488,7 +488,7 @@ if ($resql) if (! empty($arrayfields['a.tms']['checked'])) print ''; if (! empty($arrayfields['a.percent']['checked'])) { print ''; } From da238e94e10c96fade8cc90669a28dc326d13b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:21:21 +0100 Subject: [PATCH 34/82] php is > 5.4 --- htdocs/core/lib/functions.lib.php | 76 ++++++++++++++----------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 56b0dc93c35..70f6e57eb4b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1984,56 +1984,48 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $ if ($second< 0 || $second > 60) return ''; } - if (method_exists('DateTime', 'getTimestamp')) + if (empty($gm) || $gm === 'server') { - if (empty($gm) || $gm === 'server') - { - $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin' + $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin' + $localtz = new DateTimeZone($default_timezone); + } + elseif ($gm === 'user') + { + // We use dol_tz_string first because it is more reliable. + $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' + try { $localtz = new DateTimeZone($default_timezone); } - elseif ($gm === 'user') + catch(Exception $e) { - // We use dol_tz_string first because it is more reliable. - $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' - try { - $localtz = new DateTimeZone($default_timezone); - } - catch(Exception $e) - { - dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); - $default_timezone=@date_default_timezone_get(); - } + dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); + $default_timezone=@date_default_timezone_get(); } - elseif (strrpos($gm, "tz,") !== false) - { - $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' - try - { - $localtz = new DateTimeZone($timezone); - } - catch(Exception $e) - { - dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); - } - } - - if (empty($localtz)) { - $localtz = new DateTimeZone('UTC'); - } - //var_dump($localtz); - //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); - $dt = new DateTime(null, $localtz); - $dt->setDate((int) $year, (int) $month, (int) $day); - $dt->setTime((int) $hour, (int) $minute, (int) $second); - $date=$dt->getTimestamp(); // should include daylight saving time - //var_dump($date); - return $date; } - else + elseif (strrpos($gm, "tz,") !== false) { - dol_print_error('', 'PHP version must be 5.4+'); - return ''; + $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' + try + { + $localtz = new DateTimeZone($timezone); + } + catch(Exception $e) + { + dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); + } } + + if (empty($localtz)) { + $localtz = new DateTimeZone('UTC'); + } + //var_dump($localtz); + //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); + $dt = new DateTime(null, $localtz); + $dt->setDate((int) $year, (int) $month, (int) $day); + $dt->setTime((int) $hour, (int) $minute, (int) $second); + $date=$dt->getTimestamp(); // should include daylight saving time + //var_dump($date); + return $date; } From 0f80ba5353be4990929026e5ae945fc542745e01 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 1 Nov 2019 15:36:48 +0100 Subject: [PATCH 35/82] FIX prices by customer API --- htdocs/product/class/api_products.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index d6066b1a03a..1b5e8adf862 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -445,7 +445,6 @@ class Products extends DolibarrApi //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code ); } - /** * Get prices per customer for a product * @@ -471,13 +470,18 @@ class Products extends DolibarrApi if (! $result ) { throw new RestException(404, 'Product not found'); } - - if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); + + if ($result > 0) { + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + $prodcustprice = new Productcustomerprice($this->db); + $result = $prodcustprice->fetch_all('', '', 0, 0, array('t.fk_product' => $id)); } - throw new RestException(501, 'Feature not yet available'); - //return $result; + if ( empty($prodcustprice->lines)) { + throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($prodcustprice->error), $prodcustprice->errors)); + } + + return $prodcustprice->lines; } /** From bc5e6c867f4969a5b1697e164e1f033562144661 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 1 Nov 2019 14:37:21 +0000 Subject: [PATCH 36/82] Fixing style errors. --- htdocs/product/class/api_products.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1b5e8adf862..5b179d487a9 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -470,11 +470,11 @@ class Products extends DolibarrApi if (! $result ) { throw new RestException(404, 'Product not found'); } - + if ($result > 0) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - $prodcustprice = new Productcustomerprice($this->db); - $result = $prodcustprice->fetch_all('', '', 0, 0, array('t.fk_product' => $id)); + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + $prodcustprice = new Productcustomerprice($this->db); + $result = $prodcustprice->fetch_all('', '', 0, 0, array('t.fk_product' => $id)); } if ( empty($prodcustprice->lines)) { From 44c8cd9d2338145242db1aa00d28e1dc8cf8180c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:48:55 +0100 Subject: [PATCH 37/82] give a value by default The variable $fileurlnb does not seem to be defined for all execution paths --- htdocs/core/boxes/box_graph_invoices_permonth.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ba0e24ddaab..19a923ad4e1 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -135,7 +135,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); From 931f2b809d7e822bca1d0767a4ec365954aa43c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:52:13 +0100 Subject: [PATCH 38/82] Update box_graph_orders_permonth.php --- htdocs/core/boxes/box_graph_orders_permonth.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 6e5bf253832..a67c3b94f92 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -135,7 +135,8 @@ class box_graph_orders_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); @@ -144,7 +145,8 @@ class box_graph_orders_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) From 135e65c4aaae3e75ba1de48e4c1549bfa59bbdca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 15:53:57 +0100 Subject: [PATCH 39/82] Look and feel v11 Enhance the progress bar of tasks --- htdocs/admin/emailcollector_card.php | 6 +- htdocs/contrat/class/contrat.class.php | 140 ++++++---------- htdocs/core/lib/functions.lib.php | 24 ++- htdocs/core/lib/project.lib.php | 39 +++-- .../class/emailcollector.class.php | 49 ++---- htdocs/langs/en_US/modulebuilder.lang | 12 +- htdocs/modulebuilder/index.php | 155 ++++++++++-------- htdocs/mrp/ChangeLog.md | 5 - htdocs/takepos/ChangeLog.md | 5 - htdocs/theme/eldy/badges.inc.php | 2 +- htdocs/theme/eldy/global.inc.php | 6 + htdocs/theme/eldy/progress.inc.php | 9 +- htdocs/theme/md/badges.inc.php | 4 +- htdocs/theme/md/style.css.php | 6 + 14 files changed, 223 insertions(+), 239 deletions(-) delete mode 100644 htdocs/mrp/ChangeLog.md delete mode 100644 htdocs/takepos/ChangeLog.md diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index daa0c896809..cb0288b44ba 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -260,7 +260,7 @@ if ($action == 'create') { dol_fiche_head(array(), ''); - print '
'.$transRecordedType.''.$langs->trans("FullList").''; + print ''.$langs->trans("FullList").''; print '
'; - print $product_static->LibStatut($objp->tosell, 5, 0); + print ''; + print $product_static->LibStatut($objp->tosell, 3, 0); print "'; - print $product_static->LibStatut($objp->tobuy, 5, 1); + print ''; + print $product_static->LibStatut($objp->tobuy, 3, 1); print "
'.$labelstatus.''.$labelStatus.''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'
'; - print $thirdparty_static->getLibStatut(5); + print $thirdparty_static->getLibStatut(3); print "
'; - print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2); + $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2); print ajax_combobox('selectstatus'); print '
'."\n"; + print '
'."\n"; //unset($fields[]); @@ -296,7 +296,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
' . "\n"; + print '
' . "\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; @@ -448,7 +448,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; print '
'; - print '
'."\n"; + print '
'."\n"; // Common attributes //$keyforbreak='fieldkeytoswithonsecondcolumn'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a6ccd9f7cf1..038de071863 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -189,6 +189,12 @@ class Contrat extends CommonObject protected $lines_id_index_mapper=array(); + const STATUS_DRAFT = 0; + const STATUS_VALIDATED = 1; + const STATUS_CLOSED = 2; + + + /** * Constructor * @@ -1881,40 +1887,31 @@ class Contrat extends CommonObject /** * Renvoi label of a given contrat status * - * @param int $statut Status id + * @param int $status Id status * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @return string Label */ - public function LibStatut($statut, $mode) + public function LibStatut($status, $mode) { // phpcs:enable - global $langs; - $langs->load("contracts"); - if ($mode == 0) + + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } - elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); } - elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + global $langs; + $langs->load("contracts"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated'); + $this->labelStatus[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('ContractStatusDraft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('ContractStatusValidated'); + $this->labelStatusShort[self::STATUS_CLOSED] = $langs->trans('ContractStatusClosed'); } - elseif ($mode == 1) - { - if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } - elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); } - elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); } - } - elseif ($mode == 2) - { - if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0').' '.$langs->trans("ContractStatusDraft"); } - elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4').' '.$langs->trans("ContractStatusValidated"); } - elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6').' '.$langs->trans("ContractStatusClosed"); } - } - elseif ($mode == 3) - { - if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'), 'statut0'); } - elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'), 'statut4'); } - elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'), 'statut6'); } - } - elseif ($mode == 4 || $mode == 6 || $mode == 7) + + $statusType = 'status'.$status; + if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; + if ($status == self::STATUS_VALIDATED) $statusType = 'status6'; + + if ($mode == 4 || $mode == 6 || $mode == 7) { $text=''; if ($mode == 4) { @@ -1924,22 +1921,20 @@ class Contrat extends CommonObject $text.=':     '; $text.=''; } - $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; - $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; - $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?'   ':'') : ''; - $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="paddingleft2 inline-block valigntextbottom"')) : ''; - $text.=($mode == 7?'
':''); + $text.=($mode == 7?'':''); + $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.ContratLigne::LibStatut(0, 3, -1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode == 7?'':''); + $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.ContratLigne::LibStatut(4, 3, 0, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode == 7?'':''); + $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.ContratLigne::LibStatut(4, 3, 1, 'class="marginleft2"')).(($mode != 7 || $this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode == 7?'':''); + $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : ''; + $text.=($mode == 7?'':''); return $text; } - elseif ($mode == 5) + else { - if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'), 'statut0'); } - elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'), 'statut4'); } - elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'), 'statut6'); } + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } @@ -2728,65 +2723,34 @@ class ContratLigne extends CommonObjectLine /** * Return label of a contract line status * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $expired 0=Not expired, 1=Expired, -1=Both or unknown * @param string $moreatt More attribute * @return string Libelle */ - public static function LibStatut($statut, $mode, $expired = -1, $moreatt = '') + public static function LibStatut($status, $mode, $expired = -1, $moreatt = '') { // phpcs:enable global $langs; $langs->load("contracts"); - if ($mode == 0) + + if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); } + elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); } + elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); } + elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); } + elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } + + $statusType = 'status'.$status; + if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status3'; + if ($status == self::STATUS_CLOSED) $statusType = 'status6'; + + $params = array(); $reg = array(); + if (preg_match('/class="(.*)"/', $moreatt, $reg)) { - if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); } - elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } - } - elseif ($mode == 1) - { - if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); } - elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } - } - elseif ($mode == 2) - { - if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLateShort"); } - elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); } - } - elseif ($mode == 3) - { - if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0', $moreatt); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4', $moreatt); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4', $moreatt); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3', $moreatt); } - elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6', $moreatt); } - } - elseif ($mode == 4) - { - if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'), 'statut0').' '.$langs->trans("ServiceStatusInitial"); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'), 'statut4').' '.$langs->trans("ServiceStatusRunning"); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'), 'statut4').' '.$langs->trans("ServiceStatusNotLate"); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'), 'statut3').' '.$langs->trans("ServiceStatusLate"); } - elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'), 'statut6') .' '.$langs->trans("ServiceStatusClosed"); } - } - elseif ($mode == 5) - { - if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'), 'statut0'); } - elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'), 'statut4'); } - elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'), 'statut4'); } - elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'), 'statut3'); } - elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'), 'statut6'); } + $params = array('badgeParams'=>array('css' => $reg[1])); } + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params); } /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 56b0dc93c35..7750e62c506 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8093,19 +8093,18 @@ function roundUpToNextMultiple($n, $x = 5) function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) { $attr=array( - 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'') + 'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'').(empty($params['css'])?'':' '.$params['css']) ); - if(empty($html)){ + if (empty($html)) { $html = $label; } - if(!empty($url)){ + if (!empty($url)) { $attr['href'] = $url; } - if($mode==='dot') - { + if ($mode==='dot') { $attr['class'].= ' classfortooltip'; $attr['title'] = $html; $attr['aria-label'] = $label; @@ -8113,8 +8112,8 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' } // Override attr - if(!empty($params['attr']) && is_array($params['attr'])){ - foreach($params['attr']as $key => $value){ + if (!empty($params['attr']) && is_array($params['attr'])) { + foreach($params['attr']as $key => $value) { $attr[$key] = $value; } } @@ -8125,7 +8124,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' $attr = array_map('dol_escape_htmltag', $attr); $TCompiledAttr = array(); - foreach($attr as $key => $value){ + foreach($attr as $key => $value) { $TCompiledAttr[] = $key.'="'.$value.'"'; } @@ -8168,13 +8167,13 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st elseif ($displayMode == 1) { $return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel); } - // use status with images - elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) { + // Use status with images (for backward compatibility) + elseif (! empty($conf->global->MAIN_STATUS_USES_IMAGES)) { $return = ''; $htmlLabel = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'':''); $htmlLabelShort = (in_array($displayMode, array(1,2,5))?'':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'':''); - // For small screen, we use the short label instead of long label. + // For small screen, we always use the short label instead of long label. if (! empty($conf->dol_optimize_smallscreen)) { if ($displayMode == 0) $displayMode = 1; @@ -8212,7 +8211,6 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = $htmlImg .' '. $htmlLabel; } elseif ($displayMode === 5) { - // Add here a span class="hideonsmartphone ? $return = $htmlLabelShort .' '. $htmlImg; } else { // $displayMode >= 6 @@ -8220,7 +8218,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st } } // Use new badge - elseif (!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)) { + elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { $statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel; if ($displayMode == 3) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 0c80b05c9cd..ecadec1b5a8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2023,23 +2023,23 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide // this conf is actually hidden, by default we use 1% for "be carefull or warning" $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01; - $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%'; - $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%'; + $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : ''); + $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : ''); - if($progressCalculated > doubleval($task->progress)){ + if($progressCalculated > doubleval($task->progress)) { $progressBarClass = 'progress-bar-danger'; - $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%'); - $diff = ' '.($task->progress-$progressCalculated).'%'; + $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); + $diff = ' '.($task->progress-$progressCalculated).'%'; } - elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1% + elseif($progressCalculated * $warningRatio >= doubleval($task->progress)) { // warning if close at 1% $progressBarClass = 'progress-bar-warning'; - $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%'); - $diff = ' '.($task->progress-$progressCalculated).'%'; + $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); + $diff = ' '.($task->progress-$progressCalculated).'%'; } else{ $progressBarClass = 'progress-bar-success'; - $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%'); - $diff = ' '.($task->progress-$progressCalculated).'%'; + $title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).' '.$langs->trans("point")); + $diff = ' '.($task->progress-$progressCalculated).'%'; } } @@ -2062,7 +2062,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide if($progressNumber !== false) { $out.= ' '; - if($progressNumber!==true){ + if ($progressNumber!==true) { $out.= $progressNumber; // replace label by param } else{ @@ -2087,8 +2087,21 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide $out.= ''; - $out.= '
'; - $out.= '
'; + $out.= '
'; + $diffval = doubleval($task->progress) - doubleval($progressCalculated); + if ($diffval >= 0) { + // good + $out.= '
'; + $out.= '
'; + $out.= '
'; + } + else + { + // bad + $out.= '
'; + $out.= '
'; + $out.= '
'; + } $out.= '
'; $out.= '
'; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 6717b42609b..0b67fcb621f 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -183,6 +183,10 @@ class EmailCollector extends CommonObject public $debuginfo; + const STATUS_DISABLED = 0; + const STATUS_ENABLED = 1; + + /** * Constructor * @@ -506,47 +510,20 @@ class EmailCollector extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - if (empty($this->labelStatus)) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("mymodule"); - $this->labelStatus[1] = $langs->trans('Enabled'); - $this->labelStatus[0] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled'); + $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled'); + $this->labelStatusShort[self::STATUS_DISABLED] = $langs->trans('Disabled'); } - if ($mode == 0) - { - return $this->labelStatus[$status]; - } - elseif ($mode == 1) - { - return $this->labelStatus[$status]; - } - elseif ($mode == 2) - { - if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - } - elseif ($mode == 3) - { - if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } - elseif ($mode == 4) - { - if ($status == 1) return img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - elseif ($status == 0) return img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelStatus[$status]; - } - elseif ($mode == 5) - { - if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } - elseif ($mode == 6) - { - if ($status == 1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); - } + $statusType = 'status5'; + if ($status == self::STATUS_ENABLED) $statusType = 'status4'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 1f8399d939a..59d16eba2fc 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -6,7 +6,7 @@ ModuleBuilderDesc2=Path where modules are generated/edited (first directory for ModuleBuilderDesc3=Generated/editable modules found: %s ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory NewModule=New module -NewObject=New object +NewObjectInModulebuilder=New object ModuleKey=Module key ObjectKey=Object key ModuleInitialized=Module initialized @@ -66,8 +66,8 @@ ReadmeFile=Readme file ChangeLog=ChangeLog file TestClassFile=File for PHP Unit Test class SqlFile=Sql file -PageForLib=File for PHP library -PageForObjLib=File for PHP library dedicated to object +PageForLib=File for the common PHP library +PageForObjLib=File for the PHP library dedicated to object SqlFileExtraFields=Sql file for complementary attributes SqlFileKey=Sql file for keys SqlFileKeyExtraFields=Sql file for keys of complementary attributes @@ -124,4 +124,8 @@ UseSpecificEditorURL = Use a specific editor URL UseSpecificFamily = Use a specific family UseSpecificAuthor = Use a specific author UseSpecificVersion = Use a specific initial version -ModuleMustBeEnabled=The module/application must be enabled first \ No newline at end of file +ModuleMustBeEnabled=The module/application must be enabled first +IncludeRefGeneration=The reference of object must be generated automatically +IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference +IncludeDocGeneration=I want to generate some documents from the object +IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 234746a0d83..a6df5f9db43 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify @@ -810,6 +810,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname) //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php', ); + if (GETPOST('includerefgeneration', 'int')) + { + $filetogenerate += array( + 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php', + 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', + ); + } + if (GETPOST('includedocgeneration', 'int')) + { + $filetogenerate += array( + 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' + ); + } + foreach($filetogenerate as $srcfile => $destfile) { $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); @@ -1123,7 +1138,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) } } -if ($dirins && $action == 'confirm_delete') +if ($dirins && $action == 'confirm_deletemodule') { if (preg_match('/[^a-z0-9_]/i', $module)) { @@ -1150,8 +1165,6 @@ if ($dirins && $action == 'confirm_delete') } } - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); - //exit; $action = ''; $module = 'deletemodule'; } @@ -1173,26 +1186,30 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) $dir = $dirins.'/'.$modulelowercase; // Delete some files - $filetogenerate = array( - 'myobject_card.php'=>strtolower($objectname).'_card.php', - 'myobject_note.php'=>strtolower($objectname).'_note.php', - 'myobject_document.php'=>strtolower($objectname).'_document.php', - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', - 'myobject_list.php'=>strtolower($objectname).'_list.php', - 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php', - 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', - 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', - 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', - 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', - 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', - 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', - 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php' + $filetodelete = array( + 'myobject_card.php'=>strtolower($objectname).'_card.php', + 'myobject_note.php'=>strtolower($objectname).'_note.php', + 'myobject_document.php'=>strtolower($objectname).'_document.php', + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', + 'myobject_list.php'=>strtolower($objectname).'_list.php', + 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php', + 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', + 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', + 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', + 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', + 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', + 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', + 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', + 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php', + 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php', + 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' ); $resultko = 0; - foreach($filetogenerate as $filetodelete) + foreach($filetodelete as $filetodelete) { $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); if (! $resulttmp) $resultko++; @@ -1208,8 +1225,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) } } - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); - //exit; $action = ''; $tabobj = 'deleteobject'; } @@ -1436,6 +1451,7 @@ if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >=2 || // Search modules to edit print ''."\n"; $listofmodules=array(); +$i=0; foreach($dirsrootforscan as $dirread) { $dirsincustom=dol_dir_list($dirread, 'directories'); @@ -1493,8 +1509,12 @@ foreach($dirsrootforscan as $dirread) if (empty($newdircustom)) $newdircustom=img_warning(); // If dirread was forced to somewhere else, by using URL // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product - print $langs->trans("DirScanned").' : '.$dirread.'
'; + if (empty($i)) print $langs->trans("DirScanned").' : '; + else print ', '; + print ''.$dirread.''; + $i++; } +print '
'; //var_dump($listofmodules); $message=''; @@ -1526,7 +1546,7 @@ if ($message) } //print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
'; -$infomodulesfound = '
'.$form->textwithpicto($langs->trans("ModuleBuilderDesc3", count($listofmodules)), $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
'; +$infomodulesfound = '
'.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).'', $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
'; // Load module descriptor @@ -1601,16 +1621,17 @@ if ($module == 'initmodule') print $langs->trans("EnterNameOfModuleDesc").'
'; print '
'; - print ''; + print '
'; - print ''; + print '
'; print ''; } elseif ($module == 'deletemodule') { + print ''."\n"; print '
'; print ''; - print ''; + print ''; print ''; print $langs->trans("EnterNameOfModuleToDeleteDesc").'

'; @@ -1651,13 +1672,13 @@ elseif (! empty($module)) $linktoenabledisable.=img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', 1); $linktoenabledisable.="\n"; } - if (! empty($conf->$modulelowercase->enabled)) + if (empty($conf->$modulelowercase->enabled)) { - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); + $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsNotActive", $urltomodulesetup), '', -1, 'help'); } else { - $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); + $modulestatusinfo=$form->textwithpicto($langs->trans("ModuleIsLive"), $langs->trans("Warning"), -1, 'warning'); } $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); @@ -1737,13 +1758,8 @@ elseif (! empty($module)) // Link to enable / disable print $modulestatusinfo; - print ' '.$linktoenabledisable; - print '
'; + print ' '.$linktoenabledisable.'
'; - if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase) - { - print ''.$langs->trans("RealPathOfModule").' : '.realpath($dirread.'/'.$modulelowercase).'
'; - } print '
'; if ($tab == 'description') @@ -1756,21 +1772,28 @@ elseif (! empty($module)) { dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 - print ''.$langs->trans("ModuleBuilderDesc".$tab).'

'; + print ''.$langs->trans("ModuleBuilderDesc".$tab).''; + $infoonmodulepath = ''; + if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase) + { + $infoonmodulepath = ''.$langs->trans("RealPathOfModule").' : '.realpath($dirread.'/'.$modulelowercase).'
'; + print ' '.$infoonmodulepath; + } + print '
'; print '
'; print ''; print ''; print ''; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'; @@ -1931,8 +1954,8 @@ elseif (! empty($module)) { $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } print ''; @@ -1983,7 +2006,7 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print ' '.$langs->trans("LanguageFile").' : '; if (! is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").''; @@ -2113,7 +2136,7 @@ elseif (! empty($module)) $dir = $dirread.'/'.$modulelowercase.'/class'; $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; - $head3[$h][1] = $langs->trans("NewObject"); + $head3[$h][1] = ''.$langs->trans("NewObjectInModulebuilder").''; $head3[$h][2] = 'newobject'; $h++; @@ -2165,7 +2188,9 @@ elseif (! empty($module)) print ''.$langs->trans("EnterNameOfObjectDesc").'

'; - print ''; + print '
'; + print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'
'; + print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'
'; print ''; print '
'; print '
'; @@ -2173,7 +2198,6 @@ elseif (! empty($module)) print $langs->trans("or"); print '
'; print '
'; - print '
'; //print ' '; print $langs->trans("InitStructureFromExistingTable"); print ''; @@ -2687,7 +2711,7 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -2827,7 +2851,7 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -2924,7 +2948,7 @@ elseif (! empty($module)) $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''; print ''; @@ -2933,8 +2957,8 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { @@ -2991,8 +3015,8 @@ elseif (! empty($module)) print ''; print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } @@ -3047,8 +3071,8 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { @@ -3099,8 +3123,8 @@ elseif (! empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; } else { @@ -3155,9 +3179,8 @@ elseif (! empty($module)) $pathtofile = $widget['relpath']; print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print ''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } @@ -3242,8 +3265,8 @@ elseif (! empty($module)) $pathtofile = $clifile['relpath']; print ' '.$langs->trans("CLIFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } @@ -3294,7 +3317,7 @@ elseif (! empty($module)) print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print '
'; @@ -3423,8 +3446,8 @@ elseif (! empty($module)) if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; print ''; print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; - print ''.img_picto($langs->trans("Delete"), 'delete').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; print ''; } } diff --git a/htdocs/mrp/ChangeLog.md b/htdocs/mrp/ChangeLog.md deleted file mode 100644 index 416bad1d559..00000000000 --- a/htdocs/mrp/ChangeLog.md +++ /dev/null @@ -1,5 +0,0 @@ -# CHANGELOG MRP FOR DOLIBARR ERP CRM - -## 1.0 -Initial version - diff --git a/htdocs/takepos/ChangeLog.md b/htdocs/takepos/ChangeLog.md deleted file mode 100644 index 7b623eaa252..00000000000 --- a/htdocs/takepos/ChangeLog.md +++ /dev/null @@ -1,5 +0,0 @@ -# CHANGELOG TAKEPOS FOR DOLIBARR ERP CRM - -## 1.0 -Initial version - diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 975f2eb311f..27fc142d991 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -37,7 +37,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> padding: 0; border-radius: 50%; padding: 0.45em; - vertical-align: middle; + vertical-align: text-top; } a.badge:focus, a.badge:hover { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index cf5c4f9703a..4a3b73b1d20 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -473,6 +473,12 @@ textarea.centpercent { .paddingright2 { padding-: 2px; } +.marginleft2 { + margin-: 2px; +} +.marginright2 { + margin-: 2px; +} .cursordefault { cursor: default; } diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php index 3e330745440..c6b48205360 100644 --- a/htdocs/theme/eldy/progress.inc.php +++ b/htdocs/theme/eldy/progress.inc.php @@ -21,10 +21,10 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> height: 20px; overflow: hidden; background-color: #f5f5f5; - background-color: rgba(0,0,0,0.1); + background-color: rgba(128, 128, 128, 0.1); border-radius: 4px; - -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.1); - box-shadow: inset 0 1px 2px rgba(0,0,0,.1); + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } .progress.spaced{ @@ -184,4 +184,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-bar-consumed { + background-color: rgb(0, 0, 0, 0.15); } \ No newline at end of file diff --git a/htdocs/theme/md/badges.inc.php b/htdocs/theme/md/badges.inc.php index 2a1b9ffd24b..11536240ee0 100644 --- a/htdocs/theme/md/badges.inc.php +++ b/htdocs/theme/md/badges.inc.php @@ -36,8 +36,8 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> .badge-dot { padding: 0; border-radius: 50%; - padding: 0.25rem; - vertical-align: middle; + padding: 0.35em; + vertical-align: unset; } a.badge:focus, a.badge:hover { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 320a03c2775..04fe7e85d77 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -676,6 +676,12 @@ textarea.centpercent { .paddingright2 { padding-: 2px; } +.marginleft2 { + margin-: 2px; +} +.marginright2 { + margin-: 2px; +} .cursordefault { cursor: default; } From 5bdb9da5c5ca063f78a6bef5ecfb65d3cb36023e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:56:15 +0100 Subject: [PATCH 40/82] Update box_graph_invoices_supplier_permonth.php --- htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 4393e9db790..e70da7fe680 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -132,7 +132,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png'; $px1 = new DolGraph(); @@ -143,7 +144,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) From 93b00038f8c059ef08a4b1ebab193fb306294daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:57:40 +0100 Subject: [PATCH 41/82] Update box_graph_orders_supplier_permonth.php --- htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 443f374346d..911ac7a91b1 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -134,7 +134,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); @@ -143,7 +144,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) @@ -177,7 +179,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); From dab8aabb16d3064caa2bbb75e1f5c17d6ff20fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:58:30 +0100 Subject: [PATCH 42/82] Update box_graph_invoices_supplier_permonth.php --- htdocs/core/boxes/box_graph_invoices_supplier_permonth.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index e70da7fe680..6d65ea7f534 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -179,7 +179,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png'; $px2 = new DolGraph(); From d14015e3df581bfb2cf6efc8febe1b8048c2e2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 15:59:17 +0100 Subject: [PATCH 43/82] Update box_graph_invoices_permonth.php --- htdocs/core/boxes/box_graph_invoices_permonth.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 19a923ad4e1..5f951362be7 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -181,7 +181,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); From 18b662e430feecc6ccded8b909b203d60c4d8b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 16:01:08 +0100 Subject: [PATCH 44/82] Update box_graph_orders_permonth.php --- htdocs/core/boxes/box_graph_orders_permonth.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index a67c3b94f92..53952bb437b 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -180,7 +180,8 @@ class box_graph_orders_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); From a1b2130247cef3920d3195235c6fb9ee950eb5a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 16:09:31 +0100 Subject: [PATCH 45/82] Enhance the progress bar of tasks --- htdocs/core/lib/project.lib.php | 18 ++++++++++-------- htdocs/theme/eldy/progress.inc.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ecadec1b5a8..06cd96ab995 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -670,8 +670,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($total_projectlinesa_planned) { $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2); $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2); - // this conf is actually hidden, by default we use 1% for "be carefull or warning" - $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01; + + // this conf is actually hidden, by default we use 10% for "be carefull or warning" + $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; // define progress color according to time spend vs workload $progressBarClass = 'progress-bar-info'; @@ -2020,18 +2021,19 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide if ($task->planned_workload){ $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2); - // this conf is actually hidden, by default we use 1% for "be carefull or warning" - $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01; + // this conf is actually hidden, by default we use 10% for "be carefull or warning" + $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : ''); $diffTitle.= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : ''); - if($progressCalculated > doubleval($task->progress)) { + //var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.doubleval($task->progress * $warningRatio)); + if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) { $progressBarClass = 'progress-bar-danger'; $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $diff = ' '.($task->progress-$progressCalculated).'%'; } - elseif($progressCalculated * $warningRatio >= doubleval($task->progress)) { // warning if close at 1% + elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 1% $progressBarClass = 'progress-bar-warning'; $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $diff = ' '.($task->progress-$progressCalculated).'%'; @@ -2130,8 +2132,8 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '') if ($task->planned_workload){ $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2); - // this conf is actually hidden, by default we use 1% for "be carefull or warning" - $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01; + // this conf is actually hidden, by default we use 10% for "be carefull or warning" + $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; if($progressCalculated > doubleval($task->progress)){ $badgeClass.= 'badge-danger'; diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php index c6b48205360..a211c40efb4 100644 --- a/htdocs/theme/eldy/progress.inc.php +++ b/htdocs/theme/eldy/progress.inc.php @@ -167,7 +167,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> } .progress-bar-yellow, .progress-bar-warning { - background-color: #f39c12; + background-color: #bc9526; } .progress-striped .progress-bar-yellow, .progress-striped .progress-bar-warning { diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 386a81f0afd..24e7e6f7d41 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -81,7 +81,7 @@ $toolTipFontColor='#333'; $textSuccess ='#28a745'; $colorblind_deuteranopes_textSuccess ='#37de5d'; $textDanger ='#dc3545'; -$textWarning ='#f39c12'; +$textWarning ='#bc9526'; $colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color From ec05e8e2c5729d7ad8d3a9e7bf296c6ad97b1dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 16:13:40 +0100 Subject: [PATCH 46/82] $key is overwriting a variable from outer foreach loop --- htdocs/admin/notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 6d1a5c57cf6..52de58b80b8 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -236,7 +236,7 @@ foreach($listofnotifiedevents as $notifiedevent) $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator. $arrayemail=explode(',', $value); $showwarning=0; - foreach($arrayemail as $key=>$valuedet) + foreach($arrayemail as $keydet => $valuedet) { $valuedet=trim($valuedet); if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++; From 12b6e4fae6f41141a6be9555231f15889674aaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 16:25:22 +0100 Subject: [PATCH 47/82] Update translation.php Are you sure the usage of print_barre_liste($title... '', 0, '', '', $limit) is correct as it seems to always return null. --- htdocs/admin/translation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 4d234e266e8..967d7826aa0 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -458,7 +458,7 @@ if ($mode == 'searchkey') //print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder; $title = $langs->trans("TranslationKeySearch"); if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')'; - print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n"; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n"; print ''; print ''; @@ -466,7 +466,7 @@ if ($mode == 'searchkey') print '
'; print ''; print ''; - print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder).''; + print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder); //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder); From e98619745ff92a77092da1e0d0eace5b47fac7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 16:27:30 +0100 Subject: [PATCH 48/82] Update translation.php --- htdocs/admin/translation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 967d7826aa0..52ef490ceae 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -458,7 +458,7 @@ if ($mode == 'searchkey') //print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder; $title = $langs->trans("TranslationKeySearch"); if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')'; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n"; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit); print ''; print ''; From bb9b4358755241694b6b3948bd9d4744769be9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:12:07 +0100 Subject: [PATCH 49/82] doxygen for actioncomm class --- htdocs/comm/action/class/actioncomm.class.php | 228 +++++++++++++----- 1 file changed, 162 insertions(+), 66 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8432ba786a1..1b926a97453 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -45,43 +45,67 @@ class ActionComm extends CommonObject */ public $table_element = 'actioncomm'; + /** + * @var string Name of id column + */ public $table_rowid = 'id'; /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + * @var string Name of icon for actioncomm object. Filename of icon is object_action.png */ public $picto = 'action'; /** - * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - * @var int + * @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; /** - * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty - * @var integer + * @var integer 0=Default + * 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * 2=Same than 1 but accept record if fksoc is empty */ public $restrictiononfksoc = 2; /** - * Id of the event - * @var int + * @var int Id of the event */ public $id; /** - * Id of the event. Use $id as possible - * @var int + * @var int Id of the event. Use $id as possible */ public $ref; - public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) - public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. + /** + * @var int Id into parent table llx_c_actioncomm (used only if option to use type is set) + */ + public $type_id; + + /** + * @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. + */ + public $type_code; + + /** + * @var string Type label + */ public $type_label; - public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) - public $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) - public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) + + /** + * @var string Label into parent table llx_c_actioncomm (used only if option to use type is set) + */ + public $type; + + /** + * @var string Color into parent table llx_c_actioncomm (used only if option to use type is set) + */ + public $type_color; + + /** + * @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) + */ + public $code; /** * @var string Agenda event label @@ -89,72 +113,56 @@ class ActionComm extends CommonObject public $label; /** - * Date creation record (datec) - * - * @var integer + * @var integer Date creation record (datec) */ public $datec; /** - * Date end record (datef) - * - * @var integer + * @var integer Date end record (datef) */ public $datef; /** - * Duration (duree) - * - * @var integer + * @var integer Duration (duree) */ public $duree; /** - * Date modification record (tms) - * - * @var integer + * @var integer Date modification record (tms) */ public $datem; /** - * Object user that create action - * @var User + * @var User Object user that create action * @deprecated * @see $authorid */ public $author; /** - * Object user that modified action - * @var User + * @var User Object user that modified action * @deprecated * @see $usermodid */ public $usermod; /** - * Id user that create action - * @var int + * @var int Id user that create action */ public $authorid; /** - * Id user that modified action - * @var int + * @var int Id user that modified action */ public $usermodid; /** - * Date action start (datep) - * - * @var integer + * @var integer Date action start (datep) */ public $datep; /** - * Date action end (datep2) - * - * @var integer + * @var integer Date action end (datep2) */ public $datep2; @@ -163,90 +171,178 @@ class ActionComm extends CommonObject * @deprecated */ public $durationp = -1; - public $fulldayevent = 0; // 1=Event on full day /** - * Milestone - * @var int + * @var int 1=Event on full day + */ + public $fulldayevent = 0; + + /** + * @var int Milestone * @deprecated Milestone is already event with end date = start date */ public $punctual = 1; - public $percentage; // Percentage - public $location; // Location - public $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) - public $priority; // Small int (0 By default) + /** + * @var integer Percentage + */ + public $percentage; - public $userassigned = array(); // Array of user ids - public $userownerid; // Id of user owner = fk_user_action into table - public $userdoneid; // Id of user done (deprecated) + /** + * @var string Location + */ + public $location; - public $socpeopleassigned = array(); // Array of contact ids + /** + * @var int Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) + */ + public $transparency; - public $otherassigned = array(); // Array of other contact emails (not user, not contact) + /** + * @var int (0 By default) + */ + public $priority; + + /** + * @var int[] Array of user ids + */ + public $userassigned = array(); + + /** + * @var int Id of user owner = fk_user_action into table + */ + public $userownerid; + + /** + * @var int Id of user done (deprecated) + * @deprecated + */ + public $userdoneid; + + /** + * @var int[] Array of contact ids + */ + public $socpeopleassigned = array(); + + /** + * @var int[] Array of other contact emails (not user, not contact) + */ + public $otherassigned = array(); - /** - * Object user of owner - * @var User + /** + * @var User Object user of owner * @deprecated * @see userownerid */ public $usertodo; /** - * Object user that did action - * @var User + * @var User Object user that did action * @deprecated * @see userdoneid */ public $userdone; + /** + * @var int thirdparty id linked to action + */ public $socid; + + /** + * @var int socpeople id linked to action + */ public $contactid; /** - * Company linked to action (optional) - * @var Societe|null + * @var Societe|null Company linked to action (optional) * @deprecated * @see socid */ public $societe; /** - * Contact linked to action (optional) - * @var Contact|null + * @var Contact|null Contact linked to action (optional) * @deprecated * @see contactid */ public $contact; // Properties for links to other objects + /** + * @var int Id of linked object + */ public $fk_element; // Id of record - public $elementid; // Id of record alternative for API - public $elementtype; // Type of record. This if property ->element of object linked to. - // Ical + /** + * @var int Id of record alternative for API + */ + public $elementid; + + /** + * @var string Type of record. This if property ->element of object linked to. + */ + public $elementtype; + + /** + * @var string Ical name + */ public $icalname; + + /** + * @var string Ical color + */ public $icalcolor; + /** + * @var array Actions + */ public $actions=array(); - // Fields for emails + /** + * @var string Email msgid + */ public $email_msgid; + + /** + * @var string Email from + */ public $email_from; + + /** + * @var string Email sender + */ public $email_sender; + + /** + * @var string Email to + */ public $email_to; + + /** + * @var string Email tocc + */ public $email_tocc; + /** + * @var string Email tobcc + */ public $email_tobcc; + + /** + * @var string Email subject + */ public $email_subject; + + /** + * @var string Email errors to + */ public $errors_to; /** * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ public function __construct(DoliDB $db) { From 5314ff70f5f0d1b75367c58b58e0406efb929f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:26:53 +0100 Subject: [PATCH 50/82] Update index.php in class ref and rowid are the same, lib is deprecated and is label --- htdocs/compta/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 1453491fd11..fb23929f7a8 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -661,8 +661,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $obj = $db->fetch_object($resql); $chargestatic->id=$obj->rowid; - $chargestatic->ref=$obj->libelle; - $chargestatic->lib=$obj->libelle; + $chargestatic->ref=$obj->rowid; + $chargestatic->label=$obj->libelle; $chargestatic->paye=$obj->paye; print ''; From 61873aa1a89107b4073178d014d80e8ee9414e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:29:21 +0100 Subject: [PATCH 51/82] Update list.php --- htdocs/compta/sociales/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 56493f3bf7c..c2d5c94d1a3 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -261,7 +261,7 @@ if ($resql) $chargesociale_static->id=$obj->id; $chargesociale_static->ref=$obj->id; - $chargesociale_static->lib=$obj->libelle; + $chargesociale_static->label=$obj->libelle; $chargesociale_static->type_libelle=$obj->type_lib; print ''; From 38b86d4bde713af8eeccf5a348189fc52ba46dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:30:49 +0100 Subject: [PATCH 52/82] Update payments.php --- htdocs/compta/sociales/payments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index caf11a6ea3b..461cf6d8330 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -176,8 +176,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) // Label print ''; // Type From 6dd8e7152cd97e2d4765944d68b95e0055476a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:31:34 +0100 Subject: [PATCH 53/82] Update index.php --- htdocs/compta/charges/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 01cda8871b5..04c2cdd76d1 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -185,8 +185,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) // Label print ''; // Type From 8b98df296fd7c3cf64e6270fddfe23d1f6238f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:36:11 +0100 Subject: [PATCH 54/82] Update info.php --- htdocs/compta/sociales/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 3d59e2b229c..7fedbbba700 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -79,8 +79,8 @@ dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill'); $morehtmlref='
'; // Label of social contribution -$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); -$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); +$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Project if (! empty($conf->projet->enabled)) { From d11fc24e3b90762c176bdc5e5b052baf845ac4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:46:00 +0100 Subject: [PATCH 55/82] Update index.php --- htdocs/mrp/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index 742d94109e2..bd342e06b3e 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -236,7 +236,7 @@ else print '
'; $parameters = array('type' => $type, 'user' => $user); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, null); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, ''); // Note that $action and $object may have been modified by hook // End of page llxFooter(); From 2af23aa65828617af5c60e3fdb0df17d557846c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 17:54:17 +0100 Subject: [PATCH 56/82] Enhance modulebuilder --- htdocs/core/lib/modulebuilder.lib.php | 14 ++- htdocs/langs/en_US/modulebuilder.lang | 6 + htdocs/modulebuilder/index.php | 104 ++++++++++++++---- .../template/class/myobject.class.php | 12 +- .../doc/doc_generic_myobject_odt.modules.php | 0 .../mod_myobject_advanced.php | 0 .../mod_myobject_standard.php | 0 .../modules_myobject.php | 0 .../tpl/linkedobjectblock_myobject.tpl.php | 58 ++++++++++ .../template/core/tpl/mytemplate.tpl.php | 35 ------ 10 files changed, 159 insertions(+), 70 deletions(-) rename htdocs/modulebuilder/template/core/modules/{myobject => mymodule}/doc/doc_generic_myobject_odt.modules.php (100%) rename htdocs/modulebuilder/template/core/modules/{myobject => mymodule}/mod_myobject_advanced.php (100%) rename htdocs/modulebuilder/template/core/modules/{myobject => mymodule}/mod_myobject_standard.php (100%) rename htdocs/modulebuilder/template/core/modules/{myobject => mymodule}/modules_myobject.php (100%) create mode 100644 htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php delete mode 100644 htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index e6f36b25d47..4e5cbb92c02 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -128,17 +128,19 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $i++; $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).","; - $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).","; $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).","; - $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).","; + $texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).","; + $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).","; + if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',"; if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',"; if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; + if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',"; if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',"; - if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',"; + if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',"; if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; - if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',"; + if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',"; if ($val['arrayofkeyval']) { $texttoinsert.= " 'arrayofkeyval'=>array("; @@ -149,8 +151,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $texttoinsert.="'".$key2."'=>'".$val2."'"; $i++; } - $texttoinsert.= ")"; + $texttoinsert.= "),"; } + if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\""; + $texttoinsert.= "),\n"; } } diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 59d16eba2fc..4a0e0daf5c1 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -129,3 +129,9 @@ IncludeRefGeneration=The reference of object must be generated automatically IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference IncludeDocGeneration=I want to generate some documents from the object IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record. +ShowOnCombobox=Show value into combobox +KeyForTooltip=Key for tooltip +CSSClass=CSS Class +NotEditable=Not editable +ForeignKey=Foreign key +TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php:1 (1 means we add a + button after the combo to create the record) \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a6df5f9db43..7fffdfcd50d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -810,18 +810,23 @@ if ($dirins && $action == 'initobject' && $module && $objectname) //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php', ); - if (GETPOST('includerefgeneration', 'int')) + if (GETPOST('includerefgeneration', 'aZ09')) { + dol_mkdir($destdir.'/core/modules/'.strtolower($module)); + $filetogenerate += array( - 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', - 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php', - 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php', + 'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php', ); } - if (GETPOST('includedocgeneration', 'int')) + if (GETPOST('includedocgeneration', 'aZ09')) { + dol_mkdir($destdir.'/core/modules/'.strtolower($module)); + dol_mkdir($destdir.'/core/modules/'.strtolower($module).'/doc'); + $filetogenerate += array( - 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' + 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' ); } @@ -843,8 +848,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname) } } - //if (! $error) // If there is error copying 1 file, we still have to make the replacement - //{ + // Edit the class 'class/'.strtolower($objectname).'.class.php' + if (GETPOST('includerefgeneration', 'aZ09')) { + // Replace 'visible'=>1, 'noteditable'=>0, 'default'=>'' + $arrayreplacement = array('/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' => "'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'"); + //var_dump($arrayreplacement);exit; + //var_dump($destdir.'/class/'.strtolower($objectname).'.class.php');exit; + dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1); + } + + // Edit the setup file and the card page + if (GETPOST('includedocgeneration', 'aZ09')) { + // TODO + // dolReplaceInFile(); + } + // Scan for object class files $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); @@ -917,15 +935,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname) // Add module descriptor to list of files to replace "MyObject' string with real name of object. $filetogenerate[]='core/modules/mod'.$module.'.class.php'; - - // TODO } - //} } if (! $error) { - // Edit PHP files + // Edit PHP files to make replacement foreach($filetogenerate as $destfile) { $phpfileval['fullname'] = $destdir.'/'.$destfile; @@ -970,6 +985,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) if (! $error) { setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); + $tabobj = $objectname; } } @@ -1198,14 +1214,15 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', + 'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql', 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php', - 'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', - 'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php', - 'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php', - 'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' + 'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php', + 'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php', + 'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php', + 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php' ); $resultko = 0; @@ -2460,7 +2477,7 @@ elseif (! empty($module)) print load_fiche_titre($langs->trans("ObjectProperties"), '', ''); - + print ''."\n"; print '
'; print '
'; $socialcontrib->id=$obj->rowid; - $socialcontrib->ref=$obj->libelle; - $socialcontrib->lib=$obj->libelle; + $socialcontrib->ref=$obj->rowid; + $socialcontrib->label=$obj->libelle; print $socialcontrib->getNomUrl(1, '20'); print ''; $socialcontrib->id=$obj->rowid; - $socialcontrib->ref=$obj->libelle; - $socialcontrib->lib=$obj->libelle; + $socialcontrib->ref=$obj->rowid; + $socialcontrib->label=$obj->libelle; print $socialcontrib->getNomUrl(1, '20'); print '
'; print ''; @@ -2470,16 +2487,22 @@ elseif (! empty($module)) print ''; - print ''; print ''; print ''; print ''; print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; print ''; print ''; print ''; @@ -2500,11 +2523,17 @@ elseif (! empty($module)) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; print ''; print ''; @@ -2548,7 +2583,7 @@ elseif (! empty($module)) print ''; - print ''; print ''; + print ''; print ''; @@ -2575,16 +2613,34 @@ elseif (! empty($module)) print $propvisible?$propvisible:''; print ''; print ''; print ''; + print ''; + print ''; + print ''; + print ''; + /*print '';*/ print ''; print ''; print ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 43488429807..7d3de98e4df 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -68,21 +68,21 @@ class MyObject extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) * 'noteditable' says if field is not editable (1 or 0) - * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. * 'index' if we want an index in database. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). - * 'position' is the sort order of field. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). * 'css' is the CSS style to use on field. For example: 'maxwidth200' * 'help' is a string visible as a tooltip on field - * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. */ // BEGIN MODULEBUILDER PROPERTIES @@ -91,13 +91,13 @@ class MyObject extends CommonObject */ public $fields=array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'notnull'=> 1, 'default'=>'(PROV)', 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), - 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,), + 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), diff --git a/htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php similarity index 100% rename from htdocs/modulebuilder/template/core/modules/myobject/doc/doc_generic_myobject_odt.modules.php rename to htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php diff --git a/htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php similarity index 100% rename from htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_advanced.php rename to htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php diff --git a/htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php similarity index 100% rename from htdocs/modulebuilder/template/core/modules/myobject/mod_myobject_standard.php rename to htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php diff --git a/htdocs/modulebuilder/template/core/modules/myobject/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php similarity index 100% rename from htdocs/modulebuilder/template/core/modules/myobject/modules_myobject.php rename to htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php new file mode 100644 index 00000000000..c0b2e073ad0 --- /dev/null +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -0,0 +1,58 @@ + + * + * 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 . + */ + +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +print "\n"; + + +global $user; +global $noMoreLinkedObjectBlockAfter; + +$langs = $GLOBALS['langs']; +$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; + +// Load translation files required by the page +$langs->load("mymodule"); + +$total=0; $ilink=0; +foreach($linkedObjectBlock as $key => $objectlink) +{ + $ilink++; + + $trclass='oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; + ?> + + + + + + + + + + \n"; diff --git a/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php b/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php deleted file mode 100644 index 8e871e7f416..00000000000 --- a/htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -/** - * \file core/tpl/mytemplate.tpl.php - * \ingroup mymodule - * \brief Example template. - * - * Put detailed description here. - */ - -// Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ - print "Error, template page can't be called as URL"; - exit; -} - - -/** Your code here. */ -echo "Hello world!"; From f30c8eb6e894f41e42ff1fc9ac5b9716f664db64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 17:54:22 +0100 Subject: [PATCH 57/82] Update index.php Fatal error: Uncaught Error: Cannot pass parameter 3 by reference in /home/fred/netlogic/dolibarr/htdocs/mrp/index.php on line 239 --- htdocs/mrp/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index bd342e06b3e..d4b63515157 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -236,7 +236,8 @@ else print ''; $parameters = array('type' => $type, 'user' => $user); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, ''); // Note that $action and $object may have been modified by hook +$object = new stdClass(); +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // Note that $action and $object may have been modified by hook // End of page llxFooter(); From 433b45537669a4b08fd9036ebc6c23ef761e531c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 18:29:02 +0100 Subject: [PATCH 58/82] Update index.php --- htdocs/mrp/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index d4b63515157..a46fc868a20 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -236,8 +236,7 @@ else print ''; $parameters = array('type' => $type, 'user' => $user); -$object = new stdClass(); -$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters); // End of page llxFooter(); From 012c5ef0c4c47b24e7a0107c086449a9f6005d9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 18:35:48 +0100 Subject: [PATCH 59/82] Can use substitution variables into filter of fields link --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/html.form.class.php | 6 +++++- htdocs/langs/en_US/modulebuilder.lang | 2 +- htdocs/modulebuilder/template/myobject_list.php | 13 +++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7707be211f3..deb27817be9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5624,7 +5624,7 @@ abstract class CommonObject { $morecss = 'minwidth100imp'; } - elseif ($type == 'datetime') + elseif ($type == 'datetime' || $type == 'link') { $morecss = 'minwidth200imp'; } @@ -6093,7 +6093,7 @@ abstract class CommonObject $param_list_array = explode(':', $param_list[0]); $showempty=(($required && $default != '')?0:1); - $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1); + $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, empty($val['disabled'])?0:1); if (! empty($param_list_array[2])) // If we set to add a create button { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 72c1e589233..4be775ea038 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5865,7 +5865,11 @@ class Form if ($classname && class_exists($classname)) { $objecttmp = new $classname($this->db); - $objecttmp->filter = $filter; + // Make some replacement + $objecttmp->filter = str_replace( + array('__ENTITY__', '__USER_ID__'), + array($conf->entity, $user->id), + $filter); } } if (! is_object($objecttmp)) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 4a0e0daf5c1..d26f58fd00e 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -134,4 +134,4 @@ KeyForTooltip=Key for tooltip CSSClass=CSS Class NotEditable=Not editable ForeignKey=Foreign key -TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php:1 (1 means we add a + button after the combo to create the record) \ No newline at end of file +TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1;entity=$conf->entity' for example) \ No newline at end of file diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 525fa879562..bf9b73e0f53 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -153,6 +153,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$permtoread = $user->rights->mymodule->myobject->read; +$permtowrite = $user->rights->mymodule->myobject->write; +$permtodelete = $user->rights->mymodule->myobject->delete; /* @@ -190,8 +193,6 @@ if (empty($reshook)) // Mass actions $objectclass='MyObject'; $objectlabel='MyObject'; - $permtoread = $user->rights->mymodule->read; - $permtodelete = $user->rights->mymodule->delete; $uploaddir = $conf->mymodule->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -346,7 +347,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); -if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); +if ($permtodelete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); @@ -360,7 +361,7 @@ print ''; print ''; print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write); +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permtowrite); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); @@ -593,8 +594,8 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n $urlsource.=str_replace('&', '&', $param); $filedir=$diroutputmassaction; - $genallowed=$user->rights->mymodule->read; - $delallowed=$user->rights->mymodule->write; + $genallowed=$permtoread; + $delallowed=$permtowrite; print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } From 40a9326d511a1189ec1426585cba5d6c6de7a197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 18:42:58 +0100 Subject: [PATCH 60/82] $type is undefined --- htdocs/mrp/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index a46fc868a20..0a7a77c48f8 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -235,7 +235,10 @@ else print ''; -$parameters = array('type' => $type, 'user' => $user); +$parameters = array( + //'type' => $type, + 'user' => $user, +); $reshook = $hookmanager->executeHooks('dashboardMRP', $parameters); // End of page From f74833cfe11d916bfe162359e27d416d533144cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 18:44:32 +0100 Subject: [PATCH 61/82] Make modulebuilder more compatible with multicompany --- htdocs/core/class/html.form.class.php | 6 ++++-- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4be775ea038..6790ec43cae 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5866,9 +5866,10 @@ class Form { $objecttmp = new $classname($this->db); // Make some replacement + $sharedentities = getEntity(strtolower($classname)); $objecttmp->filter = str_replace( - array('__ENTITY__', '__USER_ID__'), - array($conf->entity, $user->id), + array('__ENTITY__', '__SHARED_ENTITIES__', '__USER_ID__'), + array($conf->entity, $sharedentities, $user->id), $filter); } } @@ -5878,6 +5879,7 @@ class Form return 'Error bad setup of type for field '.join(',', $InfoFieldList); } + //var_dump($objecttmp->filter); $prefixforautocompletemode=$objecttmp->element; if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company'; $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 7d3de98e4df..4cefbc159a0 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -96,7 +96,7 @@ class MyObject extends CommonObject 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), From a95a10b8f03c6dd9e724c42091537353f0197f8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 18:45:44 +0100 Subject: [PATCH 62/82] Update doc --- htdocs/langs/en_US/modulebuilder.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index d26f58fd00e..d14aa8a3c71 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -134,4 +134,4 @@ KeyForTooltip=Key for tooltip CSSClass=CSS Class NotEditable=Not editable ForeignKey=Foreign key -TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1;entity=$conf->entity' for example) \ No newline at end of file +TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example) \ No newline at end of file From 6f7788568676a219e60729650b1408e0aaf9389e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 1 Nov 2019 20:26:39 +0100 Subject: [PATCH 63/82] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 5b179d487a9..e7046e07f43 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -445,16 +445,18 @@ class Products extends DolibarrApi //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code ); } + /** * Get prices per customer for a product * * @param int $id ID of product + * @param string $thirdparty_id Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i} * * @return mixed * * @url GET {id}/selling_multiprices/per_customer */ - public function getCustomerPricesPerCustomer($id) + public function getCustomerPricesPerCustomer($id, $thirdparty_id = '') { global $conf; @@ -470,15 +472,18 @@ class Products extends DolibarrApi if (! $result ) { throw new RestException(404, 'Product not found'); } - + if ($result > 0) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($this->db); - $result = $prodcustprice->fetch_all('', '', 0, 0, array('t.fk_product' => $id)); + $filter = array(); + $filter['t.fk_product'] .= $id; + if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id; + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); } if ( empty($prodcustprice->lines)) { - throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($prodcustprice->error), $prodcustprice->errors)); + throw new RestException(404, 'Prices not found'); } return $prodcustprice->lines; From 693506cebd1e58c20f7eb325c31e3455ae2899ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 20:26:55 +0100 Subject: [PATCH 64/82] Update propal.class.php socid is int --- htdocs/comm/propal/class/propal.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8d84d1f4820..51a888af76e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -95,8 +95,17 @@ class Propal extends CommonObject */ public $socid; + /** + * ID of the contact + * @var int + */ public $contactid; public $author; + + /** + * Ref from thirdparty + * @var string + */ public $ref_client; /** @@ -240,7 +249,7 @@ class Propal extends CommonObject * @param int $socid Id third party * @param int $propalid Id proposal */ - public function __construct($db, $socid = "", $propalid = 0) + public function __construct($db, $socid = 0, $propalid = 0) { global $conf,$langs; From 0e260c859b92d1dc533dcec7874ffb29ff6fbc82 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 1 Nov 2019 19:28:39 +0000 Subject: [PATCH 65/82] Fixing style errors. --- htdocs/product/class/api_products.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index e7046e07f43..1b0020faa25 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -445,7 +445,7 @@ class Products extends DolibarrApi //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code ); } - + /** * Get prices per customer for a product * @@ -472,13 +472,13 @@ class Products extends DolibarrApi if (! $result ) { throw new RestException(404, 'Product not found'); } - + if ($result > 0) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($this->db); $filter = array(); $filter['t.fk_product'] .= $id; - if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id; + if ($thirdparty_id) $filter['t.fk_soc'] .= $thirdparty_id; $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); } From 83cc9ea643783e27ba863d673fb4f699eb68ff0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 20:48:46 +0100 Subject: [PATCH 66/82] FIX Search on leave request ref --- htdocs/holiday/list.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 1c03e3801b6..4256ecd13f9 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -197,10 +197,7 @@ llxHeader('', $langs->trans('CPTitreMenu')); $order = $db->order($sortfield, $sortorder).$db->plimit($limit + 1, $offset); // Ref -if(!empty($search_ref)) -{ - $filter.= " AND cp.rowid = ".(int) $db->escape($search_ref); -} +if (!empty($search_ref)) $filter.= natural_search("cp.ref", $search_ref); // Start date $filter.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start); // End date @@ -231,7 +228,6 @@ if (!empty($sall)) if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',', $childids).')'; - // Récupération de l'ID de l'utilisateur $user_id = $user->id; From a3a326b25ef076a3619655e0938cfad200ffcbbf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 20:52:11 +0100 Subject: [PATCH 67/82] FIX Search on leave request ref --- htdocs/holiday/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 4256ecd13f9..1ead5872f78 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -116,6 +116,7 @@ $search_type = GETPOST('search_type', 'int'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( + 'cp.ref'=>'Ref', 'cp.description'=>'Description', 'uu.lastname'=>'EmployeeLastname', 'uu.firstname'=>'EmployeeFirstname' From 4616519dcfeee162a9710478fd8612a0af4d677e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 20:52:30 +0100 Subject: [PATCH 68/82] FIX Search on leave request ref --- htdocs/holiday/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b86dd2864b5..e4137199060 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -121,6 +121,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, // List of fields to search into when doing a "search in all" $fieldstosearchall = array( + 'cp.ref'=>'Ref', 'cp.description'=>'Description', 'uu.lastname'=>'EmployeeLastname', 'uu.firstname'=>'EmployeeFirstname', @@ -287,7 +288,7 @@ $sql.= ", ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " WHERE cp.entity IN (".getEntity('holiday').")"; $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau // Search all -if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +//if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref if(!empty($search_ref)) { From cf2ee892ee1842065dfe1b02a3d54b5526fa261e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 21:27:19 +0100 Subject: [PATCH 69/82] FIX security check. A user can see holiday with link without permissions --- htdocs/holiday/card.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1f597f2ddc2..6518258b508 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -44,10 +44,6 @@ $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); $fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id); -// Protection if external user -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'holiday', $id, 'holiday'); - $now=dol_now(); // Load translation files required by the page @@ -61,9 +57,9 @@ if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = ''; $error = 0; $object = new Holiday($db); -if ($id > 0) +if (($id > 0) || $ref) { - $object->fetch($id); + $object->fetch($id, $ref); // Check current user can read this leave request $canread = 0; @@ -83,6 +79,12 @@ $candelete = 0; if (! empty($user->rights->holiday->delete)) $candelete=1; if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete=1; +// Protection if external user +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'holiday', $object->id, 'holiday'); + + + /* * Actions */ From 7bd88f33a05903e158ee83c7ff64e3062414ac08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 22:22:07 +0100 Subject: [PATCH 70/82] Update define_holiday.php --- htdocs/holiday/define_holiday.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index ec2b12f9bf5..c5ab5e0e5ec 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -201,11 +201,6 @@ if ($lastUpdate) { } print "
\n"; -$result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user. -if ($result < 0) -{ - setEventMessages($holiday->error, $holiday->errors, 'errors'); -} $filters = ''; From 8608c5db9ca9cce2f18f012a31ab935286c04218 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 23:16:08 +0100 Subject: [PATCH 71/82] Fix color of task progression --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/lib/functions.lib.php | 35 +++++++++++++++---------- htdocs/core/lib/project.lib.php | 8 +++--- htdocs/mrp/index.php | 4 +-- htdocs/projet/card.php | 2 +- htdocs/projet/index.php | 4 +-- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6807e75ba80..67693b83c6b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1029,7 +1029,7 @@ class ExtraFields { $morecss = 'minwidth100imp'; } - elseif ($type == 'datetime') + elseif ($type == 'datetime' || $type == 'link') { $morecss = 'minwidth200imp'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7750e62c506..90583e1d4e4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1122,13 +1122,20 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab { global $conf, $langs, $hookmanager; - $out="\n".'
'."\n"; - - if ($morehtmlright) $out.='
'.$morehtmlright.'
'; // Output right area first so when space is missing, text is in front of tabs and not under. - // Show title $showtitle=1; if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0; + + $out = "\n".''; + + if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) { + $out.= '
'."\n"; + } + + // Show right part + if ($morehtmlright) $out.='
'.$morehtmlright.'
'; // Output right area first so when space is missing, text is in front of tabs and not under. + + // Show title if (! empty($title) && $showtitle) { $limittitle=30; @@ -1138,6 +1145,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $out.=''; } + // Show tabs + // Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs). $maxkey=-1; if (is_array($links) && ! empty($links)) @@ -1149,16 +1158,15 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab if (! empty($conf->dol_optimize_smallscreen)) $conf->global->MAIN_MAXTABS_IN_CARD=2; // Show tabs - $bactive=false; // if =0 we don't use the feature $limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD); $displaytab=0; $nbintab=0; - $popuptab=0; $outmore=''; + $popuptab=0; + $outmore=''; for ($i = 0 ; $i <= $maxkey ; $i++) { - if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) - { + if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) { // If active tab is already present if ($i >= $limittoshow) $limittoshow--; } @@ -1166,13 +1174,10 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab for ($i = 0 ; $i <= $maxkey ; $i++) { - if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) - { + if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) { $isactive=true; - $bactive=true; } - else - { + else { $isactive=false; } @@ -1258,7 +1263,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $out.=""; } - $out.="
\n"; + if ((! empty($title) && $showtitle) || $morehtmlright || ! empty($links)) { + $out.="
\n"; + } if (! $notab || $notab == -1 || $notab == -2) $out.="\n".'
'."\n"; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 06cd96ab995..a177b3f13c0 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1996,6 +1996,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks * @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null * @param spaced $spaced bool used to add space at bottom (made by css) * @return string + * @see getTaskProgressBadge() */ function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false) { @@ -2033,7 +2034,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $diff = ' '.($task->progress-$progressCalculated).'%'; } - elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 1% + elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10% $progressBarClass = 'progress-bar-warning'; $title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).' '.$langs->trans("point")); $diff = ' '.($task->progress-$progressCalculated).'%'; @@ -2116,6 +2117,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide * @param label $label string empty = auto (progress), string = replace output * @param tooltip $tooltip string empty = auto , string = replace output * @return string + * @see getTaskProgressView() */ function getTaskProgressBadge($task, $label = '', $tooltip = '') { @@ -2135,10 +2137,10 @@ function getTaskProgressBadge($task, $label = '', $tooltip = '') // this conf is actually hidden, by default we use 10% for "be carefull or warning" $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; - if($progressCalculated > doubleval($task->progress)){ + if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) { $badgeClass.= 'badge-danger'; } - elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1% + elseif (doubleval($progressCalculated) > doubleval($task->progress)) { // warning if close at 10% $badgeClass.= 'badge-warning'; } else{ diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index 742d94109e2..9abb940283e 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -163,7 +163,7 @@ if ($resql) print '
'; print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -216,7 +216,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index f15499d4682..e4a8dd078ec 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -509,7 +509,7 @@ if ($action == 'create' && $user->rights->projet->creer) dol_fiche_head(); - print '
'; print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); print ''.$langs->trans("Type").''; + print ''.$form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelp")).''.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).''.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).''.$langs->trans("DefaultValue").''.$langs->trans("DatabaseIndex").''.$langs->trans("ForeignKey").''.$langs->trans("Position").''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).''.$langs->trans("NotEditable").''.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).''.$langs->trans("CSSClass").''.$langs->trans("KeyForTooltip").''.$langs->trans("ShowOnCombobox").''.$langs->trans("Disabled").''.$langs->trans("Comment").'
'; print ''; @@ -2531,13 +2560,19 @@ elseif (! empty($module)) $proptype=$propval['type']; $proparrayofkeyval=$propval['arrayofkeyval']; $propnotnull=$propval['notnull']; - $propsearchall=$propval['searchall']; $propdefault=$propval['default']; $propindex=$propval['index']; + $propforeignkey=$propval['foreignkey']; $propposition=$propval['position']; $propenabled=$propval['enabled']; $propvisible=$propval['visible']; + $propnoteditable=$propval['noteditable']; + $propsearchall=$propval['searchall']; $propisameasure=$propval['isameasure']; + $propcss=$propval['css']; + $prophelp=$propval['help']; + $propshowoncombobox=$propval['showoncombobox']; + //$propdisabled=$propval['disabled']; $propcomment=$propval['comment']; print '
'; print $proplabel; print ''; + print ''; print $proptype; print ''; @@ -2565,6 +2600,9 @@ elseif (! empty($module)) print ''; print $propindex?'1':''; print ''; + print $propforeignkey?$propforeignkey:''; + print ''; print $propposition; print ''; - print $propisameasure?$propisameasure:''; + print $propnoteditable?$propnoteditable:''; print ''; print $propsearchall?'1':''; print ''; + print $propisameasure?$propisameasure:''; + print ''; + print $propcss?$propcss:''; + print ''; + print $prophelp?$prophelp:''; + print ''; + print $propshowoncombobox?$propshowoncombobox:''; + print ''; + print $propdisabled?$propdisabled:''; + print ''; print $propcomment; print ''; - print ''.img_delete().''; + if ($propname != 'rowid') + { + print ''.img_delete().''; + } print '
trans("MyObject"); ?>getNomUrl(1); ?>date, 'day'); ?>getLibStatut(7); ?>'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'.$staticbom->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticbom->getLibStatut(5).''.$staticbom->getLibStatut(3).'
'.$staticmo->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticmo->getLibStatut(5).''.$staticmo->getLibStatut(3).'
'; + print '
'; $defaultref=''; $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index c16d42ae97c..be8a924e1ab 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -171,7 +171,7 @@ print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppst print '
'; -// Last modified projects +// Latest modified projects $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.tms as datem,"; $sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; @@ -243,7 +243,7 @@ if ($resql) } print ''; print '
'; - print ''; + print ''; print ''; $i++; } From cea2c3a9f43843f149285234a3303a21e95ac6e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2019 23:58:14 +0100 Subject: [PATCH 72/82] Look and feel v11 --- .../class/accountingaccount.class.php | 29 ++-- htdocs/adherents/class/adherent.class.php | 12 +- htdocs/comm/mailing/cibles.php | 6 +- htdocs/comm/mailing/class/mailing.class.php | 115 +++++--------- htdocs/comm/propal/class/propal.class.php | 26 ++-- htdocs/commande/class/commande.class.php | 18 +-- .../bank/class/paymentvarious.class.php | 32 ++-- .../deplacement/class/deplacement.class.php | 32 ++-- .../class/bonprelevement.class.php | 36 ++--- .../class/ligneprelevement.class.php | 24 +-- .../sociales/class/chargesociales.class.php | 38 ++--- htdocs/core/class/fiscalyear.class.php | 24 +-- htdocs/core/lib/functions.lib.php | 2 +- htdocs/don/class/paymentdonation.class.php | 4 +- htdocs/expedition/class/expedition.class.php | 34 ++--- .../class/paymentexpensereport.class.php | 4 +- .../fournisseur.commande.dispatch.class.php | 28 ++-- htdocs/fourn/commande/index.php | 8 +- htdocs/livraison/class/livraison.class.php | 34 ++--- htdocs/loan/class/loan.class.php | 38 ++--- .../product/stock/class/productlot.class.php | 4 +- htdocs/projet/class/task.class.php | 68 ++++----- htdocs/reception/class/reception.class.php | 34 ++--- htdocs/ticket/class/ticket.class.php | 144 +++++++++--------- htdocs/user/class/usergroup.class.php | 4 +- 25 files changed, 377 insertions(+), 421 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 21cbdeb9662..0cfc0d24826 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -638,11 +638,11 @@ class AccountingAccount extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -650,34 +650,33 @@ class AccountingAccount extends CommonObject if ($mode == 0) { - $prefix=''; - if ($statut == 1) return $langs->trans('Enabled'); - elseif ($statut == 0) return $langs->trans('Disabled'); + if ($status == 1) return $langs->trans('Enabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } elseif ($mode == 1) { - if ($statut == 1) return $langs->trans('Enabled'); - elseif ($statut == 0) return $langs->trans('Disabled'); + if ($status == 1) return $langs->trans('Enabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } elseif ($mode == 2) { - if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 3) { - if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5'); + if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); } elseif ($mode == 4) { - if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 5) { - if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); } } } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 9d0e0fa47dc..f7278f9007a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -174,7 +174,7 @@ class Adherent extends CommonObject // -1:brouillon, 0:resilie, >=1:valide,paye // def in common object - //public $statut; + //public $status; public $photo; @@ -2168,13 +2168,13 @@ class Adherent extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $need_subscription 1 if member type need subscription, 0 otherwise * @param int $date_end_subscription Date fin adhesion * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0) + public function LibStatut($status, $need_subscription, $date_end_subscription, $mode = 0) { // phpcs:enable global $langs; @@ -2184,13 +2184,13 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($statut == -1) + if ($status == -1) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); } - elseif ($statut >= 1) { + elseif ($status >= 1) { if ($need_subscription == 0) { $statusType = 'status4'; @@ -2215,7 +2215,7 @@ class Adherent extends CommonObject $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } } - elseif ($statut == 0) + elseif ($status == 0) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 998f4a6c202..fc83b20d58f 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -479,14 +479,13 @@ if ($object->fetch($id) >= 0) { $num = $db->num_rows($resql); - $param = "&id=".$object->id; + $param = "&id=".$object->id; //if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname); if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); if ($search_email) $param.= "&search_email=".urlencode($search_email); if ($search_other) $param.= "&search_other=".urlencode($search_other); - if ($page) $param.= "&page=".urlencode($page); print ''; print ''; @@ -500,6 +499,7 @@ if ($object->fetch($id) >= 0) $morehtmlcenter=''.$langs->trans("ToClearAllRecipientsClickHere").' id.'" class="button reposition">'.$langs->trans("TargetsReset").''; } $morehtmlcenter.=' id.'">'.$langs->trans("Download").''; + print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); print ''; @@ -560,6 +560,8 @@ if ($object->fetch($id) >= 0) print ''; print ''; + if ($page) $param.= "&page=".urlencode($page); + print ''; print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 41f74846125..5867e80dbb2 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -618,48 +618,24 @@ class Mailing extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; - $langs->load('mails'); + $langs->load("mailing"); - if ($mode == 0 || $mode == 1) - { - return $langs->trans($this->statuts[$statut]); - } - elseif ($mode == 2) - { - if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); - } - elseif ($mode == 3) - { - if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - } - elseif ($mode == 4) - { - if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); - } - elseif ($mode == 5) - { - if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - } + $labelStatus = $langs->trans($this->statuts[$status]); + $labelStatusShort = $langs->trans($this->statuts[$status]); + + $statusType = 'status'.$status; + if ($status == 2) $statusType = 'status3'; + if ($status == 3) $statusType = 'status6'; + + return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } @@ -667,58 +643,37 @@ class Mailing extends CommonObject * Renvoi le libelle d'un statut donne * TODO Add class mailin_target.class.php * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param string $desc Desc error * @return string Label */ - public static function libStatutDest($statut, $mode = 0, $desc = '') + public static function libStatutDest($status, $mode = 0, $desc = '') { global $langs; - $langs->load('mails'); + $langs->load("mails"); - if ($mode == 0) - { - return $langs->trans('MailingStatusError'); - } - elseif ($mode == 1) - { - return $langs->trans('MailingStatusSent'); - } - elseif ($mode == 2) - { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); - } - elseif ($mode == 3) - { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); - } - elseif ($mode == 4) - { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); - } - elseif ($mode == 5) - { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); - } - elseif ($mode == 6) - { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + $labelStatus = array(); + $labelStatusShort = array(); + + $labelStatus[-1] = $langs->trans('MailingStatusError'); + $labelStatus[1] = $langs->trans('MailingStatusSent'); + $labelStatus[2] = $langs->trans('MailingStatusRead'); + $labelStatus[3] = $langs->trans('MailingStatusNotContact'); + $labelStatusShort[-1] = $langs->trans('MailingStatusError'); + $labelStatusShort[1] = $langs->trans('MailingStatusSent'); + $labelStatusShort[2] = $langs->trans('MailingStatusRead'); + $labelStatusShort[3] = $langs->trans('MailingStatusNotContact'); + + $statusType = 'status'.$status; + if ($status == -1) $statusType = 'status8'; + if ($status == 1) $statusType = 'status6'; + if ($status == 2) $statusType = 'status4'; + + $param = array(); + if ($status == - 1) { + $param = array('badgeParams'=>array('attr'=>array('title'=>$desc))); } + return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param); } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8d84d1f4820..a76cbe3c519 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3200,11 +3200,11 @@ class Propal extends CommonObject /** * Return label of a status (draft, validated, ...) * - * @param int $statut id statut + * @param int $status Id status * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 1) + public function LibStatut($status, $mode = 1) { // phpcs:enable global $conf; @@ -3227,13 +3227,13 @@ class Propal extends CommonObject } $statusType=''; - if ($statut==self::STATUS_DRAFT) $statusType='status0'; - elseif ($statut==self::STATUS_VALIDATED) $statusType='status1'; - elseif ($statut==self::STATUS_SIGNED) $statusType='status3'; - elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5'; - elseif ($statut==self::STATUS_BILLED) $statusType='status6'; + if ($status==self::STATUS_DRAFT) $statusType='status0'; + elseif ($status==self::STATUS_VALIDATED) $statusType='status1'; + elseif ($status==self::STATUS_SIGNED) $statusType='status3'; + elseif ($status==self::STATUS_NOTSIGNED) $statusType='status5'; + elseif ($status==self::STATUS_BILLED) $statusType='status6'; - return dolGetStatus($this->labelStatus[$statut], $this->labelStatusShort[$statut], '', $statusType, $mode); + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } @@ -3272,17 +3272,17 @@ class Propal extends CommonObject $now=dol_now(); $delay_warning = 0; - $statut = 0; + $status = 0; $label = $labelShort = ''; if ($mode == 'opened') { $delay_warning=$conf->propal->cloture->warning_delay; - $statut = self::STATUS_VALIDATED; + $status = self::STATUS_VALIDATED; $label = $langs->trans("PropalsToClose"); $labelShort = $langs->trans("ToAcceptRefuse"); } if ($mode == 'signed') { $delay_warning=$conf->propal->facturation->warning_delay; - $statut = self::STATUS_SIGNED; + $status = self::STATUS_SIGNED; $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered $labelShort = $langs->trans("ToBill"); } @@ -3291,8 +3291,8 @@ class Propal extends CommonObject $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; - $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals'; + $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 261190a747e..4348b3b05a5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3469,13 +3469,13 @@ class Commande extends CommonOrder /** * Return label of status * - * @param int $statut Id statut + * @param int $status Id status * @param int $billed If invoiced * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ - public function LibStatut($statut, $billed, $mode, $donotshowbilled = 0) + public function LibStatut($status, $billed, $mode, $donotshowbilled = 0) { // phpcs:enable global $langs, $conf; @@ -3483,37 +3483,37 @@ class Commande extends CommonOrder $billedtext = ''; if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):''); - if ($statut==self::STATUS_CANCELED){ + if ($status==self::STATUS_CANCELED){ $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); $statusType='status5'; } - elseif ($statut==self::STATUS_DRAFT){ + elseif ($status==self::STATUS_DRAFT){ $labelStatus = $langs->trans('StatusOrderDraft'); $labelStatusShort = $langs->trans('StatusOrderDraftShort'); $statusType='status0'; } - elseif ($statut==self::STATUS_VALIDATED){ + elseif ($status==self::STATUS_VALIDATED){ $labelStatus = $langs->trans('StatusOrderValidated').$billedtext; $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; $statusType='status1'; } - elseif ($statut==self::STATUS_SHIPMENTONPROCESS){ + elseif ($status==self::STATUS_SHIPMENTONPROCESS){ $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; $statusType='status3'; } - elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ $labelStatus = $langs->trans('StatusOrderToBill'); $labelStatusShort = $langs->trans('StatusOrderToBillShort'); $statusType='status4'; } - elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; $statusType='status6'; } - elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ + elseif ($status==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){ $labelStatus = $langs->trans('StatusOrderDelivered'); $labelStatusShort = $langs->trans('StatusOrderDelivered'); $statusType='status6'; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index ed94c8e4700..ca3acd59e42 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -523,46 +523,46 @@ class PaymentVarious extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id status + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); } elseif ($mode == 3) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); } elseif ($mode == 4) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); } } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 1b70641a6bc..0601c62fd80 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -336,46 +336,46 @@ class Deplacement extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id status + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); } elseif ($mode == 3) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); } elseif ($mode == 4) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==2 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3058d418237..f1c3f70c53a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1995,11 +1995,11 @@ class BonPrelevement extends CommonObject /** * Return status label for a status * - * @param int $statut id statut + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable if (empty($this->labelStatus)) @@ -2013,37 +2013,37 @@ class BonPrelevement extends CommonObject if ($mode == 0 || $mode == 1) { - return $this->labelStatus[$statut]; + return $this->labelStatus[$status]; } elseif ($mode == 2) { - if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut]; - elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut]; - elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut]; + if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status]; + elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status]; + elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status]; } elseif ($mode == 3) { - if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1'); - elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3'); - elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6'); + if ($status==0) return img_picto($this->labelStatus[$status], 'statut1'); + elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3'); + elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($this->labelStatus[$statut], 'statut1').' '.$this->labelStatus[$statut]; - elseif ($statut==1) return img_picto($this->labelStatus[$statut], 'statut3').' '.$this->labelStatus[$statut]; - elseif ($statut==2) return img_picto($this->labelStatus[$statut], 'statut6').' '.$this->labelStatus[$statut]; + if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status]; + elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status]; + elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status]; } elseif ($mode == 5) { - if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1'); - elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3'); - elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6'); + if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1'); + elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3'); + elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6'); } elseif ($mode == 6) { - if ($statut==0) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut1'); - elseif ($statut==1) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut3'); - elseif ($statut==2) return $this->labelStatus[$statut].' '.img_picto($this->labelStatus[$statut], 'statut6'); + if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1'); + elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3'); + elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6'); } } } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 3b0f61b17a0..467351e3110 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -132,36 +132,36 @@ class LignePrelevement /** * Return status label for a status * - * @param int $statut id statut + * @param int $status Id status * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited - elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited + elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut1'); + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6'); + elseif ($status==3) return img_picto($langs->trans($this->statuts[$status]), 'statut8'); } elseif ($mode == 3) { - if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1'); + elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); + elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index bbffbebe0c9..50474f3d52c 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -465,12 +465,12 @@ class ChargeSociales extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - public function LibStatut($statut, $mode = 0, $alreadypaid = -1) + public function LibStatut($status, $mode = 0, $alreadypaid = -1) { // phpcs:enable global $langs; @@ -480,38 +480,38 @@ class ChargeSociales extends CommonObject if ($mode == 0 || $mode == 1) { - if ($statut == 0) return $langs->trans("Unpaid"); - elseif ($statut == 1) return $langs->trans("Paid"); + if ($status == 0) return $langs->trans("Unpaid"); + elseif ($status == 1) return $langs->trans("Paid"); } elseif ($mode == 2) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 3) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 4) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 5) { - if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 6) { - if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } else return "Error, mode/status not found"; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index f944ccdc0c0..0eed1a56580 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -290,42 +290,42 @@ class Fiscalyear extends CommonObject /** * Give a label from a status * - * @param int $statut Id status + * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts_short[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]); } elseif ($mode == 3) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8'); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8'); } elseif ($mode == 4) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); + if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); - elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); + elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 90583e1d4e4..afecdeeb234 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8094,7 +8094,7 @@ function roundUpToNextMultiple($n, $x = 5) * @param string $type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 * @param string $mode default '' , pill, dot * @param string $url the url for link - * @param array $params various params for future : recommended rather than adding more fuction arguments + * @param array $params various params for future : recommended rather than adding more fuction arguments. array('attr'=>array('title'=>'abc')) * @return string Html badge */ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index f28ecddc0eb..3c5404366de 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -474,11 +474,11 @@ class PaymentDonation extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 0c340bc8695..e4f6f06b5a0 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1668,44 +1668,44 @@ class Expedition extends CommonObject /** * Return label of a status * - * @param int $statut Id statut + * @param int $status Id statut * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - public function LibStatut($statut, $mode) + public function LibStatut($status, $mode) { // phpcs:enable global $langs; if ($mode==0) { - if ($statut==0) return $langs->trans($this->statuts[$statut]); - elseif ($statut==1) return $langs->trans($this->statuts[$statut]); - elseif ($statut==2) return $langs->trans($this->statuts[$statut]); + if ($status==0) return $langs->trans($this->statuts[$status]); + elseif ($status==1) return $langs->trans($this->statuts[$status]); + elseif ($status==2) return $langs->trans($this->statuts[$status]); } elseif ($mode==1) { - if ($statut==0) return $langs->trans($this->statutshorts[$statut]); - elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]); - elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]); + if ($status==0) return $langs->trans($this->statutshorts[$status]); + elseif ($status==1) return $langs->trans($this->statutshorts[$status]); + elseif ($status==2) return $langs->trans($this->statutshorts[$status]); } elseif ($mode == 3) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - if ($statut==0) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return $langs->trans($this->statutshorts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + if ($status==0) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return $langs->trans($this->statutshorts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); } } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 5c72dd18528..074250d2347 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -476,11 +476,11 @@ class PaymentExpenseReport extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index aed9db75a64..b453653c681 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -539,11 +539,11 @@ class CommandeFournisseurDispatch extends CommonObject /** * Return label of a status * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -551,33 +551,33 @@ class CommandeFournisseurDispatch extends CommonObject if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statutshort[$statut]); + return $langs->trans($this->statutshort[$status]); } elseif ($mode == 2) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 3) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + if ($status==0) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); } } diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index ec71820ebbb..6804f96545d 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -117,14 +117,14 @@ if ($resql) print '
'.dol_print_date($db->jdate($obj->datem), 'day').''.$projectstatic->LibStatut($obj->fk_statut, 5).''.$projectstatic->LibStatut($obj->fk_statut, 3).'
'; print ''; print "\n"; - foreach (array(0,1,2,3,4,5,6) as $statut) + foreach (array(0,1,2,3,4,5,6) as $status) { - $dataseries[]=array($commandestatic->LibStatut($statut, 1), (isset($vals[$statut])?(int) $vals[$statut]:0)); + $dataseries[]=array($commandestatic->LibStatut($status, 1), (isset($vals[$status])?(int) $vals[$status]:0)); if (! $conf->use_javascript_ajax) { print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; } } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 428015a96f4..1e7fdebaa64 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -823,44 +823,44 @@ class Livraison extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - public function LibStatut($statut, $mode) + public function LibStatut($status, $mode) { // phpcs:enable global $langs; if ($mode==0) { - if ($statut==-1) return $langs->trans('StatusDeliveryCanceled'); - elseif ($statut==0) return $langs->trans('StatusDeliveryDraft'); - elseif ($statut==1) return $langs->trans('StatusDeliveryValidated'); + if ($status==-1) return $langs->trans('StatusDeliveryCanceled'); + elseif ($status==0) return $langs->trans('StatusDeliveryDraft'); + elseif ($status==1) return $langs->trans('StatusDeliveryValidated'); } elseif ($mode==1) { - if ($statut==-1) return $langs->trans($this->statuts[$statut]); - elseif ($statut==0) return $langs->trans($this->statuts[$statut]); - elseif ($statut==1) return $langs->trans($this->statuts[$statut]); + if ($status==-1) return $langs->trans($this->statuts[$status]); + elseif ($status==0) return $langs->trans($this->statuts[$status]); + elseif ($status==1) return $langs->trans($this->statuts[$status]); } elseif ($mode == 3) { - if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5'); - if ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0'); - if ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4'); + if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5'); + if ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0'); + if ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4'); } elseif ($mode == 4) { - if ($statut==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled'); - elseif ($statut==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft'); - elseif ($statut==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated'); + if ($status==-1) return img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5').' '.$langs->trans('StatusDeliveryCanceled'); + elseif ($status==0) return img_picto($langs->trans('StatusDeliveryDraft'), 'statut0').' '.$langs->trans('StatusDeliveryDraft'); + elseif ($status==1) return img_picto($langs->trans('StatusDeliveryValidated'), 'statut4').' '.$langs->trans('StatusDeliveryValidated'); } elseif ($mode == 6) { - if ($statut==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5'); - elseif ($statut==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0'); - elseif ($statut==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4'); + if ($status==-1) return $langs->trans('StatusDeliveryCanceled').' '.img_picto($langs->trans('StatusDeliveryCanceled'), 'statut5'); + elseif ($status==0) return $langs->trans('StatusDeliveryDraft').' '.img_picto($langs->trans('StatusDeliveryDraft'), 'statut0'); + elseif ($status==1) return $langs->trans('StatusDeliveryValidated').' '.img_picto($langs->trans('StatusDeliveryValidated'), 'statut4'); } } diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index c8e241186d2..9b0c3c69ca6 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -402,12 +402,12 @@ class Loan extends CommonObject /** * Return label for given status * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - public function LibStatut($statut, $mode = 0, $alreadypaid = -1) + public function LibStatut($status, $mode = 0, $alreadypaid = -1) { // phpcs:enable global $langs; @@ -415,38 +415,38 @@ class Loan extends CommonObject if ($mode == 0 || $mode == 1) { - if ($statut == 0) return $langs->trans("Unpaid"); - elseif ($statut == 1) return $langs->trans("Paid"); + if ($status == 0) return $langs->trans("Unpaid"); + elseif ($status == 1) return $langs->trans("Paid"); } elseif ($mode == 2) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 3) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 4) { - if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 5) { - if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 6) { - if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } else return "Error, mode/status not found"; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 3848a592f21..1e217deef48 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -501,11 +501,11 @@ class Productlot extends CommonObject /** * Return label of a given status * - * @param int $statut Status + * @param int $status Status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1bd044bc985..ed42a51491b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1839,11 +1839,11 @@ class Task extends CommonObject /** * Return status label for an object * - * @param int $statut Id statut + * @param int $status Id status * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable // list of Statut of the task @@ -1862,59 +1862,59 @@ class Task extends CommonObject if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); - elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts_short[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); } elseif ($mode == 3) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1'); - elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3'); - elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); - elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); - elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5'); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); + elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3'); + elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts[$statut]); + if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]); + elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { - /*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - elseif ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - elseif ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - elseif ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - elseif ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - elseif ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + /*if ($status==0) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; } elseif ($mode == 6) { - /*if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - elseif ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - elseif ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - elseif ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + /*if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index dd819adff0a..eae8ab9de34 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1136,44 +1136,44 @@ class Reception extends CommonObject /** * Return label of a status * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - public function LibStatut($statut, $mode) + public function LibStatut($status, $mode) { // phpcs:enable global $langs; if ($mode==0) { - if ($statut==0) return $langs->trans($this->statuts[$statut]); - elseif ($statut==1) return $langs->trans($this->statuts[$statut]); - elseif ($statut==2) return $langs->trans($this->statuts[$statut]); + if ($status==0) return $langs->trans($this->statuts[$status]); + elseif ($status==1) return $langs->trans($this->statuts[$status]); + elseif ($status==2) return $langs->trans($this->statuts[$status]); } elseif ($mode==1) { - if ($statut==0) return $langs->trans('StatusReceptionDraftShort'); - elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort'); - elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort'); + if ($status==0) return $langs->trans('StatusReceptionDraftShort'); + elseif ($status==1) return $langs->trans('StatusReceptionValidatedShort'); + elseif ($status==2) return $langs->trans('StatusReceptionProcessedShort'); } elseif ($mode == 3) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6'); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6'); } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed'); + if ($status==0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status==1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); + elseif ($status==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed'); } elseif ($mode == 5) { - if ($statut==0) return $langs->trans('StatusReceptionDraftShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6'); + if ($status==0) return $langs->trans('StatusReceptionDraftShort').' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); + elseif ($status==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); + elseif ($status==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6'); } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 0daba74be77..9a3bce8c458 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1169,123 +1169,123 @@ class Ticket extends CommonObject /** * Return status label of object * - * @param string $statut id statut + * @param string $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { - if ($statut == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } } elseif ($mode == 3) { - if ($statut == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); } - elseif ($statut == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); } - elseif ($statut == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket'); + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); } - elseif ($statut == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); } - elseif ($statut == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); } - elseif ($statut == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); } - elseif ($statut == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); } - elseif ($statut == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); } } elseif ($mode == 4) { - if ($statut == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } - elseif ($statut == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$status]); } } elseif ($mode == 5 || $mode == 6) { - if ($statut == self::STATUS_NOT_READ) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); + if ($status == self::STATUS_NOT_READ) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); } - elseif ($statut == self::STATUS_READ) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); + elseif ($status == self::STATUS_READ) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); } - elseif ($statut == self::STATUS_ASSIGNED) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket'); + elseif ($status == self::STATUS_ASSIGNED) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); } - elseif ($statut == self::STATUS_IN_PROGRESS) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); + elseif ($status == self::STATUS_IN_PROGRESS) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); } - elseif ($statut == self::STATUS_NEED_MORE_INFO) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); } - elseif ($statut == self::STATUS_WAITING) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); + elseif ($status == self::STATUS_WAITING) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); } - elseif ($statut == self::STATUS_CLOSED) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); + elseif ($status == self::STATUS_CLOSED) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); } - elseif ($statut == self::STATUS_CANCELED) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); + elseif ($status == self::STATUS_CANCELED) { + return $langs->trans($this->statuts_short[$status]) . ' ' . img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); } } } @@ -2228,13 +2228,13 @@ class Ticket extends CommonObject * Get array of all contacts for a ticket * Override method of file commonobject.class.php to add phone number * - * @param int $statut Status of lines to get (-1=all) + * @param int $status Status of lines to get (-1=all) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array Array of contacts */ - public function listeContact($statut = -1, $source = 'external', $list = 0, $code = '') + public function listeContact($status = -1, $source = 'external', $list = 0, $code = '') { global $langs; @@ -2281,8 +2281,8 @@ class Ticket extends CommonObject } $sql .= " AND tc.active=1"; - if ($statut >= 0) { - $sql .= " AND ec.statut = '" . $statut . "'"; + if ($status >= 0) { + $sql .= " AND ec.statut = '" . $status . "'"; } $sql .= " ORDER BY t.lastname ASC"; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b624bdb34d9..8a6fcd60ce9 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -836,11 +836,11 @@ class UserGroup extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - public function LibStatut($statut, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; From 941043dd67356c7d40eefa83cb995c7707f30530 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Nov 2019 00:17:08 +0100 Subject: [PATCH 73/82] Fix navigation on resources --- htdocs/comm/mailing/info.php | 11 +++- .../template/myobject_agenda.php | 13 ++--- htdocs/resource/agenda.php | 55 +++++++++---------- htdocs/resource/card.php | 17 +++--- htdocs/resource/document.php | 4 +- 5 files changed, 53 insertions(+), 47 deletions(-) diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 7b270e460c8..8d15f86915d 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -57,7 +57,16 @@ if ($object->fetch($id) >= 0) $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; - if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + $nbtry = $nbok = 0; + if ($object->statut == 2 || $object->statut == 3) + { + $nbtry = $object->countNbOfTargets('alreadysent'); + $nbko = $object->countNbOfTargets('alreadysentko'); + + $morehtmlright.=' ('.$nbtry.'/'.$object->nbemail; + if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlright.=')   '; + } dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 8abb3623909..90a14061cdc 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -65,11 +65,6 @@ else } $search_agenda_label=GETPOST('search_agenda_label'); -// Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; -//$result = restrictedArea($user, 'mymodule', $id); - $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -79,7 +74,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield='a.datep,a.id'; -if (! $sortorder) $sortorder='DESC'; +if (! $sortorder) $sortorder='DESC,DESC'; // Initialize technical objects $object=new MyObject($db); @@ -93,13 +88,17 @@ $extrafields->fetch_name_optionals_label($object->table_element); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id; +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mymodule', $object->id); /* * Actions */ -$parameters=array('id'=>$socid); +$parameters=array('id'=>$id); $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 0f2e79ef86f..303db5ec7b3 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -37,6 +37,13 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; // Load translation files required by the page $langs->load("companies"); +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + if (GETPOST('actioncode', 'array')) { $actioncode=GETPOST('actioncode', 'array', 3); @@ -48,21 +55,6 @@ else } $search_agenda_label=GETPOST('search_agenda_label'); -// Security check -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); -if ($user->societe_id) $id=$user->societe_id; -// Protection if external user -if ($user->socid > 0) -{ - accessforbidden(); -} - -if( ! $user->rights->resource->read) -{ - accessforbidden(); -} - $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -74,9 +66,20 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='a.datep,a.id'; if (! $sortorder) $sortorder='DESC,DESC'; -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new DolResource($db); +$object->fetch($id, $ref); + +// Initialize technical objects +//$object=new MyObject($db); +$extrafields = new ExtraFields($db); $hookmanager->initHooks(array('agendaresource')); +// Security check +if( ! $user->rights->resource->read) +{ + accessforbidden(); +} + /* * Actions @@ -110,10 +113,9 @@ if (empty($reshook)) */ $contactstatic = new Contact($db); - $form = new Form($db); -if ($id > 0 || $ref) +if ($object->id > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -121,9 +123,6 @@ if ($id > 0 || $ref) $langs->load("companies"); $picto = 'resource'; - $object = new Dolresource($db); - $result = $object->fetch($id); - $title=$langs->trans("Agenda"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref." - ".$title; llxHeader('', $title); @@ -138,13 +137,15 @@ if ($id > 0 || $ref) $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref='
'; + $morehtmlref.='
'; + $shownav = 1; if ($user->societe_id && ! in_array('resource', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; - dol_banner_tab($object, 'id', $linkback, $shownav, 'id'); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; - print '
'; print '
'; @@ -153,11 +154,9 @@ if ($id > 0 || $ref) if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { - print '
'; - - $param='&id='.$id; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $param='&id='.$object->id.'&socid='.$socid; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); print_barre_liste($langs->trans("ActionsOnResource"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 2b4092671dc..f52da4934b0 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -63,9 +63,9 @@ $extrafields->fetch_name_optionals_label($object->table_element); -/******************************************************************* - * ACTIONS - ********************************************************************/ +/* + * Actions + */ $hookmanager->initHooks(array('resource', 'resource_card','globalcard')); $parameters=array('resource_id'=>$id); @@ -211,18 +211,17 @@ if (empty($reshook)) } -/*************************************************** -* VIEW -* -* Put here all code to build page -****************************************************/ +/* + * View + */ + $title = $langs->trans($action == 'create' ? 'AddResource' : 'ResourceSingular'); llxHeader('', $title, ''); $form = new Form($db); $formresource = new FormResource($db); -if ($action == 'create' || $object->fetch($id) > 0) +if ($action == 'create' || $object->fetch($id, $ref) > 0) { if ($action == 'create') { diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index fef78e8088c..9f1b5af4322 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -82,7 +82,7 @@ $form = new Form($db); llxHeader('', $langs->trans("Resource")); -if ($object->id) +if ($object->id > 0) { $object->fetch_thirdparty(); @@ -100,7 +100,7 @@ if ($object->id) } - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; From a14aab5eb1044605ed121111be484c786a14e82b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Nov 2019 00:18:50 +0100 Subject: [PATCH 74/82] Fix template --- htdocs/modulebuilder/template/myobject_agenda.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 90a14061cdc..7a15ba2843a 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -125,8 +125,6 @@ if (empty($reshook)) * View */ -$contactstatic = new Contact($db); - $form = new Form($db); if ($object->id > 0) From 50f55cac35c92b7ab4f349a6f9cd3c82c40a51b0 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Sat, 2 Nov 2019 00:17:45 +0000 Subject: [PATCH 75/82] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- .../fourn/class/api_supplier_orders.class.php | 590 +++++++++--------- htdocs/societe/index.php | 152 ++--- htdocs/stripe/config.php | 6 +- 3 files changed, 374 insertions(+), 374 deletions(-) diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 2ab90bcd73b..37ac4c55e9d 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -28,180 +28,180 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; */ class SupplierOrders extends DolibarrApi { - /** - * - * @var array $FIELDS Mandatory fields, checked when create and update object - */ - static $FIELDS = array( - 'socid' - ); + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); - /** - * @var CommandeFournisseur $order {@type CommandeFournisseur} - */ - public $order; + /** + * @var CommandeFournisseur $order {@type CommandeFournisseur} + */ + public $order; - /** - * Constructor - */ - public function __construct() - { - global $db, $conf; - $this->db = $db; - $this->order = new CommandeFournisseur($this->db); - } + /** + * Constructor + */ + public function __construct() + { + global $db, $conf; + $this->db = $db; + $this->order = new CommandeFournisseur($this->db); + } - /** - * Get properties of a supplier order object - * - * Return an array with supplier order information - * - * @param int $id ID of supplier order - * @return array|mixed data without useless information - * - * @throws RestException - */ - public function get($id) - { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) { - throw new RestException(401); - } + /** + * Get properties of a supplier order object + * + * Return an array with supplier order information + * + * @param int $id ID of supplier order + * @return array|mixed data without useless information + * + * @throws RestException + */ + public function get($id) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) { + throw new RestException(401); + } - $result = $this->order->fetch($id); - if ( ! $result ) { - throw new RestException(404, 'Supplier order not found'); - } + $result = $this->order->fetch($id); + if ( ! $result ) { + throw new RestException(404, 'Supplier order not found'); + } - if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $this->order->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->order); - } + $this->order->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->order); + } - /** - * List orders - * - * Get a list of supplier orders - * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" - * @return array Array of order objects - * - * @throws RestException - */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') - { - global $db, $conf; + /** + * List orders + * + * Get a list of supplier orders + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @return array Array of order objects + * + * @throws RestException + */ + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + { + global $db, $conf; - $obj_ret = array(); + $obj_ret = array(); - // case of external user, $thirdparty_ids param is ignored and replaced by user's socid - $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : $thirdparty_ids; - // If the internal user must only see his customers, force searching by him - $search_sale = 0; - if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; - $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t"; + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - $sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; - if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; - if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + $sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Filter by status - if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; - if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)"; - if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)"; - if ($status == 'running') $sql.= " AND t.fk_statut IN (3)"; - if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)"; - if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)"; - if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)"; - if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)"; - // Insert sale filter - if ($search_sale > 0) - { - $sql .= " AND sc.fk_user = ".$search_sale; - } - // Add sql filters - if ($sqlfilters) - { - if (! DolibarrApi::_checkFilters($sqlfilters)) - { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); - } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; - } + // Filter by status + if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; + if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)"; + if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)"; + if ($status == 'running') $sql.= " AND t.fk_statut IN (3)"; + if ($status == 'received_start') $sql.= " AND t.fk_statut IN (4)"; + if ($status == 'received_end') $sql.= " AND t.fk_statut IN (5)"; + if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (6,7)"; + if ($status == 'refused') $sql.= " AND t.fk_statut IN (9)"; + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } - $sql.= $db->order($sortfield, $sortorder); - if ($limit) { - if ($page < 0) - { - $page = 0; - } - $offset = $limit * $page; + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; - $sql.= $db->plimit($limit + 1, $offset); - } + $sql.= $db->plimit($limit + 1, $offset); + } - $result = $db->query($sql); - if ($result) - { - $i = 0; - $num = $db->num_rows($result); - $min = min($num, ($limit <= 0 ? $num : $limit)); - while ($i < $min) - { - $obj = $db->fetch_object($result); - $order_static = new CommandeFournisseur($db); - if($order_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($order_static); - } - $i++; - } - } - else { - throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror()); - } - if( ! count($obj_ret)) { - throw new RestException(404, 'No supplier order found'); - } - return $obj_ret; - } + $result = $db->query($sql); + if ($result) + { + $i = 0; + $num = $db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + while ($i < $min) + { + $obj = $db->fetch_object($result); + $order_static = new CommandeFournisseur($db); + if($order_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($order_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve supplier order list : '.$db->lasterror()); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No supplier order found'); + } + return $obj_ret; + } - /** - * Create supplier order object - * - * @param array $request_data Request datas - * @return int ID of supplier order - */ - public function post($request_data = null) - { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401, "Insuffisant rights"); - } - // Check mandatory fields - $result = $this->_validate($request_data); + /** + * Create supplier order object + * + * @param array $request_data Request datas + * @return int ID of supplier order + */ + public function post($request_data = null) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); - foreach($request_data as $field => $value) { - $this->order->$field = $value; - } - if(! array_keys($request_data, 'date')) { - $this->order->date = dol_now(); - } - /* We keep lines as an array + foreach($request_data as $field => $value) { + $this->order->$field = $value; + } + if(! array_keys($request_data, 'date')) { + $this->order->date = dol_now(); + } + /* We keep lines as an array if (isset($request_data["lines"])) { $lines = array(); foreach ($request_data["lines"] as $line) { @@ -210,163 +210,163 @@ class SupplierOrders extends DolibarrApi $this->order->lines = $lines; }*/ - if ($this->order->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors)); - } - return $this->order->id; - } + if ($this->order->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->order->error), $this->order->errors)); + } + return $this->order->id; + } - /** - * Update supplier order - * - * @param int $id Id of supplier order to update - * @param array $request_data Datas - * @return int - */ - public function put($id, $request_data = null) - { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } + /** + * Update supplier order + * + * @param int $id Id of supplier order to update + * @param array $request_data Datas + * @return int + */ + public function put($id, $request_data = null) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { + throw new RestException(401); + } - $result = $this->order->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Supplier order not found'); - } + $result = $this->order->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Supplier order not found'); + } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - foreach($request_data as $field => $value) { - if ($field == 'id') continue; - $this->order->$field = $value; - } + foreach($request_data as $field => $value) { + if ($field == 'id') continue; + $this->order->$field = $value; + } - if($this->order->update($id, DolibarrApiAccess::$user)) - return $this->get($id); + if($this->order->update($id, DolibarrApiAccess::$user)) + return $this->get($id); - return false; - } + return false; + } - /** - * Delete supplier order - * - * @param int $id Supplier order ID - * @return type - */ - public function delete($id) - { - if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { - throw new RestException(401); - } - $result = $this->order->fetch($id); - if ( ! $result) { - throw new RestException(404, 'Supplier order not found'); - } + /** + * Delete supplier order + * + * @param int $id Supplier order ID + * @return type + */ + public function delete($id) + { + if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { + throw new RestException(401); + } + $result = $this->order->fetch($id); + if ( ! $result) { + throw new RestException(404, 'Supplier order not found'); + } - if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500); - } + if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { + throw new RestException(500); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Supplier order deleted' - ) - ); - } + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Supplier order deleted' + ) + ); + } - /** - * Validate an order - * - * @param int $id Order ID - * @param int $idwarehouse Warehouse ID - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * - * @url POST {id}/validate - * - * @return array - * FIXME An error 403 is returned if the request has an empty body. - * Error message: "Forbidden: Content type `text/plain` is not supported." - * Workaround: send this in the body - * { - * "idwarehouse": 0, - * "notrigger": 0 - * } - */ - public function validate($id, $idwarehouse = 0, $notrigger = 0) - { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } - $result = $this->order->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Order not found'); - } + /** + * Validate an order + * + * @param int $id Order ID + * @param int $idwarehouse Warehouse ID + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * + * @url POST {id}/validate + * + * @return array + * FIXME An error 403 is returned if the request has an empty body. + * Error message: "Forbidden: Content type `text/plain` is not supported." + * Workaround: send this in the body + * { + * "idwarehouse": 0, + * "notrigger": 0 + * } + */ + public function validate($id, $idwarehouse = 0, $notrigger = 0) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { + throw new RestException(401); + } + $result = $this->order->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); - if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already validated'); - } - if ($result < 0) { - throw new RestException(500, 'Error when validating Order: '.$this->order->error); - } + $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + if ($result == 0) { + throw new RestException(304, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when validating Order: '.$this->order->error); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Order validated (Ref='.$this->order->ref.')' - ) - ); - } + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Order validated (Ref='.$this->order->ref.')' + ) + ); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** - * Clean sensible object datas - * - * @param Object $object Object to clean - * @return array Array of cleaned object properties - */ - protected function _cleanObjectDatas($object) - { - // phpcs:enable - $object = parent::_cleanObjectDatas($object); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Clean sensible object datas + * + * @param Object $object Object to clean + * @return array Array of cleaned object properties + */ + protected function _cleanObjectDatas($object) + { + // phpcs:enable + $object = parent::_cleanObjectDatas($object); - unset($object->rowid); - unset($object->barcode_type); - unset($object->barcode_type_code); - unset($object->barcode_type_label); - unset($object->barcode_type_coder); + unset($object->rowid); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); - return $object; - } + return $object; + } - /** - * Validate fields before create or update object - * - * @param array $data Datas to validate - * @return array - * - * @throws RestException - */ - private function _validate($data) - { - $order = array(); - foreach (SupplierOrders::$FIELDS as $field) { - if (!isset($data[$field])) - throw new RestException(400, "$field field missing"); - $order[$field] = $data[$field]; - } - return $order; - } + /** + * Validate fields before create or update object + * + * @param array $data Datas to validate + * @return array + * + * @throws RestException + */ + private function _validate($data) + { + $order = array(); + foreach (SupplierOrders::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $order[$field] = $data[$field]; + } + return $order; + } } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a422e199e55..50b866ca089 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -38,10 +38,10 @@ $hookmanager->initHooks(array('thirdpartiesindex')); $langs->load("companies"); $socid = GETPOST('socid', 'int'); -if ($user->societe_id) $socid=$user->societe_id; +if ($user->societe_id) $socid = $user->societe_id; // Security check -$result=restrictedArea($user, 'societe', 0, '', '', '', ''); +$result = restrictedArea($user, 'societe', 0, '', '', '', ''); $thirdparty_static = new Societe($db); @@ -51,10 +51,10 @@ $thirdparty_static = new Societe($db); */ $transAreaType = $langs->trans("ThirdPartiesArea"); -$helpurl='EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros'; +$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros'; llxHeader("", $langs->trans("ThirdParties"), $helpurl); -$linkback=''; +$linkback = ''; print load_fiche_titre($transAreaType, $linkback, 'companies'); @@ -73,26 +73,26 @@ $third = array( 'supplier' => 0, 'other' =>0 ); -$total=0; +$total = 0; $sql = "SELECT s.rowid, s.client, s.fournisseur"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= ' WHERE s.entity IN ('.getEntity('societe').')'; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND s.rowid = ".$socid; -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql .= ' WHERE s.entity IN ('.getEntity('societe').')'; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if ($socid) $sql .= " AND s.rowid = ".$socid; +if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible //print $sql; $result = $db->query($sql); if ($result) { while ($objp = $db->fetch_object($result)) { - $found=0; - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found=1; $third['prospect']++; } - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found=1; $third['customer']++; } - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found=1; $third['supplier']++; } - if (! empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found=1; $third['other']++; } + $found = 0; + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) { $found = 1; $third['prospect']++; } + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) { $found = 1; $third['customer']++; } + if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) { $found = 1; $third['supplier']++; } + if (!empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found = 1; $third['other']++; } if ($found) $total++; } } @@ -101,14 +101,14 @@ else dol_print_error($db); print '
'; print '
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'.$commandestatic->LibStatut($statut, 0).''.(isset($vals[$statut])?$vals[$statut]:0).''.$commandestatic->LibStatut($status, 0).''.(isset($vals[$status])?$vals[$status]:0).'
'."\n"; print ''; -if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) +if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) { print '"; - $statstring.= ''; - $statstring.= ""; + $statstring .= ''; + $statstring .= ""; } - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { - $statstring.= ""; - $statstring.= ''; - $statstring.= ""; + $statstring .= ""; + $statstring .= ''; + $statstring .= ""; } - if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; - $statstring2.= ''; - $statstring2.= ""; + $statstring2 .= ''; + $statstring2 .= ""; } print $statstring; print $statstring2; @@ -149,7 +149,7 @@ print ''; print '
'.$langs->trans("Statistics").'
'; - $dataseries=array(); - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect'])); - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer'])); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[]=array($langs->trans("Suppliers"), round($third['supplier'])); - if (! empty($conf->societe->enabled)) $dataseries[]=array($langs->trans("Others"), round($third['other'])); + $dataseries = array(); + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[] = array($langs->trans("Prospects"), round($third['prospect'])); + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[] = array($langs->trans("Customers"), round($third['customer'])); + if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) $dataseries[] = array($langs->trans("Suppliers"), round($third['supplier'])); + if (!empty($conf->societe->enabled)) $dataseries[] = array($langs->trans("Others"), round($third['other'])); include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); @@ -122,23 +122,23 @@ if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(rou } else { - if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) + if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = "
'.$langs->trans("Prospects").''.round($third['prospect']).'
'.$langs->trans("Prospects").''.round($third['prospect']).'
'.$langs->trans("Customers").''.round($third['customer']).'
'.$langs->trans("Customers").''.round($third['customer']).'
'.$langs->trans("Suppliers").''.round($third['supplier']).'
'.$langs->trans("Suppliers").''.round($third['supplier']).'
'; print '
'; -if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) +if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $elementtype = 'societe'; @@ -161,41 +161,41 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS print ''.$langs->trans("Categories").''; print ''; $sql = "SELECT c.label, count(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; - $sql.= " WHERE c.type = 2"; - if (! is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql.= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'"; - $sql.= " AND c.entity IN (".getEntity('category').")"; - $sql.= " GROUP BY c.label"; - $total=0; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; + $sql .= " WHERE c.type = 2"; + if (!is_numeric($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) $sql .= " AND c.label like '".$db->escape($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)."'"; + $sql .= " AND c.entity IN (".getEntity('category').")"; + $sql .= " GROUP BY c.label"; + $total = 0; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i=0; - if (! empty($conf->use_javascript_ajax) ) + $i = 0; + if (!empty($conf->use_javascript_ajax)) { - $dataseries=array(); - $rest=0; - $nbmax=10; + $dataseries = array(); + $rest = 0; + $nbmax = 10; while ($i < $num) { $obj = $db->fetch_object($result); if ($i < $nbmax) { - $dataseries[]=array($obj->label, round($obj->nb)); + $dataseries[] = array($obj->label, round($obj->nb)); } else { - $rest+=$obj->nb; + $rest += $obj->nb; } - $total+=$obj->nb; + $total += $obj->nb; $i++; } if ($i > $nbmax) { - $dataseries[]=array($langs->trans("Other"), round($rest)); + $dataseries[] = array($langs->trans("Other"), round($rest)); } include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -214,7 +214,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS $obj = $db->fetch_object($result); print ''.$obj->label.''.$obj->nb.''; - $total+=$obj->nb; + $total += $obj->nb; $i++; } } @@ -234,20 +234,20 @@ print '
'; /* * Latest modified third parties */ -$max=15; +$max = 15; $sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur"; -$sql.= ", s.code_client"; -$sql.= ", s.code_fournisseur"; -$sql.= ", s.logo"; -$sql.= ", s.canvas, s.tms as datem, s.status as status"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql.= ' WHERE s.entity IN ('.getEntity('societe').')'; -if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socid) $sql.= " AND s.rowid = ".$socid; -if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur != 1 OR s.client != 0)"; -$sql.= $db->order("s.tms", "DESC"); -$sql.= $db->plimit($max, 0); +$sql .= ", s.code_client"; +$sql .= ", s.code_fournisseur"; +$sql .= ", s.logo"; +$sql .= ", s.canvas, s.tms as datem, s.status as status"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql .= ' WHERE s.entity IN ('.getEntity('societe').')'; +if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; +if ($socid) $sql .= " AND s.rowid = ".$socid; +if (!$user->rights->fournisseur->lire) $sql .= " AND (s.fournisseur != 1 OR s.client != 0)"; +$sql .= $db->order("s.tms", "DESC"); +$sql .= $db->plimit($max, 0); //print $sql; $result = $db->query($sql); @@ -274,16 +274,16 @@ if ($result) { $objp = $db->fetch_object($result); - $thirdparty_static->id=$objp->rowid; - $thirdparty_static->name=$objp->name; - $thirdparty_static->client=$objp->client; - $thirdparty_static->fournisseur=$objp->fournisseur; + $thirdparty_static->id = $objp->rowid; + $thirdparty_static->name = $objp->name; + $thirdparty_static->client = $objp->client; + $thirdparty_static->fournisseur = $objp->fournisseur; $thirdparty_static->logo = $objp->logo; - $thirdparty_static->datem=$db->jdate($objp->datem); - $thirdparty_static->status=$objp->status; + $thirdparty_static->datem = $db->jdate($objp->datem); + $thirdparty_static->status = $objp->status; $thirdparty_static->code_client = $objp->code_client; $thirdparty_static->code_fournisseur = $objp->code_fournisseur; - $thirdparty_static->canvas=$objp->canvas; + $thirdparty_static->canvas = $objp->canvas; $thirdparty_static->email = $objp->email; print ''; @@ -293,21 +293,21 @@ if ($result) print "\n"; // Type print ''; - if ($thirdparty_static->client==1 || $thirdparty_static->client==3) + if ($thirdparty_static->client == 1 || $thirdparty_static->client == 3) { - $thirdparty_static->name=$langs->trans("Customer"); + $thirdparty_static->name = $langs->trans("Customer"); print $thirdparty_static->getNomUrl(0, 'customer', 0, 1); } if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / "; - if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + if (($thirdparty_static->client == 2 || $thirdparty_static->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $thirdparty_static->name=$langs->trans("Prospect"); + $thirdparty_static->name = $langs->trans("Prospect"); print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1); } - if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) + if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) { if ($thirdparty_static->client) print " / "; - $thirdparty_static->name=$langs->trans("Supplier"); + $thirdparty_static->name = $langs->trans("Supplier"); print $thirdparty_static->getNomUrl(0, 'supplier', 0, 1); } print ''; diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 84766f8e206..0226c724165 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -46,13 +46,13 @@ $stripearrayofkeysbyenv = array( $stripearrayofkeys = array(); if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) { - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test } else { - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); \Stripe\Stripe::setAppInfo("Dolibarr Stripe", DOL_VERSION, "https://www.dolibarr.org"); // add dolibarr version -\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION)?"2019-05-16":$conf->global->STRIPE_FORCE_VERSION); // force version API +\Stripe\Stripe::setApiVersion(empty($conf->global->STRIPE_FORCE_VERSION) ? "2019-05-16" : $conf->global->STRIPE_FORCE_VERSION); // force version API From 8c90c801074e19c65a06327c417d8d1eb29ee33c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Nov 2019 01:30:51 +0100 Subject: [PATCH 76/82] Clean code --- htdocs/don/class/paymentdonation.class.php | 1 - htdocs/expensereport/card.php | 4 ++-- htdocs/expensereport/class/expensereport.class.php | 6 ++---- htdocs/expensereport/index.php | 1 - htdocs/loan/class/paymentloan.class.php | 2 -- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 3c5404366de..dbe9702ba0c 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -633,7 +633,6 @@ class PaymentDonation extends CommonObject $result=''; - if (empty($this->ref)) $this->ref=$this->lib; $label = $langs->trans("ShowPayment").': '.$this->ref; if (!empty($this->id)) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7a62903dfe6..0f7242442fe 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1506,7 +1506,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("ModePaiement").''; print ''; - $form->select_types_paiements(2, 'fk_c_paiement'); + $form->select_types_paiements('', 'fk_c_paiement'); print ''; print ''; } @@ -1832,7 +1832,7 @@ else { print ''; print ''.$langs->trans("ModePaiement").''; - print ''.$object->libelle_paiement.''; + print ''.$object->fk_c_paiement.''; print ''; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index fffde04ac3d..958a9c38e8b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -511,7 +511,7 @@ class ExpenseReport extends CommonObject $sql.= " d.fk_user_author, d.fk_user_modif, d.fk_user_validator,"; $sql.= " d.fk_user_valid, d.fk_user_approve,"; $sql.= " d.fk_statut as status, d.fk_c_paiement, d.paid,"; - $sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement + $sql.= " dp.libelle as label_payment, dp.code as code_paiement"; // INNER JOIN paiement $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'"; @@ -567,15 +567,13 @@ class ExpenseReport extends CommonObject $this->fk_c_paiement = $obj->fk_c_paiement; $this->paid = $obj->paid; - if ($this->fk_statut==5 || $this->fk_statut==6) + if ($this->fk_statut == self::STATUS_APPROVED || $this->fk_statut == self::STATUS_CLOSED) { $user_valid = new User($this->db); if ($this->fk_user_valid > 0) $user_valid->fetch($this->fk_user_valid); $this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname); } - $this->libelle_statut = $obj->libelle_statut; - $this->libelle_paiement = $obj->libelle_paiement; $this->code_statut = $obj->code_statut; $this->code_paiement = $obj->code_paiement; diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index aaffc878046..83d60990b4e 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -221,7 +221,6 @@ if ($result) print ''.price($obj->total_ttc).''; print ''.dol_print_date($db->jdate($obj->dm), 'day').''; print ''; - //print $obj->libelle; print $expensereportstatic->LibStatut($obj->fk_status, 3); print ''; print ''; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index c938fe92c80..d3c497cbbae 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -545,8 +545,6 @@ class PaymentLoan extends CommonObject $result=''; - if (empty($this->ref)) $this->ref=$this->lib; - if (!empty($this->id)) { $link = ''; From 385cb1a26c927a2646946b6217d7c290e70fed47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Nov 2019 09:27:06 +0100 Subject: [PATCH 77/82] doxygen Commande class --- htdocs/commande/class/commande.class.php | 57 +++++++++++++++++------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4348b3b05a5..4735da31060 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -53,19 +53,22 @@ class Commande extends CommonOrder public $table_element='commande'; /** - * @var int Name of subtable line + * @var string Name of subtable line */ public $table_element_line = 'commandedet'; + /** + * @var string Name of class line + */ public $class_element_line = 'OrderLine'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field name with ID of parent key if this field has a parent */ public $fk_element = 'fk_commande'; /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + * @var string String with name of icon for commande class. Here is object_order.png */ public $picto = 'order'; @@ -87,13 +90,23 @@ class Commande extends CommonOrder protected $table_ref_field = 'ref'; /** - * Client ID - * @var int + * @var int Thirparty ID */ public $socid; + /** + * @var string Thirparty ref of order + */ public $ref_client; + + /** + * @var string Internal ref for order + */ public $ref_int; + + /** + * @var int Contact ID + */ public $contactid; /** @@ -103,10 +116,9 @@ class Commande extends CommonOrder public $statut; /** - * Billed - * @var int + * @var int Status Billed or not */ - public $billed; // billed or not + public $billed; /** * @var int Draft Status of the order @@ -115,25 +127,22 @@ class Commande extends CommonOrder public $cond_reglement_code; /** - * @var int ID + * @var int bank account ID */ public $fk_account; /** - * It holds the label of the payment mode. Use it in case translation cannot be found. - * @var string + * @var string It holds the label of the payment mode. Use it in case translation cannot be found. */ public $mode_reglement; /** - * Payment mode id - * @var int + * @var int Payment mode id */ public $mode_reglement_id; /** - * Payment mode code - * @var string + * @var string Payment mode code */ public $mode_reglement_code; @@ -157,9 +166,13 @@ class Commande extends CommonOrder public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) public $demand_reason_code; - public $date; // Date commande + /** + * @var int Date of order + */ + public $date; /** + * @var int Date of order * @deprecated * @see $date */ @@ -182,7 +195,14 @@ class Commande extends CommonOrder public $linked_objects=array(); + /** + * @var int User author ID + */ public $user_author_id; + + /** + * @var int User validator ID + */ public $user_valid; /** @@ -192,7 +212,7 @@ class Commande extends CommonOrder // Multicurrency /** - * @var int ID + * @var int Currency ID */ public $fk_multicurrency; @@ -202,6 +222,9 @@ class Commande extends CommonOrder public $multicurrency_total_tva; public $multicurrency_total_ttc; + /** + * @var Commande clone of order object + */ public $oldcopy; //! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) From 8569020e34249f384ab42cc4ce608f8141205557 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 2 Nov 2019 10:30:29 +0100 Subject: [PATCH 78/82] add some comment --- htdocs/livraison/class/livraison.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 1e7fdebaa64..7f886fbc1a5 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -64,7 +64,12 @@ class Livraison extends CommonObject public $ref_customer; public $date_delivery; // Date really received + + /** + * @var integer|string date_creation + */ public $date_creation; + public $date_valid; public $model_pdf; From 3ff5389c4eef08e72bcb1feeffb51687f8a7816c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 2 Nov 2019 10:35:43 +0100 Subject: [PATCH 79/82] add some comment --- htdocs/reception/class/reception.class.php | 10 ++++++++-- htdocs/societe/class/societe.class.php | 7 ++++--- htdocs/societe/class/societeaccount.class.php | 6 ++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index eae8ab9de34..7663789c127 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -80,8 +80,14 @@ class Reception extends CommonObject * @var int */ public $date_reception; - public $date_creation; - public $date_valid; + + /** + * @var integer|string date_creation + */ + public $date_creation; + + + public $date_valid; public $meths; public $listmeths; // List of carriers diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ca17077a47b..f930e79239d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -316,11 +316,12 @@ class Societe extends CommonObject * @var string */ public $user_modification; - /** - * Date of creation - * @var string + + /** + * @var integer|string date_creation */ public $date_creation; + /** * User that created the thirdparty * @var User diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index bf94c522f68..22fd3baf7a8 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -124,7 +124,13 @@ class SocieteAccount extends CommonObject public $date_last_login; public $date_previous_login; public $note_private; + + /** + * @var integer|string date_creation + */ public $date_creation; + + public $tms; /** From dc97a54d82bc7e1145112b636a34cd8f6de368b4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 2 Nov 2019 09:39:05 +0000 Subject: [PATCH 80/82] Fixing style errors. --- htdocs/livraison/class/livraison.class.php | 8 ++++---- htdocs/reception/class/reception.class.php | 6 +++--- htdocs/societe/class/societe.class.php | 6 +++--- htdocs/societe/class/societeaccount.class.php | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 7f886fbc1a5..dcf95b37ad6 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -64,12 +64,12 @@ class Livraison extends CommonObject public $ref_customer; public $date_delivery; // Date really received - - /** + + /** * @var integer|string date_creation - */ + */ public $date_creation; - + public $date_valid; public $model_pdf; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7663789c127..d9ba10113bb 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -80,13 +80,13 @@ class Reception extends CommonObject * @var int */ public $date_reception; - + /** * @var integer|string date_creation */ public $date_creation; - - + + public $date_valid; public $meths; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f930e79239d..9d2f86e5d77 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -316,12 +316,12 @@ class Societe extends CommonObject * @var string */ public $user_modification; - - /** + + /** * @var integer|string date_creation */ public $date_creation; - + /** * User that created the thirdparty * @var User diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 22fd3baf7a8..f93dfd0ea68 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -124,13 +124,13 @@ class SocieteAccount extends CommonObject public $date_last_login; public $date_previous_login; public $note_private; - + /** * @var integer|string date_creation */ public $date_creation; - - + + public $tms; /** From 68c971a2b5db057cf8c29572f3a5b7a0a27ed235 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Nov 2019 11:12:57 +0100 Subject: [PATCH 81/82] All properties 'type_libelle' were renamed into 'type_label'. --- ChangeLog | 1 + htdocs/compta/charges/index.php | 8 +- htdocs/compta/index.php | 7 +- htdocs/compta/paiement/card.php | 2 +- .../compta/paiement/class/paiement.class.php | 6 +- htdocs/compta/paiement_charge.php | 2 +- htdocs/compta/payment_sc/card.php | 2 +- htdocs/compta/sociales/card.php | 2 +- .../sociales/class/chargesociales.class.php | 10 +-- .../class/paymentsocialcontribution.class.php | 6 +- htdocs/compta/sociales/list.php | 12 +-- htdocs/core/class/html.form.class.php | 10 ++- htdocs/don/class/paymentdonation.class.php | 22 ++--- htdocs/don/payment/card.php | 6 +- htdocs/don/payment/payment.php | 80 ++++++++----------- .../class/paymentexpensereport.class.php | 28 +++---- htdocs/expensereport/payment/card.php | 6 +- htdocs/expensereport/payment/payment.php | 22 ++--- htdocs/fourn/class/paiementfourn.class.php | 4 +- htdocs/fourn/paiement/card.php | 2 +- .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + htdocs/langs/en_US/donations.lang | 1 + htdocs/loan/class/loanschedule.class.php | 8 +- htdocs/loan/class/paymentloan.class.php | 8 +- 24 files changed, 133 insertions(+), 124 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fa1458c534..2c534cfff8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ Following changes may create regressions for some external modules, but were nec * If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu. * All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'. * All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'. +* All properties 'type_libelle' were renamed into 'type_label'. ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 04c2cdd76d1..9694166590f 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -138,7 +138,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder); print "\n"; - $sql = "SELECT c.id, c.libelle as lib,"; + $sql = "SELECT c.id, c.libelle as label,"; $sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,"; $sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,"; $sql.= " pct.code as payment_code,"; @@ -185,12 +185,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) // Label print ''; $socialcontrib->id=$obj->rowid; - $socialcontrib->ref=$obj->rowid; - $socialcontrib->label=$obj->libelle; + $socialcontrib->ref=$obj->label; + $socialcontrib->label=$obj->label; print $socialcontrib->getNomUrl(1, '20'); print ''; // Type - print ''.$obj->lib.''; + print ''.$obj->label.''; // Expected to pay print ''.price($obj->total).''; // Ref payment diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index fb23929f7a8..a7df3685175 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -624,12 +624,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $chargestatic=new ChargeSociales($db); $sql = "SELECT c.rowid, c.amount, c.date_ech, c.paye,"; - $sql.= " cc.libelle,"; + $sql.= " cc.libelle as label,"; $sql.= " SUM(pc.amount) as sumpaid"; $sql.= " FROM (".MAIN_DB_PREFIX."c_chargesociales as cc, ".MAIN_DB_PREFIX."chargesociales as c)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = c.rowid"; $sql.= " WHERE c.fk_type = cc.id"; - $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.entity IN (".getEntity('tax').')'; $sql.= " AND c.paye = 0"; // Add where from hooks $parameters=array(); @@ -662,7 +662,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $chargestatic->id=$obj->rowid; $chargestatic->ref=$obj->rowid; - $chargestatic->label=$obj->libelle; + $chargestatic->label=$obj->label; $chargestatic->paye=$obj->paye; print ''; @@ -672,6 +672,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''.price($obj->sumpaid).''; print ''.$chargestatic->getLibStatut(3).''; print ''; + $tot_ttc+=$obj->amount; $i++; } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index e11da654bdd..3def70036ee 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -220,7 +220,7 @@ print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights print ''; // Payment type (VIR, LIQ, ...) -$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle; +$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label; print ''.$langs->trans('PaymentMode').''.$labeltype; print $object->num_paiement?' - '.$object->num_paiement:''; print ''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index e6d2a27087c..e4a4a275029 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -78,7 +78,7 @@ class Paiement extends CommonObject /** * @var string type libelle */ - public $type_libelle; + public $type_label; /** * @var string type code @@ -160,7 +160,7 @@ class Paiement extends CommonObject public function fetch($id, $ref = '', $fk_bank = '') { $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,'; - $sql.= ' c.code as type_code, c.libelle as type_libelle,'; + $sql.= ' c.code as type_code, c.libelle as type_label,'; $sql.= ' p.num_paiement as num_payment, p.note,'; $sql.= ' b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; @@ -188,7 +188,7 @@ class Paiement extends CommonObject $this->montant = $obj->amount; // deprecated $this->amount = $obj->amount; $this->note = $obj->note; - $this->type_libelle = $obj->type_libelle; + $this->type_label = $obj->type_label; $this->type_code = $obj->type_code; $this->statut = $obj->statut; $this->ext_payment_id = $obj->ext_payment_id; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 6cc91072a34..e2a4bdac11f 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -202,7 +202,7 @@ if ($action == 'create') print ''; print ''; - print '\n"; + print '\n"; print '\n"; print '\n"; /*print '\n"; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 605f5cec3bc..aaff1a99c9f 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -259,7 +259,7 @@ if ($resql) print "\n"; // Type print '\n"; // Label diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index e2bf729a396..3054e64320e 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -514,7 +514,7 @@ if ($id > 0) print '
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Type")."".$charge->type_label."
'.$langs->trans("Period")."".dol_print_date($charge->periode, 'day')."
'.$langs->trans("Label").''.$charge->label."
'.$langs->trans("DateDue")."".dol_print_date($charge->date_ech,'day')."
'; - print $socialcontrib->type_libelle; + print $socialcontrib->type_label; /*print $socialcontrib->type;*/ print "
'; // Type - print '"; + print '"; print ""; // Period end date diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 50474f3d52c..fe3f8267c3d 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -57,7 +57,7 @@ class ChargeSociales extends CommonObject public $date_ech; public $label; public $type; - public $type_libelle; + public $type_label; public $amount; public $paye; public $periode; @@ -136,7 +136,7 @@ class ChargeSociales extends CommonObject $this->lib = $obj->label; $this->label = $obj->label; $this->type = $obj->fk_type; - $this->type_libelle = $obj->libelle; + $this->type_label = $obj->libelle; $this->fk_account = $obj->fk_account; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; @@ -556,8 +556,8 @@ class ChargeSociales extends CommonObject $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->label)) $label .= '
'.$langs->trans('Label') . ': ' . $this->label; - if (! empty($this->type_libelle)) - $label .= '
'.$langs->trans('Type') . ': ' . $this->type_libelle; + if (! empty($this->type_label)) + $label .= '
'.$langs->trans('Type') . ': ' . $this->type_label; $linkclose=''; if (empty($notooltip) && $user->rights->facture->lire) @@ -689,6 +689,6 @@ class ChargeSociales extends CommonObject $this->amount=100; $this->label = 'Social contribution label'; $this->type = 1; - $this->type_libelle = 'Type of social contribution'; + $this->type_label = 'Type of social contribution'; } } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index e13738fd5f4..4fb2f27b53f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -236,7 +236,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_modif,"; - $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; + $sql.= " pt.code as type_code, pt.libelle as type_label,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; @@ -267,7 +267,7 @@ class PaymentSocialContribution extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_label = $obj->type_label; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; @@ -592,7 +592,7 @@ class PaymentSocialContribution extends CommonObject { $socialcontrib = new ChargeSociales($this->db); $socialcontrib->fetch($key); - $result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_libelle.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_libelle)?' ('.$socialcontrib->lib.')':''), 'sc'); + $result=$acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib!=$socialcontrib->type_label)?' ('.$socialcontrib->lib.')':''), 'sc'); if ($result <= 0) dol_print_error($this->db); } } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index c2d5c94d1a3..06e0135dd67 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -110,8 +110,8 @@ $chargesociale_static=new ChargeSociales($db); llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid as id, cs.fk_type as type, "; -$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,"; -$sql.= " c.libelle as type_lib,"; +$sql.= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,"; +$sql.= " c.libelle as type_label,"; $sql.= " SUM(pc.amount) as alreadypayed"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -261,8 +261,8 @@ if ($resql) $chargesociale_static->id=$obj->id; $chargesociale_static->ref=$obj->id; - $chargesociale_static->label=$obj->libelle; - $chargesociale_static->type_libelle=$obj->type_lib; + $chargesociale_static->label=$obj->label; + $chargesociale_static->type_label=$obj->type_label; print ''; @@ -272,10 +272,10 @@ if ($resql) print ''; // Label - print ''; + print ''; // Type - print ''; + print ''; // Date end period print ' // Amount print ''; -// Note -print ''; +// Note public +print ''; // Bank account if (! empty($conf->banque->enabled)) @@ -282,7 +282,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) } */ -if ($_GET['action'] == '') +if (empty($action)) { if ($user->rights->don->supprimer) { diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index 612ea5a553b..72882a79068 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -39,6 +39,8 @@ if ($user->societe_id > 0) { $socid = $user->societe_id; } +$object = new Don($db); + /* * Actions @@ -59,17 +61,17 @@ if ($action == 'add_payment') if (! $_POST["paymenttype"] > 0) { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors'); $error++; } if ($datepaid == '') { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $error++; } if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0) { - $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors'); $error++; } @@ -103,9 +105,9 @@ if ($action == 'add_payment') $payment->chid = $chid; $payment->datepaid = $datepaid; $payment->amounts = $amounts; // Tableau de montant - $payment->paymenttype = $_POST["paymenttype"]; - $payment->num_payment = $_POST["num_payment"]; - $payment->note = $_POST["note"]; + $payment->paymenttype = GETPOST("paymenttype", 'int'); + $payment->num_payment = GETPOST("num_payment", 'alphanohtml'); + $payment->note_public = GETPOST("note_public", 'none'); if (! $error) { @@ -143,7 +145,7 @@ if ($action == 'add_payment') } } - $_GET["action"]='create'; + $action = 'create'; } @@ -151,26 +153,32 @@ if ($action == 'add_payment') * View */ +$form=new Form($db); + llxHeader(); -$form=new Form($db); + +$sql = "SELECT sum(p.amount) as total"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; +$sql.= " WHERE p.fk_donation = ".$chid; +$resql = $db->query($sql); +if ($resql) +{ + $obj=$db->fetch_object($resql); + $sumpaid = $obj->total; + $db->free(); +} // Form to create donation payment -if (GETPOST('action', 'aZ09') == 'create') +if ($action == 'create') { - $don = new Don($db); - $don->fetch($chid); + $object->fetch($chid); - $total = $don->amount; + $total = $object->amount; print load_fiche_titre($langs->trans("DoPayment")); - if ($mesg) - { - print "
$mesg
"; - } - print ''; print ''; print ''; @@ -179,47 +187,24 @@ if (GETPOST('action', 'aZ09') == 'create') dol_fiche_head(); - print '
'.$langs->trans("Type")."".$object->type_libelle."
'.$langs->trans("Type")."".$object->type_label."
'.dol_trunc($obj->libelle, 42).''.dol_trunc($obj->label, 42).''.$obj->type_lib.''.$obj->type_label.''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6790ec43cae..41633f927c8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5344,13 +5344,14 @@ class Form * @param int $disabled Disable input fields * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. - * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @param string $openinghours Specify hour strat and hour end for the select ex 8,20 + * @param datetime $adddateof Add a link "Date of invoice" using the following date. See also $labeladddateof for the label used. + * @param string $openinghours Specify hour start and hour end for the select ex 8,20 * @param int $stepminutes Specify step for minutes between 1 and 30 + * @param string $labeladddateof Label to use for the $adddateof parameter. * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ - public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1) + public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '') { global $conf,$langs; @@ -5737,7 +5738,8 @@ class Form if ($conf->use_javascript_ajax && $adddateof) { $tmparray=dol_getdate($adddateof); - $retstring.=' -
'.$langs->trans('Number').''.$object->num_payment.'
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('Note').''.nl2br($object->note_public).'
'; - - print ''; - - print ''; - print '\n"; - print ''; - - $sql = "SELECT sum(p.amount) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; - $sql.= " WHERE p.fk_donation = ".$chid; - $resql = $db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $sumpaid = $obj->total; - $db->free(); - } - print ''; - print ''; - - print ''; - print "'; - print ''; + print '
'.$langs->trans("Donation").'
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Date")."".dol_print_date($don->date, 'day')."
'.$langs->trans("Amount")."".price($don->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans("AlreadyPaid").''.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'
".$langs->trans("Payment").'
'; print '"; print ''; print '\n"; print ''; print ''; print ''; print ''; // Number @@ -230,7 +215,7 @@ if (GETPOST('action', 'aZ09') == 'create') print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("Date").''; $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', 0, 0, 0, "add_payment", 1, 1, 0, '', '', $object->date, '', 1, $langs->trans("DonationDate")); print "
'.$langs->trans("PaymentMode").''; - $form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$don->paymenttype, "paymenttype"); + $form->select_types_paiements(isset($_POST["paymenttype"])?$_POST["paymenttype"]:$object->paymenttype, "paymenttype"); print "
'.$langs->trans('AccountToCredit').''; - $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$don->accountid, "accountid", 0, '', 1); // Show open bank account list + $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$object->accountid, "accountid", 0, '', 1); // Show open bank account list print '
'.$langs->trans("Comments").'
'; @@ -246,6 +231,7 @@ if (GETPOST('action', 'aZ09') == 'create') print ''; print ''; + print ''; print ''; print ''; print ''; @@ -257,10 +243,12 @@ if (GETPOST('action', 'aZ09') == 'create') while ($i < $num) { - $objp = $don; + $objp = $object; print ''; + print '"; + print '"; print '"; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 074250d2347..6fb4e539d9d 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -25,8 +25,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -/** \class PaymentExpenseReport - * \brief Class to manage payments of expense report +/** + * Class to manage payments of expense report */ class PaymentExpenseReport extends CommonObject { @@ -83,9 +83,9 @@ class PaymentExpenseReport extends CommonObject */ public $fk_user_modif; - //Unknow field - public $chid; - public $total; + public $type_code; + public $type_label; + /** * Constructor @@ -124,10 +124,10 @@ class PaymentExpenseReport extends CommonObject if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note)) $this->note=trim($this->note); + if (isset($this->note_public)) $this->note_public=trim($this->note_public); if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); - if (! empty($this->fk_expensereport)) $this->chid = $this->fk_expensereport; $totalamount = 0; foreach ($this->amounts as $key => $value) // How payment is dispatch @@ -148,10 +148,10 @@ class PaymentExpenseReport extends CommonObject { $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,"; $sql.= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)"; - $sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',"; + $sql.= " VALUES ($this->fk_expensereport, '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datepaid)."',"; $sql.= " ".$totalamount.","; - $sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; + $sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".$user->id.","; $sql.= " 0)"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -188,7 +188,6 @@ class PaymentExpenseReport extends CommonObject */ public function fetch($id) { - global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.fk_expensereport,"; @@ -198,11 +197,11 @@ class PaymentExpenseReport extends CommonObject $sql.= " t.amount,"; $sql.= " t.fk_typepayment,"; $sql.= " t.num_payment,"; - $sql.= " t.note,"; + $sql.= " t.note as note_public,"; $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_modif,"; - $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; + $sql.= " pt.code as type_code, pt.libelle as type_label,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; @@ -227,13 +226,13 @@ class PaymentExpenseReport extends CommonObject $this->amount = $obj->amount; $this->fk_typepayment = $obj->fk_typepayment; $this->num_payment = $obj->num_payment; - $this->note = $obj->note; + $this->note_public = $obj->note_public; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_label = $obj->type_label; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; @@ -540,8 +539,7 @@ class PaymentExpenseReport extends CommonObject $acc->fetch($accountid); //Fix me field - $this->total = $this->amount; - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_expensereport') $amount=$total; diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index e168c1aa5b8..99c4c81d294 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -162,8 +162,8 @@ print ''; -// Note -print ''; +// Note public +print ''; $disable_delete = 0; // Bank account @@ -258,7 +258,7 @@ if ($resql) print ''; // Remain to pay - print ''; + print ''; // Status print ''; diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 8d1c568332d..fd3f725da5a 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -113,13 +113,13 @@ if ($action == 'add_payment') // Create a line of payments $payment = new PaymentExpenseReport($db); - $payment->chid = $expensereport->id; + $payment->fk_expensereport = $expensereport->id; $payment->datepaid = $datepaid; $payment->amounts = $amounts; // Tableau de montant $payment->total = $total; - $payment->fk_typepayment = $_POST["fk_typepayment"]; - $payment->num_payment = $_POST["num_payment"]; - $payment->note = $_POST["note"]; + $payment->fk_typepayment = GETPOST("fk_typepayment", 'int'); + $payment->num_payment = GETPOST("num_payment", 'alphanothtml'); + $payment->note_public = GETPOST("note_public", 'none'); if (! $error) { @@ -239,9 +239,11 @@ if ($action == 'create' || empty($action)) print '
'.$langs->trans("Donation").''.$langs->trans("Amount").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").'
'.$object->getNomUrl(1)."'.price($objp->amount)."'.price($sumpaid)."
'.$langs->trans('Numero').''.$object->num_pa // Amount print '
'.$langs->trans('Amount').''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans('Note').''.nl2br($object->note).'
'.$langs->trans('Note').''.nl2br($object->note_public).'
'.price($objp->amount).''.price($remaintopay).''.price($objp->total_ttc - $objp->amount).''.$expensereport->getLibStatut(4, $objp->amount).'
'; - print '
'; + print '
'; - print '
'; + dol_fiche_end(); + + dol_fiche_head(); print ''."\n"; @@ -274,14 +276,14 @@ if ($action == 'create' || empty($action)) print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("Comments").'
'; - print '
'; + dol_fiche_end(); - dol_fiche_end(); + print '
'; // List of expenses ereport not already paid completely $num = 1; @@ -289,6 +291,7 @@ if ($action == 'create' || empty($action)) print ''; print ''; + print ''; print ''; print ''; print ''; @@ -304,6 +307,7 @@ if ($action == 'create' || empty($action)) print ''; + print '"; print '"; print '"; print '"; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 14d09c20d6e..98fafd3609f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -56,7 +56,7 @@ class PaiementFourn extends Paiement * Label of payment type * @var string */ - public $type_libelle; + public $type_label; /** * Code of Payment type @@ -123,7 +123,7 @@ class PaiementFourn extends Paiement $this->note = $obj->note; $this->note_private = $obj->note; $this->type_code = $obj->paiement_code; - $this->type_libelle = $obj->paiement_type; + $this->type_label = $obj->paiement_type; $this->statut = $obj->statut; $error = 1; } diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 8b65d8be7c0..1d8f72d94a3 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -197,7 +197,7 @@ if ($result > 0) print ''; // Payment mode - $labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle; + $labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_label; print ''; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index d599f1b40ed..59cd6473e57 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -46,6 +46,8 @@ UPDATE llx_c_units SET scale = -3, active = 0 WHERE code IN ('L'); UPDATE llx_c_units SET label = 'VolumeUnitm3' WHERE code IN ('M3'); UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2'); +ALTER TABLE llx_adherent_type ADD UNIQUE INDEX uk_adherent_type_libelle (libelle, entity); + -- For v11 diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 5edc8d62033..a810c61c8f4 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -17,6 +17,7 @@ DonationStatusPromiseNotValidatedShort=Draft DonationStatusPromiseValidatedShort=Validated DonationStatusPaidShort=Received DonationTitle=Donation receipt +DonationDate=Donation date DonationDatePayment=Payment date ValidPromess=Validate promise DonationReceipt=Donation receipt diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index c9a8fd9354e..c5335496313 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -94,6 +94,10 @@ class LoanSchedule extends CommonObject */ public $total; + public $type_code; + public $type_label; + + /** * Constructor * @@ -213,7 +217,7 @@ class LoanSchedule extends CommonObject $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_modif,"; - $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; + $sql.= " pt.code as type_code, pt.libelle as type_label,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; @@ -245,7 +249,7 @@ class LoanSchedule extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_label = $obj->type_label; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index d3c497cbbae..eb0508c3768 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -90,6 +90,10 @@ class PaymentLoan extends CommonObject */ public $fk_user_modif; + public $type_code; + public $type_label; + + /** * Constructor * @@ -208,7 +212,7 @@ class PaymentLoan extends CommonObject $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; $sql.= " t.fk_user_modif,"; - $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; + $sql.= " pt.code as type_code, pt.libelle as type_label,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; @@ -242,7 +246,7 @@ class PaymentLoan extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_label = $obj->type_label; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; From f9031cdbfdeb8baec98b61a02753f9fa7ed64b98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Nov 2019 11:36:48 +0100 Subject: [PATCH 82/82] Clean code --- htdocs/adherents/class/subscription.class.php | 4 ++-- htdocs/adherents/htpasswd.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 6 +++--- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/class/html.form.class.php | 20 +++++++++---------- htdocs/core/lib/project.lib.php | 10 +++++----- htdocs/don/list.php | 20 +++++++++++-------- .../class/supplier_proposal.class.php | 19 +++++++++--------- htdocs/user/class/user.class.php | 10 +++++----- 9 files changed, 52 insertions(+), 47 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 986649d15e2..e2fc13edadf 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -431,10 +431,10 @@ class Subscription extends CommonObject /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @param int $status Id status * @return string Label */ - public function LibStatut($statut) + public function LibStatut($status) { // phpcs:enable global $langs; diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index 2dd8c95923f..84fc6bc9824 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -42,7 +42,7 @@ if (empty($sortorder)) { $sortorder="ASC"; } if (empty($sortfield)) { $sortfield="d.login"; } if (! isset($statut)) { - $statut = 1 ; + $statut = 1; } if (! isset($cotis)) @@ -54,7 +54,7 @@ if (! isset($cotis)) $sql = "SELECT d.login, d.pass, d.datefin"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d "; -$sql .= " WHERE d.statut = $statut "; +$sql .= " WHERE d.statut = ".$statut; if ($cotis==1) { $sql .= " AND datefin > '".$db->idate($now)."'"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 038de071863..62c3d1bd312 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2068,10 +2068,10 @@ class Contrat extends CommonObject /** * Return list of line rowid * - * @param int $statut Status of lines to get + * @param int $status Status of lines to get * @return array|int Array of line's rowid or <0 if error */ - public function array_detail($statut = -1) + public function array_detail($status = -1) { // phpcs:enable $tab=array(); @@ -2079,7 +2079,7 @@ class Contrat extends CommonObject $sql = "SELECT cd.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " WHERE fk_contrat =".$this->id; - if ($statut >= 0) $sql.= " AND statut = '$statut'"; + if ($status >= 0) $sql.= " AND statut = ".$status; dol_syslog(get_class($this)."::array_detail()", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index deb27817be9..ab2e7c19005 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1057,13 +1057,13 @@ abstract class CommonObject /** * Get array of all contacts for an object * - * @param int $statut Status of links to get (-1=all) + * @param int $status Status of links to get (-1=all) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array|int Array of contacts, -1 if error */ - public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') + public function liste_contact($status = -1, $source = 'external', $list = 0, $code = '') { // phpcs:enable global $langs; @@ -1086,7 +1086,7 @@ abstract class CommonObject if ($source == 'internal') $sql.= " AND tc.source = 'internal'"; if ($source == 'external' || $source == 'thirdparty') $sql.= " AND tc.source = 'external'"; $sql.= " AND tc.active=1"; - if ($statut >= 0) $sql.= " AND ec.statut = '".$statut."'"; + if ($status >= 0) $sql.= " AND ec.statut = ".$status; $sql.=" ORDER BY t.lastname ASC"; dol_syslog(get_class($this)."::liste_contact", LOG_DEBUG); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 41633f927c8..4c057b3bdb6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3765,7 +3765,7 @@ class Form * * @param string $selected Id account pre-selected * @param string $htmlname Name of select zone - * @param int $statut Status of searched accounts (0=open, 1=closed, 2=both) + * @param int $status Status of searched accounts (0=open, 1=closed, 2=both) * @param string $filtre To filter list * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select @@ -3773,7 +3773,7 @@ class Form * @param string $morecss More CSS * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ - public function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '') + public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '') { // phpcs:enable global $langs, $conf; @@ -3784,7 +3784,7 @@ class Form $sql = "SELECT rowid, label, bank, clos as status, currency_code"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE entity IN (".getEntity('bank_account').")"; - if ($statut != 2) $sql.= " AND clos = '".$statut."'"; + if ($status != 2) $sql.= " AND clos = ".(int) $status; if ($filtre) $sql.=" AND ".$filtre; $sql.= " ORDER BY label"; @@ -3815,7 +3815,7 @@ class Form } print trim($obj->label); if ($showcurrency) print ' ('.$obj->currency_code.')'; - if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')'; + if ($status == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')'; print ''; $i++; } @@ -3823,7 +3823,7 @@ class Form } else { - if ($statut == 0) print ''.$langs->trans("NoActiveBankAccountDefined").''; + if ($status == 0) print ''.$langs->trans("NoActiveBankAccountDefined").''; else print ''.$langs->trans("NoBankAccountFound").''; } } @@ -3839,13 +3839,13 @@ class Form * * @param string $selected Id establishment pre-selected * @param string $htmlname Name of select zone - * @param int $statut Status of searched establishment (0=open, 1=closed, 2=both) + * @param int $status Status of searched establishment (0=open, 1=closed, 2=both) * @param string $filtre To filter list * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select * @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...) */ - public function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') + public function selectEstablishments($selected = '', $htmlname = 'entity', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '') { // phpcs:enable global $langs, $conf; @@ -3856,7 +3856,7 @@ class Form $sql = "SELECT rowid, name, fk_country, status, entity"; $sql.= " FROM ".MAIN_DB_PREFIX."establishment"; $sql.= " WHERE 1=1"; - if ($statut != 2) $sql.= " AND status = '".$statut."'"; + if ($status != 2) $sql.= " AND status = ".(int) $status; if ($filtre) $sql.=" AND ".$filtre; $sql.= " ORDER BY name"; @@ -3886,7 +3886,7 @@ class Form print ''; $i++; } @@ -3894,7 +3894,7 @@ class Form } else { - if ($statut == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").''; + if ($status == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").''; else print ''.$langs->trans("NoEstablishmentFound").''; } } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a177b3f13c0..825142d1385 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1749,12 +1749,12 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) * @param int $socid Id thirdparty * @param int $projectsListId Id of project I have permission on * @param int $mytasks Limited to task I am contact to - * @param int $statut -1=No filter on statut, 0 or 1 = Filter on status + * @param int $status -1=No filter on statut, 0 or 1 = Filter on status * @param array $listofoppstatus List of opportunity status * @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', ) * @return void */ -function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array(), $hiddenfields = array()) +function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array()) { global $langs,$conf,$user,$bc; @@ -1768,7 +1768,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $project_year_filter=0; $title=$langs->trans("Projects"); - if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]); + if (strcmp($status, '') && $status >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]); $arrayidtypeofcontact=array(); @@ -1797,9 +1797,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $sql.= " AND ec.fk_c_type_contact = ctc.rowid"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact $sql.= " AND ctc.element = 'project_task'"; } - if ($statut >= 0) + if ($status >= 0) { - $sql.= " AND p.fk_statut = ".$statut; + $sql.= " AND p.fk_statut = ".(int) $status; } if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 7d20dc93032..4e9d86af3f8 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -43,7 +43,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.datedon"; -$statut=(GETPOST("statut", 'intcomma')!='')?GETPOST("statut", 'intcomma'):"-1"; +$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-1"; $search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_ref=GETPOST('search_ref', 'alpha'); $search_company=GETPOST('search_company', 'alpha'); @@ -87,13 +87,13 @@ $donationstatic=new Don($db); // Genere requete de liste des dons $sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,"; -$sql.= " d.amount, d.fk_statut as statut, "; +$sql.= " d.amount, d.fk_statut as status,"; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; $sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")"; -if ($statut != '' && $statut != '-1') +if ($search_status != '' && $search_status != '-1') { - $sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; + $sql .= " AND d.fk_statut IN (".$db->escape($search_status).")"; } if (trim($search_ref) != '') { @@ -135,9 +135,13 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $param = '&statut='.$statut; - //if ($page > 0) $param.= '&page='.$page; - if ($optioncss != '') $param.='&optioncss='.$optioncss; + $param = ''; + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_company) $param .= '&search_company='.urlencode($search_company); + if ($search_name) $param .= '&search_name='.urlencode($search_name); + if ($search_amount) $param .= '&search_amount='.urlencode($search_amount); $newcardbutton=''; if ($user->rights->don->creer) @@ -257,7 +261,7 @@ if ($resql) print "\n"; } print ''; - print ''; + print ''; print ''; print ""; $i++; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index aa78324ad37..6af681750cc 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1698,22 +1698,22 @@ class SupplierProposal extends CommonObject * Close the askprice * * @param User $user Object user that close - * @param int $statut Statut + * @param int $status Status * @param string $note Comment * @return int <0 if KO, >0 if OK */ - public function cloture($user, $statut, $note) + public function cloture($user, $status, $note) { global $langs,$conf; - $this->statut = $statut; + $this->statut = $status; $error=0; $now=dol_now(); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal"; - $sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id; + $sql.= " SET fk_statut = ".$status.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id; $sql.= " WHERE rowid = ".$this->id; $resql=$this->db->query($sql); @@ -1722,7 +1722,7 @@ class SupplierProposal extends CommonObject $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED:$this->modelpdf; $trigger_name='SUPPLIER_PROPOSAL_CLOSE_REFUSED'; - if ($statut == 2) + if ($status == 2) { $trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED'; $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf; @@ -1732,7 +1732,7 @@ class SupplierProposal extends CommonObject $result = $this->updateOrCreatePriceFournisseur($user); } } - if ($statut == 4) + if ($status == 4) { $trigger_name='SUPPLIER_PROPOSAL_CLASSIFY_BILLED'; } @@ -2258,15 +2258,16 @@ class SupplierProposal extends CommonObject if ($resql) { $label = $labelShort = ''; + $status = ''; if ($mode == 'opened') { $delay_warning=$conf->supplier_proposal->cloture->warning_delay; - $statut = self::STATUS_VALIDATED; + $status = self::STATUS_VALIDATED; $label = $langs->trans("SupplierProposalsToClose"); $labelShort = $langs->trans("ToAcceptRefuse"); } if ($mode == 'signed') { $delay_warning=$conf->supplier_proposal->facturation->warning_delay; - $statut = self::STATUS_SIGNED; + $status = self::STATUS_SIGNED; $label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered $labelShort = $langs->trans("ToClose"); } @@ -2275,7 +2276,7 @@ class SupplierProposal extends CommonObject $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut; + $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$status; $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6baffc74a73..c34a9f1c7d0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -954,22 +954,22 @@ class User extends CommonObject /** * Change status of a user * - * @param int $statut Status to set + * @param int $status Status to set * @return int <0 if KO, 0 if nothing is done, >0 if OK */ - public function setstatus($statut) + public function setstatus($status) { global $conf,$langs,$user; $error=0; // Check parameters - if ($this->statut == $statut) return 0; - else $this->statut = $statut; + if ($this->statut == $status) return 0; + else $this->statut = $status; $this->db->begin(); - // Deactivate user + // Save in database $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET statut = ".$this->statut; $sql.= " WHERE rowid = ".$this->id;
'.$langs->trans("ExpenseReport").''.$langs->trans("Amount").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").'
'.$expensereport->getNomUrl(1)."'.price($objp->total_ttc)."'.price($sumpaid)."'.price($objp->total_ttc - $sumpaid)."
'.$langs->trans('PaymentMode').''.$labeltype; print $object->num_paiement?' - '.$object->num_paiement:''; print '
'.price($objp->amount).''.$donationstatic->LibStatut($objp->statut, 5).''.$donationstatic->LibStatut($objp->status, 5).'