From 63b15dd1b643d01235685220712499ae6f54f320 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 3 Aug 2020 11:17:30 +0200 Subject: [PATCH 01/49] Fix: User can see events that are not assigned to it --- htdocs/core/lib/security.lib.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1a8045df014..ed0424d8968 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2008-2017 Regis Houssin + * Copyright (C) 2020 Ferran Marcet * * 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 @@ -247,6 +248,26 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { if (! $user->rights->projet->lire && ! $user->rights->projet->all->lire) { $readok=0; $nbko++; } } + elseif ($feature == 'agenda') + { + if ($objectid > 0) { + require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; + $action = new ActionComm($db); + $action->fetch($objectid); + if (empty($user->rights->agenda->allactions->read) && (($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, + $action->userassigned))) || empty($user->rights->agenda->myactions->read))) { + $readok = 0; + $nbko++; + } + } + else{ + if (empty($user->rights->agenda->myactions->read) && empty($user->rights->agenda->allactions->read)) { + $readok = 0; + $nbko++; + } + } + + } elseif (! empty($feature2)) // This is for permissions on 2 levels { $tmpreadok=1; From 9926eac1926877bc97e3ceab8376053e48a098f0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 3 Aug 2020 09:26:36 +0000 Subject: [PATCH 02/49] Fixing style errors. --- htdocs/core/lib/security.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index ed0424d8968..e4dde96b464 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -266,7 +266,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f $nbko++; } } - } elseif (! empty($feature2)) // This is for permissions on 2 levels { From 7a077a2d9934e2cdababc6c610c7b8b2d1d21dc5 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 4 Aug 2020 16:45:04 +0200 Subject: [PATCH 03/49] Fix: User can see events that are not assigned to it --- htdocs/core/lib/security.lib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e4dde96b464..41534d8aac3 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -576,6 +576,18 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } + + if ($feature == 'agenda')// Also check myactions rights + { + if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) { + require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; + $action = new ActionComm($db); + $action->fetch($objectid); + if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id,$action->userassigned))) { + return false; + } + } + } } elseif (in_array($feature, $checkproject)) { From 70ad2fcee074bbd1947f067d508d3e5c1fe4eb85 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 4 Aug 2020 16:45:57 +0200 Subject: [PATCH 04/49] Fix: User can see events that are not assigned to it --- htdocs/core/lib/security.lib.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 41534d8aac3..f9db2a0e796 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -248,25 +248,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { if (! $user->rights->projet->lire && ! $user->rights->projet->all->lire) { $readok=0; $nbko++; } } - elseif ($feature == 'agenda') - { - if ($objectid > 0) { - require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; - $action = new ActionComm($db); - $action->fetch($objectid); - if (empty($user->rights->agenda->allactions->read) && (($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, - $action->userassigned))) || empty($user->rights->agenda->myactions->read))) { - $readok = 0; - $nbko++; - } - } - else{ - if (empty($user->rights->agenda->myactions->read) && empty($user->rights->agenda->allactions->read)) { - $readok = 0; - $nbko++; - } - } - } elseif (! empty($feature2)) // This is for permissions on 2 levels { $tmpreadok=1; From 8d8821743471e1359bd9f5d6da720c0f6ed4d2a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 4 Aug 2020 14:48:15 +0000 Subject: [PATCH 05/49] Fixing style errors. --- 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 f9db2a0e796..804414d04df 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -564,7 +564,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; $action = new ActionComm($db); $action->fetch($objectid); - if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id,$action->userassigned))) { + if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) { return false; } } From 10df9777b54154a30a64652c941e1e5176e60dce Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 10 Aug 2020 09:53:20 +0200 Subject: [PATCH 06/49] FIX: Visualization rights correction on last modified contacts box --- htdocs/core/boxes/box_contacts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index caea252c571..7141728c23d 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -94,7 +94,7 @@ class box_contacts extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid; $sql .= " ORDER BY sp.tms DESC"; $sql .= $this->db->plimit($max, 0); From f014365b650c31d34b250038d69115e4a2d11727 Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 10 Aug 2020 10:35:50 +0200 Subject: [PATCH 07/49] Fix lang fr --- htdocs/langs/fr_FR/main.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 611d27d7723..ff74af2ad5c 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -353,8 +353,8 @@ PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture AmountInvoiced=Montant facturé -AmountInvoicedHT=Montant facturé (TTC) -AmountInvoicedTTC=Montant facturé (HT) +AmountInvoicedHT=Montant facturé (HT) +AmountInvoicedTTC=Montant facturé (TTC) AmountPayment=Montant paiement AmountHTShort=Montant HT AmountTTCShort=Montant TTC From 990217fcb00b5354c9853b79fe9254094231b019 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 13 Aug 2020 16:59:27 +0200 Subject: [PATCH 08/49] FIX : task leftmenu --- htdocs/core/menus/standard/eldy.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6d8aa401a5..78d3d8d91b8 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -531,6 +531,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = } if (empty($noout)) { + 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)); @@ -540,6 +541,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $showmode = 1; if (empty($noout)) { + print_start_menu_entry('', 'class="tmenuend"', $showmode); print_end_menu_entry($showmode); print_end_menu_array(); @@ -1706,7 +1708,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Project affected to user - $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire); + $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks'); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); From d784c621c99d64c600309c84da3cada8c9d8e46e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 13 Aug 2020 15:07:06 +0000 Subject: [PATCH 09/49] Fixing style errors. --- htdocs/core/menus/standard/eldy.lib.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 78d3d8d91b8..ca7220037a5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -531,7 +531,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = } if (empty($noout)) { - 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)); @@ -541,7 +540,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $showmode = 1; if (empty($noout)) { - print_start_menu_entry('', 'class="tmenuend"', $showmode); print_end_menu_entry($showmode); print_end_menu_array(); From f385e02c5317baa7464ef80c2d8eb018adc9e06b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 13 Aug 2020 17:43:18 +0200 Subject: [PATCH 10/49] FIX title button attribute id empty --- 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 1f7c08c8d7a..97ad5d58969 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8258,7 +8258,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $attr['class'] .= ' classfortooltip'; } - if(empty($id)){ + if(!empty($id)){ $attr['id'] = $id; } From d35c7ed49b6322053e8abd3ddf8a64e5260fd86e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Aug 2020 11:03:12 +0200 Subject: [PATCH 11/49] Fix trans --- htdocs/langs/en_US/main.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 051dde11ff7..e7c35f6d9f7 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -353,8 +353,8 @@ PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount AmountInvoiced=Amount invoiced -AmountInvoicedHT=Amount invoiced (incl. tax) -AmountInvoicedTTC=Amount invoiced (excl. tax) +AmountInvoicedHT=Amount invoiced (excl. tax) +AmountInvoicedTTC=Amount invoiced (inc. tax) AmountPayment=Payment amount AmountHTShort=Amount (excl.) AmountTTCShort=Amount (inc. tax) From 52f20a1047acda7d13dca7d8fe6fdbf69b560fdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Aug 2020 11:52:21 +0200 Subject: [PATCH 12/49] Fix travis --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 40c37d4dd93..fe44c7393ba 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -755,7 +755,8 @@ class Categorie extends CommonObject { $objs = array(); - $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); + $classnameforobj = $this->MAP_OBJ_CLASS[$type]; + $obj = new $classnameforobj($this->db); $sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type]; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c"; From fe0b1c5ee49b2f8e41a088cac8ac8138a4360f4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Aug 2020 11:53:54 +0200 Subject: [PATCH 13/49] Fix travis --- htdocs/categories/class/categorie.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index fe44c7393ba..b0bcbadc010 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -777,7 +777,9 @@ class Categorie extends CommonObject } else { - $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); + $classnameforobj = $this->MAP_OBJ_CLASS[$type]; + + $obj = new $classnameforobj($this->db); $obj->fetch($rec['fk_' . $this->MAP_CAT_FK[$type]]); $objs[] = $obj; } From d5acc85ef08f8f4fd113ab441c5da13568f37d48 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 14 Aug 2020 12:18:28 +0200 Subject: [PATCH 14/49] FIX param entity in html form file --- htdocs/core/class/html.formfile.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2508ebce5ca..53e19a560f0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -352,7 +352,9 @@ class FormFile // Add entity in $param if not already exists if (!preg_match('/entity\=[0-9]+/', $param)) { - $param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); + $paramEntity = 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); + if (!empty($param)) $paramEntity = '&' .$paramEntity; + $param .= $paramEntity; } $printer=0; From 6e1702c1a5c40e486bc8dfa3af757bbd23a92b4d Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 17 Aug 2020 15:00:31 +0200 Subject: [PATCH 15/49] Fix infinite fetch object linked loop --- htdocs/core/lib/pdf.lib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1d9d218f7af..3c6bf0765ed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2127,8 +2127,13 @@ function pdf_getLinkedObjects($object,$outputlangs) // We concat this record info into fields xxx_value. title is overwrote. if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order { - $elementobject->fetchObjectLinked(); - if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); + $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); + if (! empty($elementobject->linkedObjectsIds['commande'])){ + dol_include_once('/commande/commande.class.php'); + $order = new Commande($object->db); + $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); + if ($ret < 1){ $order=null; } + } } if (! is_object($order)) { From d21bda604d88d856924589c03acb3d85c870402b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Aug 2020 15:27:17 +0200 Subject: [PATCH 16/49] FIX Setup of stock increase/decrease --- htdocs/admin/stock.php | 49 +++++++++++++++++++++++------------- htdocs/core/lib/ajax.lib.php | 7 +++--- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f2fa67eba57..67596fc9193 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -41,12 +41,31 @@ $action = GETPOST('action', 'alpha'); /* * Action */ + +$reg = array(); + if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $code=$reg[1]; + + // If constant is for a unique choice, delete other choices + if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) { + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity); + } + if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) { + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity); + dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity); + } + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { - header("Location: ".$_SERVER["PHP_SELF"]); + header("Location: ".$_SERVER["PHP_SELF"]); exit; } else @@ -114,7 +133,7 @@ print ''; if (! empty($conf->facture->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); + print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); @@ -134,7 +153,7 @@ print ''; if (! empty($conf->commande->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); @@ -156,7 +175,7 @@ print ''; if (! empty($conf->expedition->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); @@ -176,7 +195,7 @@ print ''; if (! empty($conf->expedition->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); @@ -189,18 +208,12 @@ else print "\n\n"; $found++; -/*if (! $found) -{ - - print ''; - print ''.$langs->trans("NoModuleToManageStockDecrease").''; - print "\n"; -}*/ - print ''; + print '
'; + // Title rule for stock increase print ''; print ''; @@ -216,7 +229,7 @@ print ''; print ''; print ''; print ''; From 06d31e8b9a6294c412bca51b35eed3335724bb45 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 26 Aug 2020 16:02:31 +0200 Subject: [PATCH 41/49] FIX: missing entity check --- htdocs/compta/prelevement/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 468d4807c65..ab1635a22b5 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -179,6 +179,7 @@ print '
'; $limit=5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")"; $sql.= " ORDER BY datec DESC"; $sql.= $db->plimit($limit); From 31825375669329ac6006ae664af2645862b906cc Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 16 Sep 2020 17:19:25 +0200 Subject: [PATCH 42/49] FIX - Send mail from contact : select mail model --- htdocs/contact/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f013cd7e8aa..ec8d64fcede 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1176,6 +1176,11 @@ else } } + // Select mail models is same action as presend + if (GETPOST('modelselected', 'alpha')) { + $action = 'presend'; + } + if (! empty($id) && $action != 'edit' && $action != 'create') { $objsoc = new Societe($db); From 23c4cfe913429a38b3e4f9edec33bdfb0166d274 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Sep 2020 20:55:28 +0200 Subject: [PATCH 43/49] FIX Yogosha report 4425 (backport) --- htdocs/core/lib/functions.lib.php | 37 ++++++++++++++++++++++++------- htdocs/document.php | 9 ++++---- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 97ad5d58969..3f4229589dd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7705,19 +7705,16 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param if (empty($conf->use_javascript_ajax)) return ''; - $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml'); - //$mime_preview[]='vnd.oasis.opendocument.presentation'; - //$mime_preview[]='archive'; - $num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview); + $isAllowedForPreview = dolIsAllowedForPreview($relativepath); if ($alldata == 1) { - if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), ); + if (isAllowedForPreview) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), ); else return array(); } - // old behavior - if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:'')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; + // old behavior, return a string + if ($isAllowedForPreview) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:'')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; else return ''; } @@ -7741,6 +7738,30 @@ function ajax_autoselect($htmlname, $addlink = '') return $out; } +/** + * Return if a file is qualified for preview + * + * @param string $file Filename we looking for information + * @return int 1 If allowed, 0 otherwise + * @see dol_mimetype(), image_format_supported() from images.lib.php + */ +function dolIsAllowedForPreview($file) { + global $conf; + + // Check .noexe extension in filename + if (preg_match('/\.noexe$/i', $file)) return 0; + + // Check mime types + $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'webp'); + if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) $mime_preview[] = 'svg+xml'; + //$mime_preview[]='vnd.oasis.opendocument.presentation'; + //$mime_preview[]='archive'; + $num_mime = array_search(dol_mimetype($file, '', 1), $mime_preview); + if ($num_mime !== false) return 1; + + // By default, not allowed for preview + return 0; +} /** * Return mime type of a file @@ -7749,7 +7770,7 @@ function ajax_autoselect($htmlname, $addlink = '') * @param string $default Default mime type if extension not found in known list * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive) - * @see image_format_supported() from images.lib.php + * @see dolIsAllowedForPreview(), image_format_supported() from images.lib.php */ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) { diff --git a/htdocs/document.php b/htdocs/document.php index 2b37792d69a..ccd404f7315 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -156,12 +156,13 @@ if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha')?tru if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false; // Define mime type -$type = 'application/octet-stream'; +$type = 'application/octet-stream'; // By default if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha'); else $type=dol_mimetype($original_file); -// Security: Force to octet-stream if file is a dangerous file -if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream'; - +// Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file +if (!dolIsAllowedForPreview($original_file)) { + $type = 'application/octet-stream'; +} // Security: Delete string ../ into $original_file $original_file = str_replace("../", "/", $original_file); From bc457ebb660ae67b0bc853e317915e9e140458c1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Sep 2020 21:22:59 +0200 Subject: [PATCH 44/49] Stickler --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3f4229589dd..c279b3fb4e5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7745,7 +7745,8 @@ function ajax_autoselect($htmlname, $addlink = '') * @return int 1 If allowed, 0 otherwise * @see dol_mimetype(), image_format_supported() from images.lib.php */ -function dolIsAllowedForPreview($file) { +function dolIsAllowedForPreview($file) +{ global $conf; // Check .noexe extension in filename From 56a9f5c48b180ed152bc3e20e99a8e6151384571 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Sep 2020 14:49:20 +0200 Subject: [PATCH 45/49] Fix --- 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 c279b3fb4e5..a5ab772b795 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7709,7 +7709,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param if ($alldata == 1) { - if (isAllowedForPreview) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), ); + if ($isAllowedForPreview) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), ); else return array(); } From 37c9afebd9d249c36660ef7d046c60c0b50fe4e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Sep 2020 14:55:32 +0200 Subject: [PATCH 46/49] Fix regression --- htdocs/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/document.php b/htdocs/document.php index ccd404f7315..a55ca1fd895 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -160,7 +160,7 @@ $type = 'application/octet-stream'; // By default if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha'); else $type=dol_mimetype($original_file); // Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file -if (!dolIsAllowedForPreview($original_file)) { +if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($original_file)) { $type = 'application/octet-stream'; } // Security: Delete string ../ into $original_file From 0fc6e9b84f9cc12c8d8161df600e1dc8dc8d3163 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 23 Sep 2020 10:54:49 +0200 Subject: [PATCH 47/49] FIX - Backtick not work with postgresql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 7055898ada6..37bb2962724 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -98,7 +98,8 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0; -ALTER TABLE llx_bom_bomline DROP COLUMN `rank`; +-- VMYSQL4.1 ALTER TABLE llx_bom_bomline DROP COLUMN `rank`; +-- VPGSQL8.2 ALTER TABLE llx_bom_bomline DROP COLUMN rank; create table llx_categorie_warehouse ( From 7a9332815c6e852e564d8ad47cae19cb06d4d1c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Sep 2020 12:22:24 +0200 Subject: [PATCH 48/49] Fix migration --- htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 91c155d3d84..c0efe6d68b3 100644 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -315,6 +315,7 @@ ALTER TABLE llx_c_chargesociales ADD COLUMN accountancy_code varchar(15) DEFAULT -- Tables for accountancy expert DROP TABLE llx_accountingaccount; +DROP TABLE llx_accounting_account; DROP TABLE llx_accountingsystem; DROP TABLE llx_accounting_system; From 0dcd85485aba5e1b7566d6a3bf616aeed556114f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Sep 2020 12:36:32 +0200 Subject: [PATCH 49/49] Fix migration --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 0f84c92ef22..88d9ae1b685 100644 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -102,6 +102,10 @@ ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_shipping_method; ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode; ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; +-- This table and constraint should not exists as it appears in more recent version, but we may have it if we load an old dump +-- on a newly created database and we want to be sure upgrade of rowid into autoincrement done later will works. +ALTER TABLE llx_reception DROP FOREIGN KEY fk_reception_fk_shipping_method; + ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description; --ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE;
'; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); @@ -237,7 +250,7 @@ print ''; if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); @@ -257,7 +270,7 @@ if (!empty($conf->reception->enabled)) print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); @@ -272,7 +285,7 @@ if (!empty($conf->reception->enabled)) print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); @@ -288,7 +301,7 @@ else if (! empty($conf->fournisseur->enabled)) { if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 1); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4018d20aee5..0ef444422f0 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -479,16 +479,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param int $entity Entity to set * @param int $revertonoff Revert on/off - * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant + * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant + * @param int $forcenoajax 1=Force to use a ahref link instead of ajax code. * @return string */ -function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0) +function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcenoajax = 0) { global $conf, $langs; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); - if (empty($conf->use_javascript_ajax)) + if (empty($conf->use_javascript_ajax) || $forcenoajax) { if (empty($conf->global->$code)) print ''.img_picto($langs->trans("Disabled"), 'off').''; else print ''.img_picto($langs->trans("Enabled"), 'on').''; From b4d2bf98fa84547e916ef1b19b4427d9cb73c9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Aug 2020 12:14:40 +0200 Subject: [PATCH 17/49] Use of undefined constant state - assumed 'state' --- htdocs/includes/OAuth/Common/Storage/DoliStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 463afe194db..f0383fdf06f 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface $sql.= " WHERE service='".$this->db->escape($service)."'"; $resql = $this->db->query($sql); $result = $this->db->fetch_array($resql); - $states[$service] = $result[state]; + $states[$service] = $result['state']; $this->states[$service] = $states[$service]; return is_array($states) From 7eb003c6843a17a1cad2ef57a183bc3dcc326c73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:19 +0200 Subject: [PATCH 18/49] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3c6bf0765ed..c83b7f28ce6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - dol_include_once('/commande/commande.class.php'); + include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1){ $order=null; } From b44d6744f9b496972491615f9c28ac445ccf6abe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:40 +0200 Subject: [PATCH 19/49] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c83b7f28ce6..c0c7c7d0f9b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2132,7 +2132,7 @@ function pdf_getLinkedObjects($object,$outputlangs) include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); - if ($ret < 1){ $order=null; } + if ($ret < 1) { $order=null; } } } if (! is_object($order)) From 7a183ea026bc0189f07ac803e006124a07eefe40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:13:30 +0200 Subject: [PATCH 20/49] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c0c7c7d0f9b..54252923ad6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2071,7 +2071,7 @@ function pdf_getTotalQty($object,$type,$outputlangs) */ function pdf_getLinkedObjects($object,$outputlangs) { - global $hookmanager; + global $db, $hookmanager; $linkedobjects=array(); @@ -2130,7 +2130,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; - $order = new Commande($object->db); + $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } } From 74eac1d06a1708152b8232be83e897385724eafa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:22:01 +0200 Subject: [PATCH 21/49] Fix include regression --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 54252923ad6..6a1ebacdab1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } From 9268955256825d9059727b0f22409dcfb71828b7 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 26 Aug 2020 09:40:20 +0200 Subject: [PATCH 22/49] FIX set sales representatives on create company card --- htdocs/societe/card.php | 2 +- htdocs/societe/class/societe.class.php | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d2f27419e76..401f7b2175b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -539,7 +539,7 @@ if (empty($reshook)) // Links with users $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); + $result = $object->setSalesRep($salesreps, true); if ($result < 0) { $error++; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 918674ba23a..30511855e91 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4133,9 +4133,10 @@ class Societe extends CommonObject * Sets sales representatives of the thirdparty * * @param int[]|int $salesrep User ID or array of user IDs + * @param bool $onlyAdd Only add (no delete before) * @return int <0 if KO, >0 if OK */ - public function setSalesRep($salesrep) + public function setSalesRep($salesrep, $onlyAdd = false) { global $user; @@ -4144,16 +4145,18 @@ class Societe extends CommonObject $salesrep = array($salesrep); } - // Get current users - $existing = $this->getSalesRepresentatives($user, 1); - // Diff - if (is_array($existing)) { - $to_del = array_diff($existing, $salesrep); - $to_add = array_diff($salesrep, $existing); - } else { - $to_del = array(); // Nothing to delete - $to_add = $salesrep; + $to_del = array(); // Nothing to delete + $to_add = $salesrep; + if ($onlyAdd === false) { + // Get current users + $existing = $this->getSalesRepresentatives($user, 1); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $salesrep); + $to_add = array_diff($salesrep, $existing); + } } $error = 0; From 9b3f13458fc1d95e92d01142dbd0b4abe76e9bbe Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 26 Aug 2020 16:02:31 +0200 Subject: [PATCH 23/49] FIX: missing entity check --- htdocs/compta/prelevement/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 936fbebcf6e..9b9e8e08ce5 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -180,6 +180,7 @@ print '
'; $limit=5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; +$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")"; $sql.= " ORDER BY datec DESC"; $sql.= $db->plimit($limit); From a5d1f1f68f0c9c3f8cf3d43629a858bd14869bc2 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 28 Aug 2020 10:02:43 +0200 Subject: [PATCH 24/49] FIX: expenses lines overlapping the frame for total amounts. If there is no room for this frame when printing the last expense line, this line should be on a new page. --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 32a8714cf12..e3d64f190d0 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport while ($i < $nblines) { $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); - if (empty($showpricebeforepagebreak)) { + if (empty($showpricebeforepagebreak) && $i !== $nblines - 1) { $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. } else { $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. From 215085e0e6f877ddf50648b9e1fc989dcdefb66c Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 28 Aug 2020 15:51:39 +0200 Subject: [PATCH 25/49] FIX: unit price divided by quantity when accepting supplier price proposal --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index b5d9652ed18..adfd1b07f04 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1810,7 +1810,7 @@ class SupplierProposal extends CommonObject if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); $productsupplier->id = $product->fk_product; - $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); + $productsupplier->update_buyprice($product->qty, $product->total_ht, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_total_ht, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '' ); } return 1; @@ -1849,7 +1849,7 @@ class SupplierProposal extends CommonObject public function createPriceFournisseur($product, $user) { global $conf; - + $price=price2num($product->subprice*$product->qty, 'MU'); $qty=price2num($product->qty); $unitPrice = price2num($product->subprice, 'MU'); From 173ad057f9805db7eddf7e1deba2b819874d6185 Mon Sep 17 00:00:00 2001 From: FlorianMortgat <5845502+FlorianMortgat@users.noreply.github.com> Date: Fri, 28 Aug 2020 20:46:35 +0200 Subject: [PATCH 26/49] + parentheses around expression for readability --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index e3d64f190d0..669827ad14c 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport while ($i < $nblines) { $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); - if (empty($showpricebeforepagebreak) && $i !== $nblines - 1) { + if (empty($showpricebeforepagebreak) && $i !== ($nblines - 1)) { $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. } else { $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. From c25463a4ba2aa73c5301a7457437849e820acc31 Mon Sep 17 00:00:00 2001 From: FlorianMortgat <5845502+FlorianMortgat@users.noreply.github.com> Date: Fri, 28 Aug 2020 21:07:11 +0200 Subject: [PATCH 27/49] + more parentheses around expression for readability --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 669827ad14c..1b578da172f 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport while ($i < $nblines) { $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); - if (empty($showpricebeforepagebreak) && $i !== ($nblines - 1)) { + if (empty($showpricebeforepagebreak) && ($i !== ($nblines - 1))) { $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. } else { $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. From 723a263cd3380b3cd4f4094d28e0ff672bd74cb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2020 05:07:23 +0200 Subject: [PATCH 28/49] Fix phpcs --- htdocs/core/class/discount.class.php | 2 +- htdocs/core/lib/pdf.lib.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index df25a619e9e..aceeee37834 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -651,7 +651,7 @@ class DiscountAbsolute $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; $sql.= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.$invoice->id; } - else if ($invoice->element == 'invoice_supplier') + elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 83efb493e0d..b915772a271 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2134,7 +2134,7 @@ function pdf_getLinkedObjects($object, $outputlangs) $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs); } } - else if ($objecttype == 'fichinter') + elseif ($objecttype == 'fichinter') { $outputlangs->load('interventions'); foreach($objects as $elementobject) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index b5d9652ed18..e402cc5971b 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1810,7 +1810,7 @@ class SupplierProposal extends CommonObject if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); $productsupplier->id = $product->fk_product; - $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); + $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); } return 1; @@ -1849,7 +1849,7 @@ class SupplierProposal extends CommonObject public function createPriceFournisseur($product, $user) { global $conf; - + $price=price2num($product->subprice*$product->qty, 'MU'); $qty=price2num($product->qty); $unitPrice = price2num($product->subprice, 'MU'); From ffb3d810def9e2988a941f43bd58aabf9fc477a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Aug 2020 16:21:59 +0200 Subject: [PATCH 29/49] Complete fix for #14580 for v10 (backport of change of develop) --- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/langs/en_US/other.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 98c55c71232..347ce29df1c 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1208,7 +1208,7 @@ class FormMail extends Form elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); } - elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } + elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentGeneric"); } $ret->label = 'default'; $ret->lang = $outputlangs->defaultlang; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 5dd7422539a..83db92bd9e2 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -97,6 +97,7 @@ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNA PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n +PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) From 134a47a93f2b97356627a6f332f43ee2c1f8229a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 1 Sep 2020 15:36:35 +0200 Subject: [PATCH 30/49] FIX 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename --- htdocs/core/class/CMailFile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 853f2f98b05..7c12f4f9d5b 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -463,6 +463,9 @@ class CMailFile { //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); $attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]); + if (!empty($mimefilename_list[$i])) { + $attachment->setFilename($mimefilename_list[$i]); + } $this->message->attach($attachment); } } From c17bc8b3c8c89b410430b148a3a622959c8733bf Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 3 Sep 2020 10:45:03 +0200 Subject: [PATCH 31/49] Fix missing param for hook --- htdocs/societe/class/societe.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9becbd199cc..f10cead50fd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2412,7 +2412,15 @@ class Societe extends CommonObject global $action; $hookmanager->initHooks(array('thirdpartydao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array( + 'id'=>$this->id, + 'getnomurl'=>$result, + 'withpicto '=> $withpicto, + 'option'=> $option, + 'maxlen'=> $maxlen, + 'notooltip'=> $notooltip, + 'save_lastsearch_value'=> $save_lastsearch_value + ); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; From bb92e64e433f068beb28a6c3758a726928e4e23d Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 3 Sep 2020 12:43:38 +0200 Subject: [PATCH 32/49] FIX: #14474 Error when deleting --- htdocs/comm/propal/class/propal.class.php | 10 ++++- htdocs/commande/class/commande.class.php | 7 ++- htdocs/compta/facture/class/facture.class.php | 8 +++- htdocs/core/class/commonobject.class.php | 45 ++++++++++++++++++- htdocs/expedition/class/expedition.class.php | 8 +++- htdocs/fichinter/class/fichinter.class.php | 8 +++- .../class/fournisseur.commande.class.php | 8 +++- .../fourn/class/fournisseur.facture.class.php | 8 +++- .../class/supplier_proposal.class.php | 8 +++- 9 files changed, 100 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a2d1e934d35..325a0894302 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2019 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2017 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -1063,7 +1063,7 @@ class Propal extends CommonObject $ret = $this->add_object_linked(); if (! $ret) dol_print_error($this->db); } - + /* * Insertion du detail des produits dans la base * Insert products detail in database @@ -2900,6 +2900,12 @@ class Propal extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7d8e2680977..47ffec60592 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -3327,6 +3327,11 @@ class Commande extends CommonOrder if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } // Remove directory with files $comref = dol_sanitizeFileName($this->ref); if ($conf->commande->dir_output && !empty($this->ref)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 12d60b067fa..21f68e1c329 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador @@ -2019,6 +2019,12 @@ class Facture extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); if ($conf->facture->dir_output && !empty($this->ref)) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 157fc718700..ccbcb9d6789 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2012-2015 Marcos García @@ -7734,4 +7734,47 @@ abstract class CommonObject } } } + + /** + * Delete related files of object in database + * + * @return bool + */ + public function delete_ecmfiles(){ + global $conf; + $this->db->begin(); + + switch ($this->element){ + case 'propal': + $element = 'propale'; + break; + case 'product': + $element = 'produit'; + break; + case 'order_supplier': + $element ='fournisseur/commande'; + break; + case 'invoice_supplier': + $element = 'fournisseur/facture/' . get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier'); + break; + case 'shipping': + $element = 'expedition/sending'; + break; + default: + $element = $this->element; + } + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files"; + $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'"; + $sql.= " AND filepath = '".$element."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; + + if (!$this->db->query($sql)) { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return false; + } + + $this->db->commit(); + return true; + } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8417ddb9bfb..b3584327f3c 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García @@ -1310,6 +1310,12 @@ class Expedition extends CommonObject { $this->db->commit(); + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We delete PDFs $ref = dol_sanitizeFileName($this->ref); if (! empty($conf->expedition->dir_output)) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4ce2aa954b2..a9ec1ba588e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke * Copyright (C) 2018 Nicolas ZABOURI @@ -1003,6 +1003,12 @@ class Fichinter extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // Remove directory with files $fichinterref = dol_sanitizeFileName($this->ref); if ($conf->ficheinter->dir_output) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef8d4b4d93f..6d73ee59f4d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry @@ -1979,6 +1979,12 @@ class CommandeFournisseur extends CommonOrder if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->fournisseur->commande->dir_output) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index e20a3f9e7de..f1bd120f082 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2017 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013-2019 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García @@ -1157,6 +1157,12 @@ class FactureFournisseur extends CommonInvoice if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory if ($conf->fournisseur->facture->dir_output) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2e6c0f45397..4279925054d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -2065,6 +2065,12 @@ class SupplierProposal extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->supplier_proposal->dir_output && !empty($this->ref)) From 9bd5ed627f195f6cc927ce372d75d697ab0230de Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Sep 2020 09:55:02 +0200 Subject: [PATCH 33/49] Fix travis issues --- 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/class/commonobject.class.php | 3 ++- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 325a0894302..3000fb8b2e3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2901,7 +2901,7 @@ class Propal extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 47ffec60592..d56329c93d9 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3328,7 +3328,7 @@ class Commande extends CommonOrder if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 21f68e1c329..5ea423fa942 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2020,7 +2020,7 @@ class Facture extends CommonInvoice if ($resql) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ccbcb9d6789..103d704a546 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7740,7 +7740,8 @@ abstract class CommonObject * * @return bool */ - public function delete_ecmfiles(){ + public function deleteEcmFiles() + { global $conf; $this->db->begin(); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b3584327f3c..fd764aca981 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1311,7 +1311,7 @@ class Expedition extends CommonObject $this->db->commit(); // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a9ec1ba588e..8e7d23a8cd8 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1004,7 +1004,7 @@ class Fichinter extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6d73ee59f4d..663d72b26b1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1980,7 +1980,7 @@ class CommandeFournisseur extends CommonOrder if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f1bd120f082..b5339d913c5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1158,7 +1158,7 @@ class FactureFournisseur extends CommonInvoice if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 4279925054d..0014db887a1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2066,7 +2066,7 @@ class SupplierProposal extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } From 6bd6b285fd83330551dfdf0a5e450440e9739689 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 8 Sep 2020 16:03:18 +0200 Subject: [PATCH 34/49] FIX : Static property called as non static --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 46431cdb510..89450c57366 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -32,7 +32,7 @@ class DolibarrApi /** * @var DoliDb $db Database object */ - protected static $db; + protected $db; /** * @var Restler $r Restler object From 5a0622c906c55950b89280207aa5a1ca80740c4c Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 8 Sep 2020 16:14:14 +0200 Subject: [PATCH 35/49] FIX cron load lang --- htdocs/core/class/translate.class.php | 49 +++++++++++++++++++++++++++ htdocs/cron/class/cronjob.class.php | 6 +++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 22ae1787ee4..ad243db872e 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -388,6 +388,55 @@ class Translate return 1; } + + + /** + * re-load translation key-value for a particular file, into a memory array. + * If data for file already loaded, do nothing. + * All data in translation array are stored in UTF-8 format. + * tab_loaded is completed with $domain key. + * rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do. + * + * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache + * + * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: + * If $domain is "file@module" instead of "file" then we look for module lang file + * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang + * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang + * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) + * @param int $forcelangdir To force a different lang directory + * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. + * @return int <0 if KO, 0 if loading not required, >0 if OK + * @see loadLangs() + */ + public function reload($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) + { + // Check parameters + if (empty($domain)) { + dol_print_error('', get_class($this) . "::Load ErrorWrongParameters"); + return -1; + } + + if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys + + $newdomain = $domain; + + // Search if a module directory name is provided into lang file name + $regs = array(); + if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { + $newdomain = $regs[1]; + } + + // Check cache and remove it + if (!empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain + { + unset($this->_tab_loaded[$newdomain]); + } + + return $this->load($domain, $alt, $stopafterdirection, $forcelangdir, $loadfromfileonly); + } + /** * Load translation key-value from database into a memory array. * If data already loaded, do nothing. diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 6139f157f8a..61511cbfd3d 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1057,7 +1057,11 @@ class Cronjob extends CommonObject if (!$error) { $result = $langs->load($this->module_name); - $result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing + if($result<0){ + $result = $langs->reload($this->module_name.'@'.$this->module_name); + } + + // If this->module_name was an existing language file, this will make nothing if ($result < 0) // If technical error { dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); From 87d9dfa0091c6ed6b837f9a52521f4b09603fdb8 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 8 Sep 2020 16:17:11 +0200 Subject: [PATCH 36/49] remove useless comm --- htdocs/cron/class/cronjob.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 61511cbfd3d..cb4ef824690 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1061,7 +1061,6 @@ class Cronjob extends CommonObject $result = $langs->reload($this->module_name.'@'.$this->module_name); } - // If this->module_name was an existing language file, this will make nothing if ($result < 0) // If technical error { dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); From 59d5391c2a4f830ad623eec9740648ed2fa7c720 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 10 Sep 2020 10:41:16 +0200 Subject: [PATCH 37/49] Add force reload param to load method --- htdocs/core/class/translate.class.php | 73 +++++---------------------- htdocs/cron/class/cronjob.class.php | 4 +- 2 files changed, 14 insertions(+), 63 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index ad243db872e..06d8432f3e1 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -163,18 +163,19 @@ class Translate * * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * - * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: - * If $domain is "file@module" instead of "file" then we look for module lang file - * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang - * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) - * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) - * @param int $forcelangdir To force a different lang directory - * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. - * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK + * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: + * If $domain is "file@module" instead of "file" then we look for module lang file + * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang + * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang + * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) + * @param int $forcelangdir To force a different lang directory + * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. + * @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found + * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK * @see loadLangs() */ - public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) + public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0) { global $conf,$db; @@ -205,7 +206,8 @@ class Translate } // Check cache - if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain + if (! empty($this->_tab_loaded[$newdomain]) + && ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)) ) // File already loaded and found and not forced for this domain { //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); return 0; @@ -388,55 +390,6 @@ class Translate return 1; } - - - /** - * re-load translation key-value for a particular file, into a memory array. - * If data for file already loaded, do nothing. - * All data in translation array are stored in UTF-8 format. - * tab_loaded is completed with $domain key. - * rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do. - * - * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache - * - * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: - * If $domain is "file@module" instead of "file" then we look for module lang file - * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang - * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) - * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) - * @param int $forcelangdir To force a different lang directory - * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. - * @return int <0 if KO, 0 if loading not required, >0 if OK - * @see loadLangs() - */ - public function reload($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) - { - // Check parameters - if (empty($domain)) { - dol_print_error('', get_class($this) . "::Load ErrorWrongParameters"); - return -1; - } - - if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys - - $newdomain = $domain; - - // Search if a module directory name is provided into lang file name - $regs = array(); - if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { - $newdomain = $regs[1]; - } - - // Check cache and remove it - if (!empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain - { - unset($this->_tab_loaded[$newdomain]); - } - - return $this->load($domain, $alt, $stopafterdirection, $forcelangdir, $loadfromfileonly); - } - /** * Load translation key-value from database into a memory array. * If data already loaded, do nothing. diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index cb4ef824690..f0cee68a01f 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1057,9 +1057,7 @@ class Cronjob extends CommonObject if (!$error) { $result = $langs->load($this->module_name); - if($result<0){ - $result = $langs->reload($this->module_name.'@'.$this->module_name); - } + $result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1); if ($result < 0) // If technical error { From 7944c21fe549edb84ba2b8234b5bca538fb88f3f Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Thu, 10 Sep 2020 12:32:12 +0200 Subject: [PATCH 38/49] FIX : Wrong redirection --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 36c06cd97f2..c7b651cb93d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -381,7 +381,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && { $obj = $db->fetch_object($resql); $id = $obj->id; - header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); + header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1'); exit; } From 8fc9b78b4762e2cf4d957d9c6bd592de57a27b6e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 11 Sep 2020 06:55:03 +0200 Subject: [PATCH 39/49] FIX Problems on FEC format --- .../accountancy/class/accountancyexport.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index bfb08746c16..b3a4430db36 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -689,8 +689,8 @@ class AccountancyExport foreach ($objectLines as $line) { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); - $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); - $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); + $date_document = dol_print_date($line->doc_date, '%Y%m%d'); + $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal . $separator; @@ -702,25 +702,25 @@ class AccountancyExport print $line->piece_num . $separator; // FEC:EcritureDate - print $date_creation . $separator; + print $date_document . $separator; // FEC:CompteNum print $line->numero_compte . $separator; // FEC:CompteLib - print $line->label_compte . $separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum print $line->subledger_account . $separator; // FEC:CompAuxLib - print $line->subledger_label . $separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef print $line->doc_ref . $separator; // FEC:PieceDate - print $date_doc . $separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib print $line->label_operation . $separator; @@ -738,7 +738,7 @@ class AccountancyExport print $line->date_lettering . $separator; // FEC:ValidDate - print $date_valid . $separator; + print $date_validation . $separator; // FEC:Montantdevise print $line->multicurrency_amount . $separator; From a891211f78d804bf92dc22c3fc8ac2d064602aa0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Sep 2020 02:32:30 +0200 Subject: [PATCH 40/49] Fix bad link --- htdocs/adherents/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 10eca32ac13..762a7d666c7 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -183,9 +183,9 @@ foreach ($data as $val) $oldyear--; print '
'; - print ''; + //print ''; print $oldyear; - print ''; + //print ''; print '00