dolibarr 21.0.0-alpha
objectline_title.tpl.php
1<?php
2/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
5 * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
6 * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
8 * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 *
24 * Need to have the following variables defined:
25 * $object (invoice, order, ...)
26 * $conf
27 * $langs
28 * $element (used to test $user->rights->$element->creer)
29 * $permtoedit (used to replace test $user->rights->$element->creer)
30 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
31 * $outputalsopricetotalwithtax
32 * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
33 *
34 * $type, $text, $description, $line
35 */
36
37// Protection to avoid direct call of template
38if (empty($object) || !is_object($object)) {
39 print "Error, template page can't be called as URL";
40 exit(1);
41}
42
43'@phan-var-force CommonObject $this
44 @phan-var-force CommonObject $object';
45
46print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
47
48// Title line
49print "<thead>\n";
50
51print '<tr class="liste_titre nodrag nodrop">';
52
53// Adds a line numbering column
54if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
55 print '<th class="linecolnum center">&nbsp;</th>';
56}
57
58// Description
59print '<th class="linecoldescription">'.$langs->trans('Description');
60$constant = get_class($object)."::STATUS_DRAFT";
61if (in_array($object->element, array('propal', 'commande', 'facture', 'order_supplier', 'invoice_supplier')) && defined($constant) && $object->status == constant($constant)) {
62 if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'servicedateforalllines') {
63 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=servicedateforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
64 }
65 if (GETPOST('mode', 'aZ09') == 'servicedateforalllines') {
66 print '&nbsp;&nbsp;<div class="classvatforalllines inline-block nowraponall">';
67 $hourmin = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : '');
68 print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
69 print $form->selectDate('', 'alldate_start', $hourmin, $hourmin, 1, "updatealllines", 1, 0);
70 print ' '.$langs->trans('to').' ';
71 print $form->selectDate('', 'alldate_end', $hourmin, $hourmin, 1, "updatealllines", 1, 0);
72 print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
73 print '</div>';
74 }
75}
76print '</th>';
77
78// Supplier ref
79if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') {
80 print '<th class="linerefsupplier maxwidth125"><span id="title_fourn_ref">'.$langs->trans("SupplierRef").'</span></th>';
81}
82
83// VAT
84print '<th class="linecolvat right nowraponall">';
85if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') || getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION')) {
86 print $langs->trans('Taxes');
87} else {
88 print $langs->trans('VAT');
89}
90
91// @phan-suppress-next-line PhanUndeclaredConstantOfClass
92if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) {
93 global $mysoc;
94
95 if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') {
96 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
97 }
98 //print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
99 if (GETPOST('mode', 'aZ09') == 'vatforalllines') {
100 print '<div class="classvatforalllines inline-block nowraponall">';
101 print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
102 print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
103 print '</div>';
104 }
105}
106print '</th>';
107
108// Price HT
109print '<th class="linecoluht right nowraponall">'.$langs->trans('PriceUHT').'</th>';
110
111// Multicurrency
112if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
113 print '<th class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</th>';
114}
115
116if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
117 print '<th class="right nowraponall">'.$langs->trans('PriceUTTC').'</th>';
118}
119
120// Qty
121print '<th class="linecolqty right">'.$langs->trans('Qty').'</th>';
122
123// Unit
124if (getDolGlobalString('PRODUCT_USE_UNITS')) {
125 print '<th class="linecoluseunit left">'.$langs->trans('Unit').'</th>';
126}
127
128// Reduction short
129print '<th class="linecoldiscount right nowraponall">';
130print $langs->trans('ReductionShort');
131
132// @phan-suppress-next-line PhanUndeclaredConstantOfClass
133if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) {
134 global $mysoc;
135
136 if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') {
137 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=remiseforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
138 }
139 //print '<script>$(document).ready(function() { $(".clickremiseforalllines").click(function() { jQuery(".classremiseforalllines").toggle(); }); });</script>';
140 if (GETPOST('mode', 'aZ09') == 'remiseforalllines') {
141 print '<div class="remiseforalllines inline-block nowraponall">';
142 print '<input class="inline-block smallpaddingimp width50 right" name="remiseforalllines" value="" placeholder="%">';
143 print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
144 print '</div>';
145 }
146}
147print '</th>';
148
149// Fields for situation invoice
150if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
151 print '<th class="linecolcycleref right">'.$langs->trans('Progress').'</th>';
152 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
153 print '<th class="linecolcycleref2 right">' . $langs->trans('SituationInvoiceProgressCurrent') . '</th>';
154 }
155 print '<th class="linecolcycleref2 right">'.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).'</th>';
156}
157
158// Purchase price
159if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
160 if ($user->hasRight('margins', 'creer')) {
161 if (getDolGlobalString('MARGIN_TYPE') == "1") {
162 print '<th class="linecolmargin1 margininfos right width75">'.$langs->trans('BuyingPrice').'</th>';
163 } else {
164 print '<th class="linecolmargin1 margininfos right width75">'.$langs->trans('CostPrice').'</th>';
165 }
166 }
167
168 if (getDolGlobalString('DISPLAY_MARGIN_RATES') && $user->hasRight('margins', 'liretous')) {
169 print '<th class="linecolmargin2 margininfos right width75">'.$langs->trans('MarginRate');
170 // @phan-suppress-next-line PhanUndeclaredConstantOfClass
171 if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) {
172 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=marginforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').'</a>';
173 if (GETPOST('mode', 'aZ09') == 'marginforalllines') {
174 print '<div class="classmarginforalllines inline-block nowraponall">';
175 print '<input type="number" name="marginforalllines" min="0" max="999.9" value="20.0" step="0.1" class="width50"><label>%</label>';
176 print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforallmargins" value="'.$langs->trans("Update").'">';
177 print '</div>';
178 }
179 }
180 print '</th>';
181 }
182 if (getDolGlobalString('DISPLAY_MARK_RATES') && $user->hasRight('margins', 'liretous')) {
183 print '<th class="linecolmargin2 margininfos right width75">'.$langs->trans('MarkRate').'</th>';
184 }
185}
186
187// Total HT
188print '<th class="linecolht right">'.$langs->trans('TotalHTShort').'</th>';
189
190// Multicurrency
191if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
192 print '<th class="linecoltotalht_currency right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</th>';
193}
194
195if ($outputalsopricetotalwithtax) {
196 print '<th class="right" style="width: 80px">'.$langs->trans('TotalTTCShort').'</th>';
197}
198
199if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
200 print '<th class="linecolasset"></th>';
201}
202
203print '<th class="linecoledit"></th>'; // No width to allow autodim
204
205print '<th class="linecoldelete" style="width: 10px"></th>';
206
207print '<th class="linecolmove" style="width: 10px"></th>';
208
209if ($action == 'selectlines') {
210 print '<th class="linecolcheckall center">';
211 print '<input type="checkbox" class="linecheckboxtoggle" />';
212 print '<script>$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
213 print '</th>';
214}
215
216print "</tr>\n";
217print "</thead>\n";
218
219print "<!-- END PHP TEMPLATE objectline_title.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.