dolibarr 23.0.3
functions_subtotals.lib.php
1<?php
2/*
3 * Copyright (C) 2025
4 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
31function subtotals_completesubstitutionarray_lines(&$substitutionarray, $langs, $object, $line)
32{
33 global $conf, $db;
34
35
36 if (defined('SUBTOTALS_SPECIAL_CODE')) {
37 $substitutionarray['is_subtotals_line'] = ($line->special_code == SUBTOTALS_SPECIAL_CODE);
38 $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);
41 $subtotal_total = 0;
42 if (isModEnabled('multicurrency') && $object->multicurrency_code != getDolCurrency()) {
43 $subtotal_total = $object->getSubtotalLineMulticurrencyAmount($line); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
44 } else {
45 $subtotal_total = $object->getSubtotalLineAmount($line); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
46 }
47 $substitutionarray['subtotals_total'] = ($subtotal_total == 0) ? "" : $subtotal_total;
48 $substitutionarray['subtotals_level'] = abs($line->qty);
49 } else {
50 $substitutionarray['is_subtotals_line'] = false;
51 $substitutionarray['is_not_subtotals_line'] = true;
52 $substitutionarray['is_subtotals_title'] = false;
53 $substitutionarray['is_subtotals_subtotal'] = false;
54 $substitutionarray['subtotals_total'] = 0;
55 $substitutionarray['subtotals_level'] = 0;
56 }
57}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
isModEnabled($module)
Is Dolibarr module enabled.