From 42d4cf99926c24e2dc98f537196ffb5de72a4e68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 10:17:54 +0100 Subject: [PATCH 1/7] Fix sql --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 9b5243b181b..8037c988f03 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -468,7 +468,7 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp; -- We fix value of 'list' from 0 to 1 for all extrafields created before this migration UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL; -UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list != 3; +UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list <> 3; ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1; --VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1; From 3da96500032b9f6b3ceca4692e24fc264a98ddea Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 10 Dec 2018 16:06:11 +0100 Subject: [PATCH 2/7] FIX if qty is 0 --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 72bd20fc25c..1e408c697f7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3035,7 +3035,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql.= " ".$this->product_type.","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; - $sql.= " ".price2num($this->total_ttc/$this->qty).","; + $sql.= " ".!empty($this->qty)?price2num($this->total_ttc/$this->qty):price2num($this->total_ttc).","; $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; $sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; From 4a61c1b6ed3643b4c87dec1e3710f1ae107e014f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Dec 2018 13:25:09 +0100 Subject: [PATCH 3/7] FIX lang not loaded --- htdocs/comm/propal/list.php | 2 +- htdocs/compta/facture/list.php | 4 ++-- htdocs/contact/list.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 980615828a5..e48175bf148 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies','propal','compta','bills','orders','products','deliveries')); +$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories')); $socid=GETPOST('socid','int'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8e4ddc2a3eb..3bec9bbebcb 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'products')); +$langs->loadLangs(array('bills', 'companies', 'products', 'categories')); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); @@ -910,7 +910,7 @@ if ($resql) $projectstatic=new Project($db); $discount = new DiscountAbsolute($db); - + if ($num > 0) { $i=0; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 841fb9d0c3a..905b2a680b0 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array("companies", "suppliers")); +$langs->loadLangs(array("companies", "suppliers", "categories")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); From d1eed144889d2a60be57eecfdd027738ee33f504 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 11 Dec 2018 13:25:33 +0100 Subject: [PATCH 4/7] FIX: #10218 Bad redirection after deleting a user or group --- htdocs/user/card.php | 4 ++-- htdocs/user/group/card.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a7282783166..6dfcf3ae7c0 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2018 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2015-2017 Jean-François Ferry @@ -152,7 +152,7 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors'); } else { - header("Location: index.php?restore_lastsearch_values=1"); + header("Location: ".DOL_URL_ROOT."/user/list.php?restore_lastsearch_values=1"); exit; } } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 47a5a5df9eb..d5f7a5b8570 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011 Herve Prot * Copyright (C) 2012 Florian Henry + * Copyright (C) 2018 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,7 +111,7 @@ if (empty($reshook)) { { $object->fetch($id); $object->delete(); - header("Location: index.php?restore_lastsearch_values=1"); + header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1"); exit; } else From 22c34bd656f86a1223cf2138385e9ae9d72044be Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 12 Dec 2018 12:09:07 +0100 Subject: [PATCH 5/7] Fix: MenuBankCash Translation is in english in es_ES --- htdocs/langs/es_ES/banks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/es_ES/banks.lang b/htdocs/langs/es_ES/banks.lang index 8add13345b2..e5e289f0c4b 100644 --- a/htdocs/langs/es_ES/banks.lang +++ b/htdocs/langs/es_ES/banks.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - banks Bank=Banco -MenuBankCash=Bank | Cash +MenuBankCash=Bancos | Cajas MenuVariousPayment=Pagos varios MenuNewVariousPayment=Nuevo pago varios BankName=Nombre del banco From 6ad106d14a3b1db17ee3c096e747d48541202474 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Dec 2018 19:56:22 +0100 Subject: [PATCH 6/7] Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 1e408c697f7..086f154184d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3035,10 +3035,10 @@ class SupplierInvoiceLine extends CommonObjectLine $sql.= " ".$this->product_type.","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; - $sql.= " ".!empty($this->qty)?price2num($this->total_ttc/$this->qty):price2num($this->total_ttc).","; + $sql.= " ".(! empty($this->qty)?price2num($this->total_ttc / $this->qty):price2num($this->total_ttc)).","; $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; - $sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; + $sql.= ' '.(! empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; $sql.= ' '.$this->rang.','; $sql.= ' '.$this->special_code.','; $sql.= " '".$this->db->escape($this->info_bits)."',"; From 7a3ab13196abb475fc654f35e878a25b7b4aac1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Dec 2018 20:45:51 +0100 Subject: [PATCH 7/7] FIX #10183 using backport of fix done in 9.0 --- htdocs/core/class/extrafields.class.php | 33 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1840f62ca5d..48eabbefe9e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1910,24 +1910,36 @@ class ExtraFields /** * return array_options array of data of extrafields value of object sent by a search form * - * @param array $extralabels $array of extrafields (@deprecated) - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @return array|int array_options set or 0 if no value + * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage) + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @return array|int array_options set or 0 if no value */ - function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='') + function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='') { global $_POST; - if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; + if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label'])) + { + $extralabels = $this->attributes[$extrafieldsobjectkey]['label']; + } + else + { + $extralabels = $extrafieldsobjectkey; + } - $array_options = array(); if (is_array($extralabels)) { + $array_options = array(); + // Get extra fields foreach ($extralabels as $key => $value) { - $key_type = $this->attributes[$object->table_element]['type'][$key]; + $key_type = ''; + if (is_string($extrafieldsobjectkey)) + { + $key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; + } if (in_array($key_type,array('date','datetime'))) { @@ -1956,8 +1968,7 @@ class ExtraFields return $array_options; } - else { - return 0; - } + + return 0; } }