From 3215e066e49b74e71a51ab2f4b1ecd2477396f09 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 11 Mar 2019 10:00:44 +0100 Subject: [PATCH 01/39] copy linked categories when cloning a product --- htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/card.php | 14 ++++++++++++++ htdocs/product/class/product.class.php | 26 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 401ccc5462e..9c96f12c589 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -147,6 +147,7 @@ RowMaterial=Raw Material CloneProduct=Clone product or service ConfirmCloneProduct=Are you sure you want to clone product or service %s? CloneContentProduct=Clone all main information of product/service +CloneCategoriesProduct=Clone tags/categories linked ClonePricesProduct=Clone prices CloneCompositionProduct=Clone virtual product/service CloneCombinationsProduct=Clone product variants diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 77ad53a3eff..2339a0c921f 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -146,6 +146,7 @@ RowMaterial=Matière première CloneProduct=Cloner produit/service ConfirmCloneProduct=Êtes-vous sûr de vouloir cloner le produit ou service %s ? CloneContentProduct=Cloner les informations générales du produit/service +CloneCategoriesProduct=Cloner les catégories associées ClonePricesProduct=Cloner les prix CloneCompositionProduct=Cloner le produits packagés CloneCombinationsProduct=Cloner les variantes diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 18ea87cb03a..e433b9a6558 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -520,6 +520,19 @@ if (empty($reshook)) } } + if (GETPOST('clone_categories')) + { + $result = $object->clone_categories($originalId, $id); + + if ($result < 1) + { + $db->rollback(); + setEventMessage($langs->trans('ErrorProductClone'), null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId); + exit; + } + } + // $object->clone_fournisseurs($originalId, $id); $db->commit(); @@ -1982,6 +1995,7 @@ $formquestionclone=array( 'text' => $langs->trans("ConfirmClone"), array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), + array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true), ); if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 51a5d7c72d0..3466625dfe5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3611,6 +3611,32 @@ class Product extends CommonObject return 1; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * copy related categories to another product + * + * @param int $fromId Id produit source + * @param int $toId Id produit cible + * @return int < 0 si erreur, > 0 si ok + */ + function clone_categories($fromId, $toId) + { + $this->db->begin(); + + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'categorie_product (fk_categorie, fk_product)'; + $sql.= " SELECT fk_categorie, $toId FROM ".MAIN_DB_PREFIX."categorie_product"; + $sql.= " WHERE fk_product = '".$fromId."'"; + + if (! $this->db->query($sql)) + { + $this->db->rollback(); + return -1; + } + + $this->db->commit(); + return 1; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre From 08d517c053ebb4f8bd87d6edd3301505ce745c17 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 11 Mar 2019 10:35:27 +0100 Subject: [PATCH 02/39] custom content was deleted --- htdocs/custom/.gitignore | 4 ++++ htdocs/custom/README.md | 22 ++++++++++++++++++++++ htdocs/custom/index.html | 0 3 files changed, 26 insertions(+) create mode 100644 htdocs/custom/.gitignore create mode 100644 htdocs/custom/README.md create mode 100644 htdocs/custom/index.html diff --git a/htdocs/custom/.gitignore b/htdocs/custom/.gitignore new file mode 100644 index 00000000000..9420e8c61eb --- /dev/null +++ b/htdocs/custom/.gitignore @@ -0,0 +1,4 @@ +/* +!.gitignore +!README.md +!index.html diff --git a/htdocs/custom/README.md b/htdocs/custom/README.md new file mode 100644 index 00000000000..3a486e5a4a8 --- /dev/null +++ b/htdocs/custom/README.md @@ -0,0 +1,22 @@ +# DOLIBARR ERP & CRM custom directory for external modules. + +This directory is dedicated to store external modules. +To use it, just copy here the directory of the module into this directory. + +Note: On linux or MAC systems, it is better to unzip/store the external module directory into +a different place than this directory and just adding a symbolic link here to the htdocs directory +of the module. + +For example on Linux OS: Get the module from the command +mkdir ~/git; cd ~/git +git clone https://git.framasoft.org/p/newmodule/newmodule.git +Then create the symbolic link +ln -fs ~/git/newmodule/htdocs /path_to_dolibarr/htdocs/custom/newmodule + +WARNING !!! +Check also that the /custom directory is active by adding into dolibarr conf/conf.php file the following +two lines, so dolibarr will also scan /custom directory to find external external modules: + +$dolibarr_main_url_root_alt='/custom'; +$dolibarr_main_document_root_alt='/path_to_dolibarr/htdocs/custom/'; + diff --git a/htdocs/custom/index.html b/htdocs/custom/index.html new file mode 100644 index 00000000000..e69de29bb2d From 7bc0260661a138193afa4a442a22dfdef51dc029 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 18 Mar 2019 14:15:55 +0100 Subject: [PATCH 03/39] begin factorization of categories cloning --- htdocs/langs/en_US/categories.lang | 1 + htdocs/langs/fr_FR/categories.lang | 1 + htdocs/product/card.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index eb34e302cad..dd446249ebe 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -88,3 +88,4 @@ AddProductServiceIntoCategory=Add the following product/service ShowCategory=Show tag/category ByDefaultInList=By default in list ChooseCategory=Choose category +CloneCategoriesProduct=Clone tags/categories linked diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index b65024a5217..9d58f0ff40d 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -88,3 +88,4 @@ AddProductServiceIntoCategory=Ajouter le produit/service suivant ShowCategory=Afficher tag/catégorie ByDefaultInList=Par défaut dans la liste ChooseCategory=Choisissez une catégorie +CloneCategories=Cloner les catégories associées diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e433b9a6558..9becc71bbb8 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1995,7 +1995,7 @@ $formquestionclone=array( 'text' => $langs->trans("ConfirmClone"), array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), + array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategories"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true), ); if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) From 61f9aac887f9755531884043abe5a11e091e51d3 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 18 Mar 2019 14:16:41 +0100 Subject: [PATCH 04/39] begin factorization of categories cloning --- htdocs/langs/en_US/products.lang | 1 - htdocs/langs/fr_FR/products.lang | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9c96f12c589..401ccc5462e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -147,7 +147,6 @@ RowMaterial=Raw Material CloneProduct=Clone product or service ConfirmCloneProduct=Are you sure you want to clone product or service %s? CloneContentProduct=Clone all main information of product/service -CloneCategoriesProduct=Clone tags/categories linked ClonePricesProduct=Clone prices CloneCompositionProduct=Clone virtual product/service CloneCombinationsProduct=Clone product variants diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 2339a0c921f..77ad53a3eff 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -146,7 +146,6 @@ RowMaterial=Matière première CloneProduct=Cloner produit/service ConfirmCloneProduct=Êtes-vous sûr de vouloir cloner le produit ou service %s ? CloneContentProduct=Cloner les informations générales du produit/service -CloneCategoriesProduct=Cloner les catégories associées ClonePricesProduct=Cloner les prix CloneCompositionProduct=Cloner le produits packagés CloneCombinationsProduct=Cloner les variantes From f167ad910e280172e2384b771593f999424d02db Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Apr 2019 11:30:51 +0200 Subject: [PATCH 05/39] camelCase and generic cloneCategories function --- htdocs/core/class/commonobject.class.php | 31 ++++++++++++++++++++++++ htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/card.php | 4 +-- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e962e59264c..ccf255af4d7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7517,4 +7517,35 @@ abstract class CommonObject } } } + + /** + * copy related categories to another object + * + * @param int $fromId Id object source + * @param int $toId Id object cible + * @param string $type Type of category ('product', ...) + * @return int < 0 si erreur, > 0 si ok + */ + function cloneCategories($fromId, $toId, $type='') + { + $this->db->begin(); + + if (empty($type)) $type = $this->table_element; + + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $categorystatic = new Categorie($this->db); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_" . $categorystatic->MAP_CAT_TABLE[$type] . " (fk_categorie, fk_product)"; + $sql.= " SELECT fk_categorie, $toId FROM ".MAIN_DB_PREFIX."categorie_" . $categorystatic->MAP_CAT_TABLE[$type]; + $sql.= " WHERE fk_product = '".$fromId."'"; + + if (! $this->db->query($sql)) + { + $this->db->rollback();die($sql); + return -1; + } + + $this->db->commit(); + return 1; + } } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 401ccc5462e..62c22548f36 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -148,6 +148,7 @@ CloneProduct=Clone product or service ConfirmCloneProduct=Are you sure you want to clone product or service %s? CloneContentProduct=Clone all main information of product/service ClonePricesProduct=Clone prices +CloneCategoriesProduct=Clone tags/categories linked CloneCompositionProduct=Clone virtual product/service CloneCombinationsProduct=Clone product variants ProductIsUsed=This product is used diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 77ad53a3eff..be288c604af 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -147,6 +147,7 @@ CloneProduct=Cloner produit/service ConfirmCloneProduct=Êtes-vous sûr de vouloir cloner le produit ou service %s ? CloneContentProduct=Cloner les informations générales du produit/service ClonePricesProduct=Cloner les prix +CloneCategoriesProduct=Cloner les catégories associées CloneCompositionProduct=Cloner le produits packagés CloneCombinationsProduct=Cloner les variantes ProductIsUsed=Ce produit est utilisé diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 9becc71bbb8..5354fcde70f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -522,7 +522,7 @@ if (empty($reshook)) if (GETPOST('clone_categories')) { - $result = $object->clone_categories($originalId, $id); + $result = $object->cloneCategories($originalId, $id); if ($result < 1) { @@ -1995,7 +1995,7 @@ $formquestionclone=array( 'text' => $langs->trans("ConfirmClone"), array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategories"), 'value' => 1), + array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true), ); if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) From d0fcece6130dcfb99504a5a824c8414879d23055 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Apr 2019 11:34:23 +0200 Subject: [PATCH 06/39] dont make generic translations --- htdocs/langs/en_US/categories.lang | 1 - htdocs/langs/fr_FR/categories.lang | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index dd446249ebe..eb34e302cad 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -88,4 +88,3 @@ AddProductServiceIntoCategory=Add the following product/service ShowCategory=Show tag/category ByDefaultInList=By default in list ChooseCategory=Choose category -CloneCategoriesProduct=Clone tags/categories linked diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 9d58f0ff40d..b65024a5217 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -88,4 +88,3 @@ AddProductServiceIntoCategory=Ajouter le produit/service suivant ShowCategory=Afficher tag/catégorie ByDefaultInList=Par défaut dans la liste ChooseCategory=Choisissez une catégorie -CloneCategories=Cloner les catégories associées From 45b3a0588f6b02b6bffdfcc2cdc5856d243a3281 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Apr 2019 11:40:57 +0200 Subject: [PATCH 07/39] remove old dev --- htdocs/product/class/product.class.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3466625dfe5..0087be5eab5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3612,31 +3612,6 @@ class Product extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * copy related categories to another product - * - * @param int $fromId Id produit source - * @param int $toId Id produit cible - * @return int < 0 si erreur, > 0 si ok - */ - function clone_categories($fromId, $toId) - { - $this->db->begin(); - - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'categorie_product (fk_categorie, fk_product)'; - $sql.= " SELECT fk_categorie, $toId FROM ".MAIN_DB_PREFIX."categorie_product"; - $sql.= " WHERE fk_product = '".$fromId."'"; - - if (! $this->db->query($sql)) - { - $this->db->rollback(); - return -1; - } - - $this->db->commit(); - return 1; - } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre From 8e2ef8e56cf807e56e3ef949142dfd7c95e25af5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 5 Apr 2019 11:42:12 +0200 Subject: [PATCH 08/39] remove old dev --- htdocs/product/class/product.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0087be5eab5..51a5d7c72d0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3611,7 +3611,6 @@ class Product extends CommonObject return 1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre From b70587c150a4a6cfa9a3438cb80736b6a958216a Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 4 Sep 2019 15:14:16 +0200 Subject: [PATCH 09/39] NEW check if a resource is in use in an event --- htdocs/admin/resource.php | 9 ++ htdocs/comm/action/card.php | 58 ++++++++++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/resource.lang | 3 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/resource.lang | 3 + htdocs/resource/element_resource.php | 132 +++++++++++++++++++++++++-- 7 files changed, 199 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index a5a0b5fbf3f..3dfd8e1e2c2 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -127,6 +127,15 @@ print ''; print ''; print ''; + +print ''; +print ''.$langs->trans('EnableResourceUsedInEventCheck').''; +print ''; +echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK'); +print ''; +print ''; +print ''; + print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index af54186e255..f7111ccf545 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -512,6 +512,64 @@ if ($action == 'update') $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) $error++; + if (!$error) { + // check if an event resource is already in use + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element == 'action') { + $eventDateStart = $object->datep; + $eventDateEnd = $object->datef; + + $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; + $sql .= " WHERE ac.id != " . $object->id; + $sql .= " AND er.resource_id IN ("; + $sql .= " SELECT resource_id FROM " . MAIN_DB_PREFIX . "element_resources as er"; + $sql .= " WHERE er.element_id = " . $object->id; + $sql .= " AND er.element_type = '" . $db->escape($object->element) . "'"; + $sql .= ")"; + $sql .= " AND er.busy = 1"; + $sql .= " AND ("; + + // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) + $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; + // event date end between ac.datep and ac.datep2 + if (!empty($eventDateEnd)) { + $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; + } + // event date start before ac.datep and event date end after ac.datep2 + $sql .= " OR ("; + $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; + if (!empty($eventDateEnd)) { + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; + } + $sql .= ")"; + + $sql .= ")"; + $resql = $db->query($sql); + if (!$resql) { + $error++; + $object->error = $db->lasterror(); + $object->errors[] = $object->error; + } else { + if ($db->num_rows($resql) > 0) { + // already in use + $error++; + $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; + while ($obj = $db->fetch_object($resql)) { + $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + } + $object->errors[] = $object->error; + } + $db->free($resql); + } + + if ($error) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + if (! $error) { $db->begin(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f59f4449b8e..e06eafd81be 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1900,6 +1900,7 @@ ResourceSetup=Configuration of Resource module UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). DisabledResourceLinkUser=Disable feature to link a resource to users DisabledResourceLinkContact=Disable feature to link a resource to contacts +EnableResourceUsedInEventCheck=Enable feature to check if a resource is in use in an event ConfirmUnactivation=Confirm module reset OnMobileOnly=On small screen (smartphone) only DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both) diff --git a/htdocs/langs/en_US/resource.lang b/htdocs/langs/en_US/resource.lang index 33a5046e006..134cc4c87a3 100644 --- a/htdocs/langs/en_US/resource.lang +++ b/htdocs/langs/en_US/resource.lang @@ -34,3 +34,6 @@ IdResource=Id resource AssetNumber=Serial number ResourceTypeCode=Resource type code ImportDataset_resource_1=Resources + +ErrorResourcesAlreadyInUse=Some resources are in use +ErrorResourceUseInEvent=%s use in %s event \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7407396835b..be8e67e3359 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1896,6 +1896,7 @@ ResourceSetup=Configuration du module Ressource UseSearchToSelectResource=Utilisez un champ avec auto-complétion pour choisir les ressources (plutôt qu'une liste déroulante). DisabledResourceLinkUser=Désactiver la fonctionnalité pour lier une ressource aux utilisateurs DisabledResourceLinkContact=Désactiver la fonctionnalité pour lier une ressource aux contacts/adresses +EnableResourceUsedInEventCheck=Activer la fonctionnalité de vérification d'une ressource déjà réservée lors d'un évènement ConfirmUnactivation=Confirmer réinitialisation du module OnMobileOnly=Sur petit écran (smartphone) uniquement DisableProspectCustomerType=Désactiver le type de tiers "Prospect + Client" (le tiers doit donc être un client potentiel ou un client, mais ne peut pas être les deux) diff --git a/htdocs/langs/fr_FR/resource.lang b/htdocs/langs/fr_FR/resource.lang index be7547b36da..5db22aedcbd 100644 --- a/htdocs/langs/fr_FR/resource.lang +++ b/htdocs/langs/fr_FR/resource.lang @@ -34,3 +34,6 @@ IdResource=id ressource AssetNumber=Numéro de série ResourceTypeCode=Code de type de ressource ImportDataset_resource_1=Ressources + +ErrorResourcesAlreadyInUse=Des ressources sont déjà occupées +ErrorResourceUseInEvent=%s occupée dans l'événement %s \ No newline at end of file diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 02565a23dd0..e55399f2da4 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -87,6 +87,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { + $error = 0; + if ($action == 'add_element_resource' && ! $cancel) { $res = 0; @@ -100,8 +102,68 @@ if (empty($reshook)) { $objstat = fetchObjectByElement($element_id, $element, $element_ref); $objstat->element = $element; // For externals module, we need to keep @xx - $res = $objstat->add_element_resource($resource_id, $resource_type, $busy, $mandatory); + + // TODO : add this check at update_linked_resource and when modifying event start or end date + // check if an event resource is already in use + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element=='action' && $resource_type=='dolresource' && intval($busy)==1) { + $eventDateStart = $objstat->datep; + $eventDateEnd = $objstat->datef; + $isFullDayEvent = intval($objstat->fulldayevent); + if (empty($eventDateEnd)) { + if ($isFullDayEvent) { + $eventDateStartArr = dol_getdate($eventDateStart); + $eventDateStart = dol_mktime(0, 0, 0, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + $eventDateEnd = dol_mktime(23, 59, 59, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + } + } + + $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($objstat->element) . "'"; + $sql .= " WHERE er.resource_id = " . $resource_id; + $sql .= " AND er.busy = 1"; + $sql .= " AND ("; + + // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) + $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; + // event date end between ac.datep and ac.datep2 + if (!empty($eventDateEnd)) { + $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; + } + // event date start before ac.datep and event date end after ac.datep2 + $sql .= " OR ("; + $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; + if (!empty($eventDateEnd)) { + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; + } + $sql .= ")"; + + $sql .= ")"; + $resql = $db->query($sql); + if (!$resql) { + $error++; + $objstat->error = $db->lasterror(); + $objstat->errors[] = $objstat->error; + } else { + if ($db->num_rows($resql)>0) { + // already in use + $error++; + $objstat->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; + while ($obj = $db->fetch_object($resql)) { + $objstat->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + } + $objstat->errors[] = $objstat->error; + } + $db->free($resql); + } + } + + if (!$error) { + $res = $objstat->add_element_resource($resource_id, $resource_type, $busy, $mandatory); + } } + if (! $error && $res > 0) { setEventMessages($langs->trans('ResourceLinkedWithSuccess'), null, 'mesgs'); @@ -123,18 +185,72 @@ if (empty($reshook)) $object->busy = $busy; $object->mandatory = $mandatory; - $result = $object->update_element_resource($user); + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type=='action' && $object->resource_type=='dolresource' && intval($object->busy)==1) { + $eventDateStart = $object->objelement->datep; + $eventDateEnd = $object->objelement->datef; + $isFullDayEvent = intval($objstat->fulldayevent); + if (empty($eventDateEnd)) { + if ($isFullDayEvent) { + $eventDateStartArr = dol_getdate($eventDateStart); + $eventDateStart = dol_mktime(0, 0, 0, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + $eventDateEnd = dol_mktime(23, 59, 59, $eventDateStartArr['mon'], $eventDateStartArr['mday'], $eventDateStartArr['year']); + } + } - if ($result >= 0) - { + $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($object->resource_type) . "'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element_type) . "'"; + $sql .= " WHERE er.resource_id = " . $object->resource_id; + $sql .= " AND er.busy = 1"; + $sql .= " AND ("; + + // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) + $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; + // event date end between ac.datep and ac.datep2 + if (!empty($eventDateEnd)) { + $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; + } + // event date start before ac.datep and event date end after ac.datep2 + $sql .= " OR ("; + $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; + if (!empty($eventDateEnd)) { + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; + } + $sql .= ")"; + + $sql .= ")"; + $resql = $db->query($sql); + if (!$resql) { + $error++; + $object->error = $db->lasterror(); + $object->errors[] = $object->error; + } else { + if ($db->num_rows($resql)>0) { + // already in use + $error++; + $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; + while ($obj = $db->fetch_object($resql)) { + $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + } + $object->errors[] = $objstat->error; + } + $db->free($resql); + } + } + + if (!$error) { + $result = $object->update_element_resource($user); + if ($result < 0) $error++; + } + + if ($error) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { setEventMessages($langs->trans('RessourceLineSuccessfullyUpdated'), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id); exit; } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } } } From 4ef7e755ad56dc76eb2319f3a87a8fe819f20055 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 5 Sep 2019 09:29:40 +0200 Subject: [PATCH 10/39] FIX only check on busy resources before updating an event --- htdocs/comm/action/card.php | 7 ++++--- htdocs/resource/element_resource.php | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f7111ccf545..ed0ad19b96d 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -524,9 +524,10 @@ if ($action == 'update') $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; $sql .= " WHERE ac.id != " . $object->id; $sql .= " AND er.resource_id IN ("; - $sql .= " SELECT resource_id FROM " . MAIN_DB_PREFIX . "element_resources as er"; - $sql .= " WHERE er.element_id = " . $object->id; - $sql .= " AND er.element_type = '" . $db->escape($object->element) . "'"; + $sql .= " SELECT resource_id FROM " . MAIN_DB_PREFIX . "element_resources"; + $sql .= " WHERE element_id = " . $object->id; + $sql .= " AND element_type = '" . $db->escape($object->element) . "'"; + $sql .= " AND busy = 1"; $sql .= ")"; $sql .= " AND er.busy = 1"; $sql .= " AND ("; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index e55399f2da4..07bcdb3fd99 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -202,6 +202,7 @@ if (empty($reshook)) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($object->resource_type) . "'"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element_type) . "'"; $sql .= " WHERE er.resource_id = " . $object->resource_id; + $sql .= " AND ac.id != " . $object->element_id; $sql .= " AND er.busy = 1"; $sql .= " AND ("; From 9ed09db93cd5f1c263ba4b231fb046c618825fa4 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 5 Sep 2019 09:41:15 +0200 Subject: [PATCH 11/39] FIX replace "
" by "
" --- htdocs/comm/action/card.php | 2 +- htdocs/resource/element_resource.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ed0ad19b96d..44d6b000efe 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -558,7 +558,7 @@ if ($action == 'update') $error++; $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; while ($obj = $db->fetch_object($resql)) { - $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); } $object->errors[] = $object->error; } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 07bcdb3fd99..bb9a54a9bf0 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -151,7 +151,7 @@ if (empty($reshook)) $error++; $objstat->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; while ($obj = $db->fetch_object($resql)) { - $objstat->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + $objstat->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); } $objstat->errors[] = $objstat->error; } @@ -232,7 +232,7 @@ if (empty($reshook)) $error++; $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; while ($obj = $db->fetch_object($resql)) { - $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); + $object->error .= '
- ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); } $object->errors[] = $objstat->error; } From 815d0bbc20d7b49ed5adfb06b31d8503e604bd48 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 5 Sep 2019 11:57:12 +0200 Subject: [PATCH 12/39] FIX rename "dolresource" into "resource" for compatibility with PR 11822 --- htdocs/comm/action/card.php | 2 +- htdocs/resource/element_resource.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 44d6b000efe..c9a4f782b4d 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -520,7 +520,7 @@ if ($action == 'update') $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'resource'"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; $sql .= " WHERE ac.id != " . $object->id; $sql .= " AND er.resource_id IN ("; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index bb9a54a9bf0..b842ad6c832 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -105,7 +105,7 @@ if (empty($reshook)) // TODO : add this check at update_linked_resource and when modifying event start or end date // check if an event resource is already in use - if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element=='action' && $resource_type=='dolresource' && intval($busy)==1) { + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element=='action' && $resource_type=='resource' && intval($busy)==1) { $eventDateStart = $objstat->datep; $eventDateEnd = $objstat->datef; $isFullDayEvent = intval($objstat->fulldayevent); @@ -185,7 +185,7 @@ if (empty($reshook)) $object->busy = $busy; $object->mandatory = $mandatory; - if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type=='action' && $object->resource_type=='dolresource' && intval($object->busy)==1) { + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type=='action' && $object->resource_type=='resource' && intval($object->busy)==1) { $eventDateStart = $object->objelement->datep; $eventDateEnd = $object->objelement->datef; $isFullDayEvent = intval($objstat->fulldayevent); From 6bb5860f62463dc8fe28c5621cc829529746287a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 5 Sep 2019 14:12:52 +0000 Subject: [PATCH 13/39] Fixing style errors. --- 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 55fef7d0185..b668ae0465f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7801,7 +7801,7 @@ abstract class CommonObject * @param string $type Type of category ('product', ...) * @return int < 0 si erreur, > 0 si ok */ - function cloneCategories($fromId, $toId, $type='') + function cloneCategories($fromId, $toId, $type = '') { $this->db->begin(); From 6902b2cbf22969c58202404c15521fa3bfa3f916 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 5 Sep 2019 16:14:15 +0200 Subject: [PATCH 14/39] fix function visibility thanks to stckler --- 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 55fef7d0185..0f8dd4f0c00 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7801,7 +7801,7 @@ abstract class CommonObject * @param string $type Type of category ('product', ...) * @return int < 0 si erreur, > 0 si ok */ - function cloneCategories($fromId, $toId, $type='') + public function cloneCategories($fromId, $toId, $type='') { $this->db->begin(); From cd96238adc0407213ce276e60f6d788933e9f0be Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 5 Sep 2019 14:19:35 +0000 Subject: [PATCH 15/39] Fixing style errors. --- 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 0f8dd4f0c00..e395f3d4455 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7801,7 +7801,7 @@ abstract class CommonObject * @param string $type Type of category ('product', ...) * @return int < 0 si erreur, > 0 si ok */ - public function cloneCategories($fromId, $toId, $type='') + public function cloneCategories($fromId, $toId, $type = '') { $this->db->begin(); From 66611f40971344a15d0118cd7051a39c3de0e445 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 9 Sep 2019 09:29:43 +0200 Subject: [PATCH 16/39] FIX rename "resource" (reserved) by "dolresource" --- htdocs/comm/action/card.php | 2 +- htdocs/resource/element_resource.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c9a4f782b4d..44d6b000efe 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -520,7 +520,7 @@ if ($action == 'update') $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'resource'"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = 'dolresource'"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; $sql .= " WHERE ac.id != " . $object->id; $sql .= " AND er.resource_id IN ("; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index b842ad6c832..bb9a54a9bf0 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -105,7 +105,7 @@ if (empty($reshook)) // TODO : add this check at update_linked_resource and when modifying event start or end date // check if an event resource is already in use - if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element=='action' && $resource_type=='resource' && intval($busy)==1) { + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element=='action' && $resource_type=='dolresource' && intval($busy)==1) { $eventDateStart = $objstat->datep; $eventDateEnd = $objstat->datef; $isFullDayEvent = intval($objstat->fulldayevent); @@ -185,7 +185,7 @@ if (empty($reshook)) $object->busy = $busy; $object->mandatory = $mandatory; - if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type=='action' && $object->resource_type=='resource' && intval($object->busy)==1) { + if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type=='action' && $object->resource_type=='dolresource' && intval($object->busy)==1) { $eventDateStart = $object->objelement->datep; $eventDateEnd = $object->objelement->datef; $isFullDayEvent = intval($objstat->fulldayevent); From 3ea2e0c915db93fca1ca696a4d6c25477d251fa9 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 9 Sep 2019 15:03:20 +0200 Subject: [PATCH 17/39] NEW add parent id or ref column in warehouse import --- htdocs/core/modules/modStock.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index f3864525d8d..93afcdaebd7 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -316,17 +316,21 @@ class modStock extends DolibarrModules $this->import_fields_array[$r]=array('e.ref'=>"LocationSummary*", 'e.description'=>"DescWareHouse",'e.lieu'=>"LieuWareHouse", 'e.address'=>"Address",'e.zip'=>'Zip','e.fk_pays'=>'CountryCode', - 'e.statut'=>'Status' + 'e.statut'=>'Status', + 'e.fk_parent'=>'ParentWarehouse' ); $this->import_convertvalue_array[$r]=array( - 'e.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry') + 'e.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'), + 'e.fk_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/product/stock/class/entrepot.class.php','class'=>'Entrepot','method'=>'fetch','element'=>'ref') ); $this->import_regex_array[$r]=array('e.statut'=>'^[0|1]'); $this->import_examplevalues_array[$r]=array('e.ref'=>"ALM001", 'e.description'=>"Central Warehouse",'e.lieu'=>"Central", 'e.address'=>"Route 66",'e.zip'=>'28080','e.fk_pays'=>'US', - 'e.statut'=>'1'); + 'e.statut'=>'1', + 'e.fk_parent'=>'' + ); // Import stocks $r++; From f4a565544fc7ac106ccacf004c07e70b91c2914f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 9 Sep 2019 16:33:12 +0200 Subject: [PATCH 18/39] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 87 +++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 446b4fa3cfe..428ebe79c4a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -178,6 +178,93 @@ class Products extends DolibarrApi } return $obj_ret; } + + /** + * List supplier's products + * + * Get a list of supplier's products + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param int $supplier Use this param to filter list by supplier + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @return array Array of product objects + * + * @url GET supplier + */ + public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '') + { + global $db, $conf; + $obj_ret = array(); + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + $sql = "SELECT t.rowid, t.ref, t.ref_ext"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as t"; + if ($category > 0) { + $sql.= ", ".MAIN_DB_PREFIX."categorie_product as c"; + } + $sql.= ", ".MAIN_DB_PREFIX."product_fournisseur_price as s"; + + $sql.= ' WHERE t.entity IN ('.getEntity('product').')'; + + if ($supplier > 0) { + $sql.= " AND s.fk_soc = ".$db->escape($supplier); + } + $sql.= " AND s.fk_product = t.rowid "; + // Select products of given category + if ($category > 0) { + $sql.= " AND c.fk_categorie = ".$db->escape($category); + $sql.= " AND c.fk_product = t.rowid "; + } + if ($mode == 1) { + // Show only products + $sql.= " AND t.fk_product_type = 0"; + } elseif ($mode == 2) { + // Show only services + $sql.= " AND t.fk_product_type = 1"; + } + // Add sql filters + if ($sqlfilters) { + if (! DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + $sql.= $db->plimit($limit + 1, $offset); + } + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + $i = 0; + while ($i < $min) + { + $obj = $db->fetch_object($result); + $product_static = new Product($db); + if($product_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($product_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); + } + if(! count($obj_ret)) { + throw new RestException(404, 'No product found'); + } + return $obj_ret; + } /** * Create product object From be66e1bd20ea9bc4de608e4f573c209ba77b9db8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 9 Sep 2019 14:36:02 +0000 Subject: [PATCH 19/39] Fixing style errors. --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 428ebe79c4a..89dd7ff823a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -193,7 +193,7 @@ class Products extends DolibarrApi * @param int $supplier Use this param to filter list by supplier * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @return array Array of product objects - * + * * @url GET supplier */ public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '') From 60e85136df9703e824945111a6e96425c83ebd8b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Sep 2019 08:48:55 +0200 Subject: [PATCH 20/39] FIX an admin can not access his own permissions after enabling advanced permissions --- htdocs/user/perms.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 2560ccc7f04..209e68048c7 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -58,7 +58,8 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $socid=0; if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms))) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms +// A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin +if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms)) && empty($user->admin)) { accessforbidden(); } From 4420af683d206ae06a1956f4ada932efcbec39e2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 14 Sep 2019 05:44:28 +0200 Subject: [PATCH 21/39] Fix Bank entries - nowrap on amount --- htdocs/compta/bank/bankentries_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 5609bb6b598..0a63e70d992 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1356,7 +1356,7 @@ if ($resql) // Debit if (! empty($arrayfields['b.debit']['checked'])) { - print ''; + print ''; if ($objp->amount < 0) { print price($objp->amount * -1); @@ -1370,7 +1370,7 @@ if ($resql) // Credit if (! empty($arrayfields['b.credit']['checked'])) { - print ''; + print ''; if ($objp->amount > 0) { print price($objp->amount); From e0238705cc89222c1ecce9b8319f09c1b21f1f91 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sat, 14 Sep 2019 19:04:43 +0200 Subject: [PATCH 22/39] Check if childtablesoncascade is not empty --- htdocs/core/class/commonobject.class.php | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d20a8d2785b..f08be052e96 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7536,18 +7536,20 @@ abstract class CommonObject } // Delete cascade first - foreach($this->childtablesoncascade as $table) - { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id; - $resql = $this->db->query($sql); - if (! $resql) - { - $this->error=$this->db->lasterror(); - $this->errors[]=$this->error; - $this->db->rollback(); - return -1; - } - } + if (! empty($this->childtablesoncascade)) { + foreach($this->childtablesoncascade as $table) + { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id; + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error=$this->db->lasterror(); + $this->errors[]=$this->error; + $this->db->rollback(); + return -1; + } + } + } if (! $error) { if (! $notrigger) { From 7019e69ee2d5825da1174220041b6ca596770ef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:09:36 +0200 Subject: [PATCH 23/39] FIX regression with option to hide picto on top menu --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 51 ++++++++++++++++++++++++++----- htdocs/theme/md/style.css.php | 46 +++++++++++++++++++++++++++- 3 files changed, 89 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12b5f63d7e1..86d02bcf22c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7265,7 +7265,7 @@ function printCommonFooter($zone = 'private') { print "\n"; print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n"; - print 'jQuery(".menuhider").click(function(event) {'; + print 'jQuery("li.menuhider").click(function(event) {'; print ' if (!$( "body" ).hasClass( "sidebar-collapse" )){ event.preventDefault(); }'."\n"; print ' console.log("We click on .menuhider");'."\n"; print ' $("body").toggleClass("sidebar-collapse")'."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index cbb69df74f9..5a12e50eaef 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1058,6 +1058,41 @@ div.blockvmenulogo { border-bottom: 0 !important; } +.backgroundforcompanylogo { + margin: px; + margin-left: 6px; + margin-right: 8px; + background-color: rgba(255,255,255,0.7); + padding: 0; + border-radius: 5px; + height: px; + /* width: 100px; */ + max-width: 100px; + vertical-align: middle; +} +.backgroundforcompanylogo img.mycompany { + object-fit: contain; + width: inherit; + height: inherit; +} +#mainmenutd_companylogo::after, #mainmenutd_menu::after { + content: unset !important; +} +li#mainmenutd_companylogo .tmenucenter { + width: unset; +} +li#mainmenutd_companylogo { + min-width: unset !important; +} + + li#mainmenutd_home { + min-width: unset !important; + } + li#mainmenutd_home .tmenucenter { + width: unset; + } + + div.blockvmenupair, div.blockvmenuimpair { border-top: none !important; border-left: none !important; @@ -1504,9 +1539,6 @@ li.tmenu, li.tmenusel { li.menuhider:hover { background-image: none !important; } -li.tmenusel, li.tmenu:hover { - /* background: rgba(0, 0, 0, 0.1); */ -} li.tmenusel::after, li.tmenu:hover::after{ content: ""; @@ -1559,7 +1591,7 @@ div.tmenucenter padding-top: 2px; height: px; - width: 100%; + /* width: 100%; */ } #menu_titre_logo { padding-top: 0; @@ -1965,8 +1997,8 @@ div.login_block_other { padding-top: 0; text-align: right; margin-right: 8px; } float: right; vertical-align: top; padding: 0px 3px 0px 4px !important; - line-height: 50px; - height: 50px; + line-height: px; + height: px; } .atoplogin, .atoplogin:hover { color: # !important; @@ -2003,8 +2035,8 @@ img.login, img.printer, img.entity { font-weight: bold; } .userimg.atoplogin img.userphoto, .userimgatoplogin img.userphoto { /* size for user photo in login bar */ - width: 32px; - height: 32px; + width: px; + height: px; border-radius: 50%; background-size: contain; background-size: contain; @@ -5676,6 +5708,9 @@ div.tabsElem a.tab { /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ @media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ { + li.tmenucompanylogo { + display: none; + } div.mainmenu { height: 23px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ebf6b1df23d..8c78e8be88b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1948,6 +1948,11 @@ foreach($mainmenuusedarray as $val) display: none; } +.topmenuimage { + + display: none; + +} a.tmenuimage { display: block; } @@ -2232,6 +2237,41 @@ div.blockvmenulogo { border-bottom: 0 !important; } +.backgroundforcompanylogo { + margin: px; + margin-left: 12px; + margin-right: 6px; + background-color: rgba(255,255,255,0.7); + padding: 0; + border-radius: 5px; + height: px; + /* width: 100px; */ + max-width: 100px; + vertical-align: middle; +} +.backgroundforcompanylogo img.mycompany { + object-fit: contain; + width: inherit; + height: inherit; +} +#mainmenutd_companylogo::after { + content: unset; +} +li#mainmenutd_companylogo .tmenucenter { + width: unset; +} +li#mainmenutd_companylogo { + min-width: unset !important; +} + + li#mainmenutd_home { + min-width: unset !important; + } + li#mainmenutd_home .tmenucenter { + width: unset; + } + + div.blockvmenupair, div.blockvmenuimpair { font-family: ; @@ -5624,7 +5664,7 @@ border-top-right-radius: 6px; } .menuhider { - width: 40px; + width: px; } /* nboftopmenuentries = , fontsize= */ @@ -5659,6 +5699,10 @@ border-top-right-radius: 6px; /* rule to reduce top menu - 2nd reduction */ @media only screen and (max-width: px) { + li.tmenucompanylogo { + display: none; + } + div.tmenucenter { max-width: px; /* size of viewport */ text-overflow: clip; From 544a1237bc0cc0d65cf3150d536e8f23a0d9cced Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:09:36 +0200 Subject: [PATCH 24/39] FIX regression with option to hide picto on top menu --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 51 ++++++++++++++++++++++++++----- htdocs/theme/md/style.css.php | 46 +++++++++++++++++++++++++++- 3 files changed, 89 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3d7c9ad0ae2..b6b691117a5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7226,7 +7226,7 @@ function printCommonFooter($zone = 'private') { print "\n"; print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n"; - print 'jQuery(".menuhider").click(function(event) {'; + print 'jQuery("li.menuhider").click(function(event) {'; print ' if (!$( "body" ).hasClass( "sidebar-collapse" )){ event.preventDefault(); }'."\n"; print ' console.log("We click on .menuhider");'."\n"; print ' $("body").toggleClass("sidebar-collapse")'."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 82001a31a41..c3ddd4ff7e2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1026,6 +1026,41 @@ div.blockvmenulogo { border-bottom: 0 !important; } +.backgroundforcompanylogo { + margin: px; + margin-left: 6px; + margin-right: 8px; + background-color: rgba(255,255,255,0.7); + padding: 0; + border-radius: 5px; + height: px; + /* width: 100px; */ + max-width: 100px; + vertical-align: middle; +} +.backgroundforcompanylogo img.mycompany { + object-fit: contain; + width: inherit; + height: inherit; +} +#mainmenutd_companylogo::after, #mainmenutd_menu::after { + content: unset !important; +} +li#mainmenutd_companylogo .tmenucenter { + width: unset; +} +li#mainmenutd_companylogo { + min-width: unset !important; +} + + li#mainmenutd_home { + min-width: unset !important; + } + li#mainmenutd_home .tmenucenter { + width: unset; + } + + div.blockvmenupair, div.blockvmenuimpair { border-top: none !important; border-left: none !important; @@ -1469,9 +1504,6 @@ li.tmenu, li.tmenusel { li.menuhider:hover { background-image: none !important; } -li.tmenusel, li.tmenu:hover { - /* background: rgba(0, 0, 0, 0.1); */ -} li.tmenusel::after, li.tmenu:hover::after{ content: ""; @@ -1524,7 +1556,7 @@ div.tmenucenter padding-top: 2px; height: px; - width: 100%; + /* width: 100%; */ } #menu_titre_logo { padding-top: 0; @@ -1930,8 +1962,8 @@ div.login_block_other { padding-top: 0; text-align: right; margin-right: 8px; } float: right; vertical-align: top; padding: 0px 3px 0px 4px !important; - line-height: 50px; - height: 50px; + line-height: px; + height: px; } .atoplogin, .atoplogin:hover { color: # !important; @@ -1968,8 +2000,8 @@ img.login, img.printer, img.entity { font-weight: bold; } .userimg.atoplogin img.userphoto, .userimgatoplogin img.userphoto { /* size for user photo in login bar */ - width: 32px; - height: 32px; + width: px; + height: px; border-radius: 50%; background-size: contain; background-size: contain; @@ -5621,6 +5653,9 @@ div.tabsElem a.tab { /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ @media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ { + li.tmenucompanylogo { + display: none; + } div.mainmenu { height: 23px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3b9064e51a1..ee0515da6fe 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1938,6 +1938,11 @@ foreach($mainmenuusedarray as $val) display: none; } +.topmenuimage { + + display: none; + +} a.tmenuimage { display: block; } @@ -2222,6 +2227,41 @@ div.blockvmenulogo { border-bottom: 0 !important; } +.backgroundforcompanylogo { + margin: px; + margin-left: 12px; + margin-right: 6px; + background-color: rgba(255,255,255,0.7); + padding: 0; + border-radius: 5px; + height: px; + /* width: 100px; */ + max-width: 100px; + vertical-align: middle; +} +.backgroundforcompanylogo img.mycompany { + object-fit: contain; + width: inherit; + height: inherit; +} +#mainmenutd_companylogo::after { + content: unset; +} +li#mainmenutd_companylogo .tmenucenter { + width: unset; +} +li#mainmenutd_companylogo { + min-width: unset !important; +} + + li#mainmenutd_home { + min-width: unset !important; + } + li#mainmenutd_home .tmenucenter { + width: unset; + } + + div.blockvmenupair, div.blockvmenuimpair { font-family: ; @@ -5743,7 +5783,7 @@ border-top-right-radius: 6px; } .menuhider { - width: 40px; + width: px; } /* nboftopmenuentries = , fontsize= */ @@ -5778,6 +5818,10 @@ border-top-right-radius: 6px; /* rule to reduce top menu - 2nd reduction */ @media only screen and (max-width: px) { + li.tmenucompanylogo { + display: none; + } + div.tmenucenter { max-width: px; /* size of viewport */ text-overflow: clip; From 755057c99f6110ee30a622cb488f55ab8e956c07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:15:46 +0200 Subject: [PATCH 25/39] FIX regression with option to hide picto on top menu --- htdocs/core/menus/standard/eldy.lib.php | 55 ++++++++++++------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a4eb2d57053..ba4fd896cd6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -55,22 +55,23 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $usemenuhider = 1; - // Show/Hide vertical menu + // Show/Hide vertical menu. The hamburger icon for .menuhider action. if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $showmode=1; $classname = 'class="tmenu menuhider"'; $idsel='menu'; - $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); + $menu->add('#', (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } $menu_arr = array(); + // Home $menu_arr[] = array( 'name' => 'Home', 'link' => '/index.php?mainmenu=home&leftmenu=home', - 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)? '   ' : "Home") , + 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : "Home") , 'level' => 0, 'enabled' => $showmode = 1, 'target' => $atarget, @@ -473,8 +474,30 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->liste = dol_sort_array($menu->liste, 'position'); // Output menu entries + // Show logo company + if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; + if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + } + else + { + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + } + $title=$langs->trans("GoIntoSetupToChangeLogo"); + + print "\n".''."\n"; + print_start_menu_entry('companylogo', 'class="tmenu tmenucompanylogo"', 1); + + print ''."\n"; + + print_end_menu_entry(4); + } + if (empty($noout)) { - foreach($menu->liste as $menkey => $menuval) { + foreach($menu->liste as $menuval) { print_start_menu_entry($menuval['idsel'], $menuval['classname'], $menuval['enabled']); print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url']!='#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); print_end_menu_entry($menuval['enabled']); @@ -615,30 +638,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $usemenuhider = 0; - // Show logo company - if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; - if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - } - else - { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; - } - $title=$langs->trans("GoIntoSetupToChangeLogo"); - print "\n".''."\n"; - print ''."\n"; - } - if (is_array($moredata) && ! empty($moredata['searchform'])) // searchform can contains select2 code or link to show old search form or link to switch on search page { print "\n"; From 76b366836877de877796f9bf99cac21488c241ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:15:59 +0200 Subject: [PATCH 26/39] FIX regression with option to hide picto on top menu --- htdocs/core/menus/standard/eldy.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b1c3111034f..dbf3ede88f9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -55,14 +55,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $usemenuhider = 1; - // Show/Hide vertical menu - if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + // Show/Hide vertical menu. The hamburger icon for .menuhider action. + if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $showmode=1; $classname = 'class="tmenu menuhider"'; $idsel='menu'; - $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); + $menu->add('#', (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } $menu_arr = array(); @@ -70,7 +70,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu_arr[] = array( 'name' => 'Home', 'link' => '/index.php?mainmenu=home&leftmenu=home', - 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)? '   ' : "Home") , + 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : "Home") , 'level' => 0, 'enabled' => $showmode = 1, 'target' => $atarget, From f5771e49d8c45ae98e821277dd96abb187ed7e42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:21:52 +0200 Subject: [PATCH 27/39] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5a12e50eaef..5beebb89a36 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1060,7 +1060,7 @@ div.blockvmenulogo } .backgroundforcompanylogo { margin: px; - margin-left: 6px; + margin-left: 8px; margin-right: 8px; background-color: rgba(255,255,255,0.7); padding: 0; From 27e3a2cb1d4db962246298b2a6940b71ce43e103 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:32:43 +0200 Subject: [PATCH 28/39] Update perms.php --- htdocs/user/perms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 209e68048c7..137ac659fd7 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -59,7 +59,7 @@ $socid=0; if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); // A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin -if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms)) && empty($user->admin)) +if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) { accessforbidden(); } From 4d0ef334713b80f7010d86770be2933d6d252f13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:43:03 +0200 Subject: [PATCH 29/39] FIX #11857 --- htdocs/comm/action/index.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 48165361d7c..d42b1b7d134 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -607,9 +607,7 @@ if ($resql) $event->fk_element=$obj->fk_element; $event->elementtype=$obj->elementtype; - $event->societe->id=$obj->fk_soc; $event->thirdparty_id=$obj->fk_soc; - $event->contact->id=$obj->fk_contact; $event->contact_id=$obj->fk_contact; // Defined date_start_in_calendar and date_end_in_calendar property @@ -1569,28 +1567,31 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'ICALEVENT') print '
('.dol_trunc($event->icalname, $maxnbofchar).')'; + $thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0)); + $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->cotact->id > 0) ? $event->contact->id : 0)); + // If action related to company / contact $linerelatedto=''; - if (! empty($event->societe->id) && $event->societe->id > 0) + if ($thirdparty_id > 0) { - if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id])) + if (! isset($cachethirdparties[$thirdparty_id]) || ! is_object($cachethirdparties[$thirdparty_id])) { $thirdparty=new Societe($db); - $thirdparty->fetch($event->societe->id); - $cachethirdparties[$event->societe->id]=$thirdparty; + $thirdparty->fetch($thirdparty_id); + $cachethirdparties[$thirdparty_id]=$thirdparty; } - else $thirdparty=$cachethirdparties[$event->societe->id]; + else $thirdparty=$cachethirdparties[$thirdparty_id]; if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1, '', 0); } - if (! empty($event->contact->id) && $event->contact->id > 0) + if (! empty($contact_id) && $contact_id > 0) { - if (! is_object($cachecontacts[$event->contact->id])) + if (! is_object($cachecontacts[$contact_id])) { $contact=new Contact($db); - $contact->fetch($event->contact->id); - $cachecontacts[$event->contact->id]=$contact; + $contact->fetch($contact_id); + $cachecontacts[$contact_id]=$contact; } - else $contact=$cachecontacts[$event->contact->id]; + else $contact=$cachecontacts[$contact_id]; if ($linerelatedto) $linerelatedto.=' '; if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1, '', 0); } From ab07da02c4cabdfecb9220d36bac3304ed6270c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 15:53:04 +0200 Subject: [PATCH 30/39] Fix scrutinizer --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 02039f3edc2..c3c008a5874 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -221,7 +221,7 @@ if (empty($conf->stripeconnect->enabled)) $endpoint = \Stripe\WebhookEndpoint::retrieve($conf->global->STRIPE_TEST_WEBHOOK_ID); $endpoint->enabled_events = $stripearrayofwebhookevents; if (GETPOST('webhook', 'alpha') == $conf->global->STRIPE_TEST_WEBHOOK_ID) { - if (empty(GETPOST('status', 'alpha'))) { + if (! GETPOST('status', 'alpha')) { $endpoint->disabled = true; } else { $endpoint->disabled = false; From 23860b15ee9b09ee146696eec9d235c875a5097a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 16:00:01 +0200 Subject: [PATCH 31/39] Try a fix for #11852 --- htdocs/societe/class/societe.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 26ad0c6bed9..0172d67e5c7 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3914,17 +3914,17 @@ class Societe extends CommonObject while($obj=$this->db->fetch_object($resql)) { $tmpobject->id=$obj->rowid; - if ($obj->fk_statut != Facture::STATUS_DRAFT // Not a draft - && ! ($obj->fk_statut == Facture::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice + if ($obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft + && ! ($obj->fk_statut == $tmpobject::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice ) { $outstandingTotal+= $obj->total_ht; $outstandingTotalIncTax+= $obj->total_ttc; } if ($obj->paye == 0 - && $obj->fk_statut != Facture::STATUS_DRAFT // Not a draft - && $obj->fk_statut != Facture::STATUS_ABANDONED // Not abandonned - && $obj->fk_statut != Facture::STATUS_CLOSED) // Not classified as paid + && $obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft + && $obj->fk_statut != $tmpobject::STATUS_ABANDONED // Not abandonned + && $obj->fk_statut != $tmpobject::STATUS_CLOSED) // Not classified as paid //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason { $paiement = $tmpobject->getSommePaiement(); @@ -3935,7 +3935,11 @@ class Societe extends CommonObject } //if credit note is converted but not used - if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed())$outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed(); + // TODO Do this also for customer ? + if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed()) + { + $outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed(); + } } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } From 5d0ba10f34a24d2f288b6150ad4c4d49402a0d79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 17:04:08 +0200 Subject: [PATCH 32/39] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 89dd7ff823a..524e36fda6e 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -194,7 +194,7 @@ class Products extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @return array Array of product objects * - * @url GET supplier + * @url GET supplier_prices */ public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '') { From 48cbcdc7571922af74a829c11e5253b24a28e567 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 15 Sep 2019 17:08:21 +0200 Subject: [PATCH 33/39] Fix #11876 --- htdocs/install/mysql/data/llx_c_hrm_public_holiday.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_hrm_public_holiday.sql b/htdocs/install/mysql/data/llx_c_hrm_public_holiday.sql index 70750494a10..737fe66f9da 100644 --- a/htdocs/install/mysql/data/llx_c_hrm_public_holiday.sql +++ b/htdocs/install/mysql/data/llx_c_hrm_public_holiday.sql @@ -70,7 +70,7 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-KONEGIE', 0, 41, '', 0, 6, 1, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-26OKT', 0, 41, '', 0, 10, 26, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-TOUSSAINT', 0, 41, '', 0, 11, 1, 1); -INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-IMMACULE', 0, 41, '', 0, 12 8, 1); +INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-IMMACULE', 0, 41, '', 0, 12, 8, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-24DEC', 0, 41, '', 0, 12, 24, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-SAINTSTEFAN', 0, 41, '', 0, 12, 26, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-Silvester', 0, 41, '', 0, 12, 31, 1); From 12d67c5f855de196a56823d2c844ec3c589ad5d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Sep 2019 17:18:10 +0200 Subject: [PATCH 34/39] Rename api to get all purchase prices --- htdocs/product/class/api_products.class.php | 177 ++++++++++---------- 1 file changed, 89 insertions(+), 88 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 524e36fda6e..812c2df7459 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -178,93 +178,6 @@ class Products extends DolibarrApi } return $obj_ret; } - - /** - * List supplier's products - * - * Get a list of supplier's products - * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param int $category Use this param to filter list by category - * @param int $supplier Use this param to filter list by supplier - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" - * @return array Array of product objects - * - * @url GET supplier_prices - */ - public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '') - { - global $db, $conf; - $obj_ret = array(); - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; - $sql = "SELECT t.rowid, t.ref, t.ref_ext"; - $sql.= " FROM ".MAIN_DB_PREFIX."product as t"; - if ($category > 0) { - $sql.= ", ".MAIN_DB_PREFIX."categorie_product as c"; - } - $sql.= ", ".MAIN_DB_PREFIX."product_fournisseur_price as s"; - - $sql.= ' WHERE t.entity IN ('.getEntity('product').')'; - - if ($supplier > 0) { - $sql.= " AND s.fk_soc = ".$db->escape($supplier); - } - $sql.= " AND s.fk_product = t.rowid "; - // Select products of given category - if ($category > 0) { - $sql.= " AND c.fk_categorie = ".$db->escape($category); - $sql.= " AND c.fk_product = t.rowid "; - } - if ($mode == 1) { - // Show only products - $sql.= " AND t.fk_product_type = 0"; - } elseif ($mode == 2) { - // Show only services - $sql.= " AND t.fk_product_type = 1"; - } - // Add sql filters - if ($sqlfilters) { - if (! DolibarrApi::_checkFilters($sqlfilters)) { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); - } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; - } - $sql.= $db->order($sortfield, $sortorder); - if ($limit) { - if ($page < 0) { - $page = 0; - } - $offset = $limit * $page; - $sql.= $db->plimit($limit + 1, $offset); - } - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $min = min($num, ($limit <= 0 ? $num : $limit)); - $i = 0; - while ($i < $min) - { - $obj = $db->fetch_object($result); - $product_static = new Product($db); - if($product_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($product_static); - } - $i++; - } - } - else { - throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); - } - if(! count($obj_ret)) { - throw new RestException(404, 'No product found'); - } - return $obj_ret; - } /** * Create product object @@ -554,6 +467,94 @@ class Products extends DolibarrApi ); } + + /** + * List purchase prices + * + * Get a list of all purchase prices of products + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category of product + * @param int $supplier Use this param to filter list by supplier + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @return array Array of product objects + * + * @url GET purchase_prices + */ + public function getSupplierProducts($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $supplier = 0, $sqlfilters = '') + { + global $db, $conf; + $obj_ret = array(); + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + $sql = "SELECT t.rowid, t.ref, t.ref_ext"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as t"; + if ($category > 0) { + $sql.= ", ".MAIN_DB_PREFIX."categorie_product as c"; + } + $sql.= ", ".MAIN_DB_PREFIX."product_fournisseur_price as s"; + + $sql.= ' WHERE t.entity IN ('.getEntity('product').')'; + + if ($supplier > 0) { + $sql.= " AND s.fk_soc = ".$db->escape($supplier); + } + $sql.= " AND s.fk_product = t.rowid "; + // Select products of given category + if ($category > 0) { + $sql.= " AND c.fk_categorie = ".$db->escape($category); + $sql.= " AND c.fk_product = t.rowid "; + } + if ($mode == 1) { + // Show only products + $sql.= " AND t.fk_product_type = 0"; + } elseif ($mode == 2) { + // Show only services + $sql.= " AND t.fk_product_type = 1"; + } + // Add sql filters + if ($sqlfilters) { + if (! DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + $sql.= $db->plimit($limit + 1, $offset); + } + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + $i = 0; + while ($i < $min) + { + $obj = $db->fetch_object($result); + $product_static = new Product($db); + if($product_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($product_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); + } + if(! count($obj_ret)) { + throw new RestException(404, 'No product found'); + } + return $obj_ret; + } + /** * Get purchase prices for a product * @@ -602,7 +603,7 @@ class Products extends DolibarrApi if($result) { $this->product = new ProductFournisseur($this->db); $this->product->fetch($id, $ref); - $this->product->list_product_fournisseur_price($id, $sortfield, $sortorder, 0, 0); + $this->product->list_product_fournisseur_price($id, '', '', 0, 0); } return $this->_cleanObjectDatas($this->product); From 4db6badfc2bd954ff11a918601d6fb4ce41a650f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Sep 2019 10:24:41 +0200 Subject: [PATCH 35/39] Fix link when no title in search of website content --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 5d4c259bf9c..6394428bd42 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3308,7 +3308,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print ''; print ''.$langs->trans("Container").''; print ''; - print ''.$answerrecord->title.''; + print ''.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).''; print ''; print ''.$answerrecord->description; print ''; From 36326fa5c04e498a0b0b73c3df4e38908bfd7553 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Sep 2019 15:18:35 +0200 Subject: [PATCH 36/39] Add squarre logo --- htdocs/theme/dolibarr_512x512.png | Bin 0 -> 9520 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/dolibarr_512x512.png diff --git a/htdocs/theme/dolibarr_512x512.png b/htdocs/theme/dolibarr_512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..bd8d7ac3bfd32616c1231e0fc626ae9d5a7d5cae GIT binary patch literal 9520 zcma)i2|Sfu*Y|adWvE1vOm`(Rm3hjLArvwbnWK>Tn5RP-O1P1dp+qRNP%@qjDKcd$ z!imHo6pnfL)}{M-zx#cj`~BX}?}zK`v#zz*UVE+o8uq@eqpe0y!%Bl72)%~7iXMWH z!6O;6hYJ2J`Sz~EKMGGJ4TC-K6S(JU6nx(6rheHILCy}KzZi$4Drp!zf>kxa>bu%w zeXKp~5FZ~OAqN*HPg`p@J0Vw(YpHW*SrLQ_(NH;O;F~r(?1vq;OKGc?{MG6 zp+}Hdr$0zWS*632Z$hc6^Y#b}^;>5hcOBg(h6fCky41ZGU4uWBF4LA%R-N;yDkhHn zS+12>{(0rwh-?UxO!-r1m&7lVE7hGFULEsp1ygHjBOBj>7q*5+7k!KB0xVPz1kY#D zgFz6*A8Xv`+CIJQoK!%NOL4doC$xd{y>%SKRnv-C?beJ69rJvmL56- zbT*(bT(}f1IwB1G@k&haD4_E1k3T5(09`VC_tykA{8szQw=^tETZpyHc%9t%)a(6{I1Iq7)?CFaef8k!Ga zrxikeKAsS#=PP#6;r+0mhHGS1iyAo~`-Y-EY;SP3*F}TTf?n?}*M|70*8HOeMux>N z^8AyGdY>2MS+u}_o^I~AA&Kw#GyRz(iF=Wb^B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grHS`!>c%MpA|tA(5>$Rkx<5yRo@zs94>t4n&ZOa!qsN&;2Q`HnYxkXZwx%lVda6$Ynk zYh$tkzN*8rGZ@2_tmQ~=&&!GVymmaAqS=D!xC3fSzxr#v7FF(G$Z92#7w@-Q)68KA zjS{oc1=QQ6Dl?0;T56cV7zox^GHO+`{a0TfGOe_KK;%{IM8V^i&bu;FSBjyo+ zIJ`d(SZ&Ip_*`&7n|PCQ7hvhRio{;sD!>SJ-HaK&PYivyG+zW-8$fI5YNB`5(tf0ZR>LW)+K8r9>&5JLs*cFkyjJ&@{C; z+{xQv{E-sJS8{nAq?ScB0R>muBxeUQz19YkE#GMe;V*+LRGNYh-LH+Tz>ZrK4tndz zvdojuLiixav}hYRHTRR7);ZK0xyWWzMcDVmBLh#sqG~b|Xq-VA^lRaRmAUF0cUm>o z$gadeJ*{i1Y(2}**SEf@RM>gCH)2z1w}_!^f}RUv3tt{$dfXLzvw6@x!vxIUY4VAU zxL8GUEL9WKi8!HwF9-F`{n~qojo%lrFq}kSsWxn|dPt z8_ECPprG&c=!Vs0-$o@xO4Jb#DBg^(qx23rv!KXU+%qFE24B}K=;>bf6H2k`=4*9{D-XQ>B&FH>JBI4 z|GG`{o9jQzisl!8-LYx Date: Mon, 16 Sep 2019 15:26:13 +0200 Subject: [PATCH 37/39] Introduce a logo squarred into setup (MAIN_INFO_SOCIETE_LOGO_SQUARRED, MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI, ...) --- htdocs/core/menus/standard/eldy.lib.php | 9 +++++++-- ...ibarr_512x512.png => dolibarr_logo_squarred.png} | Bin 2 files changed, 7 insertions(+), 2 deletions(-) rename htdocs/theme/{dolibarr_512x512.png => dolibarr_logo_squarred.png} (100%) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ba4fd896cd6..2eead6da81d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -478,13 +478,18 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; - if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + $mysoc->logo_squarred_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; + if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); + } + elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); } else { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; } $title=$langs->trans("GoIntoSetupToChangeLogo"); diff --git a/htdocs/theme/dolibarr_512x512.png b/htdocs/theme/dolibarr_logo_squarred.png similarity index 100% rename from htdocs/theme/dolibarr_512x512.png rename to htdocs/theme/dolibarr_logo_squarred.png From 68842b0b630f3d5865fde6e37b427edfdd63a6a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Sep 2019 19:08:45 +0200 Subject: [PATCH 38/39] Fix css for company logo in top menu --- htdocs/theme/eldy/global.inc.php | 6 +++--- htdocs/theme/md/style.css.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5beebb89a36..2ee73a7889b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5673,7 +5673,7 @@ div.tabsElem a.tab { /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */ -@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1) ? round($nbtopmenuentries * 90, 0) + 240 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1) ? round($nbtopmenuentries * 90, 0) + 340 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */ { div.tmenucenter { width: px; /* size of viewport */ @@ -5706,7 +5706,7 @@ div.tabsElem a.tab { } } /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ -@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 140 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ { li.tmenucompanylogo { display: none; @@ -5733,7 +5733,7 @@ div.tabsElem a.tab { } } /* rule to reduce top menu - 3rd reduction: The menu for user is on left */ -@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 40 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 140 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */ { .side-nav { z-index: 200; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8c78e8be88b..ab965b1d3d3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5670,7 +5670,7 @@ border-top-right-radius: 6px; /* nboftopmenuentries = , fontsize= */ /* disableimages = */ /* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { div.tmenucenter { max-width: px; /* size of viewport */ @@ -5697,7 +5697,7 @@ border-top-right-radius: 6px; } } /* rule to reduce top menu - 2nd reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { li.tmenucompanylogo { display: none; From 78386871f37daa2fab0c5da8acaff4e70777710f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Sep 2019 03:33:58 +0200 Subject: [PATCH 39/39] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2ee73a7889b..533608aa132 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2650,7 +2650,7 @@ table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.nobor } table.liste td, table.noborder td, div.noborder form div, table.tableforservicepart1 td, table.tableforservicepart2 td { padding: 7px 8px 7px 8px; /* t r b l */ - line-height: 22px; + /* line-height: 22px; This create trouble on cell login on list of last events of a contract*/ height: 22px; } div.liste_titre_bydiv .divsearchfield {