From ca6899c1386201c479fea276f44364e08d9e2d3b Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 5 Jan 2021 16:11:46 +0100 Subject: [PATCH 01/56] FIX right to show VAT rate in product list --- htdocs/product/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index cc12bc73349..2478e75057c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -180,7 +180,7 @@ $arrayfields = array( 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), - 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), + 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), @@ -332,7 +332,7 @@ if ($search_label) $sql .= natural_search('p.label', $search_label); if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".$db->escape($search_tosell); if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".$db->escape($search_tobuy); -if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate); +if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate, 1); if (dol_strlen($canvas) > 0) $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; if ($catid > 0) $sql .= " AND cp.fk_categorie = ".$catid; if ($catid == -2) $sql .= " AND cp.fk_categorie IS NULL"; @@ -774,7 +774,7 @@ if ($resql) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['p.tva_tx']['checked'])) { - print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], 'p.tva_tx', "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['p.pmp']['checked'])) { print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); From 7161ca9e70d00dd4f55294df753f4b01892fb77f Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 09:54:02 +0100 Subject: [PATCH 02/56] FIX issue 15659 : Missing test if conf is enabled --- htdocs/societe/card.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ea121acc4c7..052d681b0a0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1542,12 +1542,12 @@ else //} // Supplier - //if ($object->fournisseur) { - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); - print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); - print ""; - //} + if (!empty($conf->fournisseur->enabled)) { + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); + print ""; + } } // Multicurrency @@ -2180,17 +2180,19 @@ else print ""; // Supplier - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; - print ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); - $arrayselected = array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + if (!empty($conf->fournisseur->enabled)) { + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + print ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected = array(); + foreach($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print ""; } - print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print ""; } // Multicurrency @@ -2560,7 +2562,7 @@ else } // Supplier - if ($object->fournisseur) { + if (!empty($conf->fournisseur->enabled) && $object->fournisseur) { print ''.$langs->trans("SuppliersCategoriesShort").''; print ''; print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); From 2f932330d3d4ed6561385d089189de4bd4be5aa1 Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 10:10:39 +0100 Subject: [PATCH 03/56] FIX wrong name for search status param --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 999bde3fb32..a7f44bf483e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -340,7 +340,7 @@ if ($resql) if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); - if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status); + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 6f15683709893d12fcc0e0a78259f91230534c9f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 6 Jan 2021 10:42:48 +0100 Subject: [PATCH 04/56] FIX create ticket : thirdparty/contact notification #15629 --- ...terface_50_modTicket_TicketEmail.class.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 6bd33c5b2f9..22ad6415b40 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -251,11 +251,21 @@ class InterfaceTicketEmail extends DolibarrTriggers if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; - if (empty($user->socid) && empty($user->email)) { - $object->fetch_thirdparty(); - $sendto = $object->thirdparty->email; - } else { - $sendto = $user->email; + + //if contact selected send to email's contact else send to email's thirdparty + + $contactid = GETPOST('contactid', 'alpha'); + + if(!empty($contactid)) { + $contact = new Contact($this->db); + $res = $contact->fetch($contactid); + } + + if($res > 0 && !empty($contact->email) && !empty($contact->statut)) { + $sendto = $contact->email; + } elseif (!empty($object->fk_soc)) { + $object->fetch_thirdparty(); + $sendto = $object->thirdparty->email; } if ($sendto) { From 92a4314779f7c33994779670820dfe33849b75ba Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 10:45:54 +0100 Subject: [PATCH 05/56] Fix security mecanism generating data loss --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c6fd80f72d0..fccb019a730 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -602,6 +602,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti $out = trim($out); // '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '../' is dangerous because it allows dir transversals + $out = str_replace('"', "''", trim($out)); if (preg_match('/"/', $out)) $out = ''; elseif (preg_match('/\.\.\//', $out)) $out = ''; $out = dol_string_nohtmltag($out); From 4b9bb824d0bd9e8af3d857dc451d4770cf8fb7c4 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 6 Jan 2021 11:16:51 +0100 Subject: [PATCH 06/56] FIX balance starting and ending fiscal month #14197 --- htdocs/accountancy/bookkeeping/balance.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 375b17e3b96..5550c837812 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -87,6 +87,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) } else { $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $year_start = dol_print_date(dol_now(), '%Y'); + if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year $year_end = $year_start + 1; $month_end = $month_start - 1; if ($month_end < 1) From 50b5226d10547030c0a2cb151935251bb6ec6937 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 12:40:38 +0100 Subject: [PATCH 07/56] FIX #15465 External user sees last 5 shipments to other customers in the dashboard --- htdocs/core/boxes/box_shipments.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 4603450b482..dfd726ade22 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -103,10 +103,11 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; + if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; $sql .= $this->db->plimit($max, 0); From 19ee163f31e29857e611b7c57268a968d2203ddd Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 13:54:51 +0100 Subject: [PATCH 08/56] Fix add ticket on elementList --- htdocs/admin/dict.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index cce441c4052..92675cbc883 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -577,6 +577,7 @@ if ($id == 11) // 'contract' => $langs->trans('Contract'), 'project' => $langs->trans('Project'), 'project_task' => $langs->trans('Task'), + 'ticket' => $langs->trans('Ticket'), 'agenda' => $langs->trans('Agenda'), 'dolresource' => $langs->trans('Resource'), // old deprecated @@ -1454,6 +1455,7 @@ if ($id) foreach ($fieldlist as $field => $value) { //var_dump($fieldlist); + $class = ''; $showfield = 1; $valuetoshow = $obj->{$fieldlist[$field]}; From e44b14364a30f116cdebec4bc2453b096c00163b Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 6 Jan 2021 14:17:06 +0100 Subject: [PATCH 09/56] FIX useless tracking number displayed on pdf if empty --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 506e72ba1b0..7fc3d622254 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -373,14 +373,15 @@ class pdf_rouget extends ModelePdfExpedition $tab_top_alt = $tab_top; $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); - $tab_top_alt = $pdf->GetY(); //$tab_top_alt += 1; // Tracking number if (!empty($object->tracking_number)) { + $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); + $tab_top_alt = $pdf->GetY(); + $object->getUrlTrackingStatus($object->tracking_number); if (!empty($object->tracking_url)) { From ca557cfacd7ba5e4adad85c8ff9254de8020848d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 6 Jan 2021 13:22:35 +0000 Subject: [PATCH 10/56] Fixing style errors. --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 7fc3d622254..af2cbbca8cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -381,7 +381,7 @@ class pdf_rouget extends ModelePdfExpedition { $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); - + $object->getUrlTrackingStatus($object->tracking_number); if (!empty($object->tracking_url)) { From e8ba4de83248206d4f2fb6116d5e8c816ae360b9 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 6 Jan 2021 14:46:56 +0100 Subject: [PATCH 11/56] Fix #14353 --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ef8bd79b519..c063e636a91 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1107,7 +1107,7 @@ if (empty($reshook)) $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - if (GETPOST('price_ht') != '') + if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '') { $up = price2num(GETPOST('price_ht')); $price_base_type = 'HT'; From 5164a96aa0e52adaeeab3c8f414c8cba955b68da Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 6 Jan 2021 15:35:33 +0100 Subject: [PATCH 12/56] Fix #15829 --- htdocs/societe/class/societe.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ee91363dba1..bc808391562 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3650,7 +3650,7 @@ class Societe extends CommonObject public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') { // phpcs:enable - global $user, $langs; + global $conf, $user, $langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -3683,6 +3683,22 @@ class Societe extends CommonObject $result = $this->create($user); if ($result >= 0) { + // Auto-create contact on thirdparty creation + if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT)) + { + // Fill fields needed by contact + $this->name_bis = $member->lastname; + $this->firstname = $member->firstname; + $this->civility_id = $member->civility_id; + dol_syslog("We ask to create a contact/address too", LOG_DEBUG); + $result = $this->create_individual($user); + if ($result < 0) + { + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } + } + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql .= " SET fk_soc=".$this->id; $sql .= " WHERE rowid=".$member->id; From 99b977a08e892e240f167837d8ff2a39538bc729 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 15:38:30 +0100 Subject: [PATCH 13/56] add categories params on llxHeader filter --- htdocs/product/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 5e50925fbbe..dc56f607841 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -466,7 +466,11 @@ if ($resql) } } - llxHeader('', $title, $helpurl, ''); + foreach ($searchCategoryProductList as $searchCategoryProduct) { + $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); + } + llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + // Displays product removal confirmation if (GETPOST('delprod')) { From f9ae8acbc76d11749d43d899181936aef4bbeba0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 6 Jan 2021 14:47:54 +0000 Subject: [PATCH 14/56] Fixing style errors. --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dc56f607841..b3b4e3be2dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -469,7 +469,7 @@ if ($resql) foreach ($searchCategoryProductList as $searchCategoryProduct) { $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } - llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat); // Displays product removal confirmation From cf324f75d734f8dc7a83e0d54e16902331656f1a Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 6 Jan 2021 16:01:19 +0100 Subject: [PATCH 15/56] Fix bom line unit display #13831 --- htdocs/bom/tpl/objectline_create.tpl.php | 1 - htdocs/bom/tpl/objectline_edit.tpl.php | 1 - htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index eeffb625381..20d523ff512 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -116,7 +116,6 @@ if ($conf->global->PRODUCT_USE_UNITS) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); print ''; } diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 3840f495dea..31a4b1ee008 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -112,7 +112,6 @@ if ($conf->global->PRODUCT_USE_UNITS) { $coldisplay++; print ''; - print $form->selectUnits($line->fk_unit, "units"); print ''; } diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index e1e94dc2076..c9770465458 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -82,7 +82,7 @@ print ''; if ($conf->global->PRODUCT_USE_UNITS) { print ''; - $label = $line->getLabelOfUnit('short'); + $label = $tmpproduct->getLabelOfUnit('short'); if ($label !== '') { print $langs->trans($label); } From 2be2cdaadf67bdebb3b09e40fdfbeace137dba98 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 6 Jan 2021 16:06:03 +0100 Subject: [PATCH 16/56] fix style errors --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dc56f607841..b3b4e3be2dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -469,7 +469,7 @@ if ($resql) foreach ($searchCategoryProductList as $searchCategoryProduct) { $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } - llxHeader('', $title, $helpurl, '',0,0,"","",$paramsCat); + llxHeader('', $title, $helpurl, '', 0, 0, "", "", $paramsCat); // Displays product removal confirmation From 7372a1828325be5d0e3880a0fe3989f374349ecc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 19:56:49 +0100 Subject: [PATCH 17/56] Update box_shipments.php --- htdocs/core/boxes/box_shipments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index dfd726ade22..2621ab3637c 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -106,7 +106,7 @@ class box_shipments extends ModeleBoxes if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; + if ($user->socid > 0) $sql.= " AND s.rowid = ".$user->socid; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; $sql .= $this->db->plimit($max, 0); From 170814c718cfdad0615753029853f72f6e0442e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 20:21:22 +0100 Subject: [PATCH 18/56] Fix missing rollback --- htdocs/societe/class/societe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2fcfaecb19e..8de2ab23baf 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3699,6 +3699,7 @@ class Societe extends CommonObject if ($result < 0) { setEventMessages($this->error, $this->errors, 'errors'); + $this->db->rollback(); return -1; } } From 42e45d4a7a2a0ec0905aebb08fa3656f5f5c4665 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 6 Jan 2021 21:14:40 +0100 Subject: [PATCH 19/56] Fix date and datetime type in commonfield_add.tpl --- htdocs/core/tpl/commonfields_add.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 0bf2a60d0fe..0645505ea34 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -55,6 +55,8 @@ foreach ($object->fields as $key => $val) print ''; if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); + elseif ($val['type'] == 'date') $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); + elseif ($val['type'] == 'datetime') $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); else $value = GETPOST($key, 'alpha'); if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0); else print $object->showInputField($val, $key, $value, '', '', '', 0); From 8918299364a4fe7e26fad0c73ffcc7327e7c1be5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 21:24:37 +0100 Subject: [PATCH 20/56] Update commonfields_add.tpl.php --- htdocs/core/tpl/commonfields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 0645505ea34..c7311fa717d 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -55,7 +55,7 @@ foreach ($object->fields as $key => $val) print ''; if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); - elseif ($val['type'] == 'date') $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); + elseif ($val['type'] == 'date') $value = dol_mktime(0, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); elseif ($val['type'] == 'datetime') $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); else $value = GETPOST($key, 'alpha'); if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0); From 2a31ca969f31539426cbe93cc4e8736d83a5f551 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jan 2021 21:29:58 +0100 Subject: [PATCH 21/56] FIX #15388 #15891 --- htdocs/bom/bom_card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 591e9a69d88..b28cf459094 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -185,6 +185,8 @@ if (empty($reshook)) unset($_POST['disable_stock_change']); $object->fetchLines(); + + $object->calculateCosts(); } } } @@ -227,6 +229,8 @@ if (empty($reshook)) unset($_POST['disable_stock_change']); $object->fetchLines(); + + $object->calculateCosts(); } } } From 1b7d194e18b7eb60cdacb56828626b2e77ca0fcc Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 7 Jan 2021 09:03:25 +0100 Subject: [PATCH 22/56] Finish fix on add form values --- htdocs/core/tpl/commonfields_add.tpl.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index c7311fa717d..13bbdd0c857 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -55,9 +55,10 @@ foreach ($object->fields as $key => $val) print ''; if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); - elseif ($val['type'] == 'date') $value = dol_mktime(0, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); + elseif ($val['type'] == 'date') $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); elseif ($val['type'] == 'datetime') $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); - else $value = GETPOST($key, 'alpha'); + elseif ($val['type'] == 'boolean') $value = (GETPOST($key) == 'on' ? 1 : 0); + else $value = GETPOST($key, 'alphanohtml'); if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0); else print $object->showInputField($val, $key, $value, '', '', '', 0); print ''; From 24c926b32f046bb7b60d5c4858cb6f63287182c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jan 2021 15:09:16 +0100 Subject: [PATCH 23/56] Update doc --- htdocs/includes/odtphp/odf.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index d84559eb459..c2a145f5e90 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -155,9 +155,9 @@ class Odf '', '' ); - + $this->vars[$tag] = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations); - + foreach ($customStyles as $key => $val) { array_push($automaticStyles, '' . $val . ''); } @@ -181,7 +181,7 @@ class Odf $this->contentXml = str_replace('', $fonts . '', $this->contentXml); } else $this->vars[$tag] = preg_replace('/(\r\n|\r|\n)/i', "", $value); - + return $this; } @@ -804,6 +804,7 @@ IMG; // Export to PDF using LibreOffice if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice') { + // Install prerequisites: apt install soffice libreoffice-common libreoffice-writer libreoffice-java-common // using windows libreoffice that must be in path // using linux/mac libreoffice that must be in path // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 @@ -840,7 +841,7 @@ IMG; } else { - // deprecated old method + // deprecated old method using odt2pdf.sh (native, jodconverter, ...) $tmpname=preg_replace('/\.odt/i', '', $name); if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) From 243b227c33891ee3f105dfbe98f725d1586eacdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jan 2021 15:09:49 +0100 Subject: [PATCH 24/56] Fix prerequisites --- htdocs/includes/odtphp/odf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index c2a145f5e90..87cbf621da7 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -804,7 +804,7 @@ IMG; // Export to PDF using LibreOffice if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice') { - // Install prerequisites: apt install soffice libreoffice-common libreoffice-writer libreoffice-java-common + // Install prerequisites: apt install soffice libreoffice-common libreoffice-writer // using windows libreoffice that must be in path // using linux/mac libreoffice that must be in path // Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1 From fe7be8362f02cafa17a844db7871a99466227fc7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jan 2021 12:03:28 +0100 Subject: [PATCH 25/56] Fix td balance --- htdocs/admin/system/filecheck.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index b1124e88add..22bd07155d8 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -273,7 +273,7 @@ if (!$error && $xml) } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -328,7 +328,7 @@ if (!$error && $xml) } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; @@ -383,7 +383,7 @@ if (!$error && $xml) } else { - $out .= ''.$langs->trans("None").''; + $out .= ''.$langs->trans("None").''; } $out .= ''; $out .= ''; From 788ef257a97ab0eaa648b50b60d0b7998fe35925 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jan 2021 13:02:05 +0100 Subject: [PATCH 26/56] Fix GETPOST for qty --- htdocs/bom/bom_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index b28cf459094..2507f0cfa97 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -198,7 +198,7 @@ if (empty($reshook)) $error = 0; // Set if we used free entry or predefined product - $qty = price2num(GETPOST('qty', 'int')); + $qty = price2num(GETPOST('qty', 'alpha')); $qty_frozen = GETPOST('qty_frozen', 'int'); $disable_stock_change = GETPOST('disable_stock_change', 'int'); $efficiency = price2num(GETPOST('efficiency', 'int')); From f17474a8de3448e40da8d31c00019bd4bfafb13f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 11 Jan 2021 16:56:19 +0100 Subject: [PATCH 27/56] 12.0 FIX Translation Permission777 FR --- htdocs/langs/fr_FR/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index c4025fb1577..097f2227790 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -848,6 +848,7 @@ Permission773=Supprimer les notes de frais Permission774=Lire toutes les notes de frais (même pour les utilisateurs en dehors de ma hierarchie) Permission775=Approuver les notes de frais Permission776=Payer les notes de frais +Permission777=Lire les notes de frais de tout le monde Permission779=Exporter les notes de frais Permission1001=Consulter les stocks Permission1002=Créer/modifier entrepôts From 77f213832ec9fbc1ec2925066739355b9e85fe27 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:40:44 +0100 Subject: [PATCH 28/56] fix: update group name --- htdocs/user/class/usergroup.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 4d858ffbaf9..2c29db85fc7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -675,6 +675,10 @@ class UserGroup extends CommonObject { global $user, $conf; + if (empty($this->nom) && !empty($this->name)) { + $this->nom = $this->name; + } + $entity = $conf->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) { From e5ef45562883733fcb7ae5c65533c310105eb73f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:46:08 +0100 Subject: [PATCH 29/56] fix: date auto fill date paiement tax --- htdocs/compta/paiement_charge.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 509e20f3613..a1c3a246829 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -224,8 +224,8 @@ if ($action == 'create') print ''.$langs->trans("Date").''; $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : 0; - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + $datepaye = ($datepaye == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepaye); + print $form->selectDate($datepaye, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 33d7998a9682fecabd94f9f0e61a50a56ff9b0ce Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:47:20 +0100 Subject: [PATCH 30/56] fix: date auto fill date paiement tax --- htdocs/compta/paiement_charge.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a1c3a246829..37301908693 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,9 +223,9 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepaye = ($datepaye == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepaye); - print $form->selectDate($datepaye, '', '', '', '', "add_payment", 1, 1); + $datepayment = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datepayment = ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepayment); + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 7e30812529d6b68e4838d246686a02cd07216a06 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 22:01:53 +0100 Subject: [PATCH 31/56] fix review --- htdocs/compta/paiement_charge.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 37301908693..ac89cfef0b6 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,8 +223,13 @@ if ($action == 'create') print ''.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'';*/ print ''.$langs->trans("Date").''; - $datepayment = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $datepayment = ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepayment); + if (GETPOSTISSET('remonth')) { + $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { + $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); + } else { + $datepayment = '' ; + } print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print ""; print ''; From 11100b3017a8ff9c3ab3ddbaae8d4ab71290eeaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Jan 2021 15:16:43 +0100 Subject: [PATCH 32/56] missing default value --- htdocs/product/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d6f62b34769..d74cab0ada4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify @@ -1297,11 +1297,10 @@ else // Accountancy_code_buy print ''.$langs->trans("ProductAccountancyBuyCode").''; print ''; - if ($type == 0) - { + if ($type == 0) { $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT); } else { - $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT); } print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); print ''; From 1cf86931b3328ec36aab517c41b79a36b383ad09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2021 12:58:50 +0100 Subject: [PATCH 33/56] Fix graph of opportunity when a status has been removed. --- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/graph_opportunities.inc.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6d2892cddad..67c78bf2915 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -216,6 +216,7 @@ Value=Value PersonalValue=Personal value NewObject=New %s NewValue=New value +OldValue=Old value %s CurrentValue=Current value Code=Code Type=Type diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 2bb9332c2ae..97977406a48 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -20,9 +20,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; @@ -66,7 +65,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'; print ''; print ''."\n"; + $listofstatus = array_keys($listofoppstatus); + // Complete with values found into database and not into the dictionary + foreach($valsamount as $key => $val) { + if (!in_array($key, $listofstatus)) { + $listofstatus[] = $key; + } + } + foreach ($listofstatus as $status) { $labelStatus = ''; @@ -74,6 +81,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code); if (empty($labelStatus)) $labelStatus = $listofopplabel[$status]; + if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%'; From 0fa7134bd11559e51ea019dddd06ca15cb25f19b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 14 Jan 2021 13:04:02 +0100 Subject: [PATCH 34/56] better fix --- htdocs/compta/paiement_charge.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index ac89cfef0b6..f67bed0ec63 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,14 +223,16 @@ if ($action == 'create') print '';*/ print '"; print ''; From 727751e0c1512d2621d7def8c07e41f9f5c645d8 Mon Sep 17 00:00:00 2001 From: zuiko Date: Thu, 14 Jan 2021 14:44:32 +0100 Subject: [PATCH 35/56] Update functions.lib.php Fix #15820 function price2num add underscore in the pattern in instruction $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); as this: $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); in order to cover some constantes cases as 20% (TX_NORMAL) or 10% (TX_REDUIT) where underscore is used. I don't know if other characters have to be added to this pattern. --- 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 023ade28052..6921f9f967a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From fd5948f71637815bd0cc0a988d41961c8f538c32 Mon Sep 17 00:00:00 2001 From: zuiko Date: Thu, 14 Jan 2021 15:00:53 +0100 Subject: [PATCH 36/56] Update functions.lib.php Fix #15820 Fix #15820 function price2num add underscore in the pattern in instruction $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount); as this: $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); in order to cover some constantes cases as 20% (TX_NORMAL) or 10% (TX_REDUIT) where underscore is used. it seems that some constantes use also "-" so I added it in the pattern. I don't know if other characters have to be added to this pattern. --- 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 6921f9f967a..7c562357d9a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From d3cbcedce302e2845d0be253c659948e324f288a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 15 Jan 2021 09:55:42 +0100 Subject: [PATCH 37/56] FIX 12.0 (ticket) - the "openall" filter on the ticket list does not include tickets with status READ --- htdocs/ticket/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 90cd1fd1ec9..def67225f6a 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -346,11 +346,12 @@ foreach ($search as $key => $val) $newarrayofstatus[] = $val2; } if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) { - $newarrayofstatus[] = Ticket::STATUS_NOT_READ; - $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; - $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS; - $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; - $newarrayofstatus[] = Ticket::STATUS_WAITING; + $newarrayofstatus[] = Ticket::STATUS_NOT_READ; + $newarrayofstatus[] = Ticket::STATUS_READ; + $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; + $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS; + $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; + $newarrayofstatus[] = Ticket::STATUS_WAITING; } if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) { $newarrayofstatus[] = Ticket::STATUS_CLOSED; From fb14f7c0b89016c9d80ec2e49fb5e450d9565baa Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 15 Jan 2021 14:40:55 +0100 Subject: [PATCH 38/56] Modify GETPOST parameters to match with v12 --- htdocs/core/tpl/card_presend.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index d9097ee0919..aaaa043e39b 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -209,7 +209,7 @@ if ($action == 'presend') } $formmail->withto = $liste; - $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1'); + $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alpha') ? GETPOST('sendto', 'alpha') : '1') : '1'); $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; $formmail->withtopic = $topicmail; From 871691bf69dba1ed973b74957341b93e6a967bc7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jan 2021 16:34:49 +0100 Subject: [PATCH 39/56] Fix missing popup --- htdocs/admin/accountant.php | 1 + htdocs/admin/company.php | 1 + htdocs/admin/openinghours.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index c8c082db6ae..b017230c677 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -66,6 +66,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if ($action != 'updateedit' && !$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 00bd17e865f..02091124b15 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -256,6 +256,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $db->commit(); } else diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index d4886bb2a57..05e0658d1d7 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -57,6 +57,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) if ($action != 'updateedit' && !$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } From 8b9287055e48390227a6e3a660dc1ee25d78cd83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jan 2021 18:34:25 +0100 Subject: [PATCH 40/56] Update functions.lib.php --- 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 7c562357d9a..6921f9f967a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4725,7 +4725,7 @@ function price2num($amount, $rounding = '', $option = 0) if ($option != 1) { // If not a PHP number or unknown, we change or clean format //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'
'; if (!is_numeric($amount)) { - $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_\-]/', '', $amount); + $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); } if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 From 33a0cf078c44bbdd01f77e06f38f3fb3e256161b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:12:23 +0100 Subject: [PATCH 41/56] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 03d487ee0c0..a74c9129cb0 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,8 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && is_numeric($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { From c4f8e81d5d56a740da9888ce7623009ea7d611c0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:18:42 +0100 Subject: [PATCH 42/56] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index a74c9129cb0..d485702ae0f 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && is_numeric($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int if (in_array($typ, array('sellist')) && !is_numeric($crit)) $mode_search = 0;// Search on a foreign key string if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string From a109dd89486bdea61be5483fab74113782560be7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jan 2021 13:51:35 +0100 Subject: [PATCH 43/56] Fix removed unexpected values in stats graph Conflicts: htdocs/projet/graph_opportunities.inc.php --- htdocs/projet/graph_opportunities.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 97977406a48..bbb2b6f97d9 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -68,8 +68,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $listofstatus = array_keys($listofoppstatus); // Complete with values found into database and not into the dictionary - foreach($valsamount as $key => $val) { - if (!in_array($key, $listofstatus)) { + foreach ($valsamount as $key => $val) { + if (!in_array($key, $listofstatus) && $key) { $listofstatus[] = $key; } } From a8cdecf1b8c234af63c13040d7cc03823001b0f1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 19:17:23 +0100 Subject: [PATCH 44/56] better fix --- htdocs/compta/paiement_charge.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index f67bed0ec63..715a0851c65 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -223,16 +223,9 @@ if ($action == 'create') print '
';*/ print '"; print ''; From b2d790b46a21d2c26ea6d44c8ee8cb0c55815971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Jan 2021 14:27:31 +0100 Subject: [PATCH 45/56] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ffacba65feb..a441aed7c8b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ default.properties .DS_Store .idea *.iml +*.orig Thumbs.db /dolibarr_genesis.mp4 # Log files From 0917b37bb9c678b8c9eda062b9c4d893c392b955 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Jan 2021 15:20:35 +0100 Subject: [PATCH 46/56] FIX #15966 #15967 --- htdocs/core/modules/mrp/mod_mo_advanced.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index 186caca619a..592dd23388e 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -68,7 +68,7 @@ class mod_mo_advanced extends ModeleNumRefMos $texte .= '
'; $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Date").''; + $empty=1; + $datepayment=''; if (GETPOSTISSET('remonth')) { $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $empty=0; } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); - } else { - $datepayment = '' ; + $empty=0; } - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print $form->selectDate($datepayment, '', '', '', $empty, "add_payment", 1, 1); print "
'.$langs->trans("RemainderToPay").''.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Date").''; - $empty=1; - $datepayment=''; - if (GETPOSTISSET('remonth')) { - $datepayment = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $empty=0; - } elseif (!empty($conf->global->MAIN_AUTOFILL_DATE)) { - $datepayment = dol_mktime(12, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); - $empty=0; - } - print $form->selectDate($datepayment, '', '', '', $empty, "add_payment", 1, 1); + $datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : ''; + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); print "
'; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo")); From a81b3a0d610a1b0e9daba2b24b4c3110af592028 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Jan 2021 15:23:36 +0100 Subject: [PATCH 47/56] FIX #15946 --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 425e47d3251..02eb3c77d4d 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -343,6 +343,7 @@ ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk -- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL; +-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode ALTER COLUMN tracking DROP NOT NULL; INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (9,'INPERSON', 'In person at your site', NULL, NULL, 0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (10,'FEDEX', 'Fedex', NULL, 'https://www.fedex.com/apps/fedextrack/index.html?tracknumbers={TRACKID}', 0); From 560d401cff616c75baaf74aebbf4e09ac20f0327 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Jan 2021 15:54:06 +0100 Subject: [PATCH 48/56] Code comment --- htdocs/projet/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 587493709f2..711d1b02935 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -176,7 +176,8 @@ if (empty($reshook)) if (!$error && $result > 0) { // Add myself as project leader - $result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal'); + $typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error. + $result = $object->add_contact($user->id, $typeofcontact, 'internal'); if ($result < 0) { $langs->load("errors"); From 640cf50b7fa570297ce8eda96628faba9f2696f7 Mon Sep 17 00:00:00 2001 From: BlackMirror Date: Wed, 20 Jan 2021 15:20:50 +0100 Subject: [PATCH 49/56] [FM] Fix 12.0 - duplicate label, probably mistaken for ref --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index f8b7908654b..3c7c74d0362 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -343,7 +343,7 @@ class pdf_strato extends ModelePDFContract } $txtpredefinedservice = ''; - $txtpredefinedservice = $objectligne->product_label; + $txtpredefinedservice = $objectligne->product_ref; if ($objectligne->product_label) { $txtpredefinedservice .= ' - '; From a55d23f363432355efd0001cb8957d6d3eab7943 Mon Sep 17 00:00:00 2001 From: BlackMirror Date: Thu, 21 Jan 2021 15:55:52 +0100 Subject: [PATCH 50/56] [FM] FIX - ticket extrafields of type 'date' are not saved --- htdocs/ticket/card.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 076c42867ca..aaf5b29a985 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -560,17 +560,21 @@ if (empty($reshook)) { // Action to update one extrafield if ($action == "update_extras" && !empty($permissiontoadd)) { $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); - $attributekey = GETPOST('attribute', 'alpha'); - $attributekeylong = 'options_' . $attributekey; - $object->array_options['options_' . $attributekey] = GETPOST($attributekeylong, ' alpha'); - $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); - if ($result > 0) { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - $action = 'view'; - } else { + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; + if (!$error) + { + $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); + if ($result < 0) { $error++; } + } + + if ($error) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit_extras'; + } else { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + $action = 'view'; } } From 5aba1f9ccd7dc06d723972dbceab360b0fd8e9d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jan 2021 01:07:45 +0100 Subject: [PATCH 51/56] FIX missing socid into link to create event from project agenda tab --- htdocs/projet/info.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 8cc6ff87642..96b29c42c86 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -162,7 +162,7 @@ $morehtmlcenter = ''; if (!empty($conf->agenda->enabled)) { $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create); - $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } //print ''; From 2acf2353a3c5419f4666c84df4ee832bd1a98584 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 12:16:25 +0100 Subject: [PATCH 52/56] Fix bad link --- htdocs/compta/paiement/card.php | 12 +++++++----- htdocs/langs/en_US/banks.lang | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index d3dec6fde82..2c3fa39f38f 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -277,10 +277,8 @@ print ''; // Bank account if (!empty($conf->banque->enabled)) { - if ($object->fk_account > 0) - { - if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) - { + if ($object->fk_account > 0) { + if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) { dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php'); $bordereau = new RemiseCheque($db); $bordereau->fetch($bankline->fk_bordereau); @@ -297,7 +295,11 @@ if (!empty($conf->banque->enabled)) print ''; print ''; print ''; print ''; } diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 75f9549dca5..78dadc8463b 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -176,3 +176,4 @@ BankColorizeMovement=Colorize movements BankColorizeMovementDesc=If this function is enable, you can choose specific background color for debit or credit movements BankColorizeMovementName1=Background color for debit movement BankColorizeMovementName2=Background color for credit movement +NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled. \ No newline at end of file From 86e853f27d7878213e2dcbe3d6cacc15984f4ccc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 12:18:07 +0100 Subject: [PATCH 53/56] Look and feel v12 --- htdocs/compta/paiement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 2c3fa39f38f..1bb6f4ce3fa 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -298,7 +298,7 @@ if (!empty($conf->banque->enabled)) if ($object->fk_account > 0) { print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted'); } else { - print $langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentities("Module85Name")); + print ''.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentities("Module85Name")).''; } print ''; print ''; From 9b6b1e055c378683807023de4785c5b3dfa101dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jan 2021 12:20:18 +0100 Subject: [PATCH 54/56] Fix trans --- htdocs/compta/paiement/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 1bb6f4ce3fa..1cfd72d26cc 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -298,7 +298,8 @@ if (!empty($conf->banque->enabled)) if ($object->fk_account > 0) { print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted'); } else { - print ''.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentities("Module85Name")).''; + $langs->load("admin"); + print ''.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name")).''; } print ''; print ''; From ae2b61d5ef15d39d85e850cde8d97a41dbe4e527 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 23 Jan 2021 18:49:11 +0100 Subject: [PATCH 55/56] Fix stripe off_session set/unset --- htdocs/stripe/class/stripe.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 83b3905de43..a691b7bff40 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -428,11 +428,11 @@ class Stripe extends CommonObject // payment_method = // payment_method_types = array('card') //var_dump($dataforintent); - if ($off_session) - { - unset($dataforintent['setup_future_usage']); - $dataforintent["off_session"] = true; - } + if ($off_session) + { + unset($dataforintent['setup_future_usage']); + $dataforintent["setup_future_usage"] = "off_session"; + } if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; From 35448e330773b13fdc3660db6efaf0fc904b4356 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 26 Jan 2021 12:42:04 +0100 Subject: [PATCH 56/56] FIX 11.0: when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized Because of this, missing mandatory extrafields are not checked and no extrafields are inserted --- htdocs/fichinter/card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ed6d7996eff..754ef061247 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -258,7 +258,13 @@ if (empty($reshook)) } // Extrafields - $extrafields = new ExtraFields($db); + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost(null, $object); + if ($ret < 0) { + $error++; + $action = 'create'; + } $array_options = $extrafields->getOptionalsFromPost($object->table_element); $object->array_options = $array_options;
'.$langs->trans('BankTransactionLine').''; - print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted'); + if ($object->fk_account > 0) { + print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted'); + } else { + print $langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentities("Module85Name")); + } print '