Skip to content

Commit 9d0569a

Browse files
committed
Clean code
1 parent 97bdffc commit 9d0569a

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

htdocs/master.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ function is_countable($c)
114114
}
115115
}
116116

117+
if (!defined('SUBTOTALS_SPECIAL_CODE')) {
118+
define('SUBTOTALS_SPECIAL_CODE', 81);
119+
}
120+
121+
117122
/*
118123
* Disable some not used PHP stream
119124
*/

htdocs/subtotals/class/commonsubtotal.class.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
* or see https://www.gnu.org/
2121
*/
2222

23-
if (!defined('SUBTOTALS_SPECIAL_CODE')) {
24-
define('SUBTOTALS_SPECIAL_CODE', 81);
25-
}
2623

2724
/**
2825
*

htdocs/subtotals/core/substitutions/functions_subtotals.lib.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,11 @@
3030
*/
3131
function subtotals_completesubstitutionarray_lines(&$substitutionarray, $langs, $object, $line)
3232
{
33-
global $conf, $db;
34-
35-
3633
if (defined('SUBTOTALS_SPECIAL_CODE')) {
37-
$substitutionarray['is_subtotals_line'] = ($line->special_code == SUBTOTALS_SPECIAL_CODE);
34+
$substitutionarray['is_subtotals_line'] = ($line->special_code == constant('SUBTOTALS_SPECIAL_CODE'));
3835
$substitutionarray['is_not_subtotals_line'] = !$substitutionarray['is_subtotals_line'];
39-
$substitutionarray['is_subtotals_title'] = (($line->special_code == SUBTOTALS_SPECIAL_CODE) && $line->qty > 0);
40-
$substitutionarray['is_subtotals_subtotal'] = (($line->special_code == SUBTOTALS_SPECIAL_CODE) && $line->qty < 0);
36+
$substitutionarray['is_subtotals_title'] = (($line->special_code == constant('SUBTOTALS_SPECIAL_CODE')) && $line->qty > 0);
37+
$substitutionarray['is_subtotals_subtotal'] = (($line->special_code == constant('SUBTOTALS_SPECIAL_CODE')) && $line->qty < 0);
4138
$subtotal_total = 0;
4239
if (isModEnabled('multicurrency') && $object->multicurrency_code != getDolCurrency()) {
4340
$subtotal_total = $object->getSubtotalLineMulticurrencyAmount($line); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall

0 commit comments

Comments
 (0)