dolibarr 22.0.5
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 (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field
285 print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
286}
287
288if ($object->client) {
289 print '<tr><td class="titlefield">';
290 print $langs->trans('CustomerCode').'</td><td colspan="3">';
291 print $object->code_client;
292 $tmpcheck = $object->check_codeclient();
293 if ($tmpcheck != 0 && $tmpcheck != -5) {
294 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
295 }
296 print '</td></tr>';
297}
298
299if ($object->fournisseur) {
300 print '<tr><td class="titlefield">';
301 print $langs->trans('SupplierCode').'</td><td colspan="3">';
302 print $object->code_fournisseur;
303 $tmpcheck = $object->check_codefournisseur();
304 if ($tmpcheck != 0 && $tmpcheck != -5) {
305 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
306 }
307 print '</td></tr>';
308}
309
310print '</table>';
311
312print '</div>';
313
314print dol_get_fiche_end();
315
316
317
318if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
319 $prodcustprice = new ProductCustomerPrice($db);
320
321 $sortfield = GETPOST('sortfield', 'aZ09comma');
322 $sortorder = GETPOST('sortorder', 'aZ09comma');
323 $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
324 $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
325 if (empty($page) || $page == -1) {
326 $page = 0;
327 } // If $page is not defined, or '' or -1
328 $offset = $limit * $page;
329 $pageprev = $page - 1;
330 $pagenext = $page + 1;
331 if (!$sortorder) {
332 $sortorder = "ASC,ASC";
333 }
334 if (!$sortfield) {
335 $sortfield = "soc.nom,t.date_begin";
336 }
337
338 // Build filter to display only related lines
339 $filter = array(
340 't.fk_soc' => (string) $object->id
341 );
342
343 if (!empty($search_prod)) {
344 $filter ['prod.ref'] = (string) $search_prod;
345 }
346
347 if (!empty($search_label)) {
348 $filter ['prod.label'] = (string) $search_label;
349 }
350
351 if (!empty($search_price)) {
352 $filter ['t.price'] = (string) $search_price;
353 }
354
355 if (!empty($search_price_ttc)) {
356 $filter ['t.price_ttc'] = (string) $search_price_ttc;
357 }
358
359 if ($action == 'add_customer_price') {
360 // Create mode
361
362 print '<br>';
363 print '<!-- Price by customer -->'."\n";
364
365 print load_fiche_titre($langs->trans('PriceByCustomer'));
366
367 print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
368 print '<input type="hidden" name="token" value="'.newToken().'">';
369 print '<input type="hidden" name="action" value="add_customer_price_confirm">';
370 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
371 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
372 print '<input type="hidden" name="socid" value="'.$object->id.'">';
373 print '<table class="border centpercent">';
374 print '<tr>';
375 print '<td>'.$langs->trans('Product').'</td>';
376 print '<td>';
377 $form->select_produits(GETPOSTINT('prodid'), 'prodid', '', 0);
378 print '</td>';
379 print '</tr>';
380
381 // Ref. Customer
382 print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
383 print '<td><input name="ref_customer" size="12"></td></tr>';
384
385 // Applied Prices From
386 $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;
387 print '<tr><td>'.$langs->trans("AppliedPricesFrom").'</td><td>';
388 print $form->selectDate(!empty($date_begin) ? $date_begin : dol_now(), "date_begin", 0, 0, 1, "date_begin");
389 print '</td></tr>';
390
391 // Applied Prices To
392 $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
393 print '<tr><td>'.$langs->trans("AppliedPricesTo").'</td><td>';
394 print $form->selectDate($date_end, "date_end", 0, 0, 1, "date_end");
395 print '</td></tr>';
396
397 // VAT
398 print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
399 print $form->load_tva("tva_tx", GETPOST("tva_tx", "alpha"), $mysoc, null, $object->id, 0, '', false, 1);
400 print '</td></tr>';
401
402 // Price base
403 print '<tr><td width="15%">';
404 print $langs->trans('PriceBase');
405 print '</td>';
406 print '<td>';
407 print $form->selectPriceBaseType(GETPOST("price_base_type", "aZ09"), "price_base_type");
408 print '</td>';
409 print '</tr>';
410
411 // Price
412 print '<tr><td width="20%">';
413 $text = $langs->trans('SellingPrice');
414 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
415 print '</td><td>';
416 print '<input name="price" size="10" value="'.GETPOSTINT('price').'">';
417 print '</td></tr>';
418
419 // Price minimum
420 print '<tr><td>';
421 $text = $langs->trans('MinPrice');
422 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
423 print '<td><input name="price_min" size="10" value="'.GETPOSTINT('price_min').'">';
424 print '</td></tr>';
425
426 // Discount
427 $discount_percent = price2num(GETPOST("discount_percent"));
428 print '<tr><td>'.$langs->trans("Discount").'</td><td>';
429 print '<input name="discount_percent" size="10" value="'.price($discount_percent).'">';
430 print '</td></tr>';
431
432 // Update all child soc
433 print '<tr><td width="15%">';
434 print $langs->trans('ForceUpdateChildPriceSoc');
435 print '</td>';
436 print '<td>';
437 print '<input type="checkbox" name="updatechildprice" value="1"/>';
438 print '</td>';
439 print '</tr>';
440
441 // Extrafields
442 $extrafields->fetch_name_optionals_label("product_customer_price");
443 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
444 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
445 if (!empty($extralabels)) {
446 if (empty($prodcustprice->id)) {
447 foreach ($extralabels as $key => $value) {
448 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))) {
449 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
450 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
451 }
452
453 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
454 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
455 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
456 } else {
457 print $langs->trans($value);
458 }
459 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_customer_price').'</td></tr>';
460 }
461 }
462 }
463 }
464
465 print '</table>';
466
467 print $form->buttonsSaveCancel();
468
469 print '</form>';
470 } elseif ($action == 'edit_customer_price') {
471 // Edit mode
472
473 print load_fiche_titre($langs->trans('PriceByCustomer'));
474
475 $result = $prodcustprice->fetch(GETPOSTINT('lineid'));
476
477 if ($result <= 0) {
478 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
479 } else {
480 print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
481 print '<input type="hidden" name="token" value="'.newToken().'">';
482 print '<input type="hidden" name="action" value="update_customer_price_confirm">';
483 print '<input type="hidden" name="lineid" value="'.$prodcustprice->id.'">';
484 print '<table class="border centpercent">';
485 print '<tr>';
486 print '<td>'.$langs->trans('Product').'</td>';
487 $staticprod = new Product($db);
488 $staticprod->fetch($prodcustprice->fk_product);
489 print "<td>".$staticprod->getNomUrl(1)."</td>";
490 print '</tr>';
491
492 // Ref. Customer
493 print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
494 print '<td><input name="ref_customer" size="12" value="'.dol_escape_htmltag($prodcustprice->ref_customer).'"></td></tr>';
495
496 // Applied Prices From
497 print '<tr><td>'.$langs->trans("AppliedPricesFrom").'</td><td>';
498 print $form->selectDate($prodcustprice->date_begin, "date_begin", 0, 0, 1, "date_begin");
499 print '</td></tr>';
500
501 // Applied Prices To
502 print '<tr><td>'.$langs->trans("AppliedPricesTo").'</td><td>';
503 print $form->selectDate($prodcustprice->date_end, "date_end", 0, 0, 1, "date_end");
504 print '</td></tr>';
505
506 // VAT
507 print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
508 print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, null, $staticprod->id, $prodcustprice->recuperableonly);
509 print '</td></tr>';
510
511 // Price base
512 print '<tr><td width="15%">';
513 print $langs->trans('PriceBase');
514 print '</td>';
515 print '<td>';
516 print $form->selectPriceBaseType($prodcustprice->price_base_type, "price_base_type");
517 print '</td>';
518 print '</tr>';
519
520 // Price
521 print '<tr><td>';
522 $text = $langs->trans('SellingPrice');
523 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
524 print '</td><td>';
525 if ($prodcustprice->price_base_type == 'TTC') {
526 print '<input name="price" size="10" value="'.price($prodcustprice->price_ttc).'">';
527 } else {
528 print '<input name="price" size="10" value="'.price($prodcustprice->price).'">';
529 }
530 print '</td></tr>';
531
532 // Price minimum
533 print '<tr><td>';
534 $text = $langs->trans('MinPrice');
535 print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", getDolGlobalString('MAIN_MAX_DECIMALS_UNIT')), 1, 'help');
536 print '</td><td>';
537 if ($prodcustprice->price_base_type == 'TTC') {
538 print '<input name="price_min" size="10" value="'.price($prodcustprice->price_min_ttc).'">';
539 } else {
540 print '<input name="price_min" size="10" value="'.price($prodcustprice->price_min).'">';
541 }
542 print '</td></tr>';
543
544 // Discount
545 print '<tr><td>'.$langs->trans("Discount").'</td><td>';
546 print '<input name="discount_percent" size="10" value="'.price($prodcustprice->discount_percent).'">';
547 print '</td></tr>';
548
549 // Extrafields
550 $extrafields->fetch_name_optionals_label("product_customer_price");
551 $extralabels = !empty($extrafields->attributes["product_customer_price"]['label']) ? $extrafields->attributes["product_customer_price"]['label'] : '';
552 $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price");
553 if (!empty($extralabels)) {
554 if (empty($object->id)) {
555 foreach ($extralabels as $key => $value) {
556 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))) {
557 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
558 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
559 }
560
561 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
562 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
563 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
564 } else {
565 print $langs->trans($value);
566 }
567 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_customer_price').'</td></tr>';
568 }
569 }
570 } else {
571 $sql = "SELECT";
572 $sql .= " fk_object";
573 foreach ($extralabels as $key => $value) {
574 $sql .= ", ".$db->sanitize($key);
575 }
576 $sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price_extrafields";
577 $sql .= " WHERE fk_object = ".((int) $prodcustprice->id);
578 $resql = $db->query($sql);
579 if ($resql) {
580 $obj = $db->fetch_object($resql);
581 foreach ($extralabels as $key => $value) {
582 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))) {
583 if (!empty($extrafields->attributes["product_customer_price"]['langfile'][$key])) {
584 $langs->load($extrafields->attributes["product_customer_price"]['langfile'][$key]);
585 }
586
587 print '<tr><td'.($extrafields->attributes["product_customer_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
588 if (!empty($extrafields->attributes["product_customer_price"]['help'][$key])) {
589 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_customer_price"]['help'][$key]));
590 } else {
591 print $langs->trans($value);
592 }
593 print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : $obj->{$key}, '', '', '', '', 0, 'product_customer_price');
594
595 print '</td></tr>';
596 }
597 }
598 $db->free($resql);
599 }
600 }
601 }
602
603 print '</table>';
604
605 // Update all child soc
606 print '<center>';
607 print '<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
608 print '<label for="updatechildprice">'.$langs->trans('ForceUpdateChildPriceSoc').'</label>';
609 print '</center>';
610
611 print $form->buttonsSaveCancel();
612
613 print '</form>';
614 }
615 } elseif ($action == 'showlog_customer_price') {
616 print '<br>';
617 print '<!-- showlog_customer_price -->'."\n";
618
619 $sortfield = 't.datec';
620 $filter = array(
621 't.fk_product' => (string) GETPOSTINT('prodid'),
622 't.fk_soc' => (string) $socid
623 );
624
625 // Count total nb of records
626 $nbtotalofrecords = '';
627 $result = $prodcustprice->fetchAllLog($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
628 if ($result < 0) {
629 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
630 } else {
631 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
632 $nbtotalofrecords = $result;
633 }
634 }
635
636 $option = '&socid='.GETPOSTINT('socid').'&prodid='.GETPOSTINT('prodid');
637
638 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
639 print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVER ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
640
641 if (count($prodcustprice->lines) > 0) {
642 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
643 print '<input type="hidden" name="token" value="'.newToken().'">';
644 print '<input type="hidden" name="id" value="'.$object->id.'">';
645
646 print '<table class="noborder centpercent">';
647
648 print '<tr class="liste_titre">';
649 print '<td>'.$langs->trans("Product").'</td>';
650 print '<td>'.$langs->trans('RefCustomer').'</td>';
651 print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
652 print '<td>'.$langs->trans("AppliedPricesTo").'</td>';
653 print '<td class="center">'.$langs->trans("PriceBase").'</td>';
654 print '<td class="right">'.$langs->trans("VAT").'</td>';
655 print '<td class="right">'.$langs->trans("HT").'</td>';
656 print '<td class="right">'.$langs->trans("TTC").'</td>';
657 print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
658 print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
659 print '<td class="right">'.$langs->trans("Discount").'</td>';
660 print '<td class="right">'.$langs->trans("ChangedBy").'</td>';
661 print '<td>'.$langs->trans("DateCreation").'</td>';
662 print '</tr>';
663
664 foreach ($prodcustprice->lines as $line) {
665 $staticprod = new Product($db);
666 $staticprod->fetch($line->fk_product);
667
668 $userstatic = new User($db);
669 $userstatic->fetch($line->fk_user);
670
671 print '<tr class="oddeven">';
672
673 print "<td>".$staticprod->getNomUrl(1)."</td>";
674 print '<td>'.$line->ref_customer.'</td>';
675 print "<td>".dol_print_date($line->date_begin, "day", 'tzuserrel')."</td>";
676 print "<td>".dol_print_date($line->date_end, "day", 'tzuserrel')."</td>";
677
678 print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
679 print '<td class="right">'.vatrate($line->tva_tx, true, $line->recuperableonly)."</td>";
680 print '<td class="right">'.price($line->price)."</td>";
681 print '<td class="right">'.price($line->price_ttc)."</td>";
682 print '<td class="right">'.price($line->price_min).'</td>';
683 print '<td class="right">'.price($line->price_min_ttc).'</td>';
684 print '<td class="right">'.price($line->discount_percent).'</td>';
685
686 // User
687 print '<td class="right">';
688 print $userstatic->getNomUrl(-1);
689 print '</td>';
690 print "<td>".dol_print_date($line->datec, "dayhour", 'tzuserrel')."</td>";
691 }
692 print "</table>";
693 } else {
694 print $langs->trans('None');
695 }
696
697 print "\n".'<div class="tabsAction">'."\n";
698 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'">'.$langs->trans("Ok").'</a></div>';
699 print "\n</div><br>\n";
700 } else {
701 // View mode
702
703 /*
704 * Action bar
705 */
706 print "\n".'<div class="tabsAction">'."\n";
707
708 if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
709 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>';
710 }
711 print "\n</div>\n";
712
713
714 $arrayfields = array();
715 foreach ($prodcustprice->fields as $key => $val) {
716 // If $val['visible']==0, then we never show the field
717 if (!empty($val['visible'])) {
718 $visible = (int) dol_eval((string) $val['visible'], 1, 1, '1');
719 $arrayfields['t.'.$key] = array(
720 'label' => $val['label'],
721 'checked' => (($visible < 0) ? 0 : 1),
722 'enabled' => (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
723 'position' => $val['position'],
724 'help' => isset($val['help']) ? $val['help'] : ''
725 );
726 }
727 }
728 // fetch optionals attributes and labels
729 $extrafields->fetch_name_optionals_label("product_customer_price");
730 if ($extrafields->attributes["product_customer_price"] && array_key_exists('label', $extrafields->attributes["product_customer_price"])) {
731 $extralabels = $extrafields->attributes["product_customer_price"]['label'];
732
733 if (!empty($extralabels)) {
734 foreach ($extralabels as $key => $value) {
735 // Show field if not hidden
736 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
737 $extratitle = $langs->trans($value);
738 if (!empty($val['visible'])) {
739 $visible = (int) dol_eval((string) $val['visible'], 1, 1, '1');
740 $arrayfields['ef.' . $key] = array(
741 'label' => $extratitle,
742 'checked' => (($visible < 0) ? 0 : 1),
743 'position' => (int) $extrafields->attributes['product_customer_price']['pos'][$key],
744 'langfile' => $extrafields->attributes["product_customer_price"]['langfile'][$key],
745 'help' => $extrafields->attributes["product_customer_price"]['help'][$key]
746 );
747 }
748 }
749 }
750 }
751 }
752
753 $arrayfields = dol_sort_array($arrayfields, 'position');
754
755 // Count total nb of records
756 $nbtotalofrecords = '';
757 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
758 $nbtotalofrecords = $prodcustprice->fetchAll('', '', 0, 0, $filter);
759 }
760
761 $result = $prodcustprice->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
762 if ($result < 0) {
763 setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
764 }
765
766 $option = '&search_prod='.$search_prod.'&id='.$object->id.'&label='.$search_label.'&price='.$search_price.'&price_ttc='.$search_price_ttc;
767
768 print '<!-- view specific price for each product -->'."\n";
769
770 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
771 print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
772
773 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
774 print '<input type="hidden" name="token" value="'.newToken().'">';
775 print '<input type="hidden" name="id" value="'.$object->id.'">';
776 if (!empty($sortfield)) {
777 print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
778 }
779 if (!empty($sortorder)) {
780 print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
781 }
782 print '<div class="div-table-responsive-no-min">';
783 print '<table class="noborder centpercent liste">';
784
785 $param = 'socid='.$object->id.'&';
786 if ($search_prod) {
787 $param .= '&search_prod='.urlencode($search_prod);
788 }
789 if ($search_label) {
790 $param .= '&search_label='.urlencode($search_label);
791 }
792 if ($search_price) {
793 $param .= '&search_price='.urlencode($search_price);
794 }
795 if ($search_price) {
796 $param .= '&search_price='.urlencode($search_price);
797 }
798 if ($search_price_ttc) {
799 $param .= '&search_price_ttc='.urlencode($search_price_ttc);
800 }
801
802 print '<tr class="liste_titre">';
803
804 $colspan = 0;
805
806 foreach ($prodcustprice->fields as $key => $val) {
807 if (!empty($arrayfields['t.'.$key]['checked'])) {
808 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n";
809 $colspan++;
810 }
811 }
812 if (!empty($extralabels) && is_array($extralabels)) {
813 foreach ($extralabels as $key => $val) {
814 if (!empty($arrayfields['ef.'.$key]['checked'])) {
815 print getTitleFieldOfList($arrayfields['ef.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n";
816 $colspan++;
817 }
818 }
819 }
820 print '<td></td>';
821 $colspan++;
822
823 print '</tr>';
824
825 if (count($prodcustprice->lines) > 0 || $search_prod) {
826 print '<tr class="liste_titre">';
827 print '<td class="liste_titre"><input type="text" class="flat width75" name="search_prod" value="'.$search_prod.'"></td>';
828 print '<td class="liste_titre" ><input type="text" class="flat width75" name="search_label" value="'.$search_label.'"></td>';
829 print '<td class="liste_titre"></td>';
830 print '<td class="liste_titre"></td>';
831 print '<td class="liste_titre"></td>';
832 print '<td class="liste_titre"></td>';
833 print '<td class="liste_titre"></td>';
834 print '<td class="liste_titre left"><input type="text" class="flat width75" name="search_price" value="'.$search_price.'"></td>';
835 print '<td class="liste_titre left"><input type="text" class="flat width75" name="search_price_ttc" value="'.$search_price_ttc.'"></td>';
836 print '<td class="liste_titre"></td>';
837 print '<td class="liste_titre"></td>';
838 print '<td class="liste_titre"></td>';
839 print '<td class="liste_titre"></td>';
840 print '<td class="liste_titre"></td>';
841 if (!empty($extralabels)) {
842 foreach ($extralabels as $key) {
843 print '<td class="right"></td>';
844 }
845 }
846 // Print the search button
847 print '<td class="liste_titre maxwidthsearch">';
848 $searchpicto = $form->showFilterAndCheckAddButtons(0);
849 print $searchpicto;
850 print '</td>';
851 print '</tr>';
852 }
853
854 if (count($prodcustprice->lines) > 0) {
855 foreach ($prodcustprice->lines as $line) {
856 $staticprod = new Product($db);
857 $staticprod->fetch($line->fk_product);
858
859 $userstatic = new User($db);
860 $userstatic->fetch($line->fk_user);
861
862 print '<tr class="oddeven">';
863
864 print '<td class="left">'.$staticprod->getNomUrl(1)."</td>";
865 print '<td class="left">'.$staticprod->label."</td>";
866 print '<td class="left">'.$line->ref_customer.'</td>';
867 print '<td class="left">'.dol_print_date($line->date_begin, "day", 'tzuserrel')."</td>";
868 print '<td class="left">'.dol_print_date($line->date_end, "day", 'tzuserrel')."</td>";
869 print '<td class="left">'.$langs->trans($line->price_base_type)."</td>";
870 print '<td class="left">'.vatrate($line->tva_tx.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), true, $line->recuperableonly)."</td>";
871 print '<td class="left">'.price($line->price)."</td>";
872 print '<td class="left">'.price($line->price_ttc)."</td>";
873 print '<td class="left">'.price($line->price_min).'</td>';
874 print '<td class="left">'.price($line->price_min_ttc).'</td>';
875 print '<td class="left">'.$line->price_label.'</td>';
876 print '<td class="left">'.price($line->discount_percent).'</td>';
877 // User
878 print '<td class="left">';
879 print $userstatic->getNomUrl(-1);
880 print '</td>';
881
882 // Extrafields
883 $extrafields->fetch_name_optionals_label("product_customer_price");
884 $extralabels = $extrafields->attributes["product_customer_price"]['label'];
885 if (!empty($extralabels)) {
886 $sql = "SELECT";
887 $sql .= " fk_object";
888 foreach ($extralabels as $key => $value) {
889 $sql .= ", ".$db->sanitize($key);
890 }
891 $sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price_extrafields";
892 $sql .= " WHERE fk_object = ".((int) $line->id);
893 $resql = $db->query($sql);
894 if ($resql) {
895 if ($db->num_rows($resql) != 1) {
896 foreach ($extralabels as $key => $value) {
897 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
898 print "<td></td>";
899 }
900 }
901 } else {
902 $obj = $db->fetch_object($resql);
903 foreach ($extralabels as $key => $value) {
904 if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) {
905 print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key}, '', 'product_customer_price')."</td>";
906 }
907 }
908 }
909 $db->free($resql);
910 }
911 }
912 // Action
913 if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
914 print '<td class="right nowraponall">';
915 print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=showlog_customer_price&token='.newToken().'&socid='.$object->id.'&prodid='.$line->fk_product.'">';
916 print img_info();
917 print '</a>';
918 print ' ';
919 print '<a class="editfielda paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&token='.newToken().'&socid='.$object->id.'&lineid='.$line->id.'">';
920 print img_edit('default', 0, 'style="vertical-align: middle;"');
921 print '</a>';
922 print ' ';
923 print '<a class="paddingleftonly paddingrightonly" href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&token='.newToken().'&socid='.$object->id.'&lineid='.$line->id.'">';
924 print img_delete('default', 'style="vertical-align: middle;"');
925 print '</a>';
926 print '</td>';
927 }
928
929 print "</tr>\n";
930 }
931 } else {
932 if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) {
933 $colspan += 1;
934 }
935 print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans('None').'</span></td></tr>';
936 }
937
938 print "</table>";
939 print '</div>';
940
941 print "</form>";
942 }
943}
944
945// End of page
946llxFooter();
947$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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)
Return array of tabs to used on pages for third parties cards.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
dol_now($mode='auto')
Return date for now.
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.