From 44746c1899ceddd876f6a775a7e80455ca723691 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 15 Apr 2016 13:46:20 +0200 Subject: [PATCH 01/14] Merge remote-tracking branch 'upstream/3.8' into 3.9 Conflicts: htdocs/compta/localtax/quadri_detail.php --- htdocs/compta/localtax/quadri_detail.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index a4eaccba35b..925ca7fc592 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -220,9 +220,9 @@ else foreach(array_keys($x_coll) as $my_coll_rate) { $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; - $x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat']; + $x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local]; $x_both[$my_coll_rate]['paye']['totalht'] = 0; - $x_both[$my_coll_rate]['paye']['vat'] = 0; + $x_both[$my_coll_rate]['paye']['localtax'.$local] = 0; $x_both[$my_coll_rate]['coll']['links'] = ''; $x_both[$my_coll_rate]['coll']['detail'] = array(); foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) From 66c73015b2aa8de2f43e494fafe9a1bb84e2f7c8 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 3 Jun 2016 23:58:54 +0200 Subject: [PATCH 02/14] Fix issues with strict mode --- htdocs/compta/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ea154303d20..37999567738 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2015-2016 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García @@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement"; $sql.= " ORDER BY ff.date_lim_reglement ASC"; $resql=$db->query($sql); From ff6daebee68dd457544e7833854bb0be15355abb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jun 2016 01:19:27 +0200 Subject: [PATCH 03/14] FIX #5203 --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index f41a4b4e69a..30381c8c39d 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -277,7 +277,7 @@ class ProductFournisseur extends Product $error++; } - if (! $error && !empty($cong->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) + if (! $error && !empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { // Add record into log table $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log("; From a1c7632a501502efbe248f9c8d092404257af7f9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 01:28:51 +0200 Subject: [PATCH 04/14] Fix import mapping #5229 --- htdocs/imports/import.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c6fe3094b68..d2d0540ee80 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -617,6 +617,10 @@ if ($step == 4 && $datatoimport) $obj->separator = $separator; $obj->enclosure = $enclosure; } + + if(!empty(GETPOST('update'))) { + $array_match_file_to_database=array(); + } // Load source fields in input file $fieldssource=array(); @@ -738,7 +742,7 @@ if ($step == 4 && $datatoimport) print ''; print '    '.$langs->trans("Enclosure").' : '; print ''; - print ''; + print ''; print ''; print ''; } From 32b6766a7d560d7c47a042f363709588b8124ae7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jun 2016 01:50:01 +0200 Subject: [PATCH 05/14] FIX #5195 --- htdocs/fourn/commande/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a0cf8bc11bb..a9a4024c3ae 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1006,7 +1006,6 @@ if (empty($reshook)) } $idprod = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); - $res = $productsupplier->fetch($idProductFourn); $result = $object->addline( $desc, @@ -1017,7 +1016,7 @@ if (empty($reshook)) $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id, - $productsupplier->ref_fourn, + $productsupplier->fourn_ref, $lines[$i]->remise_percent, 'HT', 0, From c9834117c9999c6b2c825caea83e70d8d77e4d39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jun 2016 02:03:30 +0200 Subject: [PATCH 06/14] Fix #5156 --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a60b3ddb21b..aaa1085e377 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -149,6 +149,7 @@ Save=Save SaveAs=Save As TestConnection=Test connection ToClone=Clone +ConfirmCloneAction=Are you sure you want to clone this event ? ConfirmClone=Choose data you want to clone : NoCloneOptionsSpecified=No data to clone defined. Of=of From 01b881a0a692cb3d708c1471155b3539a40c4c96 Mon Sep 17 00:00:00 2001 From: phf Date: Sat, 4 Jun 2016 13:24:42 +0200 Subject: [PATCH 07/14] Fix builddoc with odt lost value of extrafields as "sellist" on view card --- .../modules/propale/doc/doc_generic_proposal_odt.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index d696d95c4d5..2479acaaaec 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -381,6 +381,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); + $object->fetch_optionals(); // Call the ODTSubstitution hook $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks From bd2fe75d08dde06f130a1e8408f0992458747b4a Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 14:45:03 +0200 Subject: [PATCH 08/14] Fix menus in dashboard links --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 939054a06eb..74ee7488f56 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2528,7 +2528,7 @@ class Propal extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->img = img_object($langs->trans("Propals"),"propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 47219049a91..a853ad49fec 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2910,7 +2910,7 @@ class Commande extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); - $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; $response->img=img_object($langs->trans("Orders"),"order"); while ($obj=$this->db->fetch_object($resql)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dc62189be87..6633f196eed 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3264,7 +3264,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); - $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1'; + $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); while ($obj=$this->db->fetch_object($resql)) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a24091c4f97..361ce27a494 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -753,8 +753,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->facture->enabled)) { $langs->load("bills"); - $newmenu->add("/compta/facture/list.php",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); - $newmenu->add("/compta/facture.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); + $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire); if (empty($leftmenu) || ($leftmenu == 'customers_bills')) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e7777f82cd5..31ff52886c6 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2318,7 +2318,7 @@ class CommandeFournisseur extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); - $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3'; + $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3&mainmenu=commercial&leftmenu=orders_suppliers'; $response->img=img_object($langs->trans("Orders"),"order"); while ($obj=$this->db->fetch_object($resql)) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a4799bc53fe..9a57f9c0253 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1440,7 +1440,7 @@ class FactureFournisseur extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); - $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0'; + $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); while ($obj=$this->db->fetch_object($resql)) From 8ccda16ef370e86ee801d3e3790c43ead1625f29 Mon Sep 17 00:00:00 2001 From: phf Date: Sat, 4 Jun 2016 14:50:32 +0200 Subject: [PATCH 09/14] Fix call function ldap_connect but not exists --- htdocs/core/class/ldap.class.php | 106 +++++++++++++++++-------------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index ca0cbab3925..85cb36f31f2 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -159,50 +159,41 @@ class Ldap dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING); } - // Loop on each ldap server - foreach ($this->server as $key => $host) + if (! function_exists("ldap_connect")) { - if ($connected) break; - if (empty($host)) continue; + $this->error='LDAPFunctionsNotAvailableOnPHP'; + $return=-1; + dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING); + } - if (preg_match('/^ldap/',$host)) + if (empty($this->error)) + { + // Loop on each ldap server + foreach ($this->server as $key => $host) { - $this->connection = ldap_connect($host); - } - else - { - $this->connection = ldap_connect($host,$this->serverPort); - } - - if (is_resource($this->connection)) - { - // Execute the ldap_set_option here (after connect and before bind) - $this->setVersion(); - ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. - - - if ($this->serverType == "activedirectory") + if ($connected) break; + if (empty($host)) continue; + + if (preg_match('/^ldap/',$host)) { - $result=$this->setReferrals(); - dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); - $this->result=$this->bindauth($this->searchUser,$this->searchPassword); - if ($this->result) - { - $this->bind=$this->result; - $connected=2; - break; - } - else - { - $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); - } + $this->connection = ldap_connect($host); } else { - // Try in auth mode - if ($this->searchUser && $this->searchPassword) + $this->connection = ldap_connect($host,$this->serverPort); + } + + if (is_resource($this->connection)) + { + // Execute the ldap_set_option here (after connect and before bind) + $this->setVersion(); + ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. + + + if ($this->serverType == "activedirectory") { - dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); + $result=$this->setReferrals(); + dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); $this->result=$this->bindauth($this->searchUser,$this->searchPassword); if ($this->result) { @@ -215,26 +206,45 @@ class Ldap $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); } } - // Try in anonymous - if (! $this->bind) + else { - dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG); - $result=$this->bind(); - if ($result) + // Try in auth mode + if ($this->searchUser && $this->searchPassword) { - $this->bind=$this->result; - $connected=1; - break; + dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); + $this->result=$this->bindauth($this->searchUser,$this->searchPassword); + if ($this->result) + { + $this->bind=$this->result; + $connected=2; + break; + } + else + { + $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + } } - else + // Try in anonymous + if (! $this->bind) { - $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG); + $result=$this->bind(); + if ($result) + { + $this->bind=$this->result; + $connected=1; + break; + } + else + { + $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + } } } } + + if (! $connected) $this->close(); } - - if (! $connected) $this->close(); } if ($connected) From a62f5bd5b4d5729910368cc84e3f60a71d21fd44 Mon Sep 17 00:00:00 2001 From: phf Date: Sat, 4 Jun 2016 17:17:22 +0200 Subject: [PATCH 10/14] Fix #2777 --- htdocs/core/lib/admin.lib.php | 7 +++++++ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 8 insertions(+) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index dd1615d7427..3a7485350ce 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -732,17 +732,24 @@ function activateModule($value,$withdeps=1) if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) { // Activation des modules dont le module depend + $TError=array(); $num = count($objMod->depends); for ($i = 0; $i < $num; $i++) { + $activate = false; foreach ($modulesdir as $dir) { if (file_exists($dir.$objMod->depends[$i].".class.php")) { activateModule($objMod->depends[$i]); + $activate = true; } } + + if (!$activate) $TError[] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $objMod->depends[$i]); } + + setEventMessages('', $TError, 'errors'); } if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith)) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5966578021a..925c822cfcf 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1563,3 +1563,4 @@ TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both custome IncludePath=Include path (defined into variable %s) NoModueToManageStockDecrease=No module able to manage automatic stock decrease has been activated. Stock decrease will be done on manual input only. NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only. +activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise \ No newline at end of file From 3ef9fe2c40fed0bf33a43f96456b2d056ac24ae8 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 18:10:40 +0200 Subject: [PATCH 11/14] Fix product supplier price modification with multicompany --- htdocs/core/class/html.form.class.php | 2 +- htdocs/fourn/class/fournisseur.product.class.php | 2 +- htdocs/product/class/product.class.php | 4 ++-- htdocs/product/fournisseurs.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8fb0118cd2e..64ec3d4afdd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2278,7 +2278,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; - $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; + $sql.= " WHERE p.entity IN (".getEntity('productprice', 1).")"; $sql.= " AND p.tobuy = 1"; $sql.= " AND s.fournisseur = 1"; $sql.= " AND p.rowid = ".$productid; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 9c889a97d97..f64ef0e1d95 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -433,7 +433,7 @@ class ProductFournisseur extends Product $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits, pfp.delivery_time_days"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")"; + $sql.= " WHERE pfp.entity IN (".getEntity('productprice', 1).")"; $sql.= " AND pfp.fk_soc = s.rowid"; $sql.= " AND pfp.fk_product = ".$prodid; if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ba2eac00cd9..79c21cfcbdf 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2631,7 +2631,7 @@ class Product extends CommonObject $sql.= " WHERE fk_soc = ".$id_fourn; $sql.= " AND ref_fourn = '".$this->db->escape($ref_fourn)."'"; $sql.= " AND fk_product != ".$this->id; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('productprice', 1).")"; dol_syslog(get_class($this)."::add_fournisseur", LOG_DEBUG); $resql=$this->db->query($sql); @@ -2655,7 +2655,7 @@ class Product extends CommonObject else $sql.= " AND (ref_fourn = '' OR ref_fourn IS NULL)"; $sql.= " AND quantity = '".$quantity."'"; $sql.= " AND fk_product = ".$this->id; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('productprice', 1).")"; dol_syslog(get_class($this)."::add_fournisseur", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2665ae8fd1e..a03c5f5b755 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -152,7 +152,7 @@ if (empty($reshook)) { $error++; $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("VATRateForSupplierProduct")), null, 'errors'); } if (empty($quantity)) { From abe84ef991a0ddb1e84dee192360897aa1229ace Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 18:32:00 +0200 Subject: [PATCH 12/14] Fix rights check on expense reports --- htdocs/expensereport/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index fed76abed07..0c86da36936 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -805,7 +805,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) } } -if ($action == "addline") +if ($action == "addline" && $user->rights->expensereport->creer) { $error = 0; @@ -896,7 +896,7 @@ if ($action == "addline") $action=''; } -if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes") +if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes" && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -939,7 +939,7 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes") } } -if ($action == "updateligne" ) +if ($action == "updateligne" && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -1647,7 +1647,7 @@ else print ''.$langs->trans('AmountTTC').''; } // Ajout des boutons de modification/suppression - if ($object->fk_statut < 2 || $object->fk_statut==99) + if (($object->fk_statut < 2 || $object->fk_statut==99) && $user->rights->expensereport->creer) { print ''; } @@ -1690,7 +1690,7 @@ else } // Ajout des boutons de modification/suppression - if($object->fk_statut<2 OR $object->fk_statut==99) + if(($object->fk_statut<2 OR $object->fk_statut==99) && $user->rights->expensereport->creer) { print ''; print 'rowid.'#'.$objp->rowid.'">'; @@ -1770,7 +1770,7 @@ else //print ''; // Add a line - if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') + if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer) { print_fiche_titre($langs->trans("AddLine"),'',''); From 7866fb9dae68ddf0218b8f20005bb4c1fd1a01a0 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 4 Jun 2016 19:11:32 +0200 Subject: [PATCH 13/14] Fix #5153 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index db227ae4cf6..fb577674b64 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -431,7 +431,7 @@ function dol_size($size,$type='') */ function dol_sanitizeFileName($str,$newstr='_',$unaccent=1) { - $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"'); + $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"','°'); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars); } From a5472b58d1584caeae067e2bee7dc9bd6367606b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 5 Jun 2016 00:24:00 +0200 Subject: [PATCH 14/14] FIX #5108 --- htdocs/core/ajax/ajaxdirpreview.php | 5 ++++- htdocs/ecm/index.php | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 997e27adb20..f1352f8e933 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -240,7 +240,10 @@ if ($section) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $useglobalvars=1; $form = new Form($db); - $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile')); + $formquestion=array( + 'urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'), + 'section'=>array('type'=>'hidden','value'=>$section,'name'=>'section') + ); print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0)); } diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index e3fa4ece95d..797e759fb13 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -175,10 +175,9 @@ if ($action == 'confirm_deletefile') dol_print_error($db,$ecmdir->error); exit; } - $relativepath=$ecmdir->getRelativePath(); } else $relativepath=''; - $upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:''); + $upload_dir = $conf->ecm->dir_output; $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP). $ret=dol_delete_file($file);