From 66f6d1bfd4f2d569adbcbb9e9468856557cd986e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 11 Feb 2020 15:57:49 +0100 Subject: [PATCH 1/6] add missing fields --- .../class/accountancyexport.class.php | 31 +++++++++---------- .../accountancy/class/bookkeeping.class.php | 4 +++ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 46d3feae5b2..9b107367129 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -935,6 +935,7 @@ class AccountancyExport foreach ($objectLines as $line) { $date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + $date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d'); // TYPE $type_enregistrement = 'E'; // For write movement @@ -950,7 +951,7 @@ class AccountancyExport // LIBE print $line->label_operation.$separator; // DATH - print $line->date_lim_reglement.$separator; + print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { if ($line->montant < 0) { @@ -969,21 +970,19 @@ class AccountancyExport } print $nature_piece.$separator; // RACI - /* - if (! empty($line->subledger_account)) { - if ($line->doc_type == 'supplier_invoice') { - $racine_subledger_account = '40'; - } elseif ($line->doc_type == 'customer_invoice') { - $racine_subledger_account = '41'; - } else { - $nature_piece = ''; - } - print $racine_subledger_account . $separator; - } else { - print $separator; - } - */ - print $separator; // deprecated CPTG & CPTA use instead + // if (! empty($line->subledger_account)) { +// if ($line->doc_type == 'supplier_invoice') { +// $racine_subledger_account = '40'; +// } elseif ($line->doc_type == 'customer_invoice') { +// $racine_subledger_account = '41'; +// } else { +// $racine_subledger_account = ''; +// } +// } else { + $racine_subledger_account = ''; // for records of type E leave this field blank +// } + + print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead // MONT print price(abs($line->montant), 0, '', 1, 2).$separator; // CODC diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6068e6ec0c1..7177e79b427 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -926,6 +926,7 @@ class BookKeeping extends CommonObject $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.lettering_code,"; + $sql .= " t.date_lettering,"; $sql .= " t.montant,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; @@ -934,6 +935,7 @@ class BookKeeping extends CommonObject $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; $sql .= " t.date_creation,"; + $sql .= " t.date_lim_reglement,"; $sql .= " t.tms as date_modification,"; $sql .= " t.date_export"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; @@ -1006,12 +1008,14 @@ class BookKeeping extends CommonObject $line->montant = $obj->montant; $line->sens = $obj->sens; $line->lettering_code = $obj->lettering_code; + $line->date_lettering = $obj->date_lettering; $line->fk_user_author = $obj->fk_user_author; $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; $line->journal_label = $obj->journal_label; $line->piece_num = $obj->piece_num; $line->date_creation = $this->db->jdate($obj->date_creation); + $line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement); $line->date_modification = $this->db->jdate($obj->date_modification); $line->date_export = $this->db->jdate($obj->date_export); From fc170c1081713a7b89e0a3daa6e014a96d5b6aa9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 11 Feb 2020 15:20:46 +0000 Subject: [PATCH 2/6] Fixing style errors. --- .../class/accountancyexport.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 9b107367129..c7d14d905c9 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -971,16 +971,16 @@ class AccountancyExport print $nature_piece.$separator; // RACI // if (! empty($line->subledger_account)) { -// if ($line->doc_type == 'supplier_invoice') { -// $racine_subledger_account = '40'; -// } elseif ($line->doc_type == 'customer_invoice') { -// $racine_subledger_account = '41'; -// } else { -// $racine_subledger_account = ''; -// } -// } else { + // if ($line->doc_type == 'supplier_invoice') { + // $racine_subledger_account = '40'; + // } elseif ($line->doc_type == 'customer_invoice') { + // $racine_subledger_account = '41'; + // } else { + // $racine_subledger_account = ''; + // } + // } else { $racine_subledger_account = ''; // for records of type E leave this field blank -// } + // } print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead // MONT From 5459e4b821df1f24e256c56bc311fb98470cf5c2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Feb 2020 20:11:37 +0100 Subject: [PATCH 3/6] Fix netmeasure update and display nb: netmeasure is for real weight, volume or piece; i'll try to introduce in v12 price by unit using this value ( needed for some business ie fruits, vegetables....) --- htdocs/product/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6d36495d5fc..f62979f96d3 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -17,7 +17,7 @@ * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2019 Frédéric France - * Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2019-2020 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1513,7 +1513,7 @@ else // Net Measure print ''.$langs->trans("NetMeasure").''; print ' '; - print $formproduct->selectMeasuringUnits($object->net_measure_units, '', 0, 0, 0); + print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0); print ''; } } @@ -1955,7 +1955,7 @@ else print ''.$langs->trans("NetMeasure").''; if ($object->net_measure != '') { - print $object->net_measure." ".measuringUnitString(0, "weight", $object->net_measure_units); + print $object->net_measure." ".measuringUnitString($object->net_measure_units, "", ""); } else { From 558ccdd8b9ee4edfb1f524cfa81f56ee56f8fc10 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Feb 2020 20:20:34 +0100 Subject: [PATCH 4/6] Update card.php --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index f62979f96d3..9d126ca96d9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1955,7 +1955,7 @@ else print ''.$langs->trans("NetMeasure").''; if ($object->net_measure != '') { - print $object->net_measure." ".measuringUnitString($object->net_measure_units, "", ""); + print $object->net_measure." ".measuringUnitString($object->net_measure_units); } else { From f17c7f4cb3ca1914282a619e0758c765327304e0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Feb 2020 20:21:53 +0100 Subject: [PATCH 5/6] fix for unit with rowid (netmeasure) --- htdocs/core/lib/product.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 9cf28ff20ee..f58af3500c0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -520,7 +520,14 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; $measuringUnits= new CUnits($db); - if ($scale !== '') + if ($measuring_style == '' && $scale == '') + { + $arrayforfilter = array( + 't.rowid' => $unit, + 't.active' => 1 + ); + } + elseif ($scale !== '') { $arrayforfilter = array( 't.scale' => $scale, From bd0666bf539708efe5860028d8900035c6829a04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2020 18:35:15 +0100 Subject: [PATCH 6/6] Update product.lib.php --- htdocs/core/lib/product.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index f58af3500c0..54555eb018c 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -504,7 +504,7 @@ function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $ * Return translation label of a unit key * * @param int $unit ID of unit (rowid in llx_c_units table) - * @param string $measuring_style Style of unit: weight, volume,... + * @param string $measuring_style Style of unit: 'weight', 'volume', ..., '' = 'net_measure' for option PRODUCT_ADD_NET_MEASURE * @param string $scale Scale of unit: '0', '-3', '6', ... * @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated. * @return string Unit string