From 73f6c9210fa4e020870a4188af05086c76f34b58 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 31 Mar 2020 11:01:01 +0200 Subject: [PATCH 01/15] FIX multicurrency manage on hidden conf SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL --- .../class/supplier_proposal.class.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e528b5ae5e7..6ad2dd1a2df 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1848,11 +1848,12 @@ class SupplierProposal extends CommonObject */ public function createPriceFournisseur($product, $user) { + global $conf; + if(!empty($conf->multicurrency->enabled)) include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $price=price2num($product->subprice*$product->qty, 'MU'); $qty=price2num($product->qty); $unitPrice = price2num($product->subprice, 'MU'); $now=dol_now(); - $values = array( "'".$this->db->idate($now)."'", $product->fk_product, @@ -1864,9 +1865,27 @@ class SupplierProposal extends CommonObject $product->tva_tx, $user->id ); + if(!empty($conf->multicurrency->enabled)) { + $multicurrency = new MultiCurrency($this->db); //need to fetch because empty fk_multicurrency and rate + if(!empty($product->multicurrency_code)) { + $multicurrency->fetch(0, $product->multicurrency_code); + if(! empty($multicurrency->id)) { + $values[] = $multicurrency->id; + $values[] = "'".$product->multicurrency_code."'"; + $values[] = $product->multicurrency_subprice; + $values[] = $product->multicurrency_total_ht; + $values[] = $multicurrency->rate->rate; + } + else { + for($i = 0; $i < 5; $i++) $values[] = 'NULL'; + } + } + } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_fournisseur_price '; - $sql .= '(datec, fk_product, fk_soc, ref_fourn, price, quantity, unitprice, tva_tx, fk_user) VALUES ('.implode(',', $values).')'; + $sql .= '(datec, fk_product, fk_soc, ref_fourn, price, quantity, unitprice, tva_tx, fk_user'; + if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) $sql .= ',fk_multicurrency, multicurrency_code, multicurrency_unitprice, multicurrency_price, multicurrency_tx'; + $sql .= ') VALUES ('.implode(',', $values).')'; $resql = $this->db->query($sql); if (!$resql) { From 5658d783d6b2536ad1e78854c997e9e967da851e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 31 Mar 2020 12:04:34 +0200 Subject: [PATCH 02/15] fix advtargetemailing : fatal call to static attribut (that is not static: table_element) --- htdocs/core/tpl/advtarget.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index b3b6b5d1bf1..07b7744e2f8 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -263,7 +263,8 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementtype = Societe::$table_element; + $socstatic=new Societe($db); + $elementtype = $socstatic->table_element; // fetch optionals attributes and labels dol_include_once('/core/class/extrafields.class.php'); $extrafields = new ExtraFields($db); From e3dfe60567ccd1d6da1c020a1878a5cdb0a10a20 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 31 Mar 2020 14:51:30 +0200 Subject: [PATCH 03/15] uniformize update buyprice + some fixes --- .../fourn/class/fournisseur.product.class.php | 4 ++-- .../class/supplier_proposal.class.php | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index f11f88464f3..04527e21e33 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -428,7 +428,7 @@ class ProductFournisseur extends Product $sql .= " ".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").","; $sql .= " " . $newnpr . ","; $sql .= $conf->entity . ","; - $sql .= $delivery_time_days . ","; + $sql .= ($delivery_time_days != '' ? $delivery_time_days : 'null') . ","; $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'") . ","; $sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'") . ","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'"); @@ -447,7 +447,7 @@ class ProductFournisseur extends Product if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { // Add record into log table // $this->product_fourn_price_id must be set - $result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code); + $result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code); if ($result < 0) { $error++; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e528b5ae5e7..32ac6104c90 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1792,25 +1792,25 @@ class SupplierProposal extends CommonObject */ public function updateOrCreatePriceFournisseur($user) { - $productsupplier = new ProductFournisseur($this->db); + global $conf; dol_syslog(get_class($this)."::updateOrCreatePriceFournisseur", LOG_DEBUG); foreach ($this->lines as $product) { if ($product->subprice <= 0) continue; + $productsupplier = new ProductFournisseur($this->db); - $idProductFourn = $productsupplier->find_min_price_product_fournisseur($product->fk_product, $product->qty); - $res = $productsupplier->fetch($idProductFourn); + $multicurrency_tx = 1; + $fk_multicurrency = 0; - if ($productsupplier->id) { - if ($productsupplier->fourn_qty == $product->qty) { - $this->updatePriceFournisseur($productsupplier->product_fourn_price_id, $product, $user); - } else { - $this->createPriceFournisseur($product, $user); - } - } else { - $this->createPriceFournisseur($product, $user); - } + if(empty($this->thirdparty)) $this->fetch_thirdparty(); + + $ref_fourn = $product->ref_fourn; + if(empty($ref_fourn)) $ref_fourn = $product->ref_supplier; + if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); + $productsupplier->id = $product->fk_product; + + $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '' ); } return 1; From 1f5da36fdb779e4ec8a0372bc058155cc0b05a9a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 31 Mar 2020 13:02:44 +0000 Subject: [PATCH 04/15] Fixing style errors. --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 32ac6104c90..e0f464e76a1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1810,7 +1810,7 @@ class SupplierProposal extends CommonObject if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); $productsupplier->id = $product->fk_product; - $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '' ); + $productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); } return 1; From 6f0071bebe8ae3f1c906d690a525ccfb4432129a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Mar 2020 17:54:48 +0200 Subject: [PATCH 05/15] FIX sort on company on member list --- htdocs/adherents/list.php | 4 ++++ htdocs/install/mysql/tables/llx_adherent.sql | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7497ededc8f..c9b7ee42fcf 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -52,6 +52,7 @@ $search_lastname = GETPOST("search_lastname", 'alpha'); $search_firstname = GETPOST("search_firstname", 'alpha'); $search_gender = GETPOST("search_gender", 'alpha'); $search_civility = GETPOST("search_civility", 'alpha'); +$search_company = GETPOST('search_company', 'alphanohtml'); $search_login = GETPOST("search_login", 'alpha'); $search_address = GETPOST("search_address", 'alpha'); $search_zip = GETPOST("search_zip", 'alpha'); @@ -254,6 +255,7 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as $sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; +$sql .= " s.nom,"; $sql .= " t.libelle as type, t.subscription,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; // Add fields from extrafields @@ -269,6 +271,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count if (!empty($search_categ) || !empty($catid)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid "; if ($catid > 0) $sql .= " AND cm.fk_categorie = ".$db->escape($catid); @@ -289,6 +292,7 @@ if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname); if ($search_lastname) $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); if ($search_gender != '' && $search_gender != '-1') $sql .= " AND d.gender = '".$search_gender."'"; if ($search_login) $sql .= natural_search("d.login", $search_login); +if ($search_company) $sql .= natural_search("s.nom", $search_company); if ($search_email) $sql .= natural_search("d.email", $search_email); if ($search_town) $sql .= natural_search("d.town", $search_town); if ($search_zip) $sql .= natural_search("d.zip", $search_zip); diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index cb96ab98164..1917e80c81a 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -39,7 +39,7 @@ create table llx_adherent pass_crypted varchar(128), fk_adherent_type integer NOT NULL, morphy varchar(3) NOT NULL, -- personne morale / personne physique - societe varchar(128), -- company name (should be same lenght than societe.name) + societe varchar(128), -- company name (should be same length than societe.name). No more used. fk_soc integer NULL, -- Link to third party linked to member address text, zip varchar(30), From 70706d9ea712848a6a57dceea14c7099f1a71aa8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Apr 2020 18:48:45 +0200 Subject: [PATCH 06/15] FIX Missing token and take into account max date when it can. --- htdocs/compta/stats/index.php | 27 +++++++++++++++++++-------- htdocs/core/lib/report.lib.php | 19 ++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 684ef337fcd..ba17730831f 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -31,12 +31,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'bills', 'donation', 'salaries')); -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); +$date_startday = GETPOST('date_startday', 'int'); +$date_startmonth = GETPOST('date_startmonth', 'int'); +$date_startyear = GETPOST('date_startyear', 'int'); +$date_endday = GETPOST('date_endday', 'int'); +$date_endmonth = GETPOST('date_endmonth', 'int'); +$date_endyear = GETPOST('date_endyear', 'int'); $nbofyear = 4; @@ -193,15 +193,18 @@ elseif ($modecompta == "BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; - $sql .= " WHERE b.entity = ".$conf->entity; + $sql .= " WHERE b.entity = ".$conf->entity; // In module double party accounting, we never share entities $sql .= " AND aj.entity = ".$conf->entity; $sql .= " AND b.code_journal = aj.code AND aj.nature = 2"; // @todo currently count amount in sale journal, but we need to define a category group for turnover } $sql .= " GROUP BY dm"; $sql .= " ORDER BY dm"; +// TODO Add a filter on $date_start and $date_end to reduce quantity on data //print $sql; +$minyearmonth = $maxyearmonth = 0; + $result = $db->query($sql); if ($result) { @@ -214,7 +217,7 @@ if ($result) $cum[$obj->dm] = $obj->amount_ttc; if ($obj->amount_ttc) { - $minyearmonth = ($minyearmonth ?min($minyearmonth, $obj->dm) : $obj->dm); + $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm); } $i++; @@ -309,9 +312,17 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) $mois_modulo = $mois; // ajout if ($mois > 12) {$mois_modulo = $mois - 12; } // ajout + if ($year_start == $year_end) { + if ($mois > $date_endmonth && $year_end >= $date_endyear) { + break; + } + } + print ''; + // Month print "".dol_print_date(dol_mktime(12, 0, 0, $mois_modulo, 1, 2000), "%B").""; + for ($annee = $year_start - 1; $annee <= $year_end; $annee++) // We start one year before to have data to be able to make delta { $annee_decalage = $annee; diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index 4649abc474a..979583e8b4d 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -53,16 +53,17 @@ function report_header($reportname, $notused, $period, $periodlink, $description $head[$h][1] = $langs->trans("Report"); $head[$h][2] = 'report'; - print '
'; + print ''."\n"; + print ''."\n"; dol_fiche_head($head, 'report'); foreach($moreparam as $key => $value) { - print ''; + print ''."\n"; } - print ''; + print '
'."\n"; $variante = ($periodlink || $exportlink); @@ -73,7 +74,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description print $reportname; print ''; if ($variante) print ''; - print ''; + print ''."\n"; // Calculation mode if ($calcmode) @@ -84,7 +85,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description print $calcmode; if ($variante) print ''; print ''; - print ''; + print ''."\n"; } // Ligne de la periode d'analyse du rapport @@ -94,14 +95,14 @@ function report_header($reportname, $notused, $period, $periodlink, $description if ($period) print $period; if ($variante) print ''; print ''; - print ''; + print ''."\n"; // Ligne de description print ''; print ''; print ''; if ($variante) print ''; - print ''; + print ''."\n"; // Ligne d'export print ''; @@ -110,9 +111,9 @@ function report_header($reportname, $notused, $period, $periodlink, $description print dol_print_date($builddate, 'dayhour'); print ''; if ($variante) print ''; - print ''; + print ''."\n"; - print '
'.$periodlink.'
'.$langs->trans("ReportDescription").''.$description.'
'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'
'; + print ''."\n"; dol_fiche_end(); From 7330c3120484e41ccdb59d11c449e80faf2a2637 Mon Sep 17 00:00:00 2001 From: Alex Veremme Date: Thu, 2 Apr 2020 01:10:56 +0200 Subject: [PATCH 07/15] Fix ##13474: copy extrafields of LINES from a draft invoice to an invoice template --- .../compta/facture/class/facture-rec.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5480142ec78..f856151c8af 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -251,6 +251,23 @@ class FactureRec extends CommonInvoice { $error++; } + else { + $objectline = new FactureLigneRec($this->db); + if ($objectline->fetch($result_insert)) + { + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($facsrc->lines[$i], 'fetch_optionals')) { + $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); + $objectline->array_options = $facsrc->lines[$i]->array_options; + } + + $result = $objectline->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } } if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects From 9476fbc3e714dacf376bc4d6a68f2a25717b7f32 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Apr 2020 23:16:13 +0000 Subject: [PATCH 08/15] Fixing style errors. --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f856151c8af..110f5a9cbb8 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -260,7 +260,7 @@ class FactureRec extends CommonInvoice $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); $objectline->array_options = $facsrc->lines[$i]->array_options; } - + $result = $objectline->insertExtraFields(); if ($result < 0) { From 4d2b4583d0ee4d26dfcb09514c31e08f51e314e1 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 2 Apr 2020 09:28:56 +0200 Subject: [PATCH 09/15] FIX - This error logs an Orderline::delete error, but this is an Orderline::insert error --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6e4d2efc742..d44e7e6d5a1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4409,7 +4409,7 @@ class OrderLine extends CommonOrderLine foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR); $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); From a743110f03063164bad7da85cc5224c01bad45d7 Mon Sep 17 00:00:00 2001 From: altairis Date: Thu, 2 Apr 2020 10:44:24 +0200 Subject: [PATCH 10/15] FIX md stylesheet to be included by external modules like eldy --- htdocs/theme/md/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1681c48e4e1..9d7f7b76dd4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -48,7 +48,7 @@ if (defined('THEME_ONLY_CONSTANT')) return; session_cache_limiter('public'); -require_once '../../main.inc.php'; +require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) From 5622c1947bf5f146853a9dff3b9f721579495b7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Apr 2020 12:23:53 +0200 Subject: [PATCH 11/15] Prepare 10.0.7 --- ChangeLog | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/ChangeLog b/ChangeLog index 914d5129f7e..dc0269aa321 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,77 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 10.0.7 compared to 10.0.6 ***** +FIX: 10.0 - missing translations for "orders" homepage "orders" box +FIX: 10.0 - status missing from last customer invoices box when using MAIN_STATUS_USES_CSS +FIX: 10.0 - translations for "orders" not loaded in the homepage box +FIX: #10309 +FIX: #12875 +FIX: #12932 +FIX: #12966 +FIX: #12973 +FIX: #13304 +FIX: advanced target emailing sql and ergonomy +FIX: an external user can not approved +FIX: Bad translation for productlot EatBy and SellBy +FIX: better check +FIX: better method to check user rights AND usergroup rights ! +FIX: CA by prod list filter +FIX: can be a string or integer +FIX: Check on unicity on prof id was not triggered sometimes +FIX: clone of purchase order +FIX: compatibility with multicompany (avoid duplicate data) +FIX: complex export model loading +FIX: date filter not used if no operator +FIX: date order was -1D and desc with label repetition +FIX: default lang selection when filter +FIX: dom and missing param +FIX: drafts are now implemented for stats +FIX: Error in log for email sending with smtps was not complete +FIX: Extrafield position in export field list must respect "pos" field +FIX: FEC export format +FIX: FEC export have specific name +FIX: fetching account on current entity +FIX: Filenames must not contains non ascii char or we will get non ascii +FIX: fk_type subscription list via api REST +FIX: Force FEC export to txt format +FIX: get remain to pay with rounding decimals +FIX: Invert isSellerInEEC and isBuyerInEEC +FIX: keep assigned users in session when loading projects and tasks +FIX: length, width and height units coherence in product table +FIX: links in products/services index +FIX: Mail smtps truncated if content has a line with single . +FIX: missing array option +FIX: missing global $conf +FIX: missing hook parameter +FIX: Missing Linked objects Fichinter Ref. in PDF formats +FIX: missing "statut" for getNomUrl() function +FIX: multicompany for discount +FIX: must be == and not = +FIX: Problem with column label in subscription list +FIX: regex for include or exclude categories in full arbo +FIX: Remove unexisting link +FIX: remove unused var, $usercancreate can be change by Multicompany +FIX: require category class in extrafield +FIX: round MT in accountancy books +FIX: search with '0' +FIX: send expense report mail in HTML format +FIX: SQL request and phpunit +FIX: substitute lines dates values on doc generator (ODT, ...) +FIX: test on 0 better than isset +FIX: The "automatic bind" was linked EEC to export accountancy code +FIX: thirdparty alias name desappeared if we change country with THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION conf +FIX: timezone must be tzserver and not tzuser as well as on contract card +FIX: typo on ckeck method +FIX: use "usergroup" instead "user" +FIX: Visualization rights correction on last modified contacts box +FIX: Warning on admin/export_files +FIX: We want to be able to import data for extrafields of entity 0 too +FIX: when we filter a list on a view status, we want this filter to be on bookmark that we create +FIX: wrong test +FIX: XSS vulnerability in description of list of audit events. +FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD + ***** ChangeLog for 10.0.6 compared to 10.0.5 ***** FIX Regression of 10.0.5 to create/edit proposals and orders. FIX: #12760 #12763 #12755 #12765 #12751 From 7380fa32ec911c866fcaf82e9159511598732a99 Mon Sep 17 00:00:00 2001 From: jribal Date: Wed, 1 Apr 2020 11:09:40 +0100 Subject: [PATCH 12/15] On _checkAccessToResource: category -> categorie --- htdocs/categories/class/api_categories.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 459b61ba740..4274dd37344 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -226,7 +226,7 @@ class Categories extends DolibarrApi throw new RestException(404, 'category not found'); } - if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -261,7 +261,7 @@ class Categories extends DolibarrApi throw new RestException(404, 'category not found'); } - if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -750,7 +750,7 @@ class Categories extends DolibarrApi throw new RestException(404, 'category not found'); } - if (!DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From c6f57c46a890bf8736e98497bb09e6935ad4e607 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Apr 2020 13:01:49 +0200 Subject: [PATCH 13/15] Update supplier_proposal.class.php --- .../class/supplier_proposal.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 6ad2dd1a2df..b91c6c43ffe 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1849,8 +1849,8 @@ class SupplierProposal extends CommonObject public function createPriceFournisseur($product, $user) { global $conf; - if(!empty($conf->multicurrency->enabled)) include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; - $price=price2num($product->subprice*$product->qty, 'MU'); + + $price=price2num($product->subprice*$product->qty, 'MU'); $qty=price2num($product->qty); $unitPrice = price2num($product->subprice, 'MU'); $now=dol_now(); @@ -1865,9 +1865,10 @@ class SupplierProposal extends CommonObject $product->tva_tx, $user->id ); - if(!empty($conf->multicurrency->enabled)) { - $multicurrency = new MultiCurrency($this->db); //need to fetch because empty fk_multicurrency and rate - if(!empty($product->multicurrency_code)) { + if (!empty($conf->multicurrency->enabled)) { + if (!empty($product->multicurrency_code)) { + include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; + $multicurrency = new MultiCurrency($this->db); //need to fetch because empty fk_multicurrency and rate $multicurrency->fetch(0, $product->multicurrency_code); if(! empty($multicurrency->id)) { $values[] = $multicurrency->id; From d204cfe6c64393515c1332ccc6f6b3a3d3948eb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Apr 2020 15:54:33 +0200 Subject: [PATCH 14/15] FIX Protection when database has a corrupted product id --- htdocs/product/stock/class/mouvementstock.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 7b92af43ef0..e0266172463 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -109,7 +109,7 @@ class MouvementStock extends CommonObject * @param string $batch batch number * @param boolean $skip_batch If set to true, stock movement is done without impacting batch record * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) - * @return int <0 if KO, 0 if fk_product is null, >0 if OK + * @return int <0 if KO, 0 if fk_product is null or product id does not exists, >0 if OK */ public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) { @@ -155,13 +155,15 @@ class MouvementStock extends CommonObject $product = new Product($this->db); $result=$product->fetch($fk_product); - if ($result < 0) - { + if ($result < 0) { $this->error = $product->error; $this->errors = $product->errors; dol_print_error('', "Failed to fetch product"); return -1; } + if ($product->id <= 0) { // Can happen if database is corrupted + return 0; + } $this->db->begin(); From 3408f67348ef1bc5118d9ec17d01382c920db20e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Apr 2020 16:00:09 +0200 Subject: [PATCH 15/15] Clean orhpelins in llx_product_association --- htdocs/install/mysql/migration/repair.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 7f5e6fafe3d..4297c5f324d 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -165,6 +165,10 @@ DELETE FROM llx_product_batch WHERE qty = 0; UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid); +-- Fix: delete orphelins in product_association +delete from llx_product_association where fk_product_pere NOT IN (select rowid from llx_product); +delete from llx_product_association where fk_product_fils NOT IN (select rowid from llx_product); + -- Fix: delete category child with no category parent. drop table tmp_categorie; create table tmp_categorie as select * from llx_categorie;