dolibarr 25.0.0-alpha
subtotal_expedition_view.tpl.php
1<?php
2/* Copyright (C) 2026 Frédéric France <frederic.france@free.fr>
3 */
4
13'
14@phan-var-force CommonObjectLine|CommonOrderLine|ExpeditionLigne $line
15@phan-var-force Commande|Expedition $object
16';
17
18if (!empty($line->origin_line_id)) {
19 print '<!-- subtotal origin line id = ' . $line->origin_line_id . ' -->'; // id of order line
20 $id = $line->id;
21 $element = $line->element;
22 $desc = $line->desc;
23 $line_options = $line->extraparams["subtotal"] ?? array();
24 $buttons = $object->status == Expedition::STATUS_DRAFT;
25} else {
26 print '<!-- subtotal commande line id = ' . $line->rowid . ' -->'; // id of order line
27 $id = $line->rowid;
28 $element = "commande";
29 $desc = $line->description;
30 $extraparams = (array) json_decode($line->extraparams, true);
31 $line_options = $extraparams["subtotal"] ?? array();
32}
33
34$langs->load('subtotals');
35
36$line_color = $object->getSubtotalColors((int) $line->qty);
37$colspan = 7;
38
39if (isModEnabled('productbatch')) {
40 $colspan++;
41}
42if (isModEnabled('stock')) {
43 $colspan++;
44}
45
46print '<tr id="row-' . $id . '" data-id="' . $id . '" data-element="' . $element . '" style="background:#' . $line_color . '" >';
47
48if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
49 print '<td class="center linecolnum">' . ($i + 1) . '</td>';
50}
51
52if ($line->qty > 0) { ?>
53 <td class="linecollabel" colspan="<?php echo $colspan ?>" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?>><?php echo str_repeat('&nbsp;', (int) ($line->qty - 1) * 8); ?>
54 <?php
55 echo $desc;
56 if (array_key_exists('titleshowuponpdf', $line_options)) {
57 echo '&nbsp;' . img_picto($langs->trans("ShowUPOnPDF"), 'invoicing');
58 }
59 if (array_key_exists('titleshowtotalexludingvatonpdf', $line_options)) {
60 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
61 }
62 if (array_key_exists('titleforcepagebreak', $line_options)) {
63 echo '&nbsp;' . img_picto($langs->trans("ForcePageBreak"), 'file');
64 }
65 ?>
66 </td>
67<?php } elseif ($line->qty < 0) { ?>
68<td class="linecollabel nowrap right" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?> colspan="<?php echo $colspan ?>">
69 <?php
70 echo $desc;
71 if (array_key_exists('subtotalshowtotalexludingvatonpdf', $line_options)) {
72 echo '&nbsp; <span title="' . $langs->trans("ShowTotalExludingVATOnPDF") . '">%</span>';
73 }
74 ?>
75</td>
76<?php } elseif ($line->qty == 0) { ?>
77<td class="linecollabel" colspan="<?php echo $colspan ?>" <?php echo !colorIsLight($line_color) ? ' style="color: white"' : ' style="color: black"' ?>>
78 <?php echo nl2br($desc); ?>
79</td>
80<?php }
81
82if (isset($buttons) && $buttons) {
83 // Delete picto
84 echo '<td class="linecoldelete center">';
85 echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=ask_subtotal_deleteline&token=' . newToken() . '&lineid=' . $id;
86 if ($line->qty > 0) {
87 echo '&type=title';
88 }
89 echo '">';
90 if (!colorIsLight($line_color)) {
91 echo img_delete('default', 'class="pictodelete" style="color: white"');
92 } else {
93 echo img_delete('default', 'class="pictodelete" style="color: #666"');
94 }
95 echo '</a> </td>';
96}
97
98print "</tr>";
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
const STATUS_DRAFT
Draft status.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
colorIsLight($stringcolor)
Return true if the color is light.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.