From 550df138a652b612a1fbf238a0ea6da833162085 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 7 Dec 2018 12:19:50 +0100 Subject: [PATCH 1/9] Fix unexistant fields --- htdocs/core/modules/modSociete.class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4a814954072..34f4dca8510 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -477,14 +477,11 @@ class modSociete extends DolibarrModules $this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib'); $this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank", 'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*", - 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default', - 'sr.fk_departement'=>"StateId",'sr.fk_pays'=>"CountryCode" + 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default' ); $this->import_convertvalue_array[$r]=array( - 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), - 'sr.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'), - 'sr.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'), + 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') ); $this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING", 'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333", From 42d4cf99926c24e2dc98f537196ffb5de72a4e68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 10:17:54 +0100 Subject: [PATCH 2/9] 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 3/9] 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 d1eed144889d2a60be57eecfdd027738ee33f504 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 11 Dec 2018 13:25:33 +0100 Subject: [PATCH 4/9] 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/9] 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/9] 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/9] 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; } } From 539e2c55cdc4245514bfd6eca1469372c5126772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 10:31:09 +0100 Subject: [PATCH 8/9] FIX #9629 #9625 --- htdocs/accountancy/bookkeeping/list.php | 1 - htdocs/core/lib/functions.lib.php | 17 ++++++++++------ htdocs/main.inc.php | 26 +++++++++++++++++++++---- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b0a91f7ce36..476df6d3cab 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -621,7 +621,6 @@ if ($num > 0) $object->id = $line->id; $object->piece_num = $line->piece_num; print $object->getNomUrl(1,'',0,'',1); - //print '' . $line->piece_num . ''; print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 90167504f3f..b9685a043d0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -321,13 +321,18 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu } } } - if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage + // If there is saved contextpage, page or limit + if ($paramname == 'contextpage' && ! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { - if ($paramname == 'contextpage') - { - $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; - //var_dump($paramname.' '.$out); - } + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; + } + elseif ($paramname == 'page' && ! empty($_SESSION['lastsearch_page_'.$relativepathstring])) + { + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; + } + elseif ($paramname == 'limit' && ! empty($_SESSION['lastsearch_limit_'.$relativepathstring])) + { + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; } } // Else, retreive default values if we are not doing a sort diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 826f83356c4..0e586e6f4a4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -723,18 +723,27 @@ if (! defined('NOLOGIN')) $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); //var_dump($relativepathstring); - // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp + // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); } - // We also save contextpage if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) { $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); } + if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) + { + $_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); + } + if (! empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) + { + $_SESSION['lastsearch_limit_'.$relativepathstring]=$_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); + } } $action = ''; @@ -1951,7 +1960,8 @@ if (! function_exists("llxFooter")) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) { global $conf, $langs, $user, $object; - global $delayedhtmlcontent, $contextpage; + global $delayedhtmlcontent; + global $contextpage, $page, $limit; $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); @@ -1986,8 +1996,16 @@ if (! function_exists("llxFooter")) if (preg_match('/list\.php$/', $relativepathstring)) { unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); - if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); + + if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + if (! empty($page) && $page > 1) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page; + if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit; + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); + unset($_SESSION['lastsearch_page_'.$relativepathstring]); + unset($_SESSION['lastsearch_limit_'.$relativepathstring]); } // Core error message From 37daface196feb545a13a7ddcbded2d8fe915155 Mon Sep 17 00:00:00 2001 From: PMickael Date: Fri, 14 Dec 2018 16:17:25 +0100 Subject: [PATCH 9/9] [Accounting][VAT] Fix balance should be based on period [Accounting][VAT] Fix balance should be based on period --- htdocs/compta/tva/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 7c4912411f6..2fdd1591ead 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -561,12 +561,11 @@ if (! empty($conf->global->MAIN_FEATURES_LEVEL)) print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation - $sql1 = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y') as dm"; + $sql1 = "SELECT SUM(amount) as mm"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f"; $sql1 .= " WHERE f.entity = " . $conf->entity; $sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'"; $sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'"; - $sql1 .= " GROUP BY dm ORDER BY dm ASC"; $result = $db->query($sql1); if ($result) {