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