dolibarr 24.0.0-beta
price.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
5 * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
7 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
8 * Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
10 * Copyright (C) 2024 Mélina Joum <melina.joum@altairis.fr>
11 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
34// Load Dolibarr environment
35require '../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
46require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
48require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
49require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
50
51$prodcustprice = null;
52if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
53 $prodcustprice = new ProductCustomerPrice($db);
54}
55
56
57// Load translation files required by the page
58$langs->loadLangs(array("products", "companies", "bills"));
59
60
61// Get parameters
62$action = GETPOST('action', 'aZ09');
63$search_prod = GETPOST('search_prod', 'alpha');
64$cancel = GETPOST('cancel', 'alpha');
65$search_label = GETPOST('search_label', 'alpha');
66$search_price = GETPOST('search_price');
67$search_price_ttc = GETPOST('search_price_ttc');
68
69// Security check
70$socid = GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('id');
71if ($user->socid) {
72 $socid = $user->socid;
73}
74
75// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
76$hookmanager->initHooks(array('thirdpartycustomerprice', 'globalcard'));
77
78$result = restrictedArea($user, 'societe', $socid, '&societe');
79
80// Initialize objects
81$object = new Societe($db);
82
83$error = 0;
84
85
86/*
87 * Actions
88 */
89
90$parameters = array('id' => $socid);
91$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
92if ($reshook < 0) {
93 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
94}
95
96if (empty($reshook)) {
97 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers
98 $search_prod = $search_label = $search_price = $search_price_ttc = '';
99 }
100
101 if ($action == 'add_customer_price_confirm' && $prodcustprice !== null && !$cancel && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
102 if (!(GETPOSTINT('prodid') > 0)) {
103 $error++;
104 setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Product")), null, 'errors');
105 $action = 'add_customer_price';
106 }
107
108 if (!$error) {
109 $update_child_soc = GETPOSTINT('updatechildprice');
110
111 // add price by customer
112 $prodcustprice->fk_soc = $socid;
113 $prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
114 $prodcustprice->fk_product = GETPOSTINT('prodid');
115 $prodcustprice->price = price2num(GETPOST("price"), 'MU');
116 $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
117 $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
118 $prodcustprice->discount_percent = price2num(GETPOST("discount_percent"));
119 $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server;
120 $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
121
122 $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
123
124 // We must define tva_tx, npr and local taxes
125 $vatratecode = '';
126 $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
127 $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
128 $localtax1 = 0;
129 $localtax2 = 0;
130 $localtax1_type = '0';
131 $localtax2_type = '0';
132 // If value contains the unique code of vat line (new recommended method), we use it to find npr and local taxes
133 if (preg_match('/\‍((.*)\‍)/', $tva_tx_txt, $reg)) {
134 // We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in update price.
135 $vatratecode = $reg[1];
136 // Get record from code
137 $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
138 $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
139 $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
140 $sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
141 $sql .= " AND t.code = '".$db->escape($vatratecode)."'";
142 $sql .= " AND t.entity IN (".getEntity('c_tva').")";
143 $resql = $db->query($sql);
144 if ($resql) {
145 $obj = $db->fetch_object($resql);
146 $npr = $obj->recuperableonly;
147 $localtax1 = $obj->localtax1;
148 $localtax2 = $obj->localtax2;
149 $localtax1_type = $obj->localtax1_type;
150 $localtax2_type = $obj->localtax2_type;
151 }
152 }
153
154 $prodcustprice->default_vat_code = $vatratecode;
155 $prodcustprice->tva_tx = $tva_tx;
156 $prodcustprice->recuperableonly = $npr;
157 $prodcustprice->localtax1_tx = $localtax1;
158 $prodcustprice->localtax2_tx = $localtax2;
159 $prodcustprice->localtax1_type = $localtax1_type;
160 $prodcustprice->localtax2_type = $localtax2_type;
161
162 $result = $prodcustprice->create($user, 0, $update_child_soc);
163 if ($result > 0) {
164 $extrafields->fetch_name_optionals_label("product_customer_price");
165 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
166 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
167 if (!empty($extralabels) && is_array($extralabels)) {
168 $productcustomerprice = new ProductCustomerPrice($db);
169 $res = $productcustomerprice->fetch($prodcustprice->id);
170 if ($res > 0) {
171 foreach ($extrafield_values as $key => $value) {
172 $productcustomerprice->array_options[$key] = $value;
173 }
174 $result2 = $productcustomerprice->insertExtraFields();
175 if ($result2 < 0) {
176 $prodcustprice->error = $productcustomerprice->error;
177 $prodcustprice->errors = $productcustomerprice->errors;
178 $error++;
179 }
180 }
181 }
182 }
183
184 if ($result < 0) {
185 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
186 $action = 'add_customer_price';
187 } else {
188 setEventMessages($langs->trans("Save"), null, 'mesgs');
189 $action = '';
190 }
191 }
192 }
193
194 if ($action == 'delete_customer_price' && $prodcustprice !== null && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
195 // Delete price by customer
196 $prodcustprice->id = GETPOSTINT('lineid');
197 $result = $prodcustprice->delete($user);
198
199 if ($result < 0) {
200 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
201 } else {
202 setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
203 }
204 $action = '';
205 }
206
207 if ($action == 'update_customer_price_confirm' && $prodcustprice !== null && !$cancel && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) {
208 $prodcustprice->fetch(GETPOSTINT('lineid'));
209
210 $update_child_soc = GETPOSTINT('updatechildprice');
211
212 // update price by customer
213 $prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
214 $prodcustprice->price = price2num(GETPOST("price"), 'MU');
215 $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
216 $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
217 $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
218 $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
219 $prodcustprice->discount_percent = price2num(GETPOST("discount_percent"));
220 $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server;
221 $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
222
223 $result = $prodcustprice->update($user, 0, $update_child_soc);
224 if ($result > 0) {
225 $extrafields->fetch_name_optionals_label("product_customer_price");
226 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
227 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
228 if (!empty($extralabels) && is_array($extralabels)) {
229 $productcustomerprice = new ProductCustomerPrice($db);
230 $res = $productcustomerprice->fetch($prodcustprice->id);
231 if ($res > 0) {
232 foreach ($extrafield_values as $key => $value) {
233 $productcustomerprice->array_options[$key] = $value;
234 }
235 $result2 = $productcustomerprice->insertExtraFields();
236 if ($result2 < 0) {
237 $prodcustprice->error = $productcustomerprice->error;
238 $prodcustprice->errors = $productcustomerprice->errors;
239 $error++;
240 }
241 }
242 }
243 }
244 if ($result < 0) {
245 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
246 $action = 'edit_customer_price';
247 } else {
248 setEventMessages($langs->trans("Save"), null, 'mesgs');
249 $action = '';
250 }
251 }
252}
253
254
255/*
256 * View
257 */
258
259$form = new Form($db);
260
261$object = new Societe($db);
262
263$result = $object->fetch($socid);
264llxHeader("", $langs->trans("ThirdParty").'-'.$langs->trans('PriceByCustomer'));
265
266$head = societe_prepare_head($object);
267
268print dol_get_fiche_head($head, 'price', $langs->trans("ThirdParty"), -1, 'company');
269
270$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
271
272dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
273
274print '<div class="fichecenter">';
275
276print '<div class="underbanner clearboth"></div>';
277print '<table class="border centpercent tableforfield">';
278
279// Type Prospect/Customer/Supplier
280print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
281print $object->getTypeUrl(1);
282print '</td></tr>';
283
284if ($object->client) {
285 print '<tr><td class="titlefield">';
286 print $langs->trans('CustomerCode').'</td><td colspan="3">';
287 print $object->code_client;
288 $tmpcheck = $object->check_codeclient();
289 if ($tmpcheck != 0 && $tmpcheck != -5) {
290 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
291 }
292 print '</td></tr>';
293}
294
295if ($object->fournisseur) {
296 print '<tr><td class="titlefield">';
297 print $langs->trans('SupplierCode').'</td><td colspan="3">';
298 print $object->code_fournisseur;
299 $tmpcheck = $object->check_codefournisseur();
300 if ($tmpcheck != 0 && $tmpcheck != -5) {
301 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
302 }
303 print '</td></tr>';
304}
305
306print '</table>';
307
308print '</div>';
309
310print dol_get_fiche_end();
311
312
313
314if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
315 $prodcustprice = new ProductCustomerPrice($db);
316
317 $sortfield = GETPOST('sortfield', 'aZ09comma');
318 $sortorder = GETPOST('sortorder', 'aZ09comma');
319 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
320 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
321 if (empty($page) || $page == -1) {
322 $page = 0;
323 } // If $page is not defined, or '' or -1
324 $offset = $limit * $page;
325 $pageprev = $page - 1;
326 $pagenext = $page + 1;
327 if (!$sortorder) {
328 $sortorder = "ASC,ASC";
329 }
330 if (!$sortfield) {
331 $sortfield = "soc.nom,t.date_begin";
332 }
333
334 // Build filter to display only related lines
335 $filter = array(
336 't.fk_soc' => (string) $object->id
337 );
338
339 if (!empty($search_prod)) {
340 $filter ['prod.ref'] = (string) $search_prod;
341 }
342
343 if (!empty($search_label)) {
344 $filter ['prod.label'] = (string) $search_label;
345 }
346
347 if (!empty($search_price)) {
348 $filter ['t.price'] = (string) $search_price;
349 }
350
351 if (!empty($search_price_ttc)) {
352 $filter ['t.price_ttc'] = (string) $search_price_ttc;
353 }
354
355 if ($action == 'add_customer_price') {
356 // Create mode
357
358 print '<br>';
359 print '<!-- Price by customer -->'."\n";
360
361 print load_fiche_titre($langs->trans('PriceByCustomer'));
362
363 print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
364 print '<input type="hidden" name="token" value="'.newToken().'">';
365 print '<input type="hidden" name="action" value="add_customer_price_confirm">';
366 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
367 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
368 print '<input type="hidden" name="socid" value="'.$object->id.'">';
369 print '<table class="border centpercent">';
370 print '<tr>';
371 print '<td>'.$langs->trans('Product').'</td>';
372 print '<td>';
373 $form->select_produits(GETPOSTINT('prodid'), 'prodid', '', 0);
374 print '</td>';
375 print '</tr>';
376
377 // Ref. Customer
378 print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
379 print '<td><input name="ref_customer" size="12"></td></tr>';
380
381 // Applied Prices From
382 $date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server;
383 print '<tr><td>'.$langs->trans("AppliedPricesFrom").'</td><td>';
384 print $form->selectDate(!empty($date_begin) ? $date_begin : dol_now(), "date_begin", 0, 0, 1, "date_begin");
385 print '</td></tr>';
386
387 // Applied Prices To
388 $date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
389 print '<tr><td>'.$langs->trans("AppliedPricesTo").'</td><td>';
390 print $form->selectDate($date_end, "date_end", 0, 0, 1, "date_end");
391 print '</td></tr>';
392
393 // VAT
394 print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
395 print $form->load_tva("tva_tx", GETPOST("tva_tx", "alpha"), $mysoc, null, $object->id, 0, '', false, 1);
396 print '</td></tr>';
397
398 // Price base
399 print '<tr><td width="15%">';
400 print $langs->trans('PriceBase');
401 print '</td>';
402 print '<td>';
403 print $form->selectPriceBaseType(GETPOST("price_base_type", "aZ09"), "price_base_type");
404 print '</td>';
405 print '</tr>';
406
407 // Price
408 print '<tr><td width="20%">';
409 $text = $langs->trans('SellingPrice');
410 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
411 print '</td><td>';
412 print '<input name="price" size="10" value="'.GETPOSTINT('price').'">';
413 print '</td></tr>';
414
415 // Price minimum
416 print '<tr><td>';
417 $text = $langs->trans('MinPrice');
418 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
419 print '<td><input name="price_min" size="10" value="'.GETPOSTINT('price_min').'">';
420 print '</td></tr>';
421
422 // Discount
423 $discount_percent = price2num(GETPOST("discount_percent"));
424 print '<tr><td>'.$langs->trans("Discount").'</td><td>';
425 print '<input name="discount_percent" size="10" value="'.price($discount_percent).'">';
426 print '</td></tr>';
427
428 // Update all child soc
429 print '<tr><td width="15%">';
430 print $langs->trans('ForceUpdateChildPriceSoc');
431 print '</td>';
432 print '<td>';
433 print '<input type="checkbox" name="updatechildprice" value="1"/>';
434 print '</td>';
435 print '</tr>';
436
437 // Extrafields
438 $extrafields->fetch_name_optionals_label("product_customer_price");
439 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
440 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
441 if (!empty($extralabels)) {
442 if (empty($prodcustprice->id)) {
443 foreach ($extralabels as $key => $value) {
444 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && ($extrafields->attributes["product_customer_price"]['list'][$key] == 1 || $extrafields->attributes["product_customer_price"]['list'][$key] == 3 || ($action == "add_customer_price" && $extrafields->attributes["product_customer_price"]['list'][$key] == 4))) {
445 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
446 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
447 }
448
449 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
450 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
451 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
452 } else {
453 print $langs->trans($value);
454 }
455 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_customer_price').'</td></tr>';
456 }
457 }
458 }
459 }
460
461 print '</table>';
462
463 print $form->buttonsSaveCancel();
464
465 print '</form>';
466 } elseif ($action == 'edit_customer_price') {
467 // Edit mode
468
469 print load_fiche_titre($langs->trans('PriceByCustomer'));
470
471 $result = $prodcustprice->fetch(GETPOSTINT('lineid'));
472
473 if ($result <= 0) {
474 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
475 } else {
476 print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
477 print '<input type="hidden" name="token" value="'.newToken().'">';
478 print '<input type="hidden" name="action" value="update_customer_price_confirm">';
479 print '<input type="hidden" name="lineid" value="'.$prodcustprice->id.'">';
480 print '<table class="border centpercent">';
481 print '<tr>';
482 print '<td>'.$langs->trans('Product').'</td>';
483 $staticprod = new Product($db);
484 $staticprod->fetch($prodcustprice->fk_product);
485 print "<td>".$staticprod->getNomUrl(1)."</td>";
486 print '</tr>';
487
488 // Ref. Customer
489 print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
490 print '<td><input name="ref_customer" size="12" value="'.dol_escape_htmltag($prodcustprice->ref_customer).'"></td></tr>';
491
492 // Applied Prices From
493 print '<tr><td>'.$langs->trans("AppliedPricesFrom").'</td><td>';
494 print $form->selectDate($prodcustprice->date_begin, "date_begin", 0, 0, 1, "date_begin");
495 print '</td></tr>';
496
497 // Applied Prices To
498 print '<tr><td>'.$langs->trans("AppliedPricesTo").'</td><td>';
499 print $form->selectDate($prodcustprice->date_end, "date_end", 0, 0, 1, "date_end");
500 print '</td></tr>';
501
502 // VAT
503 print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
504 print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, null, $staticprod->id, $prodcustprice->recuperableonly);
505 print '</td></tr>';
506
507 // Price base
508 print '<tr><td width="15%">';
509 print $langs->trans('PriceBase');
510 print '</td>';
511 print '<td>';
512 print $form->selectPriceBaseType($prodcustprice->price_base_type, "price_base_type");
513 print '</td>';
514 print '</tr>';
515
516 // Price
517 print '<tr><td>';
518 $text = $langs->trans('SellingPrice');
519 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
520 print '</td><td>';
521 if ($prodcustprice->price_base_type == 'TTC') {
522 print '<input name="price" size="10" value="'.price($prodcustprice->price_ttc).'">';
523 } else {
524 print '<input name="price" size="10" value="'.price($prodcustprice->price).'">';
525 }
526 print '</td></tr>';
527
528 // Price minimum
529 print '<tr><td>';
530 $text = $langs->trans('MinPrice');
531 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
532 print '</td><td>';
533 if ($prodcustprice->price_base_type == 'TTC') {
534 print '<input name="price_min" size="10" value="'.price($prodcustprice->price_min_ttc).'">';
535 } else {
536 print '<input name="price_min" size="10" value="'.price($prodcustprice->price_min).'">';
537 }
538 print '</td></tr>';
539
540 // Discount
541 print '<tr><td>'.$langs->trans("Discount").'</td><td>';
542 print '<input name="discount_percent" size="10" value="'.price($prodcustprice->discount_percent).'">';
543 print '</td></tr>';
544
545 // Extrafields
546 $extrafields->fetch_name_optionals_label("product_customer_price");
547 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
548 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
549 if (!empty($extralabels)) {
550 if (empty($object->id)) {
551 foreach ($extralabels as $key => $value) {
552 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && ($extrafields->attributes["product_customer_price"]['list'][$key] == 1 || $extrafields->attributes["product_customer_price"]['list'][$key] == 3 || ($action == "edit_price" && $extrafields->attributes["product_customer_price"]['list'][$key] == 4))) {
553 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
554 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
555 }
556
557 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
558 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
559 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
560 } else {
561 print $langs->trans($value);
562 }
563 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_customer_price').'</td></tr>';
564 }
565 }
566 } else {
567 $sql = "SELECT";
568 $sql .= " fk_object";
569 foreach ($extralabels as $key => $value) {
570 $sql .= ", ".$db->sanitize($key);
571 }
572 $sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price_extrafields";
573 $sql .= " WHERE fk_object = ".((int) $prodcustprice->id);
574 $resql = $db->query($sql);
575 if ($resql) {
576 $obj = $db->fetch_object($resql);
577 foreach ($extralabels as $key => $value) {
578 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && ($extrafields->attributes["product_customer_price"]['list'][$key] == 1 || $extrafields->attributes["product_customer_price"]['list'][$key] == 3 || ($action == "edit_price" && $extrafields->attributes["product_customer_price"]['list'][$key] == 4))) {
579 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
580 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
581 }
582
583 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
584 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
585 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
586 } else {
587 print $langs->trans($value);
588 }
589 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : $obj->{$key}, '', '', '', '', 0, 'product_customer_price');
590
591 print '</td></tr>';
592 }
593 }
594 $db->free($resql);
595 }
596 }
597 }
598
599 print '</table>';
600
601 // Update all child soc
602 print '<center>';
603 print '<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
604 print '<label for="updatechildprice">'.$langs->trans('ForceUpdateChildPriceSoc').'</label>';
605 print '</center>';
606
607 print $form->buttonsSaveCancel();
608
609 print '</form>';
610 }
611 } elseif ($action == 'showlog_customer_price') {
612 print '<br>';
613 print '<!-- showlog_customer_price -->'."\n";
614
615 $sortfield = 't.datec';
616 $filter = array(
617 't.fk_product' => (string) GETPOSTINT('prodid'),
618 't.fk_soc' => (string) $socid
619 );
620
621 // Count total nb of records
622 $nbtotalofrecords = '';
623 $result = $prodcustprice->fetchAllLog($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
624 if ($result < 0) {
625 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
626 } else {
627 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
628 $nbtotalofrecords = $result;
629 }
630 }
631
632 $option = '&socid='.GETPOSTINT('socid').'&prodid='.GETPOSTINT('prodid');
633
634 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
635 print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVER ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
636
637 if (count($prodcustprice->lines) > 0) {
638 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
639 print '<input type="hidden" name="token" value="'.newToken().'">';
640 print '<input type="hidden" name="id" value="'.$object->id.'">';
641
642 print '<table class="noborder centpercent">';
643
644 print '<tr class="liste_titre">';
645 print '<td>'.$langs->trans("Product").'</td>';
646 print '<td>'.$langs->trans('RefCustomer').'</td>';
647 print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
648 print '<td>'.$langs->trans("AppliedPricesTo").'</td>';
649 print '<td class="center">'.$langs->trans("PriceBase").'</td>';
650 print '<td class="right">'.$langs->trans("VAT").'</td>';
651 print '<td class="right">'.$langs->trans("HT").'</td>';
652 print '<td class="right">'.$langs->trans("TTC").'</td>';
653 print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
654 print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
655 print '<td class="right">'.$langs->trans("Discount").'</td>';
656 print '<td class="right">'.$langs->trans("ChangedBy").'</td>';
657 print '<td>'.$langs->trans("DateCreation").'</td>';
658 print '</tr>';
659
660 foreach ($prodcustprice->lines as $line) {
661 $staticprod = new Product($db);
662 $staticprod->fetch($line->fk_product);
663
664 $userstatic = new User($db);
665 $userstatic->fetch($line->fk_user);
666
667 print '<tr class="oddeven">';
668
669 print "<td>".$staticprod->getNomUrl(1)."</td>";
670 print '<td>'.$line->ref_customer.'</td>';
671 print "<td>".dol_print_date($line->date_begin, "day", 'tzuserrel')."</td>";
672 print "<td>".dol_print_date($line->date_end, "day", 'tzuserrel')."</td>";
673
674 print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
675 print '<td class="right">'.vatrate($line->tva_tx, true, $line->recuperableonly)."</td>";
676 print '<td class="right">'.price($line->price)."</td>";
677 print '<td class="right">'.price($line->price_ttc)."</td>";
678 print '<td class="right">'.price($line->price_min).'</td>';
679 print '<td class="right">'.price($line->price_min_ttc).'</td>';
680 print '<td class="right">'.price($line->discount_percent).'</td>';
681
682 // User
683 print '<td class="right">';
684 print $userstatic->getNomUrl(-1);
685 print '</td>';
686 print "<td>".dol_print_date($line->datec, "dayhour", 'tzuserrel')."</td>";
687 }
688 print "</table>";
689 } else {
690 print $langs->trans('None');
691 }
692
693 print "\n".'<div class="tabsAction">'."\n";
694 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'">'.$langs->trans("Ok").'</a></div>';
695 print "\n</div><br>\n";
696 } else {
697 // View mode
698
699 /*
700 * Action bar
701 */
702 print "\n".'<div class="tabsAction">'."\n";
703
704 if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
705 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=add_customer_price&token='.newToken().'&socid='.$object->id.'">'.$langs->trans("AddCustomerPrice").'</a></div>';
706 }
707 print "\n</div>\n";
708
709
710 $arrayfields = array();
711 foreach ($prodcustprice->fields as $key => $val) {
712 // If $val['visible']==0, then we never show the field
713 if (!empty($val['visible'])) {
714 $visible = (int) dol_eval((string) $val['visible'], 1, 1, '1');
715 $arrayfields['t.'.$key] = array(
716 'label' => $val['label'],
717 'checked' => (($visible < 0) ? 0 : 1),
718 'enabled' => (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
719 'position' => $val['position'],
720 'help' => isset($val['help']) ? $val['help'] : ''
721 );
722 }
723 }
724 // fetch optionals attributes and labels
725 $extrafields->fetch_name_optionals_label("product_customer_price");
726 if ($extrafields->attributes["product_customer_price"] && array_key_exists('label', $extrafields->attributes["product_customer_price"])) {
727 $extralabels = $extrafields->attributes["product_customer_price"]['label'];
728
729 if (!empty($extralabels)) {
730 foreach ($extralabels as $key => $value) {
731 // Show field if not hidden
732 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
733 $extratitle = $langs->trans($value);
734 if (!empty($val['visible'])) {
735 $visible = (int) dol_eval((string) $val['visible'], 1, 1, '1');
736 $arrayfields['ef.' . $key] = array(
737 'label' => $extratitle,
738 'checked' => (($visible < 0) ? 0 : 1),
739 'position' => (int) $extrafields->attributes['product_customer_price']['pos'][$key],
740 'langfile' => $extrafields->attributes["product_customer_price"]['langfile'][$key],
741 'help' => $extrafields->attributes["product_customer_price"]['help'][$key]
742 );
743 }
744 }
745 }
746 }
747 }
748
749 $arrayfields = dol_sort_array($arrayfields, 'position');
750
751 // Count total nb of records
752 $nbtotalofrecords = '';
753 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
754 $nbtotalofrecords = $prodcustprice->fetchAll('', '', 0, 0, $filter);
755 }
756
757 $result = $prodcustprice->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
758 if ($result < 0) {
759 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
760 }
761
762 $option = '&search_prod='.$search_prod.'&id='.$object->id.'&label='.$search_label.'&price='.$search_price.'&price_ttc='.$search_price_ttc;
763
764 print '<!-- view specific price for each product -->'."\n";
765
766 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
767 print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, 'product');
768
769 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
770 print '<input type="hidden" name="token" value="'.newToken().'">';
771 print '<input type="hidden" name="id" value="'.$object->id.'">';
772 if (!empty($sortfield)) {
773 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
774 }
775 if (!empty($sortorder)) {
776 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
777 }
778 print '<div class="div-table-responsive-no-min">';
779 print '<table class="noborder centpercent liste">';
780
781 $param = 'socid='.$object->id.'&';
782 if ($search_prod) {
783 $param .= '&search_prod='.urlencode($search_prod);
784 }
785 if ($search_label) {
786 $param .= '&search_label='.urlencode($search_label);
787 }
788 if ($search_price) {
789 $param .= '&search_price='.urlencode($search_price);
790 }
791 if ($search_price) {
792 $param .= '&search_price='.urlencode($search_price);
793 }
794 if ($search_price_ttc) {
795 $param .= '&search_price_ttc='.urlencode($search_price_ttc);
796 }
797
798 print '<tr class="liste_titre">';
799
800 $colspan = 0;
801
802 foreach ($prodcustprice->fields as $key => $val) {
803 if (!empty($arrayfields['t.'.$key]['checked'])) {
804 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n";
805 $colspan++;
806 }
807 }
808 if (!empty($extralabels) && is_array($extralabels)) {
809 foreach ($extralabels as $key => $val) {
810 if (!empty($arrayfields['ef.'.$key]['checked'])) {
811 print getTitleFieldOfList($arrayfields['ef.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n";
812 $colspan++;
813 }
814 }
815 }
816 print '<td></td>';
817 $colspan++;
818
819 print '</tr>';
820
821 if (count($prodcustprice->lines) > 0 || $search_prod) {
822 print '<tr class="liste_titre">';
823 print '<td class="liste_titre"><input type="text" class="flat width75" name="search_prod" value="'.$search_prod.'"></td>';
824 print '<td class="liste_titre" ><input type="text" class="flat width75" name="search_label" value="'.$search_label.'"></td>';
825 print '<td class="liste_titre"></td>';
826 print '<td class="liste_titre"></td>';
827 print '<td class="liste_titre"></td>';
828 print '<td class="liste_titre"></td>';
829 print '<td class="liste_titre"></td>';
830 print '<td class="liste_titre left"><input type="text" class="flat width75" name="search_price" value="'.$search_price.'"></td>';
831 print '<td class="liste_titre left"><input type="text" class="flat width75" name="search_price_ttc" value="'.$search_price_ttc.'"></td>';
832 print '<td class="liste_titre"></td>';
833 print '<td class="liste_titre"></td>';
834 print '<td class="liste_titre"></td>';
835 print '<td class="liste_titre"></td>';
836 print '<td class="liste_titre"></td>';
837 if (!empty($extralabels)) {
838 foreach ($extralabels as $key) {
839 print '<td class="right"></td>';
840 }
841 }
842 // Print the search button
843 print '<td class="liste_titre maxwidthsearch">';
844 $searchpicto = $form->showFilterAndCheckAddButtons(0);
845 print $searchpicto;
846 print '</td>';
847 print '</tr>';
848 }
849
850 if (count($prodcustprice->lines) > 0) {
851 foreach ($prodcustprice->lines as $line) {
852 $staticprod = new Product($db);
853 $staticprod->fetch($line->fk_product);
854
855 $userstatic = new User($db);
856 $userstatic->fetch($line->fk_user);
857
858 print '<tr class="oddeven">';
859
860 print '<td class="left">'.$staticprod->getNomUrl(1)."</td>";
861 print '<td class="left">'.$staticprod->label."</td>";
862 print '<td class="left">'.$line->ref_customer.'</td>';
863 print '<td class="left">'.dol_print_date($line->date_begin, "day", 'tzuserrel')."</td>";
864 print '<td class="left">'.dol_print_date($line->date_end, "day", 'tzuserrel')."</td>";
865 print '<td class="left">'.$langs->trans($line->price_base_type)."</td>";
866 print '<td class="left">'.vatrate($line->tva_tx.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), true, $line->recuperableonly)."</td>";
867 print '<td class="left">'.price($line->price)."</td>";
868 print '<td class="left">'.price($line->price_ttc)."</td>";
869 print '<td class="left">'.price($line->price_min).'</td>';
870 print '<td class="left">'.price($line->price_min_ttc).'</td>';
871 print '<td class="left">'.$line->price_label.'</td>';
872 print '<td class="left">'.price($line->discount_percent).'</td>';
873 // User
874 print '<td class="left">';
875 print $userstatic->getNomUrl(-1);
876 print '</td>';
877
878 // Extrafields
879 $extrafields->fetch_name_optionals_label("product_customer_price");
880 $extralabels = $extrafields->attributes["product_customer_price"]['label'];
881 if (!empty($extralabels)) {
882 $sql = "SELECT";
883 $sql .= " fk_object";
884 foreach ($extralabels as $key => $value) {
885 $sql .= ", ".$db->sanitize($key);
886 }
887 $sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price_extrafields";
888 $sql .= " WHERE fk_object = ".((int) $line->id);
889 $resql = $db->query($sql);
890 if ($resql) {
891 if ($db->num_rows($resql) != 1) {
892 foreach ($extralabels as $key => $value) {
893 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
894 print "<td></td>";
895 }
896 }
897 } else {
898 $obj = $db->fetch_object($resql);
899 foreach ($extralabels as $key => $value) {
900 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
901 print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key}, '', 'product_customer_price')."</td>";
902 }
903 }
904 }
905 $db->free($resql);
906 }
907 }
908 // Action
909 if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
910 print '<td class="right nowraponall">';
911 print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=showlog_customer_price&token='.newToken().'&socid='.$object->id.'&prodid='.$line->fk_product.'">';
912 print img_info();
913 print '</a>';
914 print ' ';
915 print '<a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&token='.newToken().'&socid='.$object->id.'&lineid='.$line->id.'">';
916 print img_edit('default', 0, 'style="vertical-align: middle;"');
917 print '</a>';
918 print ' ';
919 print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&token='.newToken().'&socid='.$object->id.'&lineid='.$line->id.'">';
920 print img_delete('default', 'style="vertical-align: middle;"');
921 print '</a>';
922 print '</td>';
923 }
924
925 print "</tr>\n";
926 }
927 } else {
928 if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) {
929 $colspan += 1;
930 }
931 print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans('None').'</span></td></tr>';
932 }
933
934 print "</table>";
935 print '</div>';
936
937 print "</form>";
938 }
939}
940
941// End of page
942llxFooter();
943$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
File of class to manage predefined price products or services by customer.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_info($titlealt='default')
Show info logo.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.