From 50184babb95a19ff01efb76696b3e3b60441af8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 1 Sep 2015 16:38:53 +0200 Subject: [PATCH 01/14] FIX [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask Close #2893 --- htdocs/compta/facture/class/facture.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f5a7c27ecd1..72103f6ac5a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2558,15 +2558,16 @@ class Facture extends CommonInvoice $numref = ""; $numref = $obj->getNextValue($soc,$this,$mode); - if ($numref != "") - { - return $numref; - } - else - { + /** + * $numref can be empty in case we ask for the last value because if there is no invoice created with the + * set up mask. + */ + if ($mode != 'last' && !$numref) { dol_print_error($db,"Facture::getNextNumRef ".$obj->error); return ""; } + + return $numref; } else { From bd21cf5d68c764f989e1fbea8a5125d0ca6c8290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 3 Sep 2015 11:58:20 +0200 Subject: [PATCH 02/14] Updated changelog --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0291eeb3a21..a612e867ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.4 compared to 3.6.3 ***** +- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask + ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service - Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid. @@ -43,6 +46,7 @@ English Dolibarr ChangeLog - Fix: Not showing product supplier reference when page break - Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php - Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate +- Fix: [ bug ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. From 7a115c9366ea56e2239738e4cc023d17d96d6876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 3 Sep 2015 11:59:46 +0200 Subject: [PATCH 03/14] Typo --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a612e867ecb..f83979aa8e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,6 @@ English Dolibarr ChangeLog - Fix: Not showing product supplier reference when page break - Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php - Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate -- Fix: [ bug ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. From 8076ea85eab97f6c27859de0ed0b28f7ab8faf50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Sep 2015 20:07:17 +0200 Subject: [PATCH 04/14] 3.6.4 was packaged --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 73f3ae3e77a..0e23287ac31 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.5'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From 52cb9581ff0446e36300849ccfbd2470cf0d69fb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 8 Sep 2015 16:00:13 +0200 Subject: [PATCH 05/14] Fix multientity stock management --- htdocs/product/class/html.formproduct.class.php | 2 +- htdocs/product/stock/liste.php | 2 +- htdocs/product/stock/product.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index bd302c422d9..8becd6c38ba 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -72,7 +72,7 @@ class FormProduct $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid"; $sql.= " AND ps.fk_product = '".$fk_product."'"; } - $sql.= " WHERE e.entity = ".$conf->entity; + $sql.= " WHERE e.entity IN (".getEntity('stock',1).")"; $sql.= " AND e.statut = 1"; $sql.= " ORDER BY e.label"; diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index a639bd86239..a4220be092d 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -47,7 +47,7 @@ $offset = $limit * $page; $sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; -$sql.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('stock',1).")"; if ($sref) { $sql.= " AND e.label like '%".$db->escape($sref)."%'"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 0241c0d4dcf..6b08dd16ecf 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -583,7 +583,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; -$sql.= " AND e.entity = ".$conf->entity; +$sql.= " AND e.entity IN (".getEntity('stock',1).")"; $sql.= " AND ps.fk_product = ".$product->id; $sql.= " ORDER BY e.label"; From 63a817c3a4d368beaff46e3bd72a456409446342 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 8 Sep 2015 16:13:15 +0200 Subject: [PATCH 06/14] Fix wahrehouse multientty management --- htdocs/product/stock/index.php | 4 ++-- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/valo.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index da52a5aac58..667c32346f5 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -64,7 +64,7 @@ print "
"; $sql = "SELECT e.label, e.rowid, e.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " WHERE e.statut in (0,1)"; -$sql.= " AND e.entity = ".$conf->entity; +$sql.= " AND e.entity IN (".getEntity('stock',1).")"; $sql.= $db->order('e.statut','DESC'); $sql.= $db->plimit(15, 0); @@ -119,7 +119,7 @@ $sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE m.fk_product = p.rowid"; $sql.= " AND m.fk_entrepot = e.rowid"; -$sql.= " AND e.entity = ".$conf->entity; +$sql.= " AND e.entity IN (".getEntity('stock',1).")"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; $sql.= $db->order("datem","DESC"); $sql.= $db->plimit($max,0); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 8794b00137d..e94df443702 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -129,7 +129,7 @@ $sql.= " ".MAIN_DB_PREFIX."stock_mouvement as m)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid"; $sql.= " WHERE m.fk_product = p.rowid"; $sql.= " AND m.fk_entrepot = e.rowid"; -$sql.= " AND e.entity = ".$conf->entity; +$sql.= " AND e.entity IN (".getEntity('stock',1).")"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; if ($id) { diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 17e23fef009..75b85af00fa 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -57,7 +57,7 @@ $sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sell $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; -$sql.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('stock',1).")"; if ($sref) { $sql.= " AND e.ref LIKE '%".$sref."%'"; From 355fcc78cf2fae81ebcc8aea7a86fadea9f803be Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 8 Sep 2015 20:48:31 +0200 Subject: [PATCH 07/14] Fix #3475 RemiseCheque: Undefined variable $date --- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 917c88e0743..f469b48fdde 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2015 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 @@ -744,7 +744,6 @@ class RemiseCheque extends CommonObject $resql=$this->db->query($sql); if ($resql) { - $this->date_bordereau = $date; return 1; } else From 8bdfdc0127ceabb2c1af3c4003ab9dbb08d62612 Mon Sep 17 00:00:00 2001 From: fappels Date: Thu, 10 Sep 2015 23:12:27 +0200 Subject: [PATCH 08/14] Fix #3471 3.5 Rounding issue when dispatching non-integer --- htdocs/fourn/commande/dispatch.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4bc7a22b06b..97f0cad96d8 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -229,9 +229,17 @@ if ($id > 0 || ! empty($ref)) $resql = $db->query($sql); if ($resql) { - while ( $row = $db->fetch_row($resql) ) + $num = $db->num_rows($resql); + $i = 0; + + if ($num) { - $products_dispatched[$row[0]] = $row[1]; + while ($i < $num) + { + $objd = $db->fetch_object($resql); + $products_dispatched[$objd->fk_product] = price2num($objd->qty, 5); + $i++; + } } $db->free($resql); } @@ -277,7 +285,7 @@ if ($id > 0 || ! empty($ref)) } else { - $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched + $remaintodispatch=(price2num($objp->qty, 5) - $products_dispatched[$objp->fk_product]); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch=0; if ($remaintodispatch) { From c6081f0fa2063324f9b040742ab6181bd3be3ceb Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 11 Sep 2015 20:38:32 +0200 Subject: [PATCH 09/14] Fix multientity stock management (F.Henry followup) --- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 13fc195ff06..41c73a227a4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2994,7 +2994,7 @@ class Product extends CommonObject $sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp, ps.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as w"; - $sql.= " WHERE w.entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE w.entity IN (".getEntity('stock', 1).")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 61c88abcaa5..b65c01f6840 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -358,7 +358,7 @@ class Entrepot extends CommonObject $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE entity IN (".getEntity('stock', 1).")"; $sql.= " AND statut = ".$status; $result = $this->db->query($sql); From 453ed8a05e757cfc38d308abe8d8c9da526738a1 Mon Sep 17 00:00:00 2001 From: Alexis ALGOUD Date: Mon, 28 Sep 2015 15:36:27 +0200 Subject: [PATCH 10/14] FIX error in SQL due to a previous fix --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index dd8c88162a5..c4989b3c087 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -448,7 +448,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined'); - $sql = "SELECT dbt.id"; + $sql = "SELECT dbt.".$dbt_keyfield; $sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (dbt.".$dbt_keyfield." = s.rowid)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON (sc.fk_soc = dbt.".$dbt_keyfield.")"; From 0b7305d21a6053f3c5d57593ed16fa01f05c69e1 Mon Sep 17 00:00:00 2001 From: arnaud Date: Mon, 28 Sep 2015 16:52:46 +0200 Subject: [PATCH 11/14] FIX facturestat bad sql when customer view is limited --- htdocs/compta/facture/class/facturestats.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 5d8d22cfa9d..5a9493b83b0 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -168,7 +168,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")"; $sql.= " FROM ".$this->from; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; @@ -188,7 +188,7 @@ class FactureStats extends Stats $sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg"; $sql.= " FROM ".$this->from; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " GROUP BY year"; $sql.= $this->db->order('year','DESC'); From 4da8fb901b0d28385fb5f94dd52f412b8c1e15fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2015 10:48:09 +0200 Subject: [PATCH 12/14] Add comment --- htdocs/comm/propal/class/propalestats.class.php | 2 +- htdocs/commande/class/commandestats.class.php | 2 +- htdocs/compta/facture/class/facturestats.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index dc8501c37ba..c56bb753ade 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -48,7 +48,7 @@ class PropaleStats extends Stats * Constructor * * @param DoliDB $db Database handler - * @param int $socid Id third party for filter + * @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user. * @param int $userid Id user for filter (creation user) */ function __construct($db, $socid=0, $userid=0) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 312e958a38e..1ab418a9daa 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -48,7 +48,7 @@ class CommandeStats extends Stats * Constructor * * @param DoliDB $db Database handler - * @param int $socid Id third party for filter + * @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user. * @param string $mode Option ('customer', 'supplier') * @param int $userid Id user for filter (creation user) */ diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 5d8d22cfa9d..17589145726 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -45,7 +45,7 @@ class FactureStats extends Stats * Constructor * * @param DoliDB $db Database handler - * @param int $socid Id third party for filter + * @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user. * @param string $mode Option ('customer', 'supplier') * @param int $userid Id user for filter (creation user) */ From bf262c2cae6dd7369bb830bcab3aa393789b76fe Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 5 Oct 2015 15:41:28 +0200 Subject: [PATCH 13/14] reenable search criteria in sql clause --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8ce0a1b3b45..b46540ad6d9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -753,7 +753,7 @@ class ExtraFields $sqlwhere.= ' WHERE 1'; } if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. - //$sql.=preg_replace('/^ AND /','',$sqlwhere); + $sql.=preg_replace('/^ AND /','',$sqlwhere); //print $sql; dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql); From 3f8e9bd1810450d05974d770fdf64d8707139273 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Oct 2015 19:24:31 +0200 Subject: [PATCH 14/14] Remove warning --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index a8502498e41..2803c2d06ad 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -299,7 +299,7 @@ if ($result) if (empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; - if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); + if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); else print price($objp->price).' '.$langs->trans("HT"); print ''; }