From b276a8186e8bf0b9b2b556ea2268664c31d1df5a Mon Sep 17 00:00:00 2001 From: John Date: Wed, 21 Feb 2018 10:03:04 +0100 Subject: [PATCH 01/50] Fix sql entity for sub query --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 8b68929864f..f70b9e8e4c2 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -242,7 +242,7 @@ UPDATE llx_bank_account SET accountancy_journal = 'OD' WHERE accountancy_journal ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer; ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal); -UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15'); +UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code AND aj.entity = ba.entity) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15'); ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); --Update general ledger for FEC format & harmonization From 1d6baf5f2bd69806314a82b9bdb449cad92fba36 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 22 Feb 2018 10:16:53 +0100 Subject: [PATCH 02/50] Fix: Not showing link to ad event if module is disabled --- htdocs/core/class/html.formactions.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 785ada1429c..31c33de889b 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2018 Juanjo Menent * * 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 @@ -187,10 +187,12 @@ class FormActions $urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:''); - $buttontoaddnewevent = ''; - $buttontoaddnewevent.= $langs->trans("AddEvent"); - $buttontoaddnewevent.= ''; - print load_fiche_titre($title, $buttontoaddnewevent, ''); + if ($conf->agenda->enabled) { + $buttontoaddnewevent = ''; + $buttontoaddnewevent.= $langs->trans("AddEvent"); + $buttontoaddnewevent.= ''; + } + print load_fiche_titre($title, $buttontoaddnewevent, ''); $page=0; $param=''; $sortfield='a.datep'; From 41c663f03f8a09bef1b3b76e5ad93b0acec1143f Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Thu, 22 Feb 2018 12:22:31 +0000 Subject: [PATCH 03/50] Fixed issue with elementarray null if num_rows = 0 --- htdocs/projet/class/project.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8dbce2790fa..c8096559c9c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -584,10 +584,10 @@ class Project extends CommonObject $i++; } $this->db->free($result); - - /* Return array */ - return $elements; } + + /* Return array even if empty*/ + return $elements; } else { From 3f9a9f20ce65525bfb903caf37f779a30fa3665f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Feb 2018 17:05:24 +0100 Subject: [PATCH 04/50] Fix missing substitution key --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8f2fb50b0dc..a3a12179a6e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5442,6 +5442,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__'; $substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__'; + $substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__'; if (is_object($object) && $object->element == 'shipping') { @@ -5505,11 +5506,13 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:''); + $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:''); } elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0) { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); + $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:''); } if (is_object($object->projet) && $object->projet->id > 0) From 6793d826b704ad8e0468cbcf6ee5ef17d7f2c70f Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Fri, 23 Feb 2018 10:14:54 +0100 Subject: [PATCH 05/50] Dispatch if more than ordered If the constant SUPPLIER_ORDER_MORE_THAN_WISHED is set --- .../class/fournisseur.commande.class.php | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1bbde68172e..01114cf22c5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2960,7 +2960,58 @@ class CommandeFournisseur extends CommonOrder } return 4; } - } + }elseif(! empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED) ) + {//set livraison to 'tot' if more products received than wished. (and if $closeopenorder is set to 1 of course...) + + $close=0; + + if( count($diff_array) > 0 ) + {//there are some difference between the two arrays + + //scan the array of results + foreach($diff_array as $key => $value) + {//if the quantity delivered is greater or equal to wish quantity + if($qtydelivered[$key] >= $qtywished[$key] ) + { + $close++; + } + + } + } + + + if($close == count($diff_array)) + {//all the products are received equal or more than the wished quantity + if ($closeopenorder) + { + $ret = $this->Livraison($user, $date_liv, 'tot', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 5; + } + else + { + //Diff => received partially + $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 4; + } + + + } + else + {//all the products are not received + $ret = $this->Livraison($user, $date_liv, 'par', $comment); // GETPOST("type") is 'tot', 'par', 'nev', 'can' + if ($ret<0) { + return -1; + } + return 4; + } + + } else { //Diff => received partially From d8f8e76bee485504c88c9775016f17dae6d00aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 10:39:39 +0100 Subject: [PATCH 06/50] Provide context to trigger --- htdocs/categories/class/categorie.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5b824d8c959..05005b8b5bb 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -715,11 +715,12 @@ class Categorie extends CommonObject } } - // Save object we want to link category to into category instance to provide information to trigger - $this->linkto=$obj; + // Call trigger - $result=$this->call_trigger('CATEGORY_LINK',$user); + $this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger + $this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger + $result=$this->call_trigger('CATEGORY_LINK',$user); if ($result < 0) { $error++; } // End call triggers From 194f5a2cefc6ddebcff1cb149e142919dfe3ffb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 11:03:48 +0100 Subject: [PATCH 07/50] Fix substitution key --- htdocs/core/lib/functions.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a3a12179a6e..0f10c40fddf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5506,12 +5506,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:''); + $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object)?$object->name_alias:''); $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:''); } elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0) { $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); + $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty)?$object->thirdparty->name_alias:''); $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:''); } From 829de06bf61021c9237689297975e0e391c1e1a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 11:23:04 +0100 Subject: [PATCH 08/50] Fix error management --- htdocs/societe/card.php | 39 +++++++++++++++++++++----- htdocs/societe/class/societe.class.php | 16 +++++++++-- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 362834b316d..c0775145828 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -511,6 +511,8 @@ if (empty($reshook)) { if ($action == 'add') { + $error = 0; + $db->begin(); if (empty($object->client)) $object->code_client=''; @@ -533,11 +535,21 @@ if (empty($reshook)) // Customer categories association $custcats = GETPOST('custcats', 'array'); - $object->setCategories($custcats, 'customer'); + $result = $object->setCategories($custcats, 'customer'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } // Supplier categories association $suppcats = GETPOST('suppcats', 'array'); - $object->setCategories($suppcats, 'supplier'); + $result = $object->setCategories($suppcats, 'supplier'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; @@ -566,7 +578,7 @@ if (empty($reshook)) } } else - { + { switch($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -593,7 +605,7 @@ if (empty($reshook)) $error++; } - if ($result >= 0) + if ($result >= 0 && ! $error) { $db->commit(); @@ -622,6 +634,8 @@ if (empty($reshook)) if ($action == 'update') { + $error = 0; + if (GETPOST('cancel','alpha')) { if (! empty($backtopage)) @@ -647,16 +661,27 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); $error++; } + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if (!empty($user->rights->categorie->lire)) + if (! $error && !empty($user->rights->categorie->lire)) { // Customer categories association $categories = GETPOST( 'custcats', 'array' ); - $object->setCategories($categories, 'customer'); + $result = $object->setCategories($categories, 'customer'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } // Supplier categories association $categories = GETPOST('suppcats', 'array'); - $object->setCategories($categories, 'supplier'); + $result = $object->setCategories($categories, 'supplier'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } // Logo/Photo save diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3ca69fdb6fd..f67d1a1d9e7 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3767,6 +3767,8 @@ class Societe extends CommonObject $to_add = $categories; } + $error = 0; + // Process foreach ($to_del as $del) { if ($c->fetch($del) > 0) { @@ -3774,12 +3776,20 @@ class Societe extends CommonObject } } foreach ($to_add as $add) { - if ($c->fetch($add) > 0) { - $c->add_type($this, $type_text); + if ($c->fetch($add) > 0) + { + $result = $c->add_type($this, $type_text); + if ($result < 0) + { + $error++; + $this->error = $c->error; + $this->errors = $c->errors; + break; + } } } - return 1; + return $error ? -1 : 1; } From 82ae65b18d1f6d8d0a43f0f02daaf8090eca5d03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 11:23:36 +0100 Subject: [PATCH 09/50] NEW Can get template of email from its label --- htdocs/categories/class/categorie.class.php | 2 +- htdocs/core/class/html.formmail.class.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 05005b8b5bb..ada86667f44 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -716,7 +716,7 @@ class Categorie extends CommonObject } - + // Call trigger $this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger $this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 922980f62dd..67497b4881b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -984,9 +984,10 @@ class FormMail extends Form * @param Translate $outputlangs Output lang object * @param int $id Id of template to find, or -1 for first found with lower position, or 0 for first found whatever is position * @param int $active 1=Only active template, 0=Only disabled, -1=All + * @param string $label Label of template * @return array array('topic'=>,'content'=>,..) */ - public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1) + public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1, $label='') { $ret=array(); @@ -996,6 +997,7 @@ class FormMail extends Form $sql.= " AND entity IN (".getEntity('c_email_templates').")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) $sql.=" AND active = ".$active; + if ($label) $sql.=" AND label ='".$this->db->escape($label)."'"; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; if ($id > 0) $sql.= " AND rowid=".$id; if ($id == -1) $sql.= " AND position=0"; From b3d968d4a164107734dee0a32e10ed37dcb866ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 11:40:20 +0100 Subject: [PATCH 10/50] Fix look and feel v7 --- htdocs/admin/modules.php | 8 ++++---- htdocs/modulebuilder/template/admin/about.php | 10 +++------- htdocs/modulebuilder/template/admin/setup.php | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ee17e647863..00c8d14219e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -741,12 +741,12 @@ if ($mode == 'common') if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs)) { $urltouse=dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1); - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { $urltouse=$urlpage; - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } } @@ -754,11 +754,11 @@ if ($mode == 'common') } else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) { - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } else diff --git a/htdocs/modulebuilder/template/admin/about.php b/htdocs/modulebuilder/template/admin/about.php index b6584f8d909..c34574791c1 100644 --- a/htdocs/modulebuilder/template/admin/about.php +++ b/htdocs/modulebuilder/template/admin/about.php @@ -42,14 +42,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once '../lib/mymodule.lib.php'; // Translations -$langs->load("errors"); -$langs->load("admin"); -$langs->load("mymodule@mymodule"); +$langs->loadLangs(array("errors","admin","mymodule@mymodule")); // Access control -if (! $user->admin) { - accessforbidden(); -} +if (! $user->admin) accessforbidden(); // Parameters $action = GETPOST('action', 'alpha'); @@ -73,7 +69,7 @@ $page_name = "MyModuleAbout"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule'); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 19908d33546..58a572a42ac 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -71,7 +71,7 @@ $page_name = "MyModuleSetup"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule'); From f7ecac8734e0edba02f5ea6935b842a1cd96679c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 11:40:20 +0100 Subject: [PATCH 11/50] Fix look and feel v7 --- htdocs/admin/modules.php | 8 ++++---- htdocs/modulebuilder/template/admin/about.php | 10 +++------- htdocs/modulebuilder/template/admin/setup.php | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ee17e647863..00c8d14219e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -741,12 +741,12 @@ if ($mode == 'common') if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs)) { $urltouse=dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1); - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { $urltouse=$urlpage; - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } } @@ -754,11 +754,11 @@ if ($mode == 'common') } else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) { - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } else diff --git a/htdocs/modulebuilder/template/admin/about.php b/htdocs/modulebuilder/template/admin/about.php index b6584f8d909..c34574791c1 100644 --- a/htdocs/modulebuilder/template/admin/about.php +++ b/htdocs/modulebuilder/template/admin/about.php @@ -42,14 +42,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once '../lib/mymodule.lib.php'; // Translations -$langs->load("errors"); -$langs->load("admin"); -$langs->load("mymodule@mymodule"); +$langs->loadLangs(array("errors","admin","mymodule@mymodule")); // Access control -if (! $user->admin) { - accessforbidden(); -} +if (! $user->admin) accessforbidden(); // Parameters $action = GETPOST('action', 'alpha'); @@ -73,7 +69,7 @@ $page_name = "MyModuleAbout"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule'); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 19908d33546..58a572a42ac 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -71,7 +71,7 @@ $page_name = "MyModuleSetup"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($page_name), $linkback, 'object_mymodule@mymodule'); From 36cc1c6ca95feb4111cff39d09e45012d1807c64 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Fri, 23 Feb 2018 11:59:22 +0100 Subject: [PATCH 12/50] FIX: solve column mismatch in user card's usergroup list + code cleanup --- htdocs/user/card.php | 109 +++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 60 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 1885740b489..495ff14a062 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -75,6 +75,9 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); } +if(! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { + $caneditgroup = $conf->entity == 1 && ! empty($user->admin) && empty($user->entity); +} // Define value to know what current user can do on properties of edited user if ($id) { @@ -1791,41 +1794,21 @@ else print ''."\n"; print ''."\n"; - if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print ''; - } print ''; - print "'."\n"; @@ -1849,40 +1832,46 @@ else print img_object($langs->trans("ShowGroup"),"group").' '.$group->name; } print ''; - if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '\n"; + print ''."\n"; } } else { - print ''; + $colspan = 2; + if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { + $colspan ++; + if ($caneditgroup) $colspan ++; + } + + print ''; } print "
'.$langs->trans("Groups").''.$langs->trans("Entity").''; - if ($caneditgroup) - { - // Users/Groups management only in master entity if transverse mode - if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) - { - // nothing - } - else - { - print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); - print '   '; - // Multicompany - if (! empty($conf->multicompany->enabled)) - { - if ($conf->entity == 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) - { - print ''.$langs->trans("Entity").'".$mc->select_entities($conf->entity); - } - else - { - print ''; - } - } - else - { - print ''; - } - print ''; - } + if ($caneditgroup) { + print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity); + } + + if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { + print '' . $langs->trans("Entity"); + + if ($caneditgroup) { + print '' . $mc->select_entities($conf->entity, 'entity'); + } + } + + if ($caneditgroup) { + print '   '; } print '
'; - if (! empty($group->usergroup_entity)) - { - $nb=0; - foreach($group->usergroup_entity as $group_entity) - { - $mc->getInfo($group_entity); - print ($nb > 0 ? ', ' : '').$mc->label; - print ''; - print img_delete($langs->trans("RemoveFromGroup")); - print ''; - $nb++; - } - } - } print ''; - if ($caneditgroup && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) - { - print ''; + if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { + print ''; + + if (! empty($group->usergroup_entity)) { + $nb = 0; + foreach ($group->usergroup_entity as $group_entity) { + $mc->getInfo($group_entity); + print ($nb > 0 ? ', ' : '') . $mc->label; + + if ($conf->entity == 1 && ! empty($user->admin) && empty($user->entity)) { + print ''; + print img_delete($langs->trans("RemoveFromGroup")); + print ''; + } + + $nb ++; + } + } + + if ($caneditgroup) { + print ''; + } + } elseif ($caneditgroup) { + print ''; print img_delete($langs->trans("RemoveFromGroup")); print ''; } - else - { - print " "; - } - print "
'.$langs->trans("None").'
' . $langs->trans("None") . '
"; From 8b479a05ade39a8952050ab7d86c11d50f55e8e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 12:34:25 +0100 Subject: [PATCH 13/50] Can add property in password extrafield (prepare to choose encrypt algo) --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 ++ htdocs/core/tpl/admin_extrafields_edit.tpl.php | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index fdf2f722932..3693883775a 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -93,6 +93,7 @@ $langs->load("modulebuilder"); else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} @@ -165,6 +166,7 @@ $langs->load("modulebuilder"); textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?> textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?> textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?> + textwithpicto('', $langs->trans("ExtrafieldParamPassword"),1,0,'', 0, 2, 'helpvalue5')?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index e0b4927bf19..3a5922c216f 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -91,6 +91,7 @@ $langs->load("modulebuilder"); else if (type == 'int') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();} @@ -166,7 +167,7 @@ if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_ar } } } -elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') ) +elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) { $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; @@ -210,7 +211,7 @@ else trans("Size"); ?> - + trans("Value"); ?> @@ -224,6 +225,7 @@ else textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?> textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?> textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?> + textwithpicto('', $langs->trans("ExtrafieldParamPassword"),1,0,'', 0, 2, 'helpvalue5')?> From cc618e886f75997a51700464c434b3e75508ac71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 13:19:33 +0100 Subject: [PATCH 14/50] Fix extrafield password must be >= than 64 for password_hash --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ee165ac6808..db0e7f4284a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -234,7 +234,7 @@ class ExtraFields $lengthdb='11'; } elseif($type=='password') { $typedb='varchar'; - $lengthdb='50'; + $lengthdb='128'; } else { $typedb=$type; $lengthdb=$length; From 863cab362f3202de4e99fc22313ef494a939141f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 14:38:41 +0100 Subject: [PATCH 15/50] NEW Cat set the encryption algorithm for extrafields of type password --- htdocs/core/class/commonobject.class.php | 48 ++++++++++++++----- htdocs/core/lib/security.lib.php | 12 +++-- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- .../core/tpl/admin_extrafields_edit.tpl.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/societe/card.php | 2 +- 6 files changed, 46 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f69e842ec81..af940c91234 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4629,10 +4629,10 @@ abstract class CommonObject foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix - $attributeType = $extrafields->attribute_type[$attributeKey]; - $attributeLabel = $extrafields->attribute_label[$attributeKey]; - $attributeParam = $extrafields->attribute_param[$attributeKey]; - $attributeRequired = $extrafields->attribute_required[$attributeKey]; + $attributeType = $extrafields->attributes[$this->table_element]['type'][$attributeKey]; + $attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey]; + $attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey]; + $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey]; if ($attributeRequired) { @@ -4665,7 +4665,26 @@ abstract class CommonObject $this->array_options[$key] = null; } break;*/ - case 'price': + case 'password': + $algo=''; + if (is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) + { + // If there is an encryption choice, we use it to crypt data before insert + $algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])); + if ($algo != '') + { + $new_array_options[$key] = dol_hash($this->array_options[$key], $algo); + /*var_dump($algo); + var_dump($this->array_options[$key]); + var_dump($new_array_options[$key]);*/ + } + } + else // Common usage + { + $new_array_options[$key] = $this->array_options[$key]; + } + break; + case 'price': $new_array_options[$key] = price2num($this->array_options[$key]); break; case 'date': @@ -4723,7 +4742,7 @@ abstract class CommonObject { $attributeKey = substr($key,8); // Remove 'options_' prefix // Add field of attribut - if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate + if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator $sql.=",".$attributeKey; } $sql .= ") VALUES (".$this->id; @@ -4731,8 +4750,8 @@ abstract class CommonObject foreach($new_array_options as $key => $value) { $attributeKey = substr($key,8); // Remove 'options_' prefix - // Add field o fattribut - if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate) + // Add field of attribute + if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator) { if ($new_array_options[$key] != '') { @@ -4781,7 +4800,7 @@ abstract class CommonObject * Update an exta field value for the current object. * Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) * - * @param string $key Key of the extrafield + * @param string $key Key of the extrafield (without starting 'options_') * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) * @param User $userused Object user * @return int -1=error, O=did nothing, 1=OK @@ -4806,9 +4825,12 @@ abstract class CommonObject $target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element); $value=$this->array_options["options_".$key]; - $attributeType = $extrafields->attribute_type[$key]; - $attributeLabel = $extrafields->attribute_label[$key]; - $attributeParam = $extrafields->attribute_param[$key]; + + $attributeType = $extrafields->attributes[$this->table_element]['type'][$key]; + $attributeLabel = $extrafields->attributes[$this->table_element]['label'][$key]; + $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; + $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; + switch ($attributeType) { case 'int': @@ -4838,7 +4860,7 @@ abstract class CommonObject $this->array_options["options_".$key]=$this->db->idate($this->array_options["options_".$key]); break; case 'link': - $param_list=array_keys($attributeParam ['options']); + $param_list=array_keys($attributeParam['options']); // 0 : ObjectName // 1 : classPath $InfoFieldList = explode(":", $param_list[0]); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index dda89a7425d..a367579e1cd 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -70,11 +70,11 @@ function dol_decode($chain) /** * Returns a hash of a string. - * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function. - * If constant MAIN_SECURITY_SALT is defined, we use it as a salt. + * If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function (recommanded value is 'password_hash') + * If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash'). * * @param string $chain String to hash - * @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. + * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO then md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return string Hash of string * @getRandomPassword */ @@ -83,8 +83,10 @@ function dol_hash($chain, $type='0') global $conf; // No need to add salt for password_hash - if ($type == '0' && ! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_hash')) - return password_hash($chain, PASSWORD_DEFAULT); + if (($type == '0' || $type == 'auto') && ! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_hash')) + { + return password_hash($chain, PASSWORD_DEFAULT); + } // Salt value if (! empty($conf->global->MAIN_SECURITY_SALT)) $chain=$conf->global->MAIN_SECURITY_SALT.$chain; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 3693883775a..a48e8a5f31a 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -166,7 +166,7 @@ $langs->load("modulebuilder"); textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?> textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?> textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?> - textwithpicto('', $langs->trans("ExtrafieldParamPassword"),1,0,'', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"),1,0,'', 0, 2, 'helpvalue5')?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 3a5922c216f..a919b545a36 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -225,7 +225,7 @@ else textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?> textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?> textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?> - textwithpicto('', $langs->trans("ExtrafieldParamPassword"),1,0,'', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"),1,0,'', 0, 2, 'helpvalue5')?> diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 02c44ebee88..d6bf4d01fe9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -411,6 +411,7 @@ ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldLink=Link to an object ComputedFormula=Computed field ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$object->id < 10 ? round($object->id / 2, 2) : ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5 : '-1'

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found' +ExtrafieldParamHelpPassword=Keep this field empty means value will be stored without encryption (field must be only hidden with star on screen).
Set here value 'auto' to use the default encryption rule to save password into database (then value read will be the hash only, no way to retreive original value) ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')

for example :
1,value1
2,value2
code3,value3
...

In order to have the list depending on another complementary attribute list :
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

In order to have the list depending on another list :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')

for example :
1,value1
2,value2
3,value3
... diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index c0775145828..ed8e6c74c6e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -329,7 +329,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) From 953001c7aba013f26f317e07d47a7b6a4fb252bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 15:16:49 +0100 Subject: [PATCH 16/50] Fix bad naming of column --- htdocs/expensereport/card.php | 13 ++++++++++--- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6d989e6efc0..6cebfb0fe2d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1978,7 +1978,8 @@ else $i = 0;$total = 0; print ''; - print ''.$langs->trans('Piece').''; + print ''.$langs->trans('LineNb').''; + //print ''.$langs->trans('Piece').''; print ''.$langs->trans('Date').''; if (! empty($conf->projet->enabled)) print ''.$langs->trans('Project').''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print ''.$langs->trans('CarCategory').''; @@ -2001,15 +2002,21 @@ else foreach ($object->lines as &$line) { - $piece_comptable = $i + 1; + $numline = $i + 1; if ($action != 'editline' || $line->rowid != GETPOST('rowid')) { print ''; print ''; + print $numline; + print ''; + + /*print ''; print img_picto($langs->trans("Document"), "object_generic"); - print ' '.$piece_comptable.''; + print ' '.$piece_comptable.''; + print '';*/ + print ''.dol_print_date($db->jdate($line->date), 'day').''; if (! empty($conf->projet->enabled)) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index cde8a485e59..19c7967e43a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -854,6 +854,7 @@ FileNotShared=File not shared to exernal public Project=Project Projects=Projects Rights=Permissions +LineNb=Line nb # Week day Monday=Monday Tuesday=Tuesday From 93a817681327ddf9eaa70af71a78938e48130c76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 15:28:24 +0100 Subject: [PATCH 17/50] Fix do not encrypt if empty --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index af940c91234..60d7f4a8c5e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4667,7 +4667,7 @@ abstract class CommonObject break;*/ case 'password': $algo=''; - if (is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) + if ($this->array_options[$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { // If there is an encryption choice, we use it to crypt data before insert $algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])); From f002c84a766b11b552ff9cd5510b103a94e94251 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 15:33:00 +0100 Subject: [PATCH 18/50] Fix type of expense report output in PDF --- .../modules/expensereport/doc/pdf_standard.modules.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 15d48694277..c236c9ad017 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -328,7 +328,15 @@ class pdf_standard extends ModeleExpenseReport $nextColumnPosX = $this->posxprojet; } - $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 10), 0, 'C'); + $expensereporttypecode = $object->lines[$i]->type_fees_code; + $expensereporttypecodetoshow = $outputlangs->transnoentities($expensereporttypecode); + if ($expensereporttypecodetoshow == $expensereporttypecode) + { + $expensereporttypecodetoshow = preg_replace('/^(EX_|TF_)/', '', $expensereporttypecodetoshow); + } + $expensereporttypecodetoshow = dol_trunc($expensereporttypecodetoshow, 9); // 10 is too much + + $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C'); // Project if (! empty($conf->projet->enabled)) From 812911bd44097e5defbc4d511643fa857b79c615 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 15:33:00 +0100 Subject: [PATCH 19/50] Fix type of expense report output in PDF --- .../modules/expensereport/doc/pdf_standard.modules.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 15d48694277..c236c9ad017 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -328,7 +328,15 @@ class pdf_standard extends ModeleExpenseReport $nextColumnPosX = $this->posxprojet; } - $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 10), 0, 'C'); + $expensereporttypecode = $object->lines[$i]->type_fees_code; + $expensereporttypecodetoshow = $outputlangs->transnoentities($expensereporttypecode); + if ($expensereporttypecodetoshow == $expensereporttypecode) + { + $expensereporttypecodetoshow = preg_replace('/^(EX_|TF_)/', '', $expensereporttypecodetoshow); + } + $expensereporttypecodetoshow = dol_trunc($expensereporttypecodetoshow, 9); // 10 is too much + + $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C'); // Project if (! empty($conf->projet->enabled)) From 787a13750939267bb1cda1ed308dd8b41e9adb1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 15:38:39 +0100 Subject: [PATCH 20/50] Add column for accounting doc --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 1 + htdocs/install/mysql/tables/llx_expensereport_det.sql | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index a0ec8f58e37..6488a7dafde 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -54,5 +54,6 @@ insert into llx_c_type_container (code,label,module,active) values ('blogpost', insert into llx_c_type_container (code,label,module,active) values ('other', 'Other', 'system', 1); +ALTER TABLE llx_expensereport_det ADD COLUMN docnumber varchar(128) after fk_expensereport; diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index 5cc7b1b86f5..fc0bd6e697f 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -20,9 +20,10 @@ CREATE TABLE llx_expensereport_det ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, fk_expensereport integer NOT NULL, - fk_c_type_fees integer NOT NULL, + docnumber varchar(128), -- To store a ref of a accounting doc (piece) + fk_c_type_fees integer NOT NULL, -- Type of expense fk_c_exp_tax_cat integer, - fk_projet integer, + fk_projet integer, -- Id of project comments text NOT NULL, product_type integer DEFAULT -1, qty real NOT NULL, From 0a79550f4320706d6d216717733da270932d8adb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 16:11:00 +0100 Subject: [PATCH 21/50] Fix oldcopy must be saved before update_extras --- htdocs/comm/card.php | 4 +++- htdocs/comm/propal/card.php | 4 +++- htdocs/commande/card.php | 4 +++- htdocs/compta/facture/card.php | 4 +++- htdocs/compta/facture/fiche-rec.php | 4 +++- htdocs/contrat/card.php | 2 +- htdocs/expedition/card.php | 6 ++++-- htdocs/expedition/shipment.php | 6 ++++-- htdocs/expensereport/card.php | 6 ++++-- htdocs/fichinter/card.php | 4 +++- htdocs/fourn/card.php | 4 +++- htdocs/fourn/commande/card.php | 4 +++- htdocs/fourn/facture/card.php | 4 +++- htdocs/livraison/card.php | 4 +++- htdocs/product/stock/productlot_card.php | 6 ++++-- htdocs/societe/card.php | 2 ++ htdocs/supplier_proposal/card.php | 4 +++- 17 files changed, 52 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 506b0c6fa8d..aab95264a57 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -189,9 +189,11 @@ if (empty($reshook)) if ($action == 'update_extras') { $object->fetch($id); + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 380edc5a472..02c1b0e65bb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1228,9 +1228,11 @@ if (empty($reshook)) } else if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 21975439872..2cb899fcfe6 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1268,9 +1268,11 @@ if (empty($reshook)) if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5681b0c339c..969f4d532cb 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2112,9 +2112,11 @@ if (empty($reshook)) if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index f869c01aa53..43d28c9abbd 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -444,9 +444,11 @@ if (empty($reshook)) } else if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e27bbfb7655..3b7ab5ae49b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -880,7 +880,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 82d6c746640..27b70e1b8cf 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -155,9 +155,11 @@ if (empty($reshook)) if ($action == 'update_extras') { - // Fill array 'array_options' with data from update form + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0141fc1dea5..3b7a2d74818 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -180,9 +180,11 @@ if (empty($reshook)) if ($action == 'update_extras') { - // Fill array 'array_options' with data from update form + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index bb90442a110..dd5db880bc9 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -286,9 +286,11 @@ if (empty($reshook)) if ($action == 'update_extras') { - // Fill array 'array_options' with data from update form + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 3eddb02c28b..9b623d21279 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -741,9 +741,11 @@ if (empty($reshook)) if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 6f06a6778fd..c6f0c8bb446 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -114,9 +114,11 @@ if (empty($reshook)) if ($action == 'update_extras') { $object->fetch($id); + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 15148cbcc2a..f87b4c9bd25 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -945,9 +945,11 @@ if (empty($reshook)) if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cfba614492e..cc6fb29fa5a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1255,9 +1255,11 @@ if (empty($reshook)) } if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from add form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (!$error) diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index b2218508ef6..06c602df330 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -193,9 +193,11 @@ elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) // Update extrafields if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 8e639c90108..f269e260b25 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -122,9 +122,11 @@ if (empty($reshook)) if ($action == 'update_extras') { - // Fill array 'array_options' with data from update form + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); if ($ret < 0) $error++; if (! $error) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ed8e6c74c6e..55c598fdd84 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -327,6 +327,8 @@ if (empty($reshook)) if ($action == 'update_extras') { $object->fetch($socid); + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none')); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index c4f5c5c6ba9..8d8e46a6ae9 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -927,9 +927,11 @@ if (empty($reshook)) } else if ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; if (! $error) From f3e1e81219916363936e09e79da8a7c4f61dc286 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 16:11:25 +0100 Subject: [PATCH 22/50] Fix update of extrafield password that are crypted --- htdocs/core/class/commonobject.class.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 60d7f4a8c5e..990d158af56 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4673,10 +4673,26 @@ abstract class CommonObject $algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])); if ($algo != '') { - $new_array_options[$key] = dol_hash($this->array_options[$key], $algo); - /*var_dump($algo); - var_dump($this->array_options[$key]); - var_dump($new_array_options[$key]);*/ + if (is_object($this->oldcopy)) // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value + { + //global $action; // $action may be 'create', 'update', 'update_extras'... + //var_dump($action); + //var_dump($this->oldcopy->array_options[$key]); var_dump($this->array_options[$key]); + if ($this->array_options[$key] == $this->oldcopy->array_options[$key]) // If old value crypted in database is same thaan submited new value, it means we don't change it, so we don't update. + { + $new_array_options[$key] = $this->array_options[$key]; // Value is kept + } + else + { + // var_dump($algo); + $newvalue = dol_hash($this->array_options[$key], $algo); + $new_array_options[$key] = $newvalue; + } + } + else + { + $new_array_options[$key] = $this->array_options[$key]; // Value is kept + } } } else // Common usage From 7cf7bf6e4591ac09e06cd16ef63d227895e48ac7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 16:26:23 +0100 Subject: [PATCH 23/50] Code comment --- htdocs/core/class/commonobject.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 990d158af56..f5e429bf54a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4673,12 +4673,13 @@ abstract class CommonObject $algo=reset(array_keys($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])); if ($algo != '') { + //global $action; // $action may be 'create', 'update', 'update_extras'... + //var_dump($action); + //var_dump($this->oldcopy);exit; if (is_object($this->oldcopy)) // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value { - //global $action; // $action may be 'create', 'update', 'update_extras'... - //var_dump($action); //var_dump($this->oldcopy->array_options[$key]); var_dump($this->array_options[$key]); - if ($this->array_options[$key] == $this->oldcopy->array_options[$key]) // If old value crypted in database is same thaan submited new value, it means we don't change it, so we don't update. + if ($this->array_options[$key] == $this->oldcopy->array_options[$key]) // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. { $new_array_options[$key] = $this->array_options[$key]; // Value is kept } From d8bf553ea9d1e99c568c1a1b1df5d08afc7576d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Feb 2018 19:55:15 +0100 Subject: [PATCH 24/50] Add option THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD for logo indexing --- htdocs/core/class/commonobject.class.php | 2 + htdocs/core/lib/files.lib.php | 134 +++++++++++++++++++---- htdocs/societe/card.php | 17 ++- htdocs/societe/class/societe.class.php | 28 ++--- 4 files changed, 140 insertions(+), 41 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f5e429bf54a..55e3c380c31 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4116,6 +4116,7 @@ abstract class CommonObject * @param int $hideref 1 to hide product reference. 0 by default * @param null|array $moreparams Array to provide more information * @return int >0 if OK, <0 if KO + * @see addFileIntoDatabaseIndex */ protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null) { @@ -4354,6 +4355,7 @@ abstract class CommonObject /** * Build thumb + * @TODO Move this into files.lib.php * * @param string $file Path file in UTF8 to original file to create thumbs from. * @return void diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 85d80f646d0..529f58dbbf1 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -950,7 +950,7 @@ function dolCheckVirus($src_file) * Note: * - This function can be used only into a HTML page context. Use dol_move if you are outside. * - Test on antivirus is always done (if antivirus set). - * - Database of files is NOT updated. + * - Database of files is NOT updated (this is done by dol_add_file_process() that calls this function). * * @param string $src_file Source full path filename ($_FILES['field']['tmp_name']) * @param string $dest_file Target full path filename ($_FILES['field']['name']) @@ -1554,28 +1554,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio // Update table of files if ($donotupdatesession) { - $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir); - - if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir + $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0); + if ($result < 0) { - $filename = basename($destfile); - $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); - $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); - - include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $ecmfile=new EcmFiles($db); - $ecmfile->filepath = $rel_dir; - $ecmfile->filename = $filename; - $ecmfile->label = md5_file(dol_osencode($destfull)); // MD5 of file content - $ecmfile->fullpath_orig = $TFile['name'][$i]; - $ecmfile->gen_or_uploaded = 'uploaded'; - $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content - $result = $ecmfile->create($user); - if ($result < 0) - { - setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); - } + setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); } } @@ -1679,6 +1661,114 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= } } + +/** + * Add a file into database index. + * Called by dol_add_file_process when uploading a file and on other cases. + * See also commonGenerateDocument that also add/update database index when a file is generated. + * + * @param string $dir Directory name (full real path without ending /) + * @param string $file File name + * @param string $fullpathorig Full path of origin for file (can be '') + * @param string $mode How file was created ('uploaded', 'generated', ...) + * @param int $setsharekey Set also the share key + * @return int <0 if KO, 0 if nothing done, >0 if OK + */ +function addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0) +{ + global $db, $user; + + $result = 0; + + $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $dir); + + if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir + { + $filename = basename($file); + $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); + $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); + + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + $ecmfile=new EcmFiles($db); + $ecmfile->filepath = $rel_dir; + $ecmfile->filename = $filename; + $ecmfile->label = md5_file(dol_osencode($dir.'/'.$file)); // MD5 of file content + $ecmfile->fullpath_orig = $fullpathorig; + $ecmfile->gen_or_uploaded = $mode; + $ecmfile->description = ''; // indexed content + $ecmfile->keyword = ''; // keyword content + if ($setsharekey) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $ecmfile->share = getRandomPassword(true); + } + + $result = $ecmfile->create($user); + if ($result < 0) + { + dol_syslog($ecmfile->error); + } + } + + return $result; +} + + +/** + * Delete files into database index using search criterias. + * + * @param string $dir Directory name (full real path without ending /) + * @param string $file File name + * @param string $mode How file was created ('uploaded', 'generated', ...) + * @return int <0 if KO, 0 if nothing done, >0 if OK + */ +function deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded') +{ + global $conf, $db, $user; + + $error = 0; + + if (empty($dir)) + { + dol_syslog("deleteFilesIntoDatabaseIndex: dir parameter can't be empty", LOG_ERR); + return -1; + } + + $db->begin(); + + $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $dir); + + $filename = basename($file); + $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); + $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); + + if (! $error) + { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'ecm_files'; + $sql.= ' WHERE entity = '.$conf->entity; + $sql.= " AND filepath = '" . $db->escape($rel_dir) . "'"; + if ($file) $sql.= " AND filename = '" . $db->escape($file) . "'"; + if ($mode) $sql.= " AND gen_or_uploaded = '" . $db->escape($mode) . "'"; + + $resql = $db->query($sql); + if (!$resql) + { + $error++; + dol_syslog(__METHOD__ . ' ' . $db->lasterror(), LOG_ERR); + } + } + + // Commit or rollback + if ($error) { + $db->rollback(); + return - 1 * $error; + } else { + $db->commit(); + return 1; + } +} + + /** * Convert an image file into another format. * This need Imagick php extension. diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 55c598fdd84..4e013581a25 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -713,13 +713,18 @@ if (empty($reshook)) } else { - // Create small thumbs for company (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); + // Create thumbs + $object->addThumbs($newfile); - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); + // Index file in database + if (! empty($conf->global->THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD)) + { + require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; + // the dir dirname($newfile) is directory of logo, so we should have only one file at once into index, so we delete indexes for the dir + deleteFilesIntoDatabaseIndex(dirname($newfile), '', '', 'uploaded', 1); + // now we index the uploaded logo file + addFileIntoDatabaseIndex(dirname($newfile), basename($newfile), '', 'uploaded', 1); + } } } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f67d1a1d9e7..f5c0f004794 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1121,10 +1121,11 @@ class Societe extends CommonObject * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) - * @param string $email Email (Warning, this can return several records) + * @param string $email Email of third party (Warning, this can return several records) + * @param string $ref_alias Name_alias of third party (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='') + function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='', $ref_alias='') { global $langs; global $conf; @@ -1166,17 +1167,18 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; - if ($rowid) $sql .= ' AND s.rowid = '.$rowid; - if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'"; - if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'"; - if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'"; - if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'"; - if ($idprof2) $sql .= " AND s.siret = '".$this->db->escape($idprof2)."'"; - if ($idprof3) $sql .= " AND s.ape = '".$this->db->escape($idprof3)."'"; - if ($idprof4) $sql .= " AND s.idprof4 = '".$this->db->escape($idprof4)."'"; - if ($idprof5) $sql .= " AND s.idprof5 = '".$this->db->escape($idprof5)."'"; - if ($idprof6) $sql .= " AND s.idprof6 = '".$this->db->escape($idprof6)."'"; - if ($email) $sql .= " AND s.email = '".$this->db->escape($email)."'"; + if ($rowid) $sql .= ' AND s.rowid = '.$rowid; + if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'"; + if ($ref_alias) $sql .= " AND s.nom_alias = '".$this->db->escape($nom_alias)."'"; + if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'"; + if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'"; + if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'"; + if ($idprof2) $sql .= " AND s.siret = '".$this->db->escape($idprof2)."'"; + if ($idprof3) $sql .= " AND s.ape = '".$this->db->escape($idprof3)."'"; + if ($idprof4) $sql .= " AND s.idprof4 = '".$this->db->escape($idprof4)."'"; + if ($idprof5) $sql .= " AND s.idprof5 = '".$this->db->escape($idprof5)."'"; + if ($idprof6) $sql .= " AND s.idprof6 = '".$this->db->escape($idprof6)."'"; + if ($email) $sql .= " AND s.email = '".$this->db->escape($email)."'"; $resql=$this->db->query($sql); if ($resql) From 4c06384197dc8d47b836c2b8daaa6abead75948b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 24 Feb 2018 11:13:14 +0100 Subject: [PATCH 25/50] Fix: differentiate sharing of "member" and "member_type" --- htdocs/adherents/class/adherent_type.class.php | 3 ++- htdocs/adherents/class/api_memberstypes.class.php | 2 +- htdocs/adherents/index.php | 2 +- htdocs/adherents/type.php | 2 +- htdocs/core/boxes/box_members.php | 2 +- htdocs/core/modules/mailings/fraise.modules.php | 2 +- htdocs/core/modules/modAdherent.class.php | 2 +- htdocs/societe/societecontact.php | 3 ++- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 5e9cbb07ca5..c352f5dc944 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -35,6 +35,7 @@ class AdherentType extends CommonObject public $table_element = 'adherent_type'; public $element = 'adherent_type'; public $picto = 'group'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * @var string @@ -307,7 +308,7 @@ class AdherentType extends CommonObject $sql = "SELECT rowid, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type"; - $sql.= " WHERE entity IN (".getEntity('adherent').")"; + $sql.= " WHERE entity IN (".getEntity('member_type').")"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 26d3d115f75..f2dfba0367a 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -97,7 +97,7 @@ class MembersTypes extends DolibarrApi $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; - $sql.= ' WHERE t.entity IN ('.getEntity('adherent').')'; + $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')'; // Add sql filters if ($sqlfilters) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index a04b1df5786..fd418756bd6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -65,7 +65,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d"; $sql.= " ON t.rowid = d.fk_adherent_type"; $sql.= " AND d.entity IN (".getEntity('adherent').")"; -$sql.= " WHERE t.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); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cc9fd872062..885e5a01251 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -216,7 +216,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; - $sql.= " WHERE d.entity IN (".getEntity('adherent').")"; + $sql.= " WHERE d.entity IN (".getEntity('member_type').")"; $result = $db->query($sql); if ($result) diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 25fa257d098..e5819f0f14c 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -88,7 +88,7 @@ class box_members extends ModeleBoxes $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; $sql.= " t.subscription"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t"; - $sql.= " WHERE a.entity = ".$conf->entity; + $sql.= " WHERE a.entity IN (".getEntity('member').")"; $sql.= " AND a.fk_adherent_type = t.rowid"; $sql.= " ORDER BY a.tms DESC"; $sql.= $db->plimit($max, 0); diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index a1674d6ab08..f71b6b925f0 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -127,7 +127,7 @@ class mailing_fraise extends MailingTargets $s.=''; From e2e0f23d2990caf349676d82438a787a99e3f566 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 14:01:52 +0100 Subject: [PATCH 33/50] FIX Bad var for substitution of free text --- .../modules/contract/doc/doc_generic_contract_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index ff7abbca53a..98b644c8cce 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -317,7 +317,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Line of free text $newfreetext=''; - $paramfreetext='contract_FREE_TEXT'; + $paramfreetext='CONTRACT_FREE_TEXT'; if (! empty($conf->global->$paramfreetext)) { $newfreetext=make_substitutions($conf->global->$paramfreetext,$tmparray); From 1ec5a5d0bf58cd6f21b4dfff89b825dd9598629b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 14:02:27 +0100 Subject: [PATCH 34/50] FIX Generic substitution of constant disabled for sensitive constant --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8476ab90b02..3f194d3531a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5947,7 +5947,8 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null) if (dol_textishtml($text,1)) $msgishtml = 1; $keyfound = $reg[1]; - $newval=empty($conf->global->$keyfound)?'':$conf->global->$keyfound; + if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; + else $newval=empty($conf->global->$keyfound)?'':$conf->global->$keyfound; $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml?dol_htmlentitiesbr($newval):$newval, $text); } From 619e0d3792920887e42d2d748cd9310537df9a02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 14:01:52 +0100 Subject: [PATCH 35/50] FIX Bad var for substitution of free text --- .../modules/contract/doc/doc_generic_contract_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 62eade74dfa..7e308964e29 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -324,7 +324,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Line of free text $newfreetext=''; - $paramfreetext='contract_FREE_TEXT'; + $paramfreetext='CONTRACT_FREE_TEXT'; if (! empty($conf->global->$paramfreetext)) { $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); From a5b1f114c2a88a3438a3ec3fb35697686f528ca2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 14:02:27 +0100 Subject: [PATCH 36/50] FIX Generic substitution of constant disabled for sensitive constant --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0f10c40fddf..715095f96ae 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5685,7 +5685,8 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null) if (dol_textishtml($text,1)) $msgishtml = 1; $keyfound = $reg[1]; - $newval=empty($conf->global->$keyfound)?'':$conf->global->$keyfound; + if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; + else $newval=empty($conf->global->$keyfound)?'':$conf->global->$keyfound; $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml?dol_htmlentitiesbr($newval):$newval, $text); } From 3859b5a92662c6fe3de5f31e06d36c050dcd9d15 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 24 Feb 2018 14:20:53 +0100 Subject: [PATCH 37/50] Fix: Parameter must be an array or an object that implements Countable --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b08993acf8a..fae976dec80 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -46,7 +46,7 @@ if (! empty($massaction) && count($toselect) < 1) $error++; setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); } -if (! $error && count($toselect) > $maxformassaction) +if (! $error && is_array($toselect) && count($toselect) > $maxformassaction) { setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); $error++; From 3b5a3915c44be7f06b91fae595e4b17db299844c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 14:23:52 +0100 Subject: [PATCH 38/50] NEW Use common substitution rule for language to get translation in ODT --- htdocs/core/class/commondocgenerator.class.php | 8 ++++++++ htdocs/core/class/translate.class.php | 1 + 2 files changed, 9 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index dd296429d58..f6a410469de 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -316,6 +316,14 @@ abstract class CommonDocGenerator 'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs), ); + + foreach($conf->global as $key => $val) + { + if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; + else $newval = $val; + $array_other['__['.$key.']__'] = $newval; + } + return $array_other; } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 14f017bef55..69fe031459d 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -1027,6 +1027,7 @@ class Translate foreach($this->tab_translate as $code => $label) { $substitutionarray['lang_'.$code] = $label; + $substitutionarray['__('.$code.')__'] = $label; } return $substitutionarray; From b2162492147f26443e051f84d477ae4d6526e6f6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 24 Feb 2018 15:01:29 +0100 Subject: [PATCH 39/50] Fix: missing hook parameters --- htdocs/adherents/list.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/user/index.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index a01cc379b3c..fc30d6f1ae2 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -574,7 +574,7 @@ if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titr include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters=array('arrayfields'=>$arrayfields); +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index af67bd8107b..2903cee2a88 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -614,7 +614,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 13225c2c5d3..29590820b72 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -701,7 +701,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index fe26efd490e..8d3f8971ef4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -862,7 +862,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0b45f2d63a0..ef5f8816a94 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -914,7 +914,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'],$_SERVER["PHP_SELF"],"cf.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 31d6ba2f183..0876cfc7595 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -762,7 +762,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ebb2c0a421a..178432addbc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -654,7 +654,7 @@ else // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index abf9f9cfd2a..74ee17affd5 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -599,7 +599,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters=array('arrayfields'=>$arrayfields); + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'],$_SERVER["PHP_SELF"],"sp.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 6f9ac1f638a..b5edbafa89e 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -406,7 +406,7 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_t // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters=array('arrayfields'=>$arrayfields); +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (! empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); From c604ce0a0676046c143bcbadf72e44e644819aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Feb 2018 15:31:30 +0100 Subject: [PATCH 40/50] Fix date in odt --- htdocs/core/class/commondocgenerator.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f6a410469de..f5a16aa540b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -353,6 +353,8 @@ abstract class CommonDocGenerator $sumcreditnote = $object->getSumCreditNotesUsed(); } + $date = ($object->element == 'contrat' ? $object->date_contrat : $object->date); + $resarray=array( $array_key.'_id'=>$object->id, $array_key.'_ref'=>$object->ref, @@ -361,9 +363,9 @@ abstract class CommonDocGenerator $array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)), $array_key.'_source_invoice_ref'=>$invoice_source->ref, // Dates - $array_key.'_hour'=>dol_print_date($object->date,'hour'), - $array_key.'_date'=>dol_print_date($object->date,'day'), - $array_key.'_date_rfc'=>dol_print_date($object->date,'dayrfc'), + $array_key.'_hour'=>dol_print_date($date,'hour'), + $array_key.'_date'=>dol_print_date($date,'day'), + $array_key.'_date_rfc'=>dol_print_date($date,'dayrfc'), $array_key.'_date_limit'=>(! empty($object->date_lim_reglement)?dol_print_date($object->date_lim_reglement,'day'):''), $array_key.'_date_end'=>(! empty($object->fin_validite)?dol_print_date($object->fin_validite,'day'):''), $array_key.'_date_creation'=>dol_print_date($object->date_creation,'day'), From 703d976b3bd2929c6de2cf26a5a936be7417c7a2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 24 Feb 2018 16:21:16 +0100 Subject: [PATCH 41/50] Fix: missing object entity in fetch --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/commande/class/commande.class.php | 16 +++++++++------- htdocs/compta/facture/class/facture.class.php | 4 +++- .../fourn/class/fournisseur.commande.class.php | 4 +++- .../class/supplier_proposal.class.php | 3 ++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5efc1cf9db4..7663a05812f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1321,7 +1321,7 @@ class Propal extends CommonObject function fetch($rowid,$ref='') { - $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; + $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.datec"; $sql.= ", p.date_valid as datev"; @@ -1367,6 +1367,7 @@ class Propal extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 65b704693fb..feac3d74106 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1572,7 +1572,7 @@ class Commande extends CommonOrder // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; + $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql.= ', c.fk_account'; $sql.= ', c.date_commande'; @@ -1602,12 +1602,14 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); - if ($result) - { - $obj = $this->db->fetch_object($result); - if ($obj) - { - $this->id = $obj->rowid; + if ($result) + { + $obj = $this->db->fetch_object($result); + if ($obj) + { + $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; $this->ref_customer = $obj->ref_client; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 589a184030e..a87ebf0c9a9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1239,7 +1239,7 @@ class Facture extends CommonInvoice if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; + $sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; $sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.datef as df, f.date_pointoftax'; @@ -1276,6 +1276,8 @@ class Facture extends CommonInvoice $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->facnumber; $this->ref_client = $obj->ref_client; $this->ref_ext = $obj->ref_ext; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 38d0e42d36a..a42546fdb84 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if (empty($id) && empty($ref)) return -1; - $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; + $sql = "SELECT c.rowid, c.entity, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; $sql.= " c.localtax1, c.localtax2, "; $sql.= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; @@ -253,6 +253,8 @@ class CommandeFournisseur extends CommonOrder } $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->ref; $this->ref_supplier = $obj->ref_supplier; $this->socid = $obj->fk_soc; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e43404777b6..621a229121c 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1132,7 +1132,7 @@ class SupplierProposal extends CommonObject { global $conf; - $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; + $sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.datec"; $sql.= ", p.date_valid as datev"; @@ -1166,6 +1166,7 @@ class SupplierProposal extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->remise = $obj->remise; From 029ef534d04b80292a381b19a6a4a43ea1803d47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 10:55:02 +0100 Subject: [PATCH 42/50] Clean deprecated code (property "special" removed from mod descriptor) --- htdocs/admin/modulehelp.php | 7 +--- htdocs/admin/modules.php | 13 ++----- htdocs/contrat/class/contrat.class.php | 28 +++++++------ htdocs/core/lib/admin.lib.php | 2 - htdocs/core/modules/modAccounting.class.php | 1 - htdocs/core/modules/modAdherent.class.php | 1 - htdocs/core/modules/modAgenda.class.php | 1 - htdocs/core/modules/modApi.class.php | 4 +- htdocs/core/modules/modBanque.class.php | 5 +-- htdocs/core/modules/modBarcode.class.php | 1 - htdocs/core/modules/modBlockedLog.class.php | 2 - htdocs/core/modules/modBookmark.class.php | 5 +-- htdocs/core/modules/modCashDesk.class.php | 1 - htdocs/core/modules/modCategorie.class.php | 11 +++--- htdocs/core/modules/modClickToDial.class.php | 3 +- htdocs/core/modules/modCollab.class.php | 2 - htdocs/core/modules/modCommande.class.php | 9 ++--- htdocs/core/modules/modComptabilite.class.php | 7 ++-- htdocs/core/modules/modContrat.class.php | 23 ++++++----- htdocs/core/modules/modCron.class.php | 2 - htdocs/core/modules/modDeplacement.class.php | 11 +++--- .../modules/modDocumentGeneration.class.php | 1 - htdocs/core/modules/modDon.class.php | 1 - .../core/modules/modDynamicPrices.class.php | 2 - htdocs/core/modules/modECM.class.php | 2 - htdocs/core/modules/modExpedition.class.php | 5 +-- .../core/modules/modExpenseReport.class.php | 1 - htdocs/core/modules/modExport.class.php | 1 - htdocs/core/modules/modExternalRss.class.php | 1 - htdocs/core/modules/modExternalSite.class.php | 4 +- htdocs/core/modules/modFTP.class.php | 6 +-- htdocs/core/modules/modFacture.class.php | 1 - htdocs/core/modules/modFckeditor.class.php | 1 - htdocs/core/modules/modFicheinter.class.php | 7 ++-- htdocs/core/modules/modFournisseur.class.php | 1 - htdocs/core/modules/modGeoIPMaxmind.class.php | 4 +- htdocs/core/modules/modGravatar.class.php | 4 +- htdocs/core/modules/modHRM.class.php | 39 +++++++++---------- htdocs/core/modules/modHoliday.class.php | 2 - htdocs/core/modules/modImport.class.php | 1 - htdocs/core/modules/modIncoterm.class.php | 2 - htdocs/core/modules/modLabel.class.php | 1 - htdocs/core/modules/modLdap.class.php | 4 +- htdocs/core/modules/modLoan.class.php | 9 ++--- htdocs/core/modules/modMailing.class.php | 1 - htdocs/core/modules/modMailmanSpip.class.php | 3 +- htdocs/core/modules/modMargin.class.php | 2 - .../core/modules/modModuleBuilder.class.php | 2 - .../core/modules/modMultiCurrency.class.php | 2 - htdocs/core/modules/modNotification.class.php | 3 +- htdocs/core/modules/modOauth.class.php | 4 +- htdocs/core/modules/modOpenSurvey.class.php | 2 - htdocs/core/modules/modPaybox.class.php | 4 +- htdocs/core/modules/modPaypal.class.php | 4 +- htdocs/core/modules/modPrelevement.class.php | 13 +++---- htdocs/core/modules/modPrinting.class.php | 4 +- htdocs/core/modules/modProduct.class.php | 1 - htdocs/core/modules/modProductBatch.class.php | 9 ++--- htdocs/core/modules/modProjet.class.php | 1 - htdocs/core/modules/modPropale.class.php | 11 +++--- .../core/modules/modReceiptPrinter.class.php | 4 +- htdocs/core/modules/modResource.class.php | 3 -- htdocs/core/modules/modSalaries.class.php | 1 - htdocs/core/modules/modService.class.php | 1 - htdocs/core/modules/modSkype.class.php | 4 +- htdocs/core/modules/modSociete.class.php | 1 - htdocs/core/modules/modStock.class.php | 1 - htdocs/core/modules/modStripe.class.php | 4 +- .../modules/modSupplierProposal.class.php | 13 +++---- htdocs/core/modules/modSyslog.class.php | 2 - htdocs/core/modules/modTax.class.php | 17 ++++---- htdocs/core/modules/modUser.class.php | 1 - htdocs/core/modules/modVariants.class.php | 2 - htdocs/core/modules/modWebServices.class.php | 4 +- .../modules/modWebServicesClient.class.php | 4 +- htdocs/core/modules/modWebsite.class.php | 2 - htdocs/core/modules/modWorkflow.class.php | 2 - .../core/modules/modMyModule.class.php | 2 +- htdocs/public/demo/index.php | 2 - 79 files changed, 130 insertions(+), 245 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index bc48feb076f..dd90774a05b 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -163,8 +163,6 @@ foreach ($modulesdir as $dir) $modules[$i] = $objMod; $filename[$i]= $modName; - $special = $objMod->special; - // Gives the possibility to the module, to provide his own family info and position of this family if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) { if (!is_array($familyinfo)) $familyinfo=array(); @@ -180,13 +178,11 @@ foreach ($modulesdir as $dir) $moduleposition = 800; } - if ($special == 1) $familykey='interface'; - $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; // Set categ[$i] - $specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown'; + $specialstring = 'unknown'; if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev'; if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories else $categ[$specialstring]=1; @@ -240,7 +236,6 @@ foreach($orders as $tmpkey => $tmpvalue) $i++; } $value = $orders[$key]; -$special = $objMod->special; $tab=explode('_',$value); $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 00c8d14219e..db8251d0562 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -358,8 +358,6 @@ foreach ($modulesdir as $dir) $filename[$i]= $modName; $modules[$modName] = $objMod; - $special = $objMod->special; - // Gives the possibility to the module, to provide his own family info and position of this family if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) { $familyinfo = array_merge($familyinfo, $objMod->familyinfo); @@ -374,8 +372,6 @@ foreach ($modulesdir as $dir) $moduleposition = 800; } - if ($special == 1) $familykey='interface'; - // Add list of warnings to show into arrayofwarnings and arrayofwarningsext if (! empty($objMod->warnings_activation)) { @@ -390,7 +386,7 @@ foreach ($modulesdir as $dir) $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; // Set categ[$i] - $specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown'; + $specialstring = 'unknown'; if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev'; if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories else $categ[$specialstring]=1; @@ -531,12 +527,9 @@ if ($mode == 'common') $objMod = $modules[$modName]; $dirofmodule = $dirmod[$key]; - $special = $objMod->special; - - //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; + //print $objMod->name." - ".$key." - ".$objMod->version."
"; //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') - if (($special >= 4 && $mode != 'expdev') - || ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental')) continue; // Discard if not for current tab + if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab if (! $objMod->getName()) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0b84b05b6fd..0d5262ac66b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -316,9 +316,10 @@ class Contrat extends CommonObject * * @param User $user Object User making action * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - function closeAll(User $user, $notrigger=0) + function closeAll(User $user, $notrigger=0, $comment='') { $this->db->begin(); @@ -337,7 +338,7 @@ class Contrat extends CommonObject $contratline->date_cloture=$now; $contratline->fk_user_cloture=$user->id; $contratline->statut='5'; - $result=$contratline->close_line($user, $now); + $result=$contratline->close_line($user, $now, $comment, $notrigger); if ($result < 0) { $error++; @@ -3140,9 +3141,10 @@ class ContratLigne extends CommonObjectLine * @param User $user Objet User who close contract * @param int $date_end Date end * @param string $comment A comment typed by user + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - function close_line($user, $date_end, $comment = '') + function close_line($user, $date_end, $comment = '', $notrigger=0) { global $langs, $conf; @@ -3164,15 +3166,19 @@ class ContratLigne extends CommonObjectLine $sql .= " WHERE rowid = " . $this->id . " AND statut = 4"; $resql = $this->db->query($sql); - if ($resql) { - // Call trigger - $result = $this->call_trigger('LINECONTRACT_CLOSE', $user); - if ($result < 0) { - $error++; - $this->db->rollback(); - return -1; + if ($resql) + { + if (! $notrigger) + { + // Call trigger + $result = $this->call_trigger('LINECONTRACT_CLOSE', $user); + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } + // End call triggers } - // End call triggers $this->db->commit(); return 1; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 65cc2965bea..7991b711660 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1290,8 +1290,6 @@ function complete_elementList_with_modules(&$elementList) $filename[$i]= $modName; $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module //print "x".$modName." ".$orders[$i]."\n
"; - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories - else $categ[$objMod->special]=1; $dirmod[$i] = $dirroot; if (! empty($objMod->module_parts['contactelement'])) { diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 9bad202251e..ea7208cc5dd 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -54,7 +54,6 @@ class modAccounting extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); - $this->special = 0; $this->picto = 'accounting'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index aa098146dc7..afdbfcf5ada 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -56,7 +56,6 @@ class modAdherent extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='user'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 89085ea4d6c..01aa8896c35 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -59,7 +59,6 @@ class modAgenda extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='action'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 34c8e62a03f..3e27031fd6f 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -51,7 +51,7 @@ class modApi extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -60,8 +60,6 @@ class modApi extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index c9fde5f0087..d32a63b5a86 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -58,7 +58,6 @@ class modBanque extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='account'; // Data directories to create when module is enabled @@ -138,8 +137,8 @@ class modBanque extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index da8b51c8e8e..1f734af0871 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -51,7 +51,6 @@ class modBarcode extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; $this->picto='barcode'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index b18f8bebf62..07331bcbc3c 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -55,8 +55,6 @@ class modBlockedLog extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 2; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modBookmark.class.php b/htdocs/core/modules/modBookmark.class.php index 8924be16ba4..191e12bc2eb 100644 --- a/htdocs/core/modules/modBookmark.class.php +++ b/htdocs/core/modules/modBookmark.class.php @@ -52,7 +52,6 @@ class modBookmark extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; $this->picto='bookmark'; // Data directories to create when module is enabled @@ -98,10 +97,10 @@ class modBookmark extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'supprimer'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } } diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index 33b44297628..4be7a937d1a 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -55,7 +55,6 @@ class modCashDesk extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = 'list'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index b56d405c354..153dd9ae58b 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -54,7 +54,6 @@ class modCategorie extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = 'category'; // Data directories to create when module is enabled @@ -107,12 +106,12 @@ class modCategorie extends DolibarrModules $this->rights[$r][4] = 'supprimer'; $r++; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; @@ -308,7 +307,7 @@ class modCategorie extends DolibarrModules 's.url'=>"company", 's.email'=>"company" ); // We define here only fields that use another picto - + // Add extra fields $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; $resql=$this->db->query($sql); @@ -346,7 +345,7 @@ class modCategorie extends DolibarrModules } } // End add axtra fields - + $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; diff --git a/htdocs/core/modules/modClickToDial.class.php b/htdocs/core/modules/modClickToDial.class.php index c0983cc1a8b..4a5bcfc2f89 100644 --- a/htdocs/core/modules/modClickToDial.class.php +++ b/htdocs/core/modules/modClickToDial.class.php @@ -43,7 +43,7 @@ class modClickToDial extends DolibarrModules $this->db = $db; $this->numero = 58; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion du Click To Dial"; @@ -51,7 +51,6 @@ class modClickToDial extends DolibarrModules $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; $this->picto='phoning'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index 01a80d0b702..5349b000ac3 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -54,8 +54,6 @@ class modCollab extends DolibarrModules $this->version = 'development'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. $this->picto='globe'; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index e80833ae7c4..aecfb8bd090 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -59,7 +59,6 @@ class modCommande extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='order'; // Data directories to create when module is enabled @@ -104,7 +103,7 @@ class modCommande extends DolibarrModules $this->const[$r][2] = "__(Draft)__"; $this->const[$r][3] = 'Watermark to show on draft orders'; $this->const[$r][4] = 0;*/ - + // Boxes $this->boxes = array( 0=>array('file'=>'box_commandes.php','enabledbydefaulton'=>'Home'), @@ -177,12 +176,12 @@ class modCommande extends DolibarrModules $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'export'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index c07318fb36b..41349d214fc 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -57,7 +57,6 @@ class modComptabilite extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='accounting'; // Config pages @@ -94,12 +93,12 @@ class modComptabilite extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'resultat'; $this->rights[$r][5] = 'lire'; - - + + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 1b17b773c77..ac722cd04ef 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -55,7 +55,6 @@ class modContrat extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='contract'; // Data directories to create when module is enabled @@ -71,28 +70,28 @@ class modContrat extends DolibarrModules // Constants $this->const = array(); $r=0; - + $this->const[$r][0] = "CONTRACT_ADDON"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "mod_contract_serpis"; $this->const[$r][3] = 'Nom du gestionnaire de numerotation des contrats'; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "CONTRACT_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "strato"; $this->const[$r][3] = 'Name of PDF model of contract'; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "CONTRACT_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/contracts"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; - + // Boxes $this->boxes = array( 0=>array('file'=>'box_contracts.php','enabledbydefaulton'=>'Home'), @@ -103,7 +102,7 @@ class modContrat extends DolibarrModules $this->rights = array(); $this->rights_class = 'contrat'; $r=0; - + $r++; $this->rights[$r][0] = 161; $this->rights[$r][1] = 'Lire les contrats'; @@ -146,12 +145,12 @@ class modContrat extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $langs->load("contracts"); @@ -223,7 +222,7 @@ class modContrat extends DolibarrModules $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/contracts/template_contract.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/contracts'; $dest=$dirodt.'/template_contract.odt'; - + if (file_exists($src) && ! file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -236,12 +235,12 @@ class modContrat extends DolibarrModules return 0; } } - + $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[1][2])."' AND type = 'contract' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[1][2])."','contract',".$conf->entity.")" ); - + return $this->_init($sql,$options); } } diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 8afcc26c80f..b148149910f 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -54,8 +54,6 @@ class modCron extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 2; // Name of image file used for this module. $this->picto = 'technic'; diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index ec8d665b1e0..3baa7b74590 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -54,7 +54,6 @@ class modDeplacement extends DolibarrModules $this->version = 'dolibarr_deprecated'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = "trip"; // Data directories to create when module is enabled @@ -108,12 +107,12 @@ class modDeplacement extends DolibarrModules $this->rights[5][3] = 0; $this->rights[5][4] = 'export'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports $r=0; @@ -134,12 +133,12 @@ class modDeplacement extends DolibarrModules $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; - + if (! empty($user)) // Not defined during migration process { $childids = $user->getAllChildIds(); $childids[]=$user->id; - + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; } } diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index ec40c8b6dc5..211fb38feca 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -53,7 +53,6 @@ class modDocumentGeneration extends DolibarrModules $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='email'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 08564e241aa..dacfad736bf 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -52,7 +52,6 @@ class modDon extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. $this->picto='bill'; diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php index 21aa3644e3e..c7bc152ff64 100644 --- a/htdocs/core/modules/modDynamicPrices.class.php +++ b/htdocs/core/modules/modDynamicPrices.class.php @@ -49,8 +49,6 @@ class modDynamicPrices extends DolibarrModules $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index b263b16e29e..5b85ada7f70 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -57,8 +57,6 @@ class modECM extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (XXX is id value) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 0; // Name of png file (without png) used for this module $this->picto='dir'; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 94c86e6e3b1..6fab26d68f6 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -58,7 +58,6 @@ class modExpedition extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = "sending"; // Data directories to create when module is enabled @@ -222,8 +221,8 @@ class modExpedition extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 4d84c0a6d05..9cc16969748 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -51,7 +51,6 @@ class modExpenseReport extends DolibarrModules $this->description = "Manage and claim expense reports (transportation, meal, ...)"; $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='trip'; // Data directories to create when module is enabled. diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index 4f754711ea1..b88438f5fe1 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -51,7 +51,6 @@ class modExport extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = 'technic'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php index e3f4a538c4d..cf02888b9d2 100644 --- a/htdocs/core/modules/modExternalRss.class.php +++ b/htdocs/core/modules/modExternalRss.class.php @@ -52,7 +52,6 @@ class modExternalRss extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; $this->picto='rss'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php index 388bc340776..18bb0b000b2 100644 --- a/htdocs/core/modules/modExternalSite.class.php +++ b/htdocs/core/modules/modExternalSite.class.php @@ -49,7 +49,7 @@ class modExternalSite extends DolibarrModules // Family can be 'crm','financial','hr','projects','product','technic','other' // It is used to sort modules in module setup page - $this->family = "other"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) @@ -58,8 +58,6 @@ class modExternalSite extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (XXX is id value) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 1; // Name of png file (without png) used for this module $this->picto='bookmark'; // Call to inside lang's file diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php index 5e4785d4225..bdd745437e1 100644 --- a/htdocs/core/modules/modFTP.class.php +++ b/htdocs/core/modules/modFTP.class.php @@ -48,7 +48,7 @@ class modFTP extends DolibarrModules // Family can be 'crm','financial','hr','projects','product','ecm','technic','other' // It is used to sort modules in module setup page - $this->family = "other"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) @@ -57,8 +57,6 @@ class modFTP extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (XXX is id value) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of png file (without png) used for this module $this->picto='dir'; @@ -110,7 +108,7 @@ class modFTP extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'write'; - + // Menus //------- $this->menu[$r]=array('fk_menu'=>0, diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 04628560d74..9a23c0e5e9d 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -57,7 +57,6 @@ class modFacture extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = 'bill'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 54e1eadd735..812aa227ff6 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -52,7 +52,6 @@ class modFckeditor extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. $this->picto='list'; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 0d9f73b76e4..0ba8f1bc42d 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -58,7 +58,6 @@ class modFicheinter extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = "intervention"; // Data directories to create when module is enabled @@ -147,12 +146,12 @@ class modFicheinter extends DolibarrModules $this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'unvalidate'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + //Exports //-------- $r=1; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 74c0070c92e..6034af489e5 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -59,7 +59,6 @@ class modFournisseur extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='company'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modGeoIPMaxmind.class.php b/htdocs/core/modules/modGeoIPMaxmind.class.php index eeb1b482198..88bc8b7e8b9 100644 --- a/htdocs/core/modules/modGeoIPMaxmind.class.php +++ b/htdocs/core/modules/modGeoIPMaxmind.class.php @@ -44,7 +44,7 @@ class modGeoIPMaxmind extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -53,8 +53,6 @@ class modGeoIPMaxmind extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png' diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php index c8ef071cf7e..8f25ed2025a 100644 --- a/htdocs/core/modules/modGravatar.class.php +++ b/htdocs/core/modules/modGravatar.class.php @@ -48,7 +48,7 @@ class modGravatar extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -57,8 +57,6 @@ class modGravatar extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png' diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 3d1ea43f63c..033b6396fbe 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -31,41 +31,40 @@ class modHRM extends DolibarrModules * Constructor. * Define names, constants, directories, boxes, permissions * - * @param DoliDB $db + * @param DoliDB $db */ public function __construct($db) { global $langs, $conf; - + $this->db = $db; $this->numero = 4000; $this->rights_class = 'hrm'; - + $this->family = "hr"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace( '/^mod/i', '', get_class($this)); $this->description = "Management of employees carrier and feelings (department, employment contract)"; - + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; - + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' $this->picto='generic'; - + // define triggers $this->module_parts = array(); - + // Data directories to create when module is enabled $this->dirs = array(); - + // Config pages $this->config_page_url = array('admin_hrm.php@hrm'); - + // Dependencies $this->depends = array(); $this->requiredby = array(/*" @@ -76,14 +75,14 @@ class modHRM extends DolibarrModules $this->conflictwith = array(); $this->phpmin = array ( 5, - 3 + 3 ); // Minimum version of PHP required by module $this->need_dolibarr_version = array ( 3, - 9 + 9 ); // Minimum version of Dolibarr required by module $this->langfiles = array ( - "hrm" + "hrm" ); // Dictionnaries @@ -95,7 +94,7 @@ class modHRM extends DolibarrModules // Boxes $this->boxes = array (); - + // Permissions $this->rights = array(); // Permission array used by this module $r = 0; @@ -106,21 +105,21 @@ class modHRM extends DolibarrModules $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'read'; $r ++; - + $this->rights[$r][0] = 4002; $this->rights[$r][1] = 'Create employees'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'write'; $r ++; - + $this->rights[$r][0] = 4003; $this->rights[$r][1] = 'Delete employees'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'employee'; $this->rights[$r][5] = 'delete'; $r ++; - + $this->rights[$r][0] = 4004; $this->rights[$r][1] = 'Export employees'; $this->rights[$r][3] = 0; @@ -128,13 +127,13 @@ class modHRM extends DolibarrModules $this->rights[$r][5] = 'export'; $r ++; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } - + /** * Function called when module is enabled. * The init function add constants, boxes, permissions and menus diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index aef9eb9a7bb..3fd056b525e 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -62,8 +62,6 @@ class modHoliday extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 18696ef4b11..01d66644dc7 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -51,7 +51,6 @@ class modImport extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto = 'technic'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index 7b992fe0fde..7d4d1251f31 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -57,8 +57,6 @@ class modIncoterm extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; $this->picto='generic'; $this->module_parts = array(); diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php index 4f7cb8cacbb..2d91fd121bb 100644 --- a/htdocs/core/modules/modLabel.class.php +++ b/htdocs/core/modules/modLabel.class.php @@ -51,7 +51,6 @@ class modLabel extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; $this->picto='label'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php index 27174a7dda0..0f183bd6c76 100644 --- a/htdocs/core/modules/modLdap.class.php +++ b/htdocs/core/modules/modLdap.class.php @@ -42,15 +42,13 @@ class modLdap extends DolibarrModules $this->db = $db; $this->numero = 200; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Synchronisation Ldap"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png' diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index 7e445a3dbce..51779f6ffc5 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -54,7 +54,6 @@ class modLoan extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='bill'; // Data directories to create when module is enabled @@ -118,7 +117,7 @@ class modLoan extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'delete'; $this->rights[$r][5] = ''; - + $r++; $this->rights[$r][0] = 525; $this->rights[$r][1] = 'Access loan calculator'; @@ -135,12 +134,12 @@ class modLoan extends DolibarrModules $this->rights[$r][4] = 'export'; $this->rights[$r][5] = ''; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index 64966e2105c..46b31a08696 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -51,7 +51,6 @@ class modMailing extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='email'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php index 209dcba3d2b..9a019db7fea 100644 --- a/htdocs/core/modules/modMailmanSpip.class.php +++ b/htdocs/core/modules/modMailmanSpip.class.php @@ -43,7 +43,7 @@ class modMailmanSpip extends DolibarrModules $this->db = $db; $this->numero = 105; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Mailman or Spip interface for member module"; @@ -52,7 +52,6 @@ class modMailmanSpip extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; $this->picto='technic'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 0a7f1a73a67..53fba120656 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -57,8 +57,6 @@ class modMargin extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 2; // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. $this->picto='margin'; diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php index 606cdd7af22..2c7b917d6d2 100644 --- a/htdocs/core/modules/modModuleBuilder.class.php +++ b/htdocs/core/modules/modModuleBuilder.class.php @@ -51,8 +51,6 @@ class modModuleBuilder extends DolibarrModules $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 9d1be806de1..0dbfe3380cf 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -65,8 +65,6 @@ class modMultiCurrency extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index a4a56e1da0d..cc016d294b5 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -41,7 +41,7 @@ class modNotification extends DolibarrModules $this->db = $db; $this->numero = 600; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "EMail notifications (push) on business Dolibarr events"; @@ -49,7 +49,6 @@ class modNotification extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; $this->picto='email'; // Data directories to create when module is enabled. diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 0dce715a9f4..8b045608a6d 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -46,7 +46,7 @@ class modOauth extends DolibarrModules $this->numero = 66000; // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; $this->module_position = 510; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); @@ -55,8 +55,6 @@ class modOauth extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index ea10750ad7c..fcee9f585aa 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -61,8 +61,6 @@ class modOpenSurvey extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index 6cbdd5e2127..164c9b0753a 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -48,7 +48,7 @@ class modPayBox extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "other"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -57,8 +57,6 @@ class modPayBox extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png' diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php index 08f1c77e6d6..3ea0535bd4f 100644 --- a/htdocs/core/modules/modPaypal.class.php +++ b/htdocs/core/modules/modPaypal.class.php @@ -49,7 +49,7 @@ class modPaypal extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "other"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -58,8 +58,6 @@ class modPaypal extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png' diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index 542a02e7589..4d91c937d99 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -57,7 +57,6 @@ class modPrelevement extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; // Name of png file (without png) used for this module $this->picto='payment'; @@ -74,15 +73,15 @@ class modPrelevement extends DolibarrModules // Constants $this->const = array(); $r=0; - + $this->const[$r][0] = "BANK_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "sepamandate"; $this->const[$r][3] = 'Name of manager to generate SEPA mandate'; $this->const[$r][4] = 0; $r++; - - + + // Boxes $this->boxes = array(); @@ -129,11 +128,11 @@ class modPrelevement extends DolibarrModules $this->rights[2][4] = 'bons'; $this->rights[2][5] = 'configurer'; */ - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } @@ -155,7 +154,7 @@ class modPrelevement extends DolibarrModules $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", - ); + ); return $this->_init($sql,$options); } diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php index 89bf6115dae..9924e1861b4 100644 --- a/htdocs/core/modules/modPrinting.class.php +++ b/htdocs/core/modules/modPrinting.class.php @@ -46,7 +46,7 @@ class modPrinting extends DolibarrModules $this->numero = 64000; // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; $this->module_position = 520; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); @@ -54,8 +54,6 @@ class modPrinting extends DolibarrModules $this->description = "Enable Direct Printing System."; $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 427b2cd72e0..b2a0a6faf4f 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -59,7 +59,6 @@ class modProduct extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='product'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 9dbc8eb0212..91e8ddbae3c 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -47,7 +47,7 @@ class modProductBatch extends DolibarrModules $this->family = "products"; $this->module_position = 45; - + $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Batch number, eat-by and sell-by date management module"; @@ -56,7 +56,6 @@ class modProductBatch extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='stock'; @@ -95,12 +94,12 @@ class modProductBatch extends DolibarrModules $this->rights = array(); // Permission array used by this module $r=0; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports $r=0; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index edf5a1ab050..ab837803349 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -58,7 +58,6 @@ class modProjet extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->config_page_url = array("project.php@projet"); $this->picto='project'; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index a6b38f7d5ff..d4db0130492 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -58,7 +58,6 @@ class modPropale extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='propal'; // Data directories to create when module is enabled @@ -101,13 +100,13 @@ class modPropale extends DolibarrModules $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; - + /*$this->const[$r][0] = "PROPALE_DRAFT_WATERMARK"; $this->const[$r][2] = "__(Draft)__"; $this->const[$r][3] = 'Watermark to show on draft proposals'; $this->const[$r][4] = 0; $r++;*/ - + // Boxes $this->boxes = array( 0=>array('file'=>'box_graph_propales_permonth.php','enabledbydefaulton'=>'Home'), @@ -170,12 +169,12 @@ class modPropale extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'export'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 50c93f07220..02e156a7abf 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -46,7 +46,7 @@ class modReceiptPrinter extends DolibarrModules $this->numero = 67000; // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "technic"; + $this->family = "interface"; $this->module_position = 530; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); @@ -55,8 +55,6 @@ class modReceiptPrinter extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 148dbece597..a13410ddcf1 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -69,9 +69,6 @@ class modResource extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled // (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); - // Where to store the module in setup page - // (0=common,1=interface,2=others,3=very specific) - $this->special = 2; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png // use this->picto='pictovalue' diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index aecb9eeb49f..1e648c1386a 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -60,7 +60,6 @@ class modSalaries extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='bill'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 7a9a3f4df3f..20261e98ca6 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -57,7 +57,6 @@ class modService extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='service'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modSkype.class.php b/htdocs/core/modules/modSkype.class.php index 4c7d862cf66..d84520318a3 100644 --- a/htdocs/core/modules/modSkype.class.php +++ b/htdocs/core/modules/modSkype.class.php @@ -44,7 +44,7 @@ class modSkype extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "crm"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable Skype links into contacts"; @@ -52,8 +52,6 @@ class modSkype extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. $this->picto='skype'; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index c41c2d391cc..52e865cbdbc 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -58,7 +58,6 @@ class modSociete extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->config_page_url = array("societe.php@societe"); // Name of image file used for this module. $this->picto='company'; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c23a02eeac1..ccbf6f83f57 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -57,7 +57,6 @@ class modStock extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='stock'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 7e6b15dee74..46af17cee55 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -48,7 +48,7 @@ class modStripe extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page - $this->family = "other"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) @@ -57,8 +57,6 @@ class modStripe extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=other) - $this->special = 1; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png' diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 8869f0cd343..34584ea3ffa 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -56,7 +56,6 @@ class modSupplierProposal extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='supplier_proposal'; $this->dirs = array(); @@ -177,7 +176,7 @@ class modSupplierProposal extends DolibarrModules 'position'=>302 ); $r++; - + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=supplier_proposalsubmenu', 'type'=>'left', @@ -233,8 +232,8 @@ class modSupplierProposal extends DolibarrModules return $this->_init($sql, $options); } - - + + /** * Function called when module is disabled. @@ -249,8 +248,8 @@ class modSupplierProposal extends DolibarrModules $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."rights_def WHERE module = 'askpricesupplier'" ); - + return $this->_remove($sql, $options); - } - + } + } \ No newline at end of file diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 5f7ad0f387f..97c7b71ae21 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -57,8 +57,6 @@ class modSyslog extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 2; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php index 8dfc7283b90..f3fa7d4e9db 100644 --- a/htdocs/core/modules/modTax.class.php +++ b/htdocs/core/modules/modTax.class.php @@ -58,7 +58,6 @@ class modTax extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='bill'; // Data directories to create when module is enabled @@ -119,10 +118,10 @@ class modTax extends DolibarrModules // Menus //------- - + $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; @@ -140,7 +139,7 @@ class modTax extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid'; $this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id'; $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('tax').')'; - + // Import social contributions $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; @@ -151,14 +150,14 @@ class modTax extends DolibarrModules $this->import_fields_array[$r]=array('t.libelle'=>"Label*",'t.fk_type'=>"Type", 't.amount'=>"Amount*",'t.date_ech'=>"DateDue*",'t.periode'=>"PeriodEndDate*" ); - + $this->import_convertvalue_array[$r]=array( 't.fk_type'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/sociales/class/cchargesociales.class.php','class'=>'Cchargesociales','method'=>'fetch','element'=>'Cchargesociales') ); $this->import_examplevalues_array[$r]=array('t.libelle'=>"Social/fiscal contribution",'t.fk_type'=>"TAXPRO (must be id or code found into dictionary)", 't.date_ech'=>"2016-01-01", 't.periode'=>"2016-01-01" ); - + // Import Taxes $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; @@ -169,14 +168,14 @@ class modTax extends DolibarrModules $this->import_fields_array[$r]=array('t.datep'=>"DatePayment*",'t.datev'=>"DateValue*",'t.label'=>"Label*",'t.fk_typepayment'=>"PaymentMode*", 't.amount'=>"Amount*",'t.num_payment'=>'Numero' ); - + $this->import_convertvalue_array[$r]=array( 't.fk_typepayment'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/paiement/class/cpaiement.class.php','class'=>'Cpaiement','method'=>'fetch','element'=>'Cpaiement') ); $this->import_examplevalues_array[$r]=array('t.label'=>"VAT Payment 1st quarter 2016",'t.fk_typepayment'=>"CHQ (must be id or code found into dictionary)", 't.datep'=>"2016-04-02", 't.datev'=>"2016-03-31", 't.amount'=>1000, 't.num_payment'=>'123456' ); - + } diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index 95474ac8921..92323f853f6 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -55,7 +55,6 @@ class modUser extends DolibarrModules $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; $this->picto='group'; // Data directories to create when module is enabled diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 358a35b4435..87a2e2ce491 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -62,8 +62,6 @@ class modVariants extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php index ae979eb026e..8963f81813f 100644 --- a/htdocs/core/modules/modWebServices.class.php +++ b/htdocs/core/modules/modWebServices.class.php @@ -40,7 +40,7 @@ class modWebServices extends DolibarrModules $this->db = $db; $this->numero = 2600; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the Dolibarr web services server"; @@ -48,8 +48,6 @@ class modWebServices extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modWebServicesClient.class.php b/htdocs/core/modules/modWebServicesClient.class.php index 2dd0ee871c5..9b6535143b3 100644 --- a/htdocs/core/modules/modWebServicesClient.class.php +++ b/htdocs/core/modules/modWebServicesClient.class.php @@ -40,7 +40,7 @@ class modWebServicesClient extends DolibarrModules $this->db = $db; $this->numero = 2660; - $this->family = "technic"; + $this->family = "interface"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the web service client to call external supplier web services"; @@ -48,8 +48,6 @@ class modWebServicesClient extends DolibarrModules $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 1; // Name of image file used for this module. $this->picto='technic'; diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index d62576c5063..fb6e91283db 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -54,8 +54,6 @@ class modWebsite extends DolibarrModules $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. $this->picto='globe'; diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index 5c348cdf77f..e721513073a 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -56,8 +56,6 @@ class modWorkflow extends DolibarrModules $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 2; // Name of png file (without png) used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 1d8ba3dace6..eea2a85e656 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -53,7 +53,7 @@ class modMyModule extends DolibarrModules // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'mymodule'; - // Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other' + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // It is used to group modules by family in module setup page $this->family = "other"; // Module position in the family on 2 digits ('01', '10', '20', ...) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 61685ed8267..81450bd8a04 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -178,8 +178,6 @@ foreach ($modulesdir as $dir) $filename[$i]= $modName; $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module //print "x".$modName." ".$orders[$i]."\n
"; - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories - else $categ[$objMod->special]=1; $dirmod[$i] = $dirroot; $j++; $i++; From dd204947b8fff0c09ccaf3c0b82cc551a061da2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 11:00:50 +0100 Subject: [PATCH 43/50] CSS --- htdocs/public/demo/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 81450bd8a04..61919c54b1a 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -327,7 +327,7 @@ foreach ($demoprofiles as $profilearray) print '
'; } - print '
'."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -338,7 +338,7 @@ foreach ($demoprofiles as $profilearray) print ''."\n"; print ''."\n"; - print '
'."\n"; + print '
'."\n"; print '
'; From 2d252e85e6a1728f2edb456df781c9fab277acf4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 12:13:34 +0100 Subject: [PATCH 44/50] FIX Import process must stop after ending line nb to import --- htdocs/imports/import.php | 107 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 82ecad62417..abf3ec45c7c 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -225,7 +225,7 @@ if ($step == 3 && $datatoimport) $param='&datatoimport='.$datatoimport.'&format='.$format; if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline; if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb; - + $file = $conf->import->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $ret=dol_delete_file($file); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); @@ -429,9 +429,9 @@ if ($step == 2 && $datatoimport) print ''; print '

'; - + dol_fiche_end(); - + print ''; print ''; @@ -450,7 +450,7 @@ if ($step == 2 && $datatoimport) $liste=$objmodelimport->liste_modeles($db); foreach($liste as $key) { - + print ''; print ''.img_picto_common($key,$objmodelimport->getPictoForKey($key)).''; $text=$objmodelimport->getDriverDescForKey($key); @@ -495,7 +495,7 @@ if ($step == 3 && $datatoimport) print '
'; print '
'; - + print ''; // Module @@ -516,11 +516,11 @@ if ($step == 3 && $datatoimport) print '
'; print '
'; - + print '
'; - + print ''.$langs->trans("InformationOnSourceFile").''; - + print '
'; print '
'; print ''; @@ -537,15 +537,15 @@ if ($step == 3 && $datatoimport) print '
'; print '
'; - + dol_fiche_end(); print '
'; - + print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -553,7 +553,7 @@ if ($step == 3 && $datatoimport) print ''; print ''; print ''; - + print ''; $filetoimport=''; @@ -613,7 +613,7 @@ if ($step == 3 && $datatoimport) $modulepart='import'; $urlsource=$_SERVER["PHP_SELF"].'?step='.$step.$param.'&filetoimport='.urlencode($filetoimport); $relativepath=$file; - + print ''; print ''; print '
'.img_mime($file).''; @@ -665,9 +665,9 @@ if ($step == 4 && $datatoimport) header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath)); exit; } - + } - + if (GETPOST('update')) { $array_match_file_to_database=array(); } @@ -772,9 +772,9 @@ if ($step == 4 && $datatoimport) print '
'; print '
'; - + print '
'; - + print ''.$langs->trans("InformationOnSourceFile").''; print '
'; print '
'; @@ -820,9 +820,9 @@ if ($step == 4 && $datatoimport) print ''; print '
'; - + dol_fiche_end(); - + print '
'."\n"; @@ -873,7 +873,7 @@ if ($step == 4 && $datatoimport) $lefti=1; foreach ($array_match_file_to_database as $key => $val) { - + show_elem($fieldssource,$key,$val,$var); // key is field number in source file //print '> '.$lefti.'-'.$key.'-'.$val; $listofkeys[$key]=1; @@ -890,7 +890,7 @@ if ($step == 4 && $datatoimport) $num=count($fieldssource); while ($lefti <= $num) { - + $newkey=getnewkey($fieldssource,$listofkeys); show_elem($fieldssource,$newkey,'',$var); // key start after field number in source file //print '> '.$lefti.'-'.$newkey; @@ -913,7 +913,7 @@ if ($step == 4 && $datatoimport) print ''; foreach($fieldstarget as $code=>$label) { - + print ''; $i++; @@ -1148,7 +1148,7 @@ if ($step == 4 && $datatoimport) $var=false; while ($i < $num) { - + $obj = $db->fetch_object($resql); print '
'; print $obj->label; @@ -1213,16 +1213,16 @@ if ($step == 5 && $datatoimport) if ($excludefirstline) $param.='&excludefirstline='.$excludefirstline; if ($endatlinenb) $param.='&endatlinenb='.$endatlinenb; if (!empty($updatekeys)) $param.='&updatekeys[]='.implode('&updatekeys[]=', $updatekeys); - + llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); $head = import_prepare_head($param,5); - + print ''; print ''; // step 5 print ''; // step 5 - + dol_fiche_head($head, 'step5', $langs->trans("NewImport"), -1); print '
'; @@ -1248,9 +1248,9 @@ if ($step == 5 && $datatoimport) print '
'; print '
'; - + print '
'; - + print ''.$langs->trans("InformationOnSourceFile").''; print '
'; print '
'; @@ -1274,7 +1274,7 @@ if ($step == 5 && $datatoimport) print htmlentities($enclosure); print ''; } - + // File to import print ''.$langs->trans("FileToImport").''; print ''; @@ -1351,16 +1351,16 @@ if ($step == 5 && $datatoimport) print_r($objimport->array_import_updatekeys); echo '';*/ print ''; - + print ''; print '
'; - + print '
'; print ''.$langs->trans("InformationOnTargetTables").''; print '
'; print '
'; - + print ''; //print ''; @@ -1426,7 +1426,7 @@ if ($step == 5 && $datatoimport) print '
'.$langs->trans("InformationOnTargetTables").'
'; print '
'; - + dol_fiche_end(); @@ -1475,10 +1475,11 @@ if ($step == 5 && $datatoimport) $sourcelinenb=0; $endoffile=0; // Loop on each input file record - while ($sourcelinenb < $nboflines && ! $endoffile) + while (($sourcelinenb < $nboflines) && ! $endoffile) { $sourcelinenb++; // Read line and stor it into $arrayrecord + //dol_syslog("line ".$sourcelinenb.' - '.$nboflines.' - '.$excludefirstline.' - '.$endatlinenb); $arrayrecord=$obj->import_read_record(); if ($arrayrecord === false) { @@ -1487,11 +1488,11 @@ if ($step == 5 && $datatoimport) continue; } if ($excludefirstline && ($sourcelinenb < $excludefirstline)) continue; - if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue; - + if ($endatlinenb && ($sourcelinenb > $endatlinenb)) break; + // Run import $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys); - + if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; if (! count($obj->errors) && ! count($obj->warnings)) $nbok++; @@ -1505,7 +1506,7 @@ if ($step == 5 && $datatoimport) } $error=0; - + // Run the sql after import if defined //var_dump($objimport->array_import_run_sql_after[0]); if (! empty($objimport->array_import_run_sql_after[0]) && is_array($objimport->array_import_run_sql_after[0])) @@ -1515,14 +1516,14 @@ if ($step == 5 && $datatoimport) { $i++; $resqlafterimport=$db->query($sqlafterimport); - if (! $resqlafterimport) + if (! $resqlafterimport) { $arrayoferrors['none'][]=array('lib'=>$langs->trans("Error running final request: ".$sqlafterimport)); $error++; } } } - + $db->rollback(); // We force rollback because this was just a simulation. // Show OK @@ -1613,7 +1614,7 @@ if ($step == 5 && $datatoimport) print ''.$langs->trans("RunImportFile").''; } print ''; - + } print '
'; @@ -1690,9 +1691,9 @@ if ($step == 6 && $datatoimport) print ''; print ''; - + print '
'; - + print ''.$langs->trans("InformationOnSourceFile").'
'; print ''; //print ''; @@ -1714,7 +1715,7 @@ if ($step == 6 && $datatoimport) print htmlentities($enclosure); print ''; } - + // File to import print ''; print ''; - + print '
'.$langs->trans("InformationOnSourceFile").'
'.$langs->trans("FileToImport").''; @@ -1745,7 +1746,7 @@ if ($step == 6 && $datatoimport) print ''; print ''; print '
'; print '
'; @@ -1848,11 +1849,11 @@ if ($step == 6 && $datatoimport) continue; } if ($excludefirstline && ($sourcelinenb < $excludefirstline)) continue; - if ($endatlinenb && ($sourcelinenb > $endatlinenb)) continue; + if ($endatlinenb && ($sourcelinenb > $endatlinenb)) break; // Run import $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid,$updatekeys); - + if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; if (! count($obj->errors) && ! count($obj->warnings)) $nbok++; @@ -1866,10 +1867,10 @@ if ($step == 6 && $datatoimport) } if (count($arrayoferrors) > 0) $db->rollback(); // We force rollback because this was errors. - else + else { $error=0; - + // Run the sql after import if defined //var_dump($objimport->array_import_run_sql_after[0]); if (! empty($objimport->array_import_run_sql_after[0]) && is_array($objimport->array_import_run_sql_after[0])) @@ -1879,18 +1880,18 @@ if ($step == 6 && $datatoimport) { $i++; $resqlafterimport=$db->query($sqlafterimport); - if (! $resqlafterimport) + if (! $resqlafterimport) { $arrayoferrors['none'][]=array('lib'=>$langs->trans("Error running final request: ".$sqlafterimport)); $error++; } } } - + if (! $error) $db->commit(); // We can commit if no errors. else $db->rollback(); } - + dol_fiche_end(); @@ -1930,7 +1931,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') global $langs,$bc; $height='24'; - + print "\n\n\n"; print '
'."\n"; From 7b448a2d18b0e2b78b614642cc979aa59842ad28 Mon Sep 17 00:00:00 2001 From: Rui Strecht Date: Thu, 22 Feb 2018 12:22:31 +0000 Subject: [PATCH 45/50] Fixed issue with elementarray null if num_rows = 0 --- htdocs/projet/class/project.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e24a444702c..d9eeee14d89 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -583,10 +583,10 @@ class Project extends CommonObject $i++; } $this->db->free($result); - - /* Return array */ - return $elements; } + + /* Return array even if empty*/ + return $elements; } else { From 4581d6049cb17b641bbd29eedd98ee76e6e40d8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 12:52:39 +0100 Subject: [PATCH 46/50] Update societecontact.php --- htdocs/societe/societecontact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index bac674b4e2b..67a44d87ccf 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -223,7 +223,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE d.fk_soc = ".$id; - $sql.= " AND fk_adherent_type = t.rowid"; + $sql.= " AND d.fk_adherent_type = t.rowid"; dol_syslog("get list sql=".$sql); $resql = $db->query($sql); From 0a571a0677a90560d2e175e03660a861beb0fb5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 12:58:17 +0100 Subject: [PATCH 47/50] Complete fix #8230 --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index fa06a7e7d05..ed8e58e1c12 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -407,7 +407,7 @@ foreach($object->fields as $key => $val) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters=array('arrayfields'=>$arrayfields); +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; From 1f60d9ba81534d799349a87d8b37e0ba1b5d1899 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 13:14:55 +0100 Subject: [PATCH 48/50] Fix travis --- htdocs/core/modules/modHRM.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 033b6396fbe..a209fdccf2e 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -31,7 +31,7 @@ class modHRM extends DolibarrModules * Constructor. * Define names, constants, directories, boxes, permissions * - * @param DoliDB $db + * @param DoliDB $db Database handler */ public function __construct($db) { From 2cd5ed65a658dec9cc94d2bb900a944554db09a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 14:13:09 +0100 Subject: [PATCH 49/50] Clean deprecated (field unit_charge in supplier price) --- htdocs/core/class/html.formmargin.class.php | 4 +--- .../fourn/class/fournisseur.product.class.php | 24 ++++++------------- .../install/mysql/migration/7.0.0-8.0.0.sql | 2 ++ .../tables/llx_product_fournisseur_price.sql | 5 ++-- htdocs/product/composition/card.php | 2 +- htdocs/product/fournisseurs.php | 17 ------------- htdocs/product/list.php | 2 +- 7 files changed, 14 insertions(+), 42 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 5f78fa0e283..cf1b7064a01 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -85,8 +85,6 @@ class FormMargin $product = new ProductFournisseur($db); if ($product->fetch_product_fournisseur_price($line->fk_fournprice)) $line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100); - if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) - $line->pa_ht += $product->fourn_unitcharges; } // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) { @@ -96,7 +94,7 @@ class FormMargin $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign $pa = $line->qty * $pa_ht; - + // calcul des marges if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 74da470c04c..c8c24afc942 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -64,10 +64,6 @@ class ProductFournisseur extends Product var $fourn_unitprice; var $fourn_tva_tx; var $fourn_tva_npr; - /** - * @deprecated - */ - var $fourn_unitcharges; // old version used a buggy system to calculate margin of a charge field on supplier price. Now margin is on pmp, best supplier price or cost price. var $fk_supplier_price_expression; var $supplier_reputation; // reputation of supplier @@ -215,7 +211,6 @@ class ProductFournisseur extends Product $error=0; $unitBuyPrice = price2num($buyprice/$qty,'MU'); - $unitCharges = price2num($charges/$qty,'MU'); $now=dol_now(); @@ -250,7 +245,6 @@ class ProductFournisseur extends Product $sql.= " remise_percent = ".$remise_percent.","; $sql.= " remise = ".$remise.","; $sql.= " unitprice = ".$unitBuyPrice.","; - $sql.= " unitcharges = ".$unitCharges.","; // deprecated $sql.= " fk_availability = ".$availability.","; $sql.= " entity = ".$conf->entity.","; $sql.= " tva_tx = ".price2num($tva_tx).","; @@ -306,7 +300,7 @@ class ProductFournisseur extends Product if ($resql) { // Add price for this quantity to supplier $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price("; - $sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation)"; + $sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation)"; $sql .= " values('" . $this->db->idate($now) . "',"; $sql .= " " . $this->id . ","; $sql .= " " . $fourn->id . ","; @@ -319,7 +313,6 @@ class ProductFournisseur extends Product $sql .= " " . $unitBuyPrice . ","; $sql .= " " . $tva_tx . ","; $sql .= " " . $charges . ","; - $sql .= " " . $unitCharges . ","; $sql .= " " . $availability . ","; $sql .= " ".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").","; $sql .= " " . $newnpr . ","; @@ -393,7 +386,7 @@ class ProductFournisseur extends Product { global $conf; $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.fk_availability,"; - $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price + $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price $sql.= " pfp.supplier_reputation"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$rowid; @@ -418,7 +411,6 @@ class ProductFournisseur extends Product $this->fourn_remise_percent = $obj->remise_percent; $this->fourn_remise = $obj->remise; $this->fourn_unitprice = $obj->unitprice; - $this->fourn_unitcharges = $obj->unitcharges; // deprecated $this->fourn_tva_tx = $obj->tva_tx; // TODO // $this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ? @@ -478,7 +470,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE pfp.entity IN (".getEntity('productprice').")"; @@ -510,7 +502,6 @@ class ProductFournisseur extends Product $prodfourn->fourn_remise = $record["remise"]; $prodfourn->fourn_unitprice = $record["unitprice"]; $prodfourn->fourn_charges = $record["charges"]; // deprecated - $prodfourn->fourn_unitcharges = $record["unitcharges"]; // deprecated $prodfourn->fourn_tva_tx = $record["tva_tx"]; $prodfourn->fourn_id = $record["fourn_id"]; $prodfourn->fourn_name = $record["supplier_name"]; @@ -588,7 +579,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges, "; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges,"; $sql.= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE s.entity IN (".getEntity('societe').")"; @@ -623,7 +614,7 @@ class ProductFournisseur extends Product { $fourn_price = $record["price"]; // discount calculated buy price - $fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"]; + $fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) - $record["remise"]; if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) { $prod_supplier = new ProductFournisseur($this->db); $prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"]; @@ -657,7 +648,6 @@ class ProductFournisseur extends Product $this->fourn_remise = $record["remise"]; $this->fourn_unitprice = $record["unitprice"]; $this->fourn_charges = $record["charges"]; // deprecated - $this->fourn_unitcharges = $record["unitcharges"]; // deprecated $this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_id = $record["fourn_id"]; $this->fourn_name = $record["supplier_name"]; @@ -755,14 +745,14 @@ class ProductFournisseur extends Product $out .= ''.$langs->trans("Supplier").''; $out .= ''.$langs->trans("SupplierRef").''; foreach ($productFournList as $productFourn) { - $out.= ''.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) + $productFourn->fourn_unitcharges - $productFourn->fourn_remise):'').''; + $out.= ''.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) - $productFourn->fourn_remise):'').''; $out.= ''.($showunitprice?$productFourn->fourn_qty:'').''; $out.= ''.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).''; $out.= ''.$productFourn->fourn_ref.''; } $out .= ''; } else { - $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); } return $out; } diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 6488a7dafde..79148c6887d 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -29,6 +29,8 @@ -- For 8.0 +ALTER TABLE llx_product_fournisseur_price DROP COLUMN unitcharges; + ALTER TABLE llx_societe ADD COLUMN fk_entrepot integer DEFAULT 0; ALTER TABLE llx_projet ADD COLUMN bill_time integer DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 1c86bfe04f8..14664225a9d 100755 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -29,13 +29,12 @@ create table llx_product_fournisseur_price fk_soc integer, ref_fourn varchar(30), fk_availability integer, - price double(24,8) DEFAULT 0, + price double(24,8) DEFAULT 0, -- price without tax for quantity quantity double, remise_percent double NOT NULL DEFAULT 0, remise double NOT NULL DEFAULT 0, - unitprice double(24,8) DEFAULT 0, + unitprice double(24,8) DEFAULT 0, -- unit price without tax charges double(24,8) DEFAULT 0, -- to store transport cost. Constant PRODUCT_CHARGES must be set to see it. - unitcharges double(24,8) DEFAULT 0, -- deprecated default_vat_code varchar(10), tva_tx double(6,3) NOT NULL, localtax1_tx double(6,3) DEFAULT 0, diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index a6cc3427243..79120aa1191 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -370,7 +370,7 @@ if ($id > 0 || ! empty($ref)) } print ''; - $totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise), 'MT'); + $totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise), 'MT'); $total+=$totalline; print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 5219291e8af..4f266611940 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -638,11 +638,6 @@ if ($id > 0 || $ref) print_liste_field_titre("DiscountQtyMin",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("NbDaysToDelivery",$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("ReputationForThisProduct",$_SERVER["PHP_SELF"],"pfp.supplier_reputation","",$param,'align="center"',$sortfield,$sortorder); - // Charges ???? - if ($conf->global->PRODUCT_CHARGES) - { - if (! empty($conf->margin->enabled)) print_liste_field_titre("UnitCharges"); - } print_liste_field_titre(''); print "\n"; @@ -708,18 +703,6 @@ if ($id > 0 || $ref) } print''; - // Charges ???? - /* - if ($conf->global->PRODUCT_CHARGES) - { - if (! empty($conf->margin->enabled)) - { - print ''; - print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):" "); - print ''; - } - }*/ - if (is_object($hookmanager)) { $parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$object->id); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ebb2c0a421a..59b76ecab69 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -793,7 +793,7 @@ else if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) { $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); - print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); + print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); } else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); } From 251136bebf0cf02b216daa69463384b0c05b7b0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Feb 2018 15:00:14 +0100 Subject: [PATCH 50/50] Fix PHPUnit --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 589a184030e..ea06bd61dbd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3846,6 +3846,7 @@ class Facture extends CommonInvoice // Initialize parameters $this->id=0; + $this->entity = 1; $this->ref = 'SPECIMEN'; $this->specimen=1; $this->socid = 1;