From e7a5d263555b77a720b3eeb304df7e98ddb6dfce Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 14:25:54 +0100 Subject: [PATCH 01/23] FIX remove backward compatibility projectid and uses object id instead --- htdocs/projet/element.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 97e99c93370..fe8a27ec6f8 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -83,17 +83,16 @@ if (! isset($_POST['datesrfc']) && ! isset($_POST['datesday']) && ! empty($conf- //$dates=dol_time_plus_duree($datee, -1, 'y'); $dates=dol_get_first_day($tmp['year'], 1); } -if ($id == '' && $projectid == '' && $ref == '') +if ($id == '' && $ref == '') { - dol_print_error('', 'Bad parameter'); - exit; + setEventMessage($langs->trans('ErrorBadParameters'), 'errors'); + header('Location: list.php'); + exit(); } $mine = $_REQUEST['mode']=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects -$projectid=$id; // For backward compatibility - $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once @@ -102,7 +101,7 @@ if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob // Security check $socid=$object->socid; //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. -$result = restrictedArea($user, 'projet', $projectid, 'projet&project'); +$result = restrictedArea($user, 'projet', $object->id, 'projet&project'); $hookmanager->initHooks(array('projectOverview')); @@ -513,7 +512,7 @@ elseif ($action == "unlink") { $tablename = GETPOST("tablename", "aZ09"); - $projectField = GETPOST("projectfield", "aZ09"); + $projectField = GETPOST('projectfield', 'aZ09') ? GETPOST('projectfield', 'aZ09') : 'fk_projet'; $elementselectid = GETPOST("elementselect", "int"); $result = $object->remove_element($tablename, $elementselectid, $projectField); @@ -532,7 +531,7 @@ $showdatefilter=0; if (! $showdatefilter) { print '
'; - print '
'; + print ''; print ''; print ''; print ''; @@ -755,7 +754,7 @@ foreach ($listofreferent as $key => $value) if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300', -2, !empty($project_field)?$project_field:'fk_projet'); - if (! $selectList || ($selectList<0)) + if ($selectList<0) { setEventMessages($formproject->error, $formproject->errors, 'errors'); } @@ -763,7 +762,7 @@ foreach ($listofreferent as $key => $value) { // Define form with the combo list of elements to link $addform.='
'; - $addform.=''; + $addform.=''; $addform.=''; $addform.=''; $addform.=''; @@ -890,7 +889,7 @@ foreach ($listofreferent as $key => $value) { if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true { - print ''; + print ''; print img_picto($langs->trans('Unlink'), 'unlink'); print ''; } From e03222b83109f2f56daf7b98398138c4900261d9 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 14:38:01 +0100 Subject: [PATCH 02/23] FIX var transkey not defined in input hidden --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e92cc80a08e..747a621e860 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1985,9 +1985,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent'; print ''; $transfound=0; + $transkey=''; if (in_array($fieldlist[$field], array('label','libelle'))) { - $transkey=''; // Special case for labels if ($tabname == MAIN_DB_PREFIX.'c_civility') { $transkey="Civility".strtoupper($obj->code); From b0edd464948af16d11adbd5ed311bf15cc55b958 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 15:07:26 +0100 Subject: [PATCH 03/23] FIX add product qty in shipment already sent --- htdocs/product/class/product.class.php | 21 +++++++++++++++------ htdocs/product/stock/product.php | 9 ++++++++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d00cba86e6a..c61d778a9f9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2633,12 +2633,13 @@ class Product extends CommonObject /** * Charge tableau des stats expedition client pour le produit/service * - * @param int $socid Id societe pour filtrer sur une societe - * @param string $filtrestatut Id statut pour filtrer sur un statut - * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. - * @return array Tableau des stats + * @param int $socid Id societe pour filtrer sur une societe + * @param string $filtrestatut Id statut pour filtrer sur un statut + * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. + * @param string $filterShipmentStatus [=''] Ids shipment status separated by comma + * @return int <0 if KO, >0 if OK (Tableau des stats) */ - public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0) + public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $filterShipmentStatus = '') { // phpcs:enable global $conf,$user; @@ -2668,6 +2669,7 @@ class Product extends CommonObject if ($filtrestatut <> '') { $sql.= " AND c.fk_statut in (".$filtrestatut.")"; } + if (!empty($filterShipmentStatus)) $sql.= " AND e.fk_statut IN (" . $filterShipmentStatus . ")"; $result = $this->db->query($sql); if ($result ) { @@ -4461,7 +4463,14 @@ class Product extends CommonObject } if (! empty($conf->expedition->enabled)) { - $result=$this->load_stats_sending(0, '1,2', 1); + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $filterShipmentStatus = ''; + if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { + $filterShipmentStatus = Expedition::STATUS_VALIDATED . ',' . Expedition::STATUS_CLOSED; + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + $filterShipmentStatus = Expedition::STATUS_CLOSED; + } + $result = $this->load_stats_sending(0, '1,2', 1, $filterShipmentStatus); if ($result < 0) dol_print_error($this->db, $this->error); $stock_sending_client=$this->stats_expedition['qty']; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 944b3ce96cd..89e60ed07ed 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -666,8 +666,15 @@ if ($id > 0 || $ref) // Number of product from customer order already sent (partial shipping) if (!empty($conf->expedition->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $filterShipmentStatus = ''; + if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { + $filterShipmentStatus = Expedition::STATUS_VALIDATED . ',' . Expedition::STATUS_CLOSED; + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + $filterShipmentStatus = Expedition::STATUS_CLOSED; + } if ($found) $helpondiff .= '
'; else $found = 1; - $result = $object->load_stats_sending(0, '2', 1); + $result = $object->load_stats_sending(0, '2', 1, $filterShipmentStatus); $helpondiff .= $langs->trans("ProductQtyInShipmentAlreadySent") . ': ' . $object->stats_expedition['qty']; } From 99e63ad5073e0805a36fdc8e0342374c6da68a55 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 15:18:45 +0100 Subject: [PATCH 04/23] FIX uses GETPOSTISSET instead of GETPOST for projectfield --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index fe8a27ec6f8..d60a71d5999 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -512,7 +512,7 @@ elseif ($action == "unlink") { $tablename = GETPOST("tablename", "aZ09"); - $projectField = GETPOST('projectfield', 'aZ09') ? GETPOST('projectfield', 'aZ09') : 'fk_projet'; + $projectField = GETPOSTISSET('projectfield') ? GETPOST('projectfield', 'aZ09') : 'fk_projet'; $elementselectid = GETPOST("elementselect", "int"); $result = $object->remove_element($tablename, $elementselectid, $projectField); From 720146c45f071364ef6d547a44880276fa6768b6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 15:37:12 +0100 Subject: [PATCH 05/23] FIX class Facture undefined in displaying margin information --- htdocs/core/class/html.formmargin.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6b7ba7348ff..579b8fe5208 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -63,6 +63,8 @@ class FormMargin { global $conf, $db; + require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + // Default returned array $marginInfos = array( 'pa_products' => 0, From 792096ad08ae495ffd81d57bc1b987fb5c227baf Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 23 Dec 2019 16:00:35 +0100 Subject: [PATCH 06/23] FIX url new for task time spent in project element tab --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 97e99c93370..06d14f18042 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -436,7 +436,7 @@ $listofreferent=array( 'table'=>'projet_task', 'datefieldname'=>'task_date', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?id='.$id, + 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id, 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->rights->projet->creer, 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), From 5521d13a1186a5f0c5a60da96f1f7c528a2c3db3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 22:12:50 +0100 Subject: [PATCH 07/23] Prepare 10.0.5 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 7c71221ba3c..c0697df392b 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From 07b40f043e3992cab80e545d9cc0afdd3a0df1b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2019 22:44:34 +0100 Subject: [PATCH 08/23] Prepare 10.0.5 --- ChangeLog | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index 99e70e960c9..b1b64681abb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,33 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 10.0.5 compared to 10.0.4 ***** +FIX: 10.0: add URL param "restore_last_search_values=1" to all backlinks pointing to lists +FIX: 10.0: do not display single-letter values (indicating duration unit without value) in product list +FIX: #12473 +FIX: #12481 : fix ticket creation from thirdparty, mission $socid var +FIX: #12482 +FIX: #12644 +FIX: #12665 Mass invoice validation with stock management +FIX: #12688 +FIX: #12745 +FIX: add and modify category translate form with posted values on errors +FIX: add URL param "restore_last_search_values=1" to all backlinks that point to a list +FIX: CommandeFournisseurLigne update function must not be able to return other value than 1 if success +FIX: contact card state address selected after filling address +FIX: dol_string_nohtmltag when there is html with windows EOL "
\r\n" +FIX: filter language is an array +FIX: first col at wrong position in Export 2007 (new) +FIX: getrights() request +FIX: Invoice Situation integration into Margin +FIX: missing nl2br conversion +FIX: not fee in payout list +FIX: product_fourn_price_id was assigned too late for logPrice() function +FIX: Reduce number of request for list of products +FIX: set due date in object in create invoice +FIX: units traductions for selectUnits() function +FIX: when we need to bill several orders, order lines unit is not on bill lines +NEW: 9.0: allow users to use the mysqldump '--quick' option ***** ChangeLog for 10.0.4 compared to 10.0.3 ***** FIX: The pdf templates were using the large logo making PDF too large (and edition of proposal, order, invoice VERY slow) From 44400b786654a363bea4a9bf5c3414e6248fb8db Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 24 Dec 2019 07:22:25 +0100 Subject: [PATCH 09/23] FIX : Some issues on salary payment --- htdocs/compta/salaries/card.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 392b90b7bb6..5371e773828 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -44,6 +44,12 @@ $id=GETPOST("id", 'int'); $action=GETPOST('action', 'aZ09'); $cancel= GETPOST('cancel', 'aZ09'); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$accountid = GETPOST('accountid', 'int') > 0 ? GETPOST('accountid', 'int') : 0; + +$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int')); +$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int')); +$datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); +$dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); // Security check $socid = GETPOST("socid", "int"); @@ -71,34 +77,30 @@ if ($cancel) if ($action == 'classin' && $user->rights->banque->modifier) { $object->fetch($id); - $object->setProject(GETPOST('projectid')); + $object->setProject($projectid); } if ($action == 'add' && empty($cancel)) { $error=0; - $datep=dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int')); - $datev=dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int')); - $datesp=dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); - $dateep=dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); if (empty($datev)) $datev=$datep; $type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1); - $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; - $object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user", "int") : 0; + $object->accountid=GETPOST("accountid", "int") > 0 ? GETPOST("accountid", "int") : 0; + $object->fk_user=GETPOST("fk_user", "int") > 0 ? GETPOST("fk_user", "int") : 0; $object->datev=$datev; $object->datep=$datep; - $object->amount=price2num(GETPOST("amount")); - $object->label=GETPOST("label"); + $object->amount=price2num(GETPOST("amount", "alpha")); + $object->label=GETPOST("label", "alphanohtml"); $object->datesp=$datesp; $object->dateep=$dateep; - $object->note=GETPOST("note"); + $object->note=GETPOST("note", "none"); $object->type_payment=($type_payment > 0 ? $type_payment : 0); - $object->num_payment=GETPOST("num_payment"); + $object->num_payment=GETPOST("num_payment", "alphanohtml"); $object->fk_user_author=$user->id; - $object->fk_project= GETPOST('fk_project', 'int'); + $object->fk_project= $projectid; // Set user current salary as ref salaray for the payment $fuser=new User($db); @@ -303,7 +305,7 @@ if ($action == 'create') print ''.$langs->trans("Project").''; - $numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); + $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); print ''; } @@ -313,14 +315,14 @@ if ($action == 'create') { print ''; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).''; - $form->select_comptes($_POST["accountid"], "accountid", 0, '', 1); // Affiche liste des comptes courant + $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant print ''; } // Type payment print ''; print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; - $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2); + $form->select_types_paiements(GETPOST("paymenttype", "aZ09"), "paymenttype", '', 2); print ''; // Number From c8dfc3d9fc85515de1b40105f0fef6180a97681c Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 24 Dec 2019 16:09:29 +0100 Subject: [PATCH 10/23] FIX: error 500 when getting margin info for objects other than invoices --- htdocs/core/class/html.formmargin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6b7ba7348ff..8485afecec9 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -98,7 +98,7 @@ class FormMargin $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if ($object->type == Facture::TYPE_SITUATION) { + if ($object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; From 9a7307eea8f7d6899c6bc854faafcc0dec6c3beb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 26 Dec 2019 12:01:09 +0100 Subject: [PATCH 11/23] FIX Missing language key for MAIN_MAXTABS_IN_CARD --- 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 54eeac4085e..a9c79e747a3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -982,3 +982,4 @@ PaymentInformation=Payment information ValidFrom=Valid from ValidUntil=Valid until NoRecordedUsers=No users +More=More From a804208b32b0e76d3374018f9a3aae222ffd656a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 27 Dec 2019 20:54:47 +0100 Subject: [PATCH 12/23] Fix missing language key --- htdocs/langs/en_US/boxes.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index b1ab8e41fbc..1e2252d54b2 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -84,4 +84,5 @@ ForProposals=Proposals LastXMonthRolling=The latest %s month rolling ChooseBoxToAdd=Add widget to your dashboard BoxAdded=Widget was added in your dashboard -BoxTitleUserBirthdaysOfMonth=Birthdays of this month \ No newline at end of file +BoxTitleUserBirthdaysOfMonth=Birthdays of this month +BoxBirthdays=Birthdays of this month From c9cc6cbbeab0d449e22f183e3a8f1ec030b7dd13 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sun, 29 Dec 2019 23:15:49 +0100 Subject: [PATCH 13/23] Fix decimal value on update object --- htdocs/core/actions_addupdatedelete.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 1d5dd28b21a..068a487c448 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -113,8 +113,8 @@ if ($action == 'update' && ! empty($permissiontoadd)) $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif ($object->fields[$key]['type']=='datetime') { $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); - } elseif ($object->fields[$key]['type']=='price') { - $value = price2num(GETPOST($key)); + } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { + $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup } else { $value = GETPOST($key, 'alpha'); } From 71a29981187851cbc484db35f91554e8df1a2b51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 30 Dec 2019 15:36:09 +0100 Subject: [PATCH 14/23] FIX wrong var name and avoid warning --- htdocs/product/admin/product_tools.php | 2 +- htdocs/product/class/product.class.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index cfbedbcb7f1..d68b395d5ad 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -135,7 +135,7 @@ if ($action == 'convert') $newlevel=$level; //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatratclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); + $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvatrateclean, $newminprice, $newlevel, $newnpr, 0, 0, $localtaxes_type, $newdefaultvatcode); if ($retm < 0) { $error++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d00cba86e6a..e59b52be803 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1859,6 +1859,9 @@ class Product extends CommonObject if (empty($newnpr)) { $newnpr=0; } + if (empty($newminprice)) { + $newminprice=0; + } // Check parameters if ($newvat == '') { From 5cc0d26eae777a1e51ceb714021a60ec79e0fd4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2019 17:26:02 +0100 Subject: [PATCH 15/23] Revert "FIX class Facture undefined in displaying margin information" --- htdocs/core/class/html.formmargin.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 64048c5cfdc..8485afecec9 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -63,8 +63,6 @@ class FormMargin { global $conf, $db; - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; - // Default returned array $marginInfos = array( 'pa_products' => 0, From 08d0d63a0461592238f7bbf15ab2f1c862ca2593 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2019 17:30:27 +0100 Subject: [PATCH 16/23] FIX #12760 #12763 #12755 #12765 #12751 --- htdocs/core/class/html.formmargin.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 64048c5cfdc..7c169916b60 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -1,5 +1,5 @@ +/* Copyright (c) 2015-2019 Laurent Destailleur * * 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 @@ -100,7 +100,7 @@ class FormMargin $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if ($object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) { + if ($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; From d2efe1d4272289af6e73d38974035b57370e61cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2019 17:52:28 +0100 Subject: [PATCH 17/23] Fix SQL injection on type parameter in list of events --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dc00a4dd091..5233c58f079 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -301,7 +301,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc I if ($socid > 0) $sql.= " AND s.rowid = ".$socid; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; -if ($type) $sql.= " AND c.id = ".$type; +if ($type) $sql.= " AND c.id = ".(int) $type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started From 67316c912542d77dba736938cf7f514d4b316de0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 3 Jan 2020 14:38:25 +0100 Subject: [PATCH 18/23] FIX Loan card - Wrong language key used --- htdocs/loan/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 73d7a7eeaf0..0c5eda1d972 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -624,7 +624,7 @@ if ($id > 0) else { print ''; - print $langs->trans("LoanAccountancyCapitalCode"); + print $langs->trans("LoanAccountancyInsuranceCode"); print ''; if (! empty($conf->accounting->enabled)) From 93d87d581b3f4055c20066eb01b8f071a24f3060 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 3 Jan 2020 14:56:49 +0100 Subject: [PATCH 19/23] FIX typo on language key --- htdocs/langs/en_US/other.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 0ad4c5dfc83..5dd7422539a 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -56,7 +56,7 @@ Notify_BILL_SUPPLIER_PAYED=Vendor invoice paid Notify_BILL_SUPPLIER_SENTBYMAIL=Vendor invoice sent by mail Notify_BILL_SUPPLIER_CANCELED=Vendor invoice cancelled Notify_CONTRACT_VALIDATE=Contract validated -Notify_FICHEINTER_VALIDATE=Intervention validated +Notify_FICHINTER_VALIDATE=Intervention validated Notify_FICHINTER_ADD_CONTACT=Added contact to Intervention Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail Notify_SHIPPING_VALIDATE=Shipping validated @@ -269,4 +269,4 @@ WEBSITE_KEYWORDS=Keywords LinesToImport=Lines to import MemoryUsage=Memory usage -RequestDuration=Duration of request \ No newline at end of file +RequestDuration=Duration of request From f14aaf5e50d9daeb4538d10468c987df9ee01b79 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 3 Jan 2020 16:35:02 +0100 Subject: [PATCH 20/23] FIX Some problems on conciliation with others modules --- htdocs/compta/bank/releve.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index b93f381c555..845ba1a2172 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -37,12 +37,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; //show files require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("banks","categories","companies","bills","trips")); +$langs->loadLangs(array("banks","categories","companies","bills","trips","donations","loan")); $action=GETPOST('action', 'alpha'); $id=GETPOST('account', 'int'); @@ -363,7 +366,10 @@ $paymentsupplierstatic=new PaiementFourn($db); $paymentvatstatic=new TVA($db); $bankstatic=new Account($db); $banklinestatic=new AccountLine($db); -$remisestatic = new RemiseCheque($db); +$remisestatic=new RemiseCheque($db); +$paymentdonationstatic=new PaymentDonation($db); +$paymentloanstatic=new PaymentLoan($db); +$paymentvariousstatic=new PaymentVarious($db); // Must be before button action $param=''; @@ -668,6 +674,27 @@ else print ''; $newline=0; } + elseif ($links[$key]['type']=='payment_donation') + { + $paymentdonationstatic->id=$links[$key]['url_id']; + $paymentdonationstatic->ref=$langs->trans("Payment"); + print ' '.$paymentdonationstatic->getNomUrl(1); + $newline = 0; + } + elseif ($links[$key]['type']=='payment_loan') + { + $paymentloanstatic->id=$links[$key]['url_id']; + $paymentloanstatic->ref=$langs->trans("Payment"); + print ' '.$paymentloanstatic->getNomUrl(1); + $newline = 0; + } + elseif ($links[$key]['type']=='payment_various') + { + $paymentvariousstatic->id=$links[$key]['url_id']; + $paymentvariousstatic->ref=$langs->trans("Payment"); + print ' '.$paymentvariousstatic->getNomUrl(1); + $newline = 0; + } elseif ($links[$key]['type']=='banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) From 79458ac139e5bd88b1402e98c5b0413dd545ca1f Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Fri, 3 Jan 2020 18:05:49 +0100 Subject: [PATCH 21/23] FIX an issue that shows all entities stock Before : If products are shared between several entities, the stock of each entity are to add in this page (reassort.php) Now : Each entity see only her stock and not other's stock. --- htdocs/product/reassort.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 476fec36c2a..cbf461f4fe4 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -123,10 +123,12 @@ $sql.= ' SUM(s.reel) as stock_physique'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ', u.short_label as unit_short'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_product'; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on s.fk_entrepot = e.rowid'; if (! empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product').")"; +$sql.= " AND e.entity IN (".getEntity('entrepot').")"; if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ if ($sall) $sql.=natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) From 8a5f3d48f41caaa65f4ca18da1fdd9dd1116be1f Mon Sep 17 00:00:00 2001 From: Pierre Tocquin Date: Fri, 3 Jan 2020 19:18:24 +0100 Subject: [PATCH 22/23] Update api_supplier_invoices.class.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction test data 'date' lors de la création d'une facture fournisseur. `array_keys` remplacé par `array_key_exists` dans la clause `if`. Cette clause est correcte dans api_invoices.class.php. --- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 416f7e11e94..f4918650dc7 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -200,7 +200,7 @@ class SupplierInvoices extends DolibarrApi foreach($request_data as $field => $value) { $this->invoice->$field = $value; } - if(! array_keys($request_data, 'date')) { + if(! array_key_exists('date', $request_data)) { $this->invoice->date = dol_now(); } /* We keep lines as an array From 37f93077328b8567674d57f19cb35005bd7f78fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jan 2020 20:53:49 +0100 Subject: [PATCH 23/23] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c61d778a9f9..4a8390d80cd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2634,7 +2634,7 @@ class Product extends CommonObject * Charge tableau des stats expedition client pour le produit/service * * @param int $socid Id societe pour filtrer sur une societe - * @param string $filtrestatut Id statut pour filtrer sur un statut + * @param string $filtrestatut [=''] Ids order status separated by comma * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param string $filterShipmentStatus [=''] Ids shipment status separated by comma * @return int <0 if KO, >0 if OK (Tableau des stats)