From 63824861a61b5bff5d74bfe566f60e29ccd2401a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 16:58:06 +0200 Subject: [PATCH 01/17] Fix import of chart of account. The account parent was not managed. --- htdocs/core/modules/modAccounting.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index c47e8d310f1..20dfc120bbd 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -281,11 +281,11 @@ class modAccounting extends DolibarrModules $this->import_tables_array[$r]=array('aa'=>MAIN_DB_PREFIX.'accounting_account'); $this->import_tables_creator_array[$r]=array('aa'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation"); - $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^\d{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^\d{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); + $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); $this->import_convertvalue_array[$r]=array( - 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), - 'aa.account_parent'=>array('rule'=>'zeroifnull'), + 'aa.account_parent'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch'), + 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), ); - $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); } } From 49991eabf8c2b90aea1ab51306064bf806fce924 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 17:09:18 +0200 Subject: [PATCH 02/17] Fix import of accounting account from ref in import profiles --- htdocs/core/modules/import/import_csv.modules.php | 7 +++++-- htdocs/core/modules/import/import_xlsx.modules.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 6db495e9f04..8ffab2ddbee 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -443,11 +443,14 @@ class ImportCsv extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method),array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') $param_array = array('', $newval, 1); + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - call_user_func_array(array($classinstance, $method),array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index d96dc18104f..707a4f745eb 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -470,11 +470,14 @@ class ImportXlsx extends ModeleImports } $classinstance=new $class($this->db); // Try the fetch from code or ref - call_user_func_array(array($classinstance, $method),array('', $newval)); + $param_array = array('', $newval); + if ($class == 'AccountingAccount') $param_array = array('', $newval, 1); + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') { - call_user_func_array(array($classinstance, $method),array('', '', $newval)); + $param_array = array('', '', $newval); + call_user_func_array(array($classinstance, $method), $param_array); } $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; From 769fbdb429a325fb3ab47077b3491a9d798d75eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 17:39:37 +0200 Subject: [PATCH 03/17] FIX the id was not loaded in fetch of accounting system --- htdocs/accountancy/class/accountancysystem.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index b70fa7238bb..95199ce9500 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -83,13 +83,13 @@ class AccountancySystem if ($rowid > 0 || $ref) { - $sql = "SELECT a.pcg_version, a.label, a.active"; + $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a"; $sql .= " WHERE"; if ($rowid) { $sql .= " a.rowid = '" . $rowid . "'"; } elseif ($ref) { - $sql .= " a.pcg_version = '" . $ref . "'"; + $sql .= " a.pcg_version = '" . $this->db->escape($ref) . "'"; } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); From 0fc7ad7c1fea60bd59fe6cd20518c327a47862b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 18:05:29 +0200 Subject: [PATCH 04/17] Add one param to fetch of accounting account to solve chart import --- .../accountancy/class/accountingaccount.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 886e19577fb..d01a48d1664 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -149,12 +149,13 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, 0 if not found, Id of record if OK and found + * @param int $rowid Id + * @param string $account_number Account number + * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account + * @param string $limittochartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'. + * @return int <0 if KO, 0 if not found, Id of record if OK and found */ - function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) + function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') { global $conf; @@ -172,6 +173,9 @@ class AccountingAccount extends CommonObject if (! empty($limittocurrentchart)) { $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; } + if (! empty($limittoachartaccount)) { + $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."')"; + } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); From bad565cc64decea9c9e4cd5377c96d72cbdf38ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 18:13:24 +0200 Subject: [PATCH 05/17] Fix syntax error --- htdocs/accountancy/class/accountingaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index d01a48d1664..ccb12f7bc4c 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -174,7 +174,7 @@ class AccountingAccount extends CommonObject $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')'; } if (! empty($limittoachartaccount)) { - $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."')"; + $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); From c04d082ad1316213479036a1762f933dcbefcd31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 May 2019 18:14:15 +0200 Subject: [PATCH 06/17] FIX Import of chart of account --- .../modules/import/import_csv.modules.php | 19 +++++++++++++++++-- .../modules/import/import_xlsx.modules.php | 19 +++++++++++++++++-- htdocs/core/modules/modAccounting.class.php | 3 ++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 8ffab2ddbee..4dd4ef342e7 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -444,7 +444,22 @@ class ImportCsv extends ModeleImports $classinstance=new $class($this->db); // Try the fetch from code or ref $param_array = array('', $newval); - if ($class == 'AccountingAccount') $param_array = array('', $newval, 1); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') @@ -462,7 +477,7 @@ class ImportCsv extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,'code',$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); else if (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn',$key,$newval,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 707a4f745eb..1c5fae77338 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -471,7 +471,22 @@ class ImportXlsx extends ModeleImports $classinstance=new $class($this->db); // Try the fetch from code or ref $param_array = array('', $newval); - if ($class == 'AccountingAccount') $param_array = array('', $newval, 1); + if ($class == 'AccountingAccount') + { + //var_dump($arrayrecord[0]['val']); + /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; + $tmpchartofaccount = new AccountancySystem($this->db); + $tmpchartofaccount->fetch($conf->global->CHARTOFACCOUNTS); + var_dump($tmpchartofaccount->ref.' - '.$arrayrecord[0]['val']); + if ((! ($conf->global->CHARTOFACCOUNTS > 0)) || $tmpchartofaccount->ref != $arrayrecord[0]['val']) + { + $this->errors[$error]['lib']=$langs->trans('ErrorImportOfChartLimitedToCurrentChart', $tmpchartofaccount->ref); + $this->errors[$error]['type']='RESTRICTONCURRENCTCHART'; + $errorforthistable++; + $error++; + }*/ + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') @@ -489,7 +504,7 @@ class ImportXlsx extends ModeleImports { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,'code',$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); else if (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn',$key,$newval,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorFieldValueNotIn'; + else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; $this->errors[$error]['type']='FOREIGNKEY'; $errorforthistable++; $error++; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 20dfc120bbd..ec8622f2b95 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -283,9 +283,10 @@ class modAccounting extends DolibarrModules $this->import_fields_array[$r]=array('aa.fk_pcg_version'=>"Chartofaccounts*",'aa.account_number'=>"AccountAccounting*",'aa.label'=>"Label*",'aa.account_parent'=>"Accountparent","aa.fk_accounting_category"=>"AccountingCategory","aa.pcg_type"=>"Pcgtype*",'aa.pcg_subtype'=>'Pcgsubtype*','aa.active'=>'Status*','aa.datec'=>"DateCreation"); $this->import_regex_array[$r]=array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system','aa.account_number'=>'^.{1,32}$','aa.label'=>'^.{1,255}$','aa.account_parent'=>'^.{0,32}$','aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category','aa.pcg_type'=>'^.{1,20}$','aa.pcg_subtype'=>'^.{1,20}$','aa.active'=>'^0|1$','aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); $this->import_convertvalue_array[$r]=array( - 'aa.account_parent'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch'), + 'aa.account_parent'=>array('rule'=>'fetchidfromref','classfile'=>'/accountancy/class/accountingaccount.class.php','class'=>'AccountingAccount','method'=>'fetch','element'=>'AccountingAccount'), 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/accountancy/class/accountancycategory.class.php','class'=>'AccountancyCategory','method'=>'fetch','dict'=>'DictionaryAccountancyCategory'), ); $this->import_examplevalues_array[$r]=array('aa.fk_pcg_version'=>"PCG99-ABREGE",'aa.account_number'=>"707",'aa.label'=>"Product sales",'aa.account_parent'=>"ref:7 or id:1407","aa.fk_accounting_category"=>"","aa.pcg_type"=>"PROD",'aa.pcg_subtype'=>'PRODUCT','aa.active'=>'1','aa.datec'=>"2017-04-28"); + $this->import_updatekeys_array[$r]=array('aa.fk_pcg_version'=>'Chartofaccounts','aa.account_number'=>'AccountAccounting'); } } From d6aef8971909b99222ce9586f19f0c39ebdee252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 May 2019 12:42:12 +0200 Subject: [PATCH 07/17] Fix css --- htdocs/theme/eldy/global.inc.php | 14 ++++++-------- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 624277e8aec..db5820f7da2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3076,7 +3076,8 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .boxstats, .boxstats130 { display: inline-block; - margin: 8px; + margin-left: 8px; + margin-right: 8px; margin-top: 5px; margin-bottom: 5px; text-align: center; @@ -3093,7 +3094,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { text-overflow: ellipsis; } .boxstats130 { - width: 158px; + width: 100%; height: 59px; /* padding: 3px; */ } @@ -3130,8 +3131,6 @@ ul.noborder li:nth-child(even):not(.liste_titre) { { .boxstats, .boxstats130 { margin: 3px; - /*border: 1px solid #ccc; - box-shadow: none; */ } .boxstats130 { text-align: @@ -3143,15 +3142,14 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .thumbstat150 { flex: 1 1 110px; margin-bottom: 8px; - width: 160px; + min-width: px; /* on screen < 320, we guaranty to have 2 columns */ + max-width: px; /* on screen < 320, we guaranty to have 2 columns */ + /* width: ...px; If I use with, there is trouble on size of flex boxes solved with min + (max that is a little bit higer than min) */ } .dashboardlineindicator { float: left; padding-left: 5px; } - .boxstats130 { - width: 148px; - } .boxstats { width: 111px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c9e56da0e63..2dfdf4e28a1 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3361,7 +3361,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .boxstats130 { width: 135px; - height: 48px; + height: 54px; padding: 3px; } @media only screen and (max-width: 767px) From b67363d76988e5a7c0de8c436016b47fbf64d24e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 May 2019 18:54:43 +0200 Subject: [PATCH 08/17] Fix rename export php lib to avoi duplicate with old library. --- htdocs/core/modules/export/export_excel.modules.php | 2 +- htdocs/core/modules/export/export_excel2007.modules.php | 2 +- htdocs/core/modules/export/export_excel2007new.modules.php | 2 +- htdocs/exports/export.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 3eafc454530..ffb1fd83cce 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -76,7 +76,7 @@ class ExportExcel extends ModeleExports $this->db = $db; $this->id='excel'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 95'; // Label of driver + $this->label='Excel 95 (old library)'; // Label of driver $this->desc = $langs->trans('Excel95FormatDesc'); $this->extension='xls'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index e33849427b1..7460d71ff13 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -76,7 +76,7 @@ class ExportExcel2007 extends ExportExcel $this->db = $db; $this->id='excel2007'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007'; // Label of driver + $this->label='Excel 2007 (old library)'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 32b6029a294..266cedc1310 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -78,7 +78,7 @@ class ExportExcel2007new extends ModeleExports $this->db = $db; $this->id='excel2007new'; // Same value then xxx in file name export_xxx.modules.php - $this->label='Excel 2007 by PHPSpreadSheet'; // Label of driver + $this->label='Excel 2007'; // Label of driver $this->desc = $langs->trans('Excel2007FormatDesc'); $this->extension='xlsx'; // Extension for generated file by this driver $this->picto='mime/xls'; // Picto diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 9663806fdc2..b6dfc23cf48 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1009,7 +1009,7 @@ if ($step == 4 && $datatoexport) print ''; print $value.' '; - print ''; + print ''; if ($value < count($array_selected)) print ''.img_down().''; if ($value > 1) print ''.img_up().''; print ''; From a5865d3e4a292b6f7909bf4b11e03b16d71ca538 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 May 2019 19:29:33 +0200 Subject: [PATCH 09/17] Debug BOM --- htdocs/bom/class/bom.class.php | 22 ++++++++++--------- htdocs/core/tpl/commonfields_view.tpl.php | 4 ++-- .../install/mysql/migration/9.0.0-10.0.0.sql | 11 ++++++---- htdocs/install/mysql/tables/llx_bom_bom.sql | 7 +++--- htdocs/langs/en_US/main.lang | 2 ++ htdocs/langs/en_US/mrp.lang | 2 ++ 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9f6a2a7a6a6..153554933cd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -94,18 +94,19 @@ class BOM extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), - 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), - 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), - 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), - 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), + 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), + 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), + 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900, 'notnull'=>-1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), ); public $rowid; public $ref; @@ -121,6 +122,7 @@ class BOM extends CommonObject public $status; public $fk_product; public $qty; + public $efficiency; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index f6d59435e74..49b234c651c 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -90,10 +90,10 @@ foreach($object->fields as $key => $val) print ''; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; print ''; diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 035cd0d48c5..e4fc1b04f29 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -212,19 +212,22 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4), date_creation datetime NOT NULL, - tms timestamp NOT NULL, + tms timestamp, date_valid datetime, fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(24,8) DEFAULT 1; + create table llx_bom_bom_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index a406229a0e4..4e559566817 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -23,6 +23,9 @@ CREATE TABLE llx_bom_bom( description text, note_public text, note_private text, + fk_product integer, + qty double(24,8), + efficiency double(8,4) DEFAULT 1, date_creation datetime NOT NULL, tms timestamp, date_valid datetime, @@ -30,8 +33,6 @@ CREATE TABLE llx_bom_bom( fk_user_modif integer, fk_user_valid integer, import_key varchar(14), - status integer NOT NULL, - fk_product integer, - qty double(24,8) + status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 233861a2f0e..fd74d0cae07 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -971,3 +971,5 @@ ShowMoreInfos=Show More Infos NoFilesUploadedYet=Please upload a document first SeePrivateNote=See private note PaymentInformation=Payment information +ValidFrom=Valid from +ValidUntil=Valid until \ No newline at end of file diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 0d57c7ed4a7..c4bb9193a33 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -11,3 +11,5 @@ BOMsModelModule=BOMS document templates FreeLegalTextOnBOMs=Free text on document of BOM WatermarkOnDraftBOMs=Watermark on draft BOM ConfirmCloneBillOfMaterials=Are you sure you want to clone this bill of material ? +ManufacturingEfficiency=Manufacturing efficiency +ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production From 9f9f3bda63692c7f681cdcfbbdf552b7dcf90879 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 01:06:19 +0200 Subject: [PATCH 10/17] Debug BOM module --- htdocs/bom/bom_card.php | 34 ++++++++++++++++- htdocs/bom/class/bom.class.php | 22 ++++++----- htdocs/bom/tpl/objectline_create.tpl.php | 37 +++---------------- .../install/mysql/migration/9.0.0-10.0.0.sql | 10 +++-- .../install/mysql/tables/llx_bom_bomline.sql | 5 ++- 5 files changed, 60 insertions(+), 48 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index e81d86f5eea..ab8062889b1 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -110,8 +110,40 @@ if (empty($reshook)) $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO'; $trackid='bom'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; -} + // Add line + if ($action == 'addline' && $user->rights->bom->write) + { + $langs->load('errors'); + $error = 0; + + // Set if we used free entry or predefined product + $idprod=GETPOST('idprod', 'int'); + $qty=GETPOST('qty', 'int'); + $efficiency=GETPOST('efficiency', 'int'); + + if ($qty == '') { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); + $error++; + } + if (! ($idprod > 0)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors'); + $error++; + } + + $bomline = new BOMLine($db); + $bomline->fk_bom = $id; + $bomline->fk_product = $prodid; + $bomline->qty = $qty; + $bomline->efficiency = $efficiency; + + $result = $bomline->create($user); + if ($result <= 0) + { + setEventMessages($bomline->error, $bomline->errors, 'errors'); + } + } +} /* diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 153554933cd..f1dd4f03e06 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -946,7 +946,7 @@ class BOMLine extends CommonObject /** * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png */ - public $picto = 'bomline@bom'; + public $picto = 'bomline'; /** @@ -974,20 +974,22 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>-1, 'isameasure'=>'1',), + 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); public $rowid; - public $description; - public $import_key; - public $qty; - public $fk_product; public $fk_bom; + public $fk_product; + public $description; + public $qty; + public $efficiency; public $rank; + public $import_key; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 2937f5af45e..a2aabaeb81b 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -81,7 +81,7 @@ if ($nolinesbefore) { print ''; } ?> - trans('Lost'); ?> + trans('ManufacturingEfficiency'); ?>   - ">% + "> 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined") - { - console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); - jQuery("#pbq").val(pbq); - if (jQuery("#qty").val() < pbqqty) - { - jQuery("#qty").val(pbqqty); - } - if (jQuery("#remise_percent").val() < pbqpercent) - { - jQuery("#remise_percent").val(pbqpercent); - } - } - else - { - jQuery("#pbq").val(''); - } + console.log("#idprod change triggered"); /* To set focus */ - if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0) + if (jQuery('#idprod').val() > 0) { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index e4fc1b04f29..defa2936c02 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -226,7 +226,7 @@ CREATE TABLE llx_bom_bom( -- END MODULEBUILDER FIELDS ) ENGINE=innodb; -ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(24,8) DEFAULT 1; +ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1; create table llx_bom_bom_extrafields ( @@ -239,15 +239,19 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer, + fk_product integer, description text, import_key varchar(14), qty double(24,8), - fk_product integer, - fk_bom integer, + efficiency double(8,4) DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; + + create table llx_bom_bomline_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index d1a958e9633..b9763c754e8 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -17,11 +17,12 @@ CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + fk_bom integer, + fk_product integer, description text, import_key varchar(14), qty double(24,8), - fk_product integer, - fk_bom integer, + efficiency double(8,4) DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; \ No newline at end of file From bd61c1f7f5b346fe896c4f573a876ff0a810d22f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 01:16:06 +0200 Subject: [PATCH 11/17] Debug BOM module --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 8 ++++---- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 8 ++++---- htdocs/install/mysql/tables/llx_bom_bomline.sql | 11 +++++------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ab8062889b1..0f2dfb5e52b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -133,7 +133,7 @@ if (empty($reshook)) $bomline = new BOMLine($db); $bomline->fk_bom = $id; - $bomline->fk_product = $prodid; + $bomline->fk_product = $idprod; $bomline->qty = $qty; $bomline->efficiency = $efficiency; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index f1dd4f03e06..de67cbc82e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -974,11 +974,11 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>-1, 'isameasure'=>'1',), - 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), + 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index defa2936c02..c0c1ba711e1 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -239,12 +239,12 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index b9763c754e8..0bdfac6ae55 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -13,16 +13,15 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. - CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb; From b7a3cdd7c6370aed259dfbb20e8e739eea7d823b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 01:16:06 +0200 Subject: [PATCH 12/17] Debug BOM module --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 8 ++++---- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 10 ++++++---- htdocs/install/mysql/tables/llx_bom_bomline.sql | 12 ++++++------ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ab8062889b1..0f2dfb5e52b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -133,7 +133,7 @@ if (empty($reshook)) $bomline = new BOMLine($db); $bomline->fk_bom = $id; - $bomline->fk_product = $prodid; + $bomline->fk_product = $idprod; $bomline->qty = $qty; $bomline->efficiency = $efficiency; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index f1dd4f03e06..de67cbc82e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -974,11 +974,11 @@ class BOMLine extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), - 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>-1, 'isameasure'=>'1',), - 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), + 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index defa2936c02..075e95fb0bd 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -239,17 +239,19 @@ create table llx_bom_bom_extrafields CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; +ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL; create table llx_bom_bomline_extrafields diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index b9763c754e8..bafaaf73694 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -13,16 +13,16 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. - CREATE TABLE llx_bom_bomline( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_bom integer, - fk_product integer, + fk_bom integer NOT NULL, + fk_product integer NOT NULL, + fk_bom_child integer NULL, description text, import_key varchar(14), - qty double(24,8), - efficiency double(8,4) DEFAULT 1, + qty double(24,8) NOT NULL, + efficiency double(8,4) NOT NULL DEFAULT 1, rank integer NOT NULL -- END MODULEBUILDER FIELDS -) ENGINE=innodb; \ No newline at end of file +) ENGINE=innodb; From cbb20a3587018e7a8d413c9b555a1bcad6c6211d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 02:08:44 +0200 Subject: [PATCH 13/17] CSS --- htdocs/theme/eldy/global.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index db5820f7da2..501e48e52f2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3138,6 +3138,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { .thumbstat { flex: 1 1 110px; margin-bottom: 8px; + min-width: px; /* on screen < 320, we guaranty to have 2 columns */ } .thumbstat150 { flex: 1 1 110px; From d3318e6d6039a5f8c62a435bf45826f4e4b6f046 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 11:21:08 +0200 Subject: [PATCH 14/17] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 501e48e52f2..010d2bd8eed 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -699,7 +699,7 @@ div.fiche { justify-content: flex-start; } .thumbstat { - min-width: 150px; + min-width: 148px; } .thumbstat150 { min-width: 168px; @@ -3103,7 +3103,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { padding-right: 3px; padding-top: 2px; padding-bottom: 2px; - width: 121px; + width: 118px; } .tabBar .fichehalfright .boxstats { padding-top: 8px; From f2e03b39097d2f2ea812c937714bc4f0f7b27a64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 11:24:57 +0200 Subject: [PATCH 15/17] Removed useless files (replaced with DebugBar) --- .../modules/syslog/mod_syslog_chromephp.php | 174 ------- .../modules/syslog/mod_syslog_firephp.php | 175 ------- .../ccampbell/chromephp/ChromePhp.php | 446 ------------------ htdocs/includes/ccampbell/chromephp/README.md | 23 - .../ccampbell/chromephp/composer.json | 24 - 5 files changed, 842 deletions(-) delete mode 100644 htdocs/core/modules/syslog/mod_syslog_chromephp.php delete mode 100644 htdocs/core/modules/syslog/mod_syslog_firephp.php delete mode 100644 htdocs/includes/ccampbell/chromephp/ChromePhp.php delete mode 100644 htdocs/includes/ccampbell/chromephp/README.md delete mode 100644 htdocs/includes/ccampbell/chromephp/composer.json diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php deleted file mode 100644 index f3d34c4a9cd..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ /dev/null @@ -1,174 +0,0 @@ -isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php'); - } - - /** - * Is the module active ? - * - * @return int -1 if not active, 0 if active but lib/path not found, 1 if OK - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'; - } - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - - restore_include_path(); - - if ($res) - { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler - } - else - { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_CHROMEPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/', - 'attr' => 'size="60"', - 'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/' - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $langs,$conf; - - $errors = array(); - - if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) - { - $conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); - } - else - { - $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; - } - } - - return $errors; - } - - /** - * Output log content. We also start output buffering at first log write. - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration()) > 0) return false; - - try - { - // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - $res = @include_once 'ChromePhp.php'; - if (! $res) $res=@include_once 'ChromePhp.class.php'; - set_include_path($oldinclude); - - ob_start(); // To be sure headers are not flushed until all page is completely processed - if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); - elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); - elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']); - else ChromePhp::log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - } - } -} diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php deleted file mode 100644 index abc341f9a30..00000000000 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ /dev/null @@ -1,175 +0,0 @@ - - * Copyright (C) 2015 RaphaĆ«l Doursenaud - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; - -/** - * Class to manage logging to a FirePHP - */ -class mod_syslog_firephp extends LogHandler implements LogHandlerInterface -{ - public $code = 'firephp'; - private static $firephp_include_path = '/includes/firephp/firephp-core/lib/'; - private static $firephp_class_path = 'FirePHPCore/FirePHP.class.php'; - - /** - * Return name of logger - * - * @return string Name of logger - */ - public function getName() - { - return 'FirePHP'; - } - - /** - * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development') - * - * @return string - */ - public function getVersion() - { - return 'dolibarr'; - } - - /** - * Content of the info tooltip. - * - * @return false|string - */ - public function getInfo() - { - global $langs; - - return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path); - } - - /** - * Is the module active ? - * - * @return int - */ - public function isActive() - { - global $conf; - try - { - if (empty($conf->global->SYSLOG_FIREPHP_INCLUDEPATH)) { - $conf->global->SYSLOG_FIREPHP_INCLUDEPATH = DOL_DOCUMENT_ROOT . self::$firephp_include_path; - } - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - $res = @include_once self::$firephp_class_path; - restore_include_path(); - if ($res) { - return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler - } else { - return 0; - } - } - catch(Exception $e) - { - print ''."\n"; - } - - return -1; - } - - /** - * Return array of configuration data - * - * @return array Return array of configuration data - */ - public function configure() - { - global $langs; - - return array( - array( - 'name' => $langs->trans('IncludePath', 'SYSLOG_FIREPHP_INCLUDEPATH'), - 'constant' => 'SYSLOG_FIREPHP_INCLUDEPATH', - 'default' => DOL_DOCUMENT_ROOT . self::$firephp_include_path, - 'attr' => 'size="60"', - 'example' => '/usr/share/php, ' . DOL_DOCUMENT_ROOT . self::$firephp_include_path - ) - ); - } - - /** - * Return if configuration is valid - * - * @return array Array of errors. Empty array if ok. - */ - public function checkConfiguration() - { - global $conf, $langs; - - $errors = array(); - - if (!file_exists($conf->global->SYSLOG_FIREPHP_INCLUDEPATH . self::$firephp_class_path)) - { - $conf->global->MAIN_SYSLOG_DISABLE_FIREPHP = 1; // avoid infinite loop - if (is_object($langs)) // $langs may not be defined yet. - { - $errors[] = $langs->trans("ErrorFailedToOpenFile", self::$firephp_class_path); - } - else - { - $errors[] = "ErrorFailedToOpenFile " . self::$firephp_class_path; - } - } - - return $errors; - } - - /** - * Output log content - * - * @param array $content Content to log - * @return null|false - */ - public function export($content) - { - global $conf; - - if (! empty($conf->global->MAIN_SYSLOG_DISABLE_FIREPHP)) return; // Global option to disable output of this handler - - //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration())) return false; - - try - { - // Warning FirePHPCore must be into PHP include path. It is not possible to use into require_once a constant from - // database or config file because we must be able to log data before database or config file read. - $oldinclude=get_include_path(); - set_include_path($conf->global->SYSLOG_FIREPHP_INCLUDEPATH); - include_once self::$firephp_class_path; - set_include_path($oldinclude); - ob_start(); // To be sure headers are not flushed until all page is completely processed - $firephp = FirePHP::getInstance(true); - if ($content['level'] == LOG_ERR) $firephp->error($content['message']); - elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']); - elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']); - else $firephp->log($content['message']); - } - catch (Exception $e) - { - // Do not use dol_syslog here to avoid infinite loop - return false; - } - } -} diff --git a/htdocs/includes/ccampbell/chromephp/ChromePhp.php b/htdocs/includes/ccampbell/chromephp/ChromePhp.php deleted file mode 100644 index 577b1cecb9d..00000000000 --- a/htdocs/includes/ccampbell/chromephp/ChromePhp.php +++ /dev/null @@ -1,446 +0,0 @@ - - */ -class ChromePhp -{ - /** - * @var string - */ - const VERSION = '4.1.0'; - - /** - * @var string - */ - const HEADER_NAME = 'X-ChromeLogger-Data'; - - /** - * @var string - */ - const BACKTRACE_LEVEL = 'backtrace_level'; - - /** - * @var string - */ - const LOG = 'log'; - - /** - * @var string - */ - const WARN = 'warn'; - - /** - * @var string - */ - const ERROR = 'error'; - - /** - * @var string - */ - const GROUP = 'group'; - - /** - * @var string - */ - const INFO = 'info'; - - /** - * @var string - */ - const GROUP_END = 'groupEnd'; - - /** - * @var string - */ - const GROUP_COLLAPSED = 'groupCollapsed'; - - /** - * @var string - */ - const TABLE = 'table'; - - /** - * @var string - */ - protected $_php_version; - - /** - * @var int - */ - protected $_timestamp; - - /** - * @var array - */ - protected $_json = array( - 'version' => self::VERSION, - 'columns' => array('log', 'backtrace', 'type'), - 'rows' => array() - ); - - /** - * @var array - */ - protected $_backtraces = array(); - - /** - * @var bool - */ - protected $_error_triggered = false; - - /** - * @var array - */ - protected $_settings = array( - self::BACKTRACE_LEVEL => 1 - ); - - /** - * @var ChromePhp - */ - protected static $_instance; - - /** - * Prevent recursion when working with objects referring to each other - * - * @var array - */ - protected $_processed = array(); - - /** - * constructor - */ - private function __construct() - { - $this->_php_version = phpversion(); - $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time(); - $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; - } - - /** - * gets instance of this class - * - * @return ChromePhp - */ - public static function getInstance() - { - if (self::$_instance === null) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * logs a variable to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function log() - { - $args = func_get_args(); - return self::_log('', $args); - } - - /** - * logs a warning to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function warn() - { - $args = func_get_args(); - return self::_log(self::WARN, $args); - } - - /** - * logs an error to the console - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function error() - { - $args = func_get_args(); - return self::_log(self::ERROR, $args); - } - - /** - * sends a group log - * - * @param string value - */ - public static function group() - { - $args = func_get_args(); - return self::_log(self::GROUP, $args); - } - - /** - * sends an info log - * - * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] - * @return void - */ - public static function info() - { - $args = func_get_args(); - return self::_log(self::INFO, $args); - } - - /** - * sends a collapsed group log - * - * @param string value - */ - public static function groupCollapsed() - { - $args = func_get_args(); - return self::_log(self::GROUP_COLLAPSED, $args); - } - - /** - * ends a group log - * - * @param string value - */ - public static function groupEnd() - { - $args = func_get_args(); - return self::_log(self::GROUP_END, $args); - } - - /** - * sends a table log - * - * @param string value - */ - public static function table() - { - $args = func_get_args(); - return self::_log(self::TABLE, $args); - } - - /** - * internal logging call - * - * @param string $type - * @return void - */ - protected static function _log($type, array $args) - { - // nothing passed in, don't do anything - if (count($args) == 0 && $type != self::GROUP_END) { - return; - } - - $logger = self::getInstance(); - - $logger->_processed = array(); - - $logs = array(); - foreach ($args as $arg) { - $logs[] = $logger->_convert($arg); - } - - $backtrace = debug_backtrace(false); - $level = $logger->getSetting(self::BACKTRACE_LEVEL); - - $backtrace_message = 'unknown'; - if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) { - $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line']; - } - - $logger->_addRow($logs, $backtrace_message, $type); - } - - /** - * converts an object to a better format for logging - * - * @param Object - * @return array - */ - protected function _convert($object) - { - // if this isn't an object then just return it - if (!is_object($object)) { - return $object; - } - - //Mark this object as processed so we don't convert it twice and it - //Also avoid recursion when objects refer to each other - $this->_processed[] = $object; - - $object_as_array = array(); - - // first add the class name - $object_as_array['___class_name'] = get_class($object); - - // loop through object vars - $object_vars = get_object_vars($object); - foreach ($object_vars as $key => $value) { - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - $object_as_array[$key] = $this->_convert($value); - } - - $reflection = new ReflectionClass($object); - - // loop through the properties and add those - foreach ($reflection->getProperties() as $property) { - - // if one of these properties was already added above then ignore it - if (array_key_exists($property->getName(), $object_vars)) { - continue; - } - $type = $this->_getPropertyKey($property); - - if ($this->_php_version >= 5.3) { - $property->setAccessible(true); - } - - try { - $value = $property->getValue($object); - } catch (ReflectionException $e) { - $value = 'only PHP 5.3 can access private/protected properties'; - } - - // same instance as parent object - if ($value === $object || in_array($value, $this->_processed, true)) { - $value = 'recursion - parent object [' . get_class($value) . ']'; - } - - $object_as_array[$type] = $this->_convert($value); - } - return $object_as_array; - } - - /** - * takes a reflection property and returns a nicely formatted key of the property name - * - * @param ReflectionProperty - * @return string - */ - protected function _getPropertyKey(ReflectionProperty $property) - { - $static = $property->isStatic() ? ' static' : ''; - if ($property->isPublic()) { - return 'public' . $static . ' ' . $property->getName(); - } - - if ($property->isProtected()) { - return 'protected' . $static . ' ' . $property->getName(); - } - - if ($property->isPrivate()) { - return 'private' . $static . ' ' . $property->getName(); - } - } - - /** - * adds a value to the data array - * - * @var mixed - * @return void - */ - protected function _addRow(array $logs, $backtrace, $type) - { - // if this is logged on the same line for example in a loop, set it to null to save space - if (in_array($backtrace, $this->_backtraces)) { - $backtrace = null; - } - - // for group, groupEnd, and groupCollapsed - // take out the backtrace since it is not useful - if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) { - $backtrace = null; - } - - if ($backtrace !== null) { - $this->_backtraces[] = $backtrace; - } - - $row = array($logs, $backtrace, $type); - - $this->_json['rows'][] = $row; - $this->_writeHeader($this->_json); - } - - protected function _writeHeader($data) - { - header(self::HEADER_NAME . ': ' . $this->_encode($data)); - } - - /** - * encodes the data to be sent along with the request - * - * @param array $data - * @return string - */ - protected function _encode($data) - { - return base64_encode(utf8_encode(json_encode($data))); - } - - /** - * adds a setting - * - * @param string key - * @param mixed value - * @return void - */ - public function addSetting($key, $value) - { - $this->_settings[$key] = $value; - } - - /** - * add ability to set multiple settings in one call - * - * @param array $settings - * @return void - */ - public function addSettings(array $settings) - { - foreach ($settings as $key => $value) { - $this->addSetting($key, $value); - } - } - - /** - * gets a setting - * - * @param string key - * @return mixed - */ - public function getSetting($key) - { - if (!isset($this->_settings[$key])) { - return null; - } - return $this->_settings[$key]; - } -} diff --git a/htdocs/includes/ccampbell/chromephp/README.md b/htdocs/includes/ccampbell/chromephp/README.md deleted file mode 100644 index 3dd7dbe19dd..00000000000 --- a/htdocs/includes/ccampbell/chromephp/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## Overview -ChromePhp is a PHP library for the Chrome Logger Google Chrome extension. - -This library allows you to log variables to the Chrome console. - -## Requirements -- PHP 5 or later - -## Installation -1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd -2. Click the extension icon in the browser to enable it for the current tab's domain -3. Put ChromePhp.php somewhere in your PHP include path -4. Log some data - - ```php - include 'ChromePhp.php'; - ChromePhp::log('Hello console!'); - ChromePhp::log($_SERVER); - ChromePhp::warn('something went wrong!'); - ``` - -More information can be found here: -http://www.chromelogger.com diff --git a/htdocs/includes/ccampbell/chromephp/composer.json b/htdocs/includes/ccampbell/chromephp/composer.json deleted file mode 100644 index dc16853d3ec..00000000000 --- a/htdocs/includes/ccampbell/chromephp/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "ccampbell/chromephp", - "type": "library", - "description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).", - "keywords": ["log","logging"], - "homepage": "http://github.com/ccampbell/chromephp", - "license": "Apache-2.0", - "authors": [ - { - "name": "Craig Campbell", - "email": "iamcraigcampbell@gmail.com", - "homepage": "http://craig.is", - "role": "Developer" - } - ], - "require": { - "php": ">=5.0.0" - }, - "autoload": { - "psr-0": { - "ChromePhp": "" - } - } -} From a40e5ca66c8af956432b531d85fb8b9d8d00da58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 11:36:16 +0200 Subject: [PATCH 16/17] Fix phpcs --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index add69abf0dc..0924eee89e5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3142,7 +3142,7 @@ class Facture extends CommonInvoice return; } - include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Cap percentages to 100 if ($percent > 100) $percent = 100; From 410932f3f2b0446e2913a626d8227c79d1c036c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 May 2019 12:01:08 +0200 Subject: [PATCH 17/17] Trans --- htdocs/langs/en_US/ticket.lang | 3 ++- htdocs/ticket/index.php | 11 +++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 9d70262a519..6a2d7e89cb7 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -268,7 +268,8 @@ TicketPublicInterfaceForbidden=The public interface for the tickets was not enab ErrorEmailOrTrackingInvalid=Bad value for tracking ID or email OldUser=Old user NewUser=New user - +NumberOfTicketsByMonth=Number of tickets per month +NbOfTickets=Number of tickets # notifications TicketNotificationEmailSubject=Ticket %s updated TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 2e9f76ff8a3..824b1f1833e 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -259,7 +259,7 @@ print '
'; /* - * Last tickets + * Latest tickets */ $max = 10; @@ -302,13 +302,8 @@ if ($result) { print '
'; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($num > 0) {
' . $transRecordedType . ''.$langs->trans("FullList").'
' . $transRecordedType . ''.$langs->trans("FullList").'