From d0b3614c5778980e03e570af5efd620194920d5e Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Tue, 28 Jan 2020 15:31:03 +0100 Subject: [PATCH 1/4] Default receipt template --- htdocs/core/modules/modReceiptPrinter.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index f2d207e1983..f61ba3a026f 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -132,13 +132,15 @@ class modReceiptPrinter extends DolibarrModules */ public function init($options = '') { - global $conf; + global $conf, $langs; // Clean before activation $this->remove($options); $sql = array( "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;", "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;", - ); + "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Default')."';", + "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Default')."', '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', 1);", + ); return $this->_init($sql, $options); } } From 09bcb39cff6ff754601abb2ca9eae73b1bdbadb3 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Tue, 28 Jan 2020 18:59:51 +0100 Subject: [PATCH 2/4] Default to Example --- htdocs/core/modules/modReceiptPrinter.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index f61ba3a026f..f2fc5183668 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -138,8 +138,8 @@ class modReceiptPrinter extends DolibarrModules $sql = array( "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;", "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;", - "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Default')."';", - "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Default')."', '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', 1);", + "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Example')."';", + "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', 1);", ); return $this->_init($sql, $options); } From 9313aabd5c65707b25e60df0763bedf4fe5c7885 Mon Sep 17 00:00:00 2001 From: kadogo Date: Tue, 28 Jan 2020 19:28:09 +0100 Subject: [PATCH 3/4] NEW Add duration information for fichinter --- htdocs/projet/element.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 50942b8b363..38d078321e1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -826,6 +826,14 @@ foreach ($listofreferent as $key => $value) elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'payment_salary'))) print $langs->trans("User"); else print $langs->trans("ThirdParty"); print ''; + // Duration of intervention + if($tablename == 'fichinter') + { + print ''; + print $langs->trans("TotalDuration"); + $total_duration = 0; + print ''; + } // Amount HT //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("AmountHT").''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''.$langs->trans("Amount").''; @@ -1024,6 +1032,15 @@ foreach ($listofreferent as $key => $value) } print ''; + // Add duration and store it in counter for fichinter + if($tablename == 'fichinter') + { + print ''; + print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + $total_duration += $element->duration; + print ''; + } + // Amount without tax $warning = ''; if (empty($value['disableamount'])) @@ -1201,6 +1218,8 @@ foreach ($listofreferent as $key => $value) } //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalHT").' : '.price($total_ht).''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''.$langs->trans("Total").' : '.price($total_ht).''; + // If fichinter add the total_duration + if($tablename == 'fichinter') print ''.convertSecondToTime($total_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; print ''; if (empty($value['disableamount'])) { From 1de640242f1f19ea2d11318b0b80bec21bac958a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 28 Jan 2020 18:33:01 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/projet/element.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 38d078321e1..8ae94aa536b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -827,13 +827,13 @@ foreach ($listofreferent as $key => $value) else print $langs->trans("ThirdParty"); print ''; // Duration of intervention - if($tablename == 'fichinter') + if($tablename == 'fichinter') { - print ''; - print $langs->trans("TotalDuration"); - $total_duration = 0; - print ''; - } + print ''; + print $langs->trans("TotalDuration"); + $total_duration = 0; + print ''; + } // Amount HT //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("AmountHT").''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''.$langs->trans("Amount").''; @@ -1032,14 +1032,14 @@ foreach ($listofreferent as $key => $value) } print ''; - // Add duration and store it in counter for fichinter - if($tablename == 'fichinter') - { - print ''; - print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - $total_duration += $element->duration; - print ''; - } + // Add duration and store it in counter for fichinter + if($tablename == 'fichinter') + { + print ''; + print convertSecondToTime($element->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + $total_duration += $element->duration; + print ''; + } // Amount without tax $warning = '';