From 7fb93f39b4f77ed41f7df9b50af16e25e7e263df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2021 17:59:22 +0100 Subject: [PATCH 01/12] Code comment --- test/phpunit/ImportTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index e9bf019740c..32970f6fe1c 100644 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -142,6 +142,10 @@ class ImportTest extends PHPUnit\Framework\TestCase // according to option $this->assertEquals(0, 0); + // TODO Export and compare the file exported with the $file imported. + + + return true; } } From 527c32d79ec313e3f1ba121e3d73b5395759651f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 18 Feb 2021 11:04:37 +0100 Subject: [PATCH 02/12] with new phpoffice col start at 1 not 0 --- htdocs/core/modules/import/import_xlsx.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 6c0bcc0f4b1..9d3c4e2b94e 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -173,7 +173,7 @@ class ImportXlsx extends ModeleImports $this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true); $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); - $col = 0; + $col = 1; foreach ($headerlinefields as $field) { $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, 1, $outputlangs->transnoentities($field)); // set autowidth @@ -195,7 +195,7 @@ class ImportXlsx extends ModeleImports public function write_record_example($outputlangs, $contentlinevalues) { // phpcs:enable - $col = 0; + $col = 1; $row = 2; foreach ($contentlinevalues as $cell) { $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, $row, $cell); @@ -289,7 +289,7 @@ class ImportXlsx extends ModeleImports $xlsx = new Xlsx(); $info = $xlsx->listWorksheetinfo($this->file); $countcolumns = $info[0]['totalColumns']; - for ($col = 0; $col < $countcolumns; $col++) { + for ($col = 1; $col <= $countcolumns; $col++) { $this->headers[$col] = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, 1)->getValue(); } return 0; @@ -314,7 +314,7 @@ class ImportXlsx extends ModeleImports $xlsx = new Xlsx(); $info = $xlsx->listWorksheetinfo($this->file); $countcolumns = $info[0]['totalColumns']; - for ($col = 0; $col < $countcolumns; $col++) { + for ($col = 1; $col <= $countcolumns; $col++) { $val = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, $this->record)->getValue(); $array[$col]['val'] = $val; $array[$col]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we consider it null From 32a360dd2a03d7a7c685b47aa85591a8dab4a3e8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 18 Feb 2021 12:24:24 +0100 Subject: [PATCH 03/12] fix sample xls file --- htdocs/core/modules/modProduct.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index f92d9b30890..27446890043 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -749,13 +749,13 @@ class modProduct extends DolibarrModules $this->import_convertvalue_array[$r] = array( 'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') ); - $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"PRODUCT_REF or id:123456", + $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"ref:PRODUCT_REF or id:123456", 'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1", 'pr.price'=>"100", 'pr.price_ttc'=>"110", 'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110", 'pr.tva_tx'=>'20', 'pr.recuperableonly'=>'0', - 'pr.date_price'=>'2013-04-10'); + 'pr.date_price'=>'2020-12-31'); } if (!empty($conf->global->MAIN_MULTILANGS)) From f111302a25c603301905f352887d10fbc7dc6042 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 18 Feb 2021 12:48:06 +0100 Subject: [PATCH 04/12] fix column count --- .../modules/import/import_xlsx.modules.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 9d3c4e2b94e..ebe0486d97c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -372,7 +372,7 @@ class ImportXlsx extends ModeleImports //var_dump($sort_array_match_file_to_database); - if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val']))) { + if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[1]['val']))) { //print 'W'; $this->warnings[$warning]['lib'] = $langs->trans('EmptyLine'); $this->warnings[$warning]['type'] = 'EMPTY'; @@ -401,7 +401,7 @@ class ImportXlsx extends ModeleImports else $tablewithentity_cache[$tablename] = 0; // table does not contains entity field } else dol_print_error($this->db); } else { - //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); + dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } // array of fields to column index @@ -420,7 +420,7 @@ class ImportXlsx extends ModeleImports if ($key <= $maxfields) { // Set $newval with value to insert and set $listvalues with sql request part for insert $newval = ''; - if ($arrayrecord[($key - 1)]['type'] > 0) $newval = $arrayrecord[($key - 1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value + if ($arrayrecord[($key)]['type'] > 0) $newval = $arrayrecord[($key)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value // Make some tests on $newval @@ -572,21 +572,21 @@ class ImportXlsx extends ModeleImports $newval = $this->thirpartyobject->code_client; //print 'code_client='.$newval; } - if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" + if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null" } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') { if (strtolower($newval) == 'auto') { $newval = $this->thirpartyobject->get_codefournisseur(0, 1); $newval = $this->thirpartyobject->code_fournisseur; //print 'code_fournisseur='.$newval; } - if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" + if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null" } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') { if (strtolower($newval) == 'auto') { $this->thirpartyobject->get_codecompta('customer'); $newval = $this->thirpartyobject->code_compta; //print 'code_compta='.$newval; } - if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" + if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null" } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') { if (strtolower($newval) == 'auto') { $this->thirpartyobject->get_codecompta('supplier'); @@ -594,7 +594,7 @@ class ImportXlsx extends ModeleImports if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" //print 'code_compta_fournisseur='.$newval; } - if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" + if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null" } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') { $defaultref = ''; // TODO provide the $modTask (module of generation of ref) as parameter of import_insert function @@ -624,7 +624,7 @@ class ImportXlsx extends ModeleImports $errorforthistable++; $error++; } else { - $newval = $arrayrecord[($key - 1)]['val']; //We get new value computed. + $newval = $arrayrecord[($key)]['val']; //We get new value computed. } } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); @@ -695,8 +695,8 @@ class ImportXlsx extends ModeleImports $listfields[] = $fieldname; // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null"); - elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) $listvalues[] = "''"; + if (empty($newval) && $arrayrecord[($key)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null"); + elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) $listvalues[] = "''"; else $listvalues[] = "'" . $this->db->escape($newval) . "'"; } $i++; From e46d4ee75d3c1e12ec6e6d1b10ae1b4fddf12bc5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 18 Feb 2021 12:50:15 +0100 Subject: [PATCH 05/12] fix sample product import files --- htdocs/core/modules/modProduct.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 27446890043..78f638b1821 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -547,7 +547,7 @@ class modProduct extends DolibarrModules // field order as per structure of table llx_product $import_sample = array( - 'p.ref' => "PREF123456", + 'p.ref' => "ref:PREF123456", 'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'), 'p.label' => "Product name in default language", 'p.description' => "Product description in default language", @@ -687,7 +687,7 @@ class modProduct extends DolibarrModules ); $this->import_examplevalues_array[$r] = array( - 'sp.fk_product' => "PRODUCT_REF or id:123456", + 'sp.fk_product' => "ref:PRODUCT_REF or id:123456", 'sp.fk_soc' => "My Supplier", 'sp.ref_fourn' => "XYZ-F123456", 'sp.quantity' => "5", From 3a073c75e7a8552a8dfc68647576c727cc4d23d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2021 17:56:04 +0100 Subject: [PATCH 06/12] Too verbose --- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index ebe0486d97c..5b2e339a588 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -401,7 +401,7 @@ class ImportXlsx extends ModeleImports else $tablewithentity_cache[$tablename] = 0; // table does not contains entity field } else dol_print_error($this->db); } else { - dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); + //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } // array of fields to column index From 52dce616b94c043140bc11e7974be96df0c06296 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 18 Feb 2021 08:10:14 +0100 Subject: [PATCH 07/12] FIX 16165 Create customer discount without vat --- htdocs/core/class/discount.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9f901ed3452..af336c38745 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -222,6 +222,7 @@ class DiscountAbsolute if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht = 0; if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva = 0; if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc = 0; + if (empty($this->tva_tx)) $this->tva_tx = 0; // Check parameters if (empty($this->description)) From d88560c2ee58d4bdae0ef2cbbf3d61629f615687 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2021 18:04:14 +0100 Subject: [PATCH 08/12] changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 7023df33e3c..fbd0ef1e169 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ FIX: #16135 FIX: #16143 FIX: #16156 FIX: #16160 +FIX: #16165 Create customer discount without vat FIX: #16185 FIX: #16189, fix download/see check deposit PDF FIX: #16215 From b167a4a0c77f8682d248fe8d24696baa2ce1b442 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2021 22:00:44 +0100 Subject: [PATCH 09/12] FIX date selector when using reduced year (like on smartphone) --- ChangeLog | 1 + htdocs/compta/paiement.php | 10 ++-- htdocs/core/class/html.form.class.php | 52 ++++++++++---------- htdocs/core/class/html.formactions.class.php | 2 +- htdocs/core/js/lib_head.js.php | 7 +-- htdocs/core/lib/functions.lib.php | 10 ++-- 6 files changed, 45 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbd0ef1e169..1b08a59db9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,6 +57,7 @@ FIX: ODT generation very slow FIX: amount in summary of report FIX: vat value when code contains number FIX: payment term label on PDF +FIX: date selector when using reduced year (like on smartphone) ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 83393a52cb6..95db83c937b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -507,19 +507,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print ''; - print ''; + print ''; // Check transmitter print ''.$langs->trans('CheckTransmitter'); print ' ('.$langs->trans("ChequeMaker").')'; print ''; - print ''; + print ''; // Bank name print ''.$langs->trans('Bank'); print ' ('.$langs->trans("ChequeBank").')'; print ''; - print ''; + print ''; // Comments print ''.$langs->trans('Comments').''; @@ -577,6 +577,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $i = 0; //print ''; print '
'; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -785,7 +787,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print "\n"; } print "
"; - //print "\n"; + print "
\n"; } $db->free($resql); } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a3bdfefaf2b..7f8831bec96 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5614,6 +5614,9 @@ class Form if ($h == 3) $shour = ''; if ($m == 3) $smin = ''; + $nowgmt = dol_now('gmt'); + //var_dump(dol_print_date($nowgmt, 'dayhourinputnoreduce', 'tzuserrel')); + // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' $usecalendar = 'combo'; if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) { @@ -5636,13 +5639,13 @@ class Form // Calendrier popup version eldy if ($usecalendar == "eldy") { - // Zone de saisie manuelle de la date + // Input area to enter date manually $retstring .= 'trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring .= '>'; - // Icone calendrier + // Icon calendar if (!$disabled) { $retstring .= '