40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/price.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_expression.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_parser.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
59 require_once DOL_DOCUMENT_ROOT.
'/product/class/productcustomerprice.class.php';
65$langs->loadLangs(array(
'products',
'bills',
'companies',
'other'));
73$action =
GETPOST(
'action',
'aZ09');
74$cancel =
GETPOST(
'cancel',
'alpha');
77$search_soc =
GETPOST(
'search_soc');
80$fieldvalue = (!empty($id) ?
$id : (!empty($ref) ? $ref :
''));
81$fieldtype = (!empty($ref) ?
'ref' :
'rowid');
83 $socid = $user->socid;
87if ($id > 0 || !empty($ref)) {
95 $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5;
99$hookmanager->initHooks(array(
'productpricecard',
'globalcard'));
102 if (
$object->type == $object::TYPE_PRODUCT) {
105 if (
$object->type == $object::TYPE_SERVICE) {
109 restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
112$maxpricesupplier = 0;
115 $permissiontoadd =
$object->getRights()->creer;
117 $permissiontoadd = ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'));
129$parameters = array(
'id' => $id,
'ref' => $ref);
130$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
135if (empty($reshook)) {
136 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
140 if ($action ==
'setlabelsellingprice' && $user->admin) {
141 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
142 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.GETPOST(
'pricelevel');
147 if (($action ==
'update_vat') && !$cancel && $permissiontoadd) {
148 $tva_tx_txt =
GETPOST(
'tva_tx',
'alpha');
150 $price_label =
GETPOST(
'price_label',
'alpha');
153 $tva_tx = $tva_tx_txt;
156 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
157 $vatratecode = $reg[1];
158 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx_txt);
161 $tva_tx =
price2num(preg_replace(
'/\*/',
'', $tva_tx));
162 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
165 $localtax1_type =
'0';
166 $localtax2_type =
'0';
169 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
171 $vatratecode = $reg[1];
173 $sql =
"SELECT t.rowid, t.type_vat, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
174 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
175 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
176 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
177 $sql .=
" AND t.code = '".$db->escape($vatratecode).
"'";
178 $sql .=
" AND t.type_vat IN (0, 1)";
179 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
180 $resql =
$db->query($sql);
182 $obj =
$db->fetch_object($resql);
184 $npr = $obj->recuperableonly;
185 $localtax1 = $obj->localtax1;
186 $localtax2 = $obj->localtax2;
187 $localtax1_type = $obj->localtax1_type;
188 $localtax2_type = $obj->localtax2_type;
193 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
194 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
195 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
196 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
197 $sql .=
" AND t.code = ''";
198 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
199 $resql =
$db->query($sql);
201 $obj =
$db->fetch_object($resql);
203 $npr = $obj->recuperableonly;
204 $localtax1 = $obj->localtax1;
205 $localtax2 = $obj->localtax2;
206 $localtax1_type = $obj->localtax1_type;
207 $localtax2_type = $obj->localtax2_type;
212 $object->default_vat_code = $vatratecode;
215 $object->localtax1_tx = $localtax1;
216 $object->localtax2_tx = $localtax2;
217 $object->localtax1_type = $localtax1_type;
218 $object->localtax2_type = $localtax2_type;
219 $object->price_label = $price_label;
231 $produit_multiprices_limit =
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT');
232 for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
234 if (
$object->multiprices_base_type[$i] ==
'HT') {
235 $oldprice =
$object->multiprices[$i];
236 $oldminprice =
$object->multiprices_min[$i];
238 $oldprice =
$object->multiprices_ttc[$i];
239 $oldminprice =
$object->multiprices_min_ttc[$i];
241 $oldpricebasetype =
$object->multiprices_base_type[$i];
242 $oldnpr =
$object->multiprices_recuperableonly[$i];
245 $localtaxarray = array();
247 $ret =
$object->updatePrice($oldprice, $oldpricebasetype, $user, (
float) $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode, $price_label);
256 if (
$object->price_base_type ==
'HT') {
258 $oldminprice =
$object->price_min;
260 $oldprice =
$object->price_ttc;
261 $oldminprice =
$object->price_min_ttc;
263 $oldpricebasetype =
$object->price_base_type;
267 $localtaxarray = array();
269 $ret =
$object->updatePrice($oldprice, $oldpricebasetype, $user, (
float) $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode, $price_label);
287 $maxpricesupplier = 0;
289 if (($action ==
'update_price' || $action ==
'update_level_price') && !$cancel && $permissiontoadd) {
291 $pricestoupdate = array();
296 $maxpricesupplier =
$object->min_recommended_price();
302 $object->fk_price_expression = empty($eid) ? 0 : $eid;
304 if (
$object->fk_price_expression != 0) {
306 require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_parser.class.php';
309 if ($priceparser->parseProduct($object) < 0) {
318 || ($action ==
'update_level_price' &&
getDolGlobalString(
'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')))) {
319 $newprice =
GETPOST(
'price',
'array');
320 $newprice_min =
GETPOST(
'price_min',
'array');
321 $newpricebase =
GETPOST(
'multiprices_base_type',
'array');
322 $newvattx =
GETPOST(
'tva_tx',
'array');
323 $newvatnpr =
GETPOST(
'tva_npr',
'array');
324 $newlocaltax1_tx =
GETPOST(
'localtax1_tx',
'array');
325 $newlocaltax1_type =
GETPOST(
'localtax1_type',
'array');
326 $newlocaltax2_tx =
GETPOST(
'localtax2_tx',
'array');
327 $newlocaltax2_type =
GETPOST(
'localtax2_type',
'array');
330 $object->price_autogen = (int) (
GETPOST(
'usePriceRules') ==
'on');
332 $produit_multiprices_limit =
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT');
333 for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
334 if (!isset($newprice[$i])) {
338 $tva_tx_txt = $newvattx[$i];
340 $tva_tx = $tva_tx_txt;
343 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
344 $vat_src_code = $reg[1];
345 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx_txt);
347 $tva_tx =
price2num(preg_replace(
'/\*/',
'', $tva_tx));
349 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
350 $localtax1 = $newlocaltax1_tx[$i];
351 $localtax1_type = $newlocaltax1_type[$i];
352 $localtax2 = $newlocaltax2_tx[$i];
353 $localtax2_type = $newlocaltax2_type[$i];
354 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
356 $vatratecode = $reg[1];
358 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
359 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
360 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
361 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
362 $sql .=
" AND t.code ='".$db->escape($vatratecode).
"'";
363 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
364 $resql =
$db->query($sql);
366 $obj =
$db->fetch_object($resql);
368 $npr = $obj->recuperableonly;
369 $localtax1 = $obj->localtax1;
370 $localtax2 = $obj->localtax2;
371 $localtax1_type = $obj->localtax1_type;
372 $localtax2_type = $obj->localtax2_type;
376 if (in_array(
$mysoc->country_code, array(
'ES'))) {
383 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
384 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
385 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
386 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
387 $sql .=
" AND t.code = ''";
388 $resql =
$db->query($sql);
390 $obj =
$db->fetch_object($resql);
392 $npr = $obj->recuperableonly;
393 $localtax1 = $obj->localtax1;
394 $localtax2 = $obj->localtax2;
395 $localtax1_type = $obj->localtax1_type;
396 $localtax2_type = $obj->localtax2_type;
401 $pricestoupdate[$i] = array(
403 'price' =>
price2num($newprice[$i],
'', 2),
404 'price_min' =>
price2num($newprice_min[$i],
'', 2),
405 'price_base_type' => $newpricebase[$i],
406 'default_vat_code' => $vatratecode,
409 'localtaxes_array' => array(
'0' => $localtax1_type,
'1' => $localtax1,
'2' => $localtax2_type,
'3' => $localtax2)
420 $newpricebase =
GETPOST(
'price_base_type',
'alpha');
421 $tva_tx_txt =
GETPOST(
'tva_tx',
'alpha');
422 $price_label =
GETPOST(
'price_label',
'alpha');
424 $tva_tx = $tva_tx_txt;
427 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
428 $vat_src_code = $reg[1];
429 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx_txt);
431 $tva_tx =
price2num(preg_replace(
'/\*/',
'', $tva_tx));
433 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
436 $localtax1_type =
'0';
437 $localtax2_type =
'0';
439 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
441 $vatratecode = $reg[1];
443 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
444 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
445 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
446 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
447 $sql .=
" AND t.code ='".$db->escape($vatratecode).
"'";
448 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
449 $resql =
$db->query($sql);
451 $obj =
$db->fetch_object($resql);
453 $npr = $obj->recuperableonly;
454 $localtax1 = $obj->localtax1;
455 $localtax2 = $obj->localtax2;
456 $localtax1_type = $obj->localtax1_type;
457 $localtax2_type = $obj->localtax2_type;
461 if (in_array(
$mysoc->country_code, array(
'ES'))) {
468 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
469 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
470 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
471 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
472 $sql .=
" AND t.code = ''";
473 $resql =
$db->query($sql);
475 $obj =
$db->fetch_object($resql);
477 $npr = $obj->recuperableonly;
478 $localtax1 = $obj->localtax1;
479 $localtax2 = $obj->localtax2;
480 $localtax1_type = $obj->localtax1_type;
481 $localtax2_type = $obj->localtax2_type;
486 $pricestoupdate[0] = array(
487 'price' => $newprice,
488 'price_label' => $price_label,
489 'price_min' => $newprice_min,
490 'price_base_type' => $newpricebase,
491 'default_vat_code' => $vatratecode,
494 'localtaxes_array' => array(
'0' => $localtax1_type,
'1' => $localtax1,
'2' => $localtax2_type,
'3' => $localtax2)
503 $object->packaging = (float) $packaging;
506 foreach ($pricestoupdate as $key => $val) {
507 $newprice = $val[
'price'];
509 if ($val[
'price'] < $val[
'price_min'] && !empty(
$object->fk_price_expression)) {
510 $newprice = $val[
'price_min'];
514 $newprice_min =
price2num($val[
'price_min'],
'MU');
517 if (
getDolGlobalString(
'PRODUCT_MINIMUM_RECOMMENDED_PRICE') && $newprice_min < $maxpricesupplier) {
518 setEventMessages($langs->trans(
"MinimumPriceLimit",
price($maxpricesupplier, 0,
'', 1, - 1, - 1,
'auto')),
null,
'errors');
523 if (!array_key_exists($key,
$object->multiprices) ||
$object->multiprices[$key] != $newprice ||
$object->multiprices_min[$key] != $newprice_min ||
$object->multiprices_base_type[$key] != $val[
'price_base_type'] ||
$object->multiprices_tva_tx[$key] != $newvattx) {
524 $res =
$object->updatePrice((
float) $newprice, $val[
'price_base_type'], $user, (
float) $val[
'vat_tx'], (
float) $newprice_min, $key, $val[
'npr'], $psq, 0, $val[
'localtaxes_array'], $val[
'default_vat_code'], $val[
'price_label']);
536 $price_extralabels = $extrafields->fetch_name_optionals_label(
"product_price");
538 $sql =
"SELECT rowid";
539 $sql .=
" FROM ".$object->db->prefix().
"product_price";
540 $sql .=
" WHERE entity IN (".getEntity(
'productprice').
")";
541 $sql .=
" AND price_level=".((int) $key);
542 $sql .=
" AND fk_product = ".((int)
$object->id);
543 $sql .=
" ORDER BY date_price DESC, rowid DESC";
545 $resql =
$object->db->query($sql);
547 $lineid =
$object->db->fetch_object($resql);
550 if (!empty($lineid->rowid)) {
551 require_once DOL_DOCUMENT_ROOT .
'/core/class/genericobject.class.php';
554 $genericObject->id = $lineid->rowid;
555 $genericObject->table_element =
'product_price';
556 foreach ($price_extralabels as $code => $label) {
557 $extrafield_values = $extrafields->getOptionalsFromPost(
'product_price', (
string) $key);
558 $genericObject->array_options[
'options_'.$code] = $extrafield_values[
'options_'.$code];
560 $result = $genericObject->insertExtraFields();
581 $action =
'edit_price';
587 if ($action ==
'delete' && $user->hasRight(
'produit',
'supprimer')) {
595 if ($action ==
'activate_price_by_qty' && $permissiontoadd) {
598 $basePriceType =
$object->price_base_type;
599 $basePrice = ($basePriceType ==
'HT') ?
$object->price :
$object->price_ttc;
600 $basePriceMin = ($basePriceType ==
'HT') ?
$object->price_min :
$object->price_min_ttc;
601 if (
getDolGlobalString(
'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && $level > 0 && isset(
$object->multiprices[$level])) {
603 $basePriceType = (empty(
$object->multiprices_base_type[$level]) ?
'HT' :
$object->multiprices_base_type[$level]);
604 $basePrice = ($basePriceType ==
'HT') ?
$object->multiprices[$level] :
$object->multiprices_ttc[$level];
605 $basePriceMin = ($basePriceType ==
'HT') ?
$object->multiprices_min[$level] :
$object->multiprices_min_ttc[$level];
607 $ret =
$object->updatePrice($basePrice, $basePriceType, $user,
$object->tva_tx, $basePriceMin, $level,
$object->tva_npr, 1, 0, array(),
$object->default_vat_code);
614 if ($action ==
'disable_price_by_qty' && $permissiontoadd) {
617 $basePriceType =
$object->price_base_type;
618 $basePrice = ($basePriceType ==
'HT') ?
$object->price :
$object->price_ttc;
619 $basePriceMin = ($basePriceType ==
'HT') ?
$object->price_min :
$object->price_min_ttc;
620 if (
getDolGlobalString(
'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && $level > 0 && isset(
$object->multiprices[$level])) {
622 $basePriceType = (empty(
$object->multiprices_base_type[$level]) ?
'HT' :
$object->multiprices_base_type[$level]);
623 $basePrice = ($basePriceType ==
'HT') ?
$object->multiprices[$level] :
$object->multiprices_ttc[$level];
624 $basePriceMin = ($basePriceType ==
'HT') ?
$object->multiprices_min[$level] :
$object->multiprices_min_ttc[$level];
626 $ret =
$object->updatePrice($basePrice, $basePriceType, $user,
$object->tva_tx, $basePriceMin, $level,
$object->tva_npr, 0, 0, array(),
$object->default_vat_code);
633 if ($action ==
'edit_price_by_qty') {
638 if ($action ==
'update_price_by_qty' && $permissiontoadd) {
648 if (empty($quantity)) {
650 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Qty")),
null,
'errors');
652 if (empty($newprice)) {
654 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Price")),
null,
'errors');
656 if (!$error && !($rowid > 0)) {
658 $sql =
"SELECT pp.rowid FROM ".MAIN_DB_PREFIX.
"product_price as pp";
659 $sql .=
" WHERE pp.rowid = ".((int) $priceid).
" AND pp.fk_product = ".((int)
$object->id);
660 $resql =
$db->query($sql);
661 if (!$resql || !
$db->num_rows($resql)) {
668 if (
$object->price_base_type ==
'TTC') {
673 $unitPrice =
price2num((
float) $price / (
float) $quantity,
'MU');
677 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_price_by_qty SET";
678 $sql .=
" price=".((float) $price).
",";
679 $sql .=
" unitprice=".((float) $unitPrice).
",";
680 $sql .=
" quantity=".((float) $quantity).
",";
681 $sql .=
" remise_percent=".((float) $remise_percent).
",";
682 $sql .=
" remise=".((float) $remise);
683 $sql .=
" WHERE rowid = ".((int) $rowid);
684 $sql .=
" AND fk_product_price IN (SELECT pp.rowid FROM ".MAIN_DB_PREFIX.
"product_price as pp WHERE pp.fk_product = ".((int)
$object->id).
")";
686 $result =
$db->query($sql);
691 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"product_price_by_qty (fk_product_price,price,unitprice,quantity,remise_percent,remise) values (";
692 $sql .= ((int) $priceid).
','.((float) $price).
','.((float) $unitPrice).
','.((float) $quantity).
','.((float) $remise_percent).
','.((float) $remise).
')';
694 $result =
$db->query($sql);
696 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
706 if ($action ==
'delete_price_by_qty' && $permissiontoadd) {
708 if (!empty($rowid)) {
709 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"product_price_by_qty";
710 $sql .=
" WHERE rowid = ".((int) $rowid);
711 $sql .=
" AND fk_product_price IN (SELECT pp.rowid FROM ".MAIN_DB_PREFIX.
"product_price as pp WHERE pp.fk_product = ".((int)
$object->id).
")";
713 $result =
$db->query($sql);
715 setEventMessages((
'delete_price_by_qty'.$langs->transnoentities(
'MissingIds')),
null,
'errors');
719 if ($action ==
'delete_all_price_by_qty' && $permissiontoadd) {
721 if (!empty($priceid)) {
722 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"product_price_by_qty";
723 $sql .=
" WHERE fk_product_price = ".((int) $priceid);
724 $sql .=
" AND fk_product_price IN (SELECT pp.rowid FROM ".MAIN_DB_PREFIX.
"product_price as pp WHERE pp.fk_product = ".((int)
$object->id).
")";
726 $result =
$db->query($sql);
728 setEventMessages((
'delete_price_by_qty'.$langs->transnoentities(
'MissingIds')),
null,
'errors');
737 if ($action ==
'add_customer_price_confirm' && !$cancel && $prodcustprice !==
null && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
738 $maxpricesupplier =
$object->min_recommended_price();
740 $update_child_soc =
GETPOSTINT(
'updatechildprice');
744 $prodcustprice->ref_customer =
GETPOST(
'ref_customer',
'alpha');
745 $prodcustprice->fk_product =
$object->id;
748 $prodcustprice->price_base_type =
GETPOST(
"price_base_type",
'alpha');
749 $prodcustprice->price_label =
GETPOST(
"price_label",
'alpha');
754 $extralabels = $extrafields->fetch_name_optionals_label(
"product_customer_price");
755 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_customer_price");
757 $tva_tx_txt =
GETPOST(
"tva_tx",
'alpha');
759 $tva_tx = $tva_tx_txt;
761 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
762 $vat_src_code = $reg[1];
763 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx_txt);
765 $tva_tx =
price2num(preg_replace(
'/\*/',
'', $tva_tx));
767 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
770 $localtax1_type =
'0';
771 $localtax2_type =
'0';
773 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
775 $vatratecode = $reg[1];
777 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
778 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
779 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
780 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
781 $sql .=
" AND t.code ='".$db->escape($vatratecode).
"'";
782 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
783 $resql =
$db->query($sql);
785 $obj =
$db->fetch_object($resql);
787 $npr = $obj->recuperableonly;
788 $localtax1 = $obj->localtax1;
789 $localtax2 = $obj->localtax2;
790 $localtax1_type = $obj->localtax1_type;
791 $localtax2_type = $obj->localtax2_type;
795 if (in_array(
$mysoc->country_code, array(
'ES'))) {
802 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
803 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
804 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
805 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
806 $sql .=
" AND t.code = ''";
807 $resql =
$db->query($sql);
809 $obj =
$db->fetch_object($resql);
811 $npr = $obj->recuperableonly;
812 $localtax1 = $obj->localtax1;
813 $localtax2 = $obj->localtax2;
814 $localtax1_type = $obj->localtax1_type;
815 $localtax2_type = $obj->localtax2_type;
820 $prodcustprice->default_vat_code = $vatratecode;
821 $prodcustprice->tva_tx = $tva_tx;
822 $prodcustprice->recuperableonly = $npr;
823 $prodcustprice->localtax1_tx = $localtax1;
824 $prodcustprice->localtax2_tx = $localtax2;
825 $prodcustprice->localtax1_type = $localtax1_type;
826 $prodcustprice->localtax2_type = $localtax2_type;
828 if (!($prodcustprice->fk_soc > 0)) {
829 $langs->load(
"errors");
830 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdParty")),
null,
'errors');
832 $action =
'add_customer_price';
834 if (
getDolGlobalString(
'PRODUCT_MINIMUM_RECOMMENDED_PRICE') && $prodcustprice->price_min < (
float) $maxpricesupplier) {
835 $langs->load(
"errors");
836 setEventMessages($langs->trans(
"MinimumPriceLimit",
price((
float) $maxpricesupplier, 0,
'', 1, -1, -1,
'auto')),
null,
'errors');
838 $action =
'add_customer_price';
843 $result = $prodcustprice->create($user, 0, $update_child_soc);
845 if (!empty($extrafield_values) && is_array($extrafield_values)) {
847 $res = $productcustomerprice->fetch($prodcustprice->id);
849 foreach ($extrafield_values as $key => $value) {
850 $productcustomerprice->array_options[$key] = $value;
852 $result2 = $productcustomerprice->insertExtraFields();
854 $prodcustprice->error = $productcustomerprice->error;
855 $prodcustprice->errors = $productcustomerprice->errors;
864 $action =
'add_customer_price';
873 if (in_array($action, [
'confirm_remove_customer_price',
'update_customer_price_confirm']) && $prodcustprice !==
null) {
875 if ((
int) $prodcustprice->fk_product !== (
int)
$object->id) {
881 if ($action ==
'confirm_remove_customer_price' && $prodcustprice !==
null && ($user->hasRight(
'produit',
'supprimer') || $user->hasRight(
'service',
'supprimer'))) {
883 $update_child_soc =
GETPOSTINT(
'updatechildprice');
886 $result = $prodcustprice->delete($user, 0, $update_child_soc);
889 $db->query(
"DELETE FROM ".MAIN_DB_PREFIX.
"product_customer_price_extrafields WHERE fk_object = ".((
int) $prodcustprice->id));
904 if ($action ==
'update_customer_price_confirm' && !$cancel && $prodcustprice !==
null && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
905 $maxpricesupplier =
$object->min_recommended_price();
907 $update_child_soc =
GETPOSTINT(
'updatechildprice');
912 $prodcustprice->ref_customer =
GETPOST(
'ref_customer',
'alpha');
915 $prodcustprice->price_base_type =
GETPOST(
"price_base_type",
'alpha');
916 $prodcustprice->price_label =
GETPOST(
"price_label",
'alpha');
921 $extralabels = $extrafields->fetch_name_optionals_label(
"product_customer_price");
922 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_customer_price");
924 $tva_tx_txt =
GETPOST(
"tva_tx");
926 $tva_tx = $tva_tx_txt;
928 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
929 $vat_src_code = $reg[1];
930 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx_txt);
932 $tva_tx =
price2num(preg_replace(
'/\*/',
'', $tva_tx));
934 $npr = preg_match(
'/\*/', $tva_tx_txt) ? 1 : 0;
937 $localtax1_type =
'0';
938 $localtax2_type =
'0';
940 if (preg_match(
'/\((.*)\)/', $tva_tx_txt, $reg)) {
942 $vatratecode = $reg[1];
944 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
945 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
946 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
947 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
948 $sql .=
" AND t.code ='".$db->escape($vatratecode).
"'";
949 $sql .=
" AND t.entity IN (".getEntity(
'c_tva').
")";
950 $resql =
$db->query($sql);
952 $obj =
$db->fetch_object($resql);
954 $npr = $obj->recuperableonly;
955 $localtax1 = $obj->localtax1;
956 $localtax2 = $obj->localtax2;
957 $localtax1_type = $obj->localtax1_type;
958 $localtax2_type = $obj->localtax2_type;
962 if (in_array(
$mysoc->country_code, array(
'ES'))) {
969 $sql =
"SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
970 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_tva as t, ".MAIN_DB_PREFIX.
"c_country as c";
971 $sql .=
" WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(
$mysoc->country_code).
"'";
972 $sql .=
" AND t.taux = ".((float) $tva_tx).
" AND t.active = 1";
973 $sql .=
" AND t.code = ''";
974 $resql =
$db->query($sql);
976 $obj =
$db->fetch_object($resql);
978 $npr = $obj->recuperableonly;
979 $localtax1 = $obj->localtax1;
980 $localtax2 = $obj->localtax2;
981 $localtax1_type = $obj->localtax1_type;
982 $localtax2_type = $obj->localtax2_type;
987 $prodcustprice->default_vat_code = $vatratecode;
988 $prodcustprice->tva_tx = $tva_tx;
989 $prodcustprice->recuperableonly = $npr;
990 $prodcustprice->localtax1_tx = $localtax1;
991 $prodcustprice->localtax2_tx = $localtax2;
992 $prodcustprice->localtax1_type = $localtax1_type;
993 $prodcustprice->localtax2_type = $localtax2_type;
995 if ($prodcustprice->price_min < $maxpricesupplier &&
getDolGlobalString(
'PRODUCT_MINIMUM_RECOMMENDED_PRICE')) {
996 setEventMessages($langs->trans(
"MinimumPriceLimit",
price($maxpricesupplier, 0,
'', 1, -1, -1,
'auto')),
null,
'errors');
998 $action =
'update_customer_price';
1002 $result = $prodcustprice->update($user, 0, $update_child_soc);
1004 if (!empty($extrafield_values) && is_array($extrafield_values)) {
1006 $res = $productcustomerprice->fetch($prodcustprice->id);
1008 foreach ($extrafield_values as $key => $value) {
1009 $productcustomerprice->array_options[$key] = $value;
1011 $result2 = $productcustomerprice->insertExtraFields();
1013 $prodcustprice->error = $productcustomerprice->error;
1014 $prodcustprice->errors = $productcustomerprice->errors;
1023 $action =
'update_customer_price';
1039if (!empty($id) || !empty($ref)) {
1044$title = $langs->trans(
'ProductServiceCard');
1048 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'SellingPrices');
1049 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
1052 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'SellingPrices');
1053 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
1056llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'classforhorizontalscrolloftabs mod-product page-price');
1058if ($action ==
'ask_remove_customer_price' && ($user->hasRight(
'produit',
'supprimer') || $user->hasRight(
'service',
'supprimer'))) {
1059 $formquestion = array(
1060 array(
'type' =>
'checkbox',
'name' =>
'updatechildprice',
'label' => $langs->trans(
'ForceDeleteChildPriceSoc'),
'value' => 0),
1062 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.
GETPOSTINT(
'lineid'), $langs->trans(
'DeleteCustomerPrice'), $langs->trans(
'ConfirmDeleteCustomerPrice'),
'confirm_remove_customer_price', $formquestion, 0, 1);
1067$titre = $langs->trans(
"CardProduct".
$object->type);
1072$linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1&type='.
$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
1073$object->next_prev_filter =
"(te.fk_product_type:=:".((int)
$object->type).
")";
1076if ($user->socid && !in_array(
'product', explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL')))) {
1080dol_banner_tab($object,
'ref', $linkback, $shownav,
'ref');
1083print
'<div class="fichecenter">';
1085print
'<div class="underbanner clearboth"></div>';
1086print
'<table class="border tableforfield centpercent">';
1093 if (!empty($socid)) {
1096 $soc->fetch($socid);
1100 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
1101 print
'<tr><td class="">';
1102 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type, $object, 0, $typeformat) : $langs->trans(
'Type');
1104 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type, $object, 0, $typeformat);
1109 print
'<tr><td class="titlefieldcreate">';
1110 print $langs->trans(
"SellingPrice");
1112 print
'<td colspan="2">';
1113 if (
$object->multiprices_base_type[$soc->price_level] ==
'TTC') {
1114 print
'<span class="amount">'.price(
$object->multiprices_ttc[$soc->price_level]).
'</span>';
1116 print
'<span class="amount">'.price(
$object->multiprices[$soc->price_level]).
'</span>';
1118 if (
$object->multiprices_base_type[$soc->price_level]) {
1119 print
' '.$langs->trans(
$object->multiprices_base_type[$soc->price_level]);
1121 print
' '.$langs->trans(
$object->price_base_type);
1126 print
'<tr><td>'.$langs->trans(
"MinPrice").
'</td><td colspan="2">';
1127 if (
$object->multiprices_base_type[$soc->price_level] ==
'TTC') {
1128 print
price(
$object->multiprices_min_ttc[$soc->price_level]).
' '.$langs->trans(
$object->multiprices_base_type[$soc->price_level]);
1130 print
price(
$object->multiprices_min[$soc->price_level]).
' '.$langs->trans(empty(
$object->multiprices_base_type[$soc->price_level]) ?
'HT' :
$object->multiprices_base_type[$soc->price_level]);
1136 print
'<tr><td>'.$langs->trans(
"DefaultTaxRate").
'</td><td colspan="2">';
1138 $positiverates =
'';
1140 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->multiprices_tva_tx[$soc->price_level]);
1143 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->multiprices_localtax1_tx[$soc->price_level]);
1146 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->multiprices_localtax2_tx[$soc->price_level]);
1148 if (empty($positiverates)) {
1149 $positiverates =
'0';
1151 echo
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''), true,
$object->tva_npr);
1156 print
'<tr><td>'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
1158 $positiverates =
'';
1163 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax1_tx);
1166 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax2_tx);
1168 if (empty($positiverates)) {
1169 $positiverates =
'0';
1171 echo
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''), true,
$object->tva_npr);
1179 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
1180 print
'<tr><td class="">';
1181 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type, $object, 0, $typeformat) : $langs->trans(
'Type');
1183 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type, $object, 0, $typeformat);
1188 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DefaultTaxRate").
'</td>';
1189 print
'<td colspan="2">'.vatrate(
$object->multiprices_tva_tx[1],
true).
'</td>';
1194 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
1195 print
'<tr><td class="">';
1196 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type, $object, 0, $typeformat) : $langs->trans(
'Type');
1198 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type, $object, 0, $typeformat);
1203 print
'<!-- Default VAT Rate -->';
1204 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
1207 $positiverates =
'';
1209 $positiverates .= ($positiverates ?
'<span class="opacitymedium">/</span>' :
'').
price2num(
$object->tva_tx);
1212 $positiverates .= ($positiverates ?
'<span class="opacitymedium">/</span>' :
'').
price2num(
$object->localtax1_tx);
1215 $positiverates .= ($positiverates ?
'<span class="opacitymedium">/</span>' :
'').
price2num(
$object->localtax2_tx);
1217 if (empty($positiverates)) {
1218 $positiverates =
'0';
1221 print
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''), true,
$object->tva_npr, 1);
1234 print
'<table class="liste centpercent">';
1235 print
'<tr class="liste_titre"><td>';
1236 print $langs->trans(
"PriceLevel");
1238 print
' <a class="editfielda" href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'editlabelsellingprice',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->trans(
'EditSellingPriceLabel'), 0).
'</a>';
1241 print
'<td style="text-align: right">'.$langs->trans(
"SellingPrice").
'</td>';
1242 print
'<td style="text-align: right">'.$langs->trans(
"MinPrice").
'</td>';
1244 $extrafields->fetch_name_optionals_label(
"product_price");
1245 if ($extrafields->attributes[
"product_price"] && array_key_exists(
'label', $extrafields->attributes[
"product_price"])) {
1246 $extralabels = $extrafields->attributes[
"product_price"][
'label'];
1247 if (!empty($extralabels)) {
1248 foreach ($extralabels as $key => $value) {
1250 if (!empty($extrafields->attributes[
"product_price"][
'list'][$key]) && $extrafields->attributes[
"product_price"][
'list'][$key] != 3) {
1251 if (!empty($extrafields->attributes[
"product_price"][
'langfile'][$key])) {
1252 $langs->load($extrafields->attributes[
"product_price"][
'langfile'][$key]);
1254 if (!empty($extrafields->attributes[
"product_price"][
'help'][$key])) {
1255 $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_price"][
'help'][$key]));
1257 $extratitle = $langs->trans($value);
1259 $field =
'ef.' . $key;
1260 print
'<td style="text-align: right">'.$extratitle.
'</td>';
1267 $produit_multiprices_limit =
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT');
1268 for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
1269 print
'<tr class="oddeven">';
1273 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$i;
1274 if (preg_match(
'/editlabelsellingprice/', $action)) {
1275 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
1276 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1277 print
'<input type="hidden" name="action" value="setlabelsellingprice">';
1278 print
'<input type="hidden" name="pricelevel" value="'.$i.
'">';
1279 print $langs->trans(
"SellingPrice").
' '.$i.
' - ';
1280 print
'<input class="maxwidthonsmartphone" type="text" name="labelsellingprice" value="' .
getDolGlobalString($keyforlabel).
'">';
1281 print
' <input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
1284 print $langs->trans(
"SellingPrice").
' '.$i;
1291 if (
$object->multiprices_base_type [$i] ==
'TTC') {
1292 print
'<td class="right"><span class="amount">'.price(
$object->multiprices_ttc[$i]);
1294 print
'<td class="right"><span class="amount">'.price(
$object->multiprices[$i]);
1297 if (
$object->multiprices_base_type[$i]) {
1298 print
' '.$langs->trans(
$object->multiprices_base_type [$i]).
'</span></td>';
1300 print
' '.$langs->trans(
$object->price_base_type).
'</span></td>';
1304 print
'<td style="text-align: right">';
1305 if (empty(
$object->multiprices_base_type[$i])) {
1306 $object->multiprices_base_type[$i] =
"HT";
1308 if (
$object->multiprices_base_type[$i] ==
'TTC') {
1309 print
price(
$object->multiprices_min_ttc[$i]).
' '.$langs->trans(
$object->multiprices_base_type[$i]);
1311 print
price(
$object->multiprices_min[$i]).
' '.$langs->trans(
$object->multiprices_base_type[$i]);
1314 if (!empty($extralabels)) {
1315 require_once DOL_DOCUMENT_ROOT .
'/core/class/genericobject.class.php';
1318 $genericObject->table_element =
'product_price';
1319 $sql1 =
"SELECT rowid";
1320 $sql1 .=
" FROM ".$object->db->prefix().
"product_price";
1321 $sql1 .=
" WHERE entity IN (".getEntity(
'productprice').
")";
1322 $sql1 .=
" AND price_level=".((int) $i);
1323 $sql1 .=
" AND fk_product = ".((int)
$object->id);
1324 $sql1 .=
" ORDER BY date_price DESC, rowid DESC";
1325 $sql1 .=
" LIMIT 1";
1326 $resql1 =
$object->db->query($sql1);
1327 if ($resql1 && $lineid =
$object->db->fetch_object($resql1)) {
1328 $genericObject->id = $lineid->rowid;
1329 $genericObject->fetch_optionals();
1331 foreach ($extralabels as $key => $value) {
1332 if (!empty($extrafields->attributes[
"product_price"][
'list'][$key]) && $extrafields->attributes[
"product_price"][
'list'][$key] != 3) {
1333 print
'<td align="right">'.$extrafields->showOutputField($key, $genericObject->array_options[
'options_' . $key],
'',
'product_price').
"</td>";
1342 print
'<tr><td>'.$langs->trans(
"PriceByQuantity").
' '.$i;
1346 print
'</td><td colspan="2">';
1348 if (
$object->prices_by_qty[$i] == 1) {
1349 print
'<table width="50%" class="border" summary="List of quantities">';
1351 print
'<tr class="liste_titre">';
1352 print
'<td>'.$langs->trans(
"PriceByQuantityRange").
' '.$i.
'</td>';
1353 print
'<td class="right">'.$langs->trans(
"HT").
'</td>';
1354 print
'<td class="right">'.$langs->trans(
"UnitPrice").
'</td>';
1355 print
'<td class="right">'.$langs->trans(
"Discount").
'</td>';
1356 print
'<td> </td>';
1359 foreach (
$object->prices_by_qty_list[$i] as $ii => $prices) {
1360 if ($action ==
'edit_price_by_qty' && $rowid == $prices[
'rowid'] && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1361 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1362 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1363 print
'<input type="hidden" name="action" value="update_price_by_qty">';
1364 print
'<input type="hidden" name="priceid" value="'.$object->prices_by_qty_id[$i].
'">';
1365 print
'<input type="hidden" value="'.$prices[
'rowid'].
'" name="rowid">';
1366 print
'<tr class="'.($ii % 2 == 0 ?
'pair' :
'impair').
'">';
1367 print
'<td><input size="5" type="text" value="'.$prices[
'quantity'].
'" name="quantity"></td>';
1368 print
'<td class="right" colspan="2"><input size="10" type="text" value="'.price2num($prices[
'price'],
'MU').
'" name="price"> '.
$object->price_base_type.
'</td>';
1369 print
'<td class="right nowraponall"><input size="5" type="text" value="'.$prices[
'remise_percent'].
'" name="remise_percent"> %</td>';
1370 print
'<td class="center"><input type="submit" value="'.$langs->trans(
"Modify").
'" class="button"></td>';
1374 print
'<tr class="'.($ii % 2 == 0 ?
'pair' :
'impair').
'">';
1375 print
'<td>'.$prices[
'quantity'].
'</td>';
1376 print
'<td class="right">'.price($prices[
'price']).
'</td>';
1377 print
'<td class="right">'.price($prices[
'unitprice']).
'</td>';
1378 print
'<td class="right">'.price($prices[
'remise_percent']).
' %</td>';
1379 print
'<td class="center">';
1380 if (($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1381 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit_price_by_qty&token='.
newToken().
'&rowid='.$prices[
"rowid"].
'">';
1383 print
'<a class="marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete_price_by_qty&token='.
newToken().
'&rowid='.$prices[
"rowid"].
'">';
1392 if ($action !=
'edit_price_by_qty' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1393 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1394 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1395 print
'<input type="hidden" name="action" value="update_price_by_qty">';
1396 print
'<input type="hidden" name="priceid" value="'.$object->prices_by_qty_id[$i].
'">';
1397 print
'<input type="hidden" value="0" name="rowid">';
1398 print
'<tr class="'.($ii % 2 == 0 ?
'pair' :
'impair').
'">';
1399 print
'<td><input size="5" type="text" value="1" name="quantity"></td>';
1400 print
'<td class="right" class="nowrap"><input size="10" type="text" value="0" name="price"> '.$object->price_base_type.
'</td>';
1401 print
'<td class="right"> </td>';
1402 print
'<td class="right" class="nowraponall"><input size="5" type="text" value="0" name="remise_percent"> %</td>';
1403 print
'<td class="center"><input type="submit" value="'.$langs->trans(
"Add").
'" class="button"></td>';
1409 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=disable_price_by_qty&level='.$i.
'&token='.
newToken().
'">('.$langs->trans(
"DisablePriceByQty").
')</a>';
1411 print $langs->trans(
"No");
1412 print
' <a class="marginleftonly marginrightonly" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=activate_price_by_qty&level='.$i.
'&token='.
newToken().
'">('.$langs->trans(
"Activate").
')</a>';
1421 $typeformat =
'select;0:'.$langs->trans(
"Product").
',1:'.$langs->trans(
"Service");
1422 print
'<tr><td class="">';
1423 print (!
getDolGlobalString(
'PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey(
"Type",
'fk_product_type', (
string)
$object->type, $object, 0, $typeformat) : $langs->trans(
'Type');
1425 print $form->editfieldval(
"Type",
'fk_product_type',
$object->type, $object, 0, $typeformat);
1430 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
1432 $positiverates =
'';
1437 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax1_tx);
1440 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax2_tx);
1442 if (empty($positiverates)) {
1443 $positiverates =
'0';
1445 echo
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''), true,
$object->tva_npr, 0, 1);
1455 print
'<tr class="field_selling_price"><td>'.$langs->trans(
"SellingPrice").
'</td><td>';
1456 if (
$object->price_base_type ==
'TTC') {
1461 print
'<i class="opacitymedium"> - ' .
price(
$object->price_ttc).
' '.$langs->trans(
'TTC') .
'</i>';
1468 print
'<tr class="field_min_price"><td>'.$langs->trans(
"MinPrice").
'</td><td>';
1469 if (
$object->price_base_type ==
'TTC') {
1474 print
'<i class="opacitymedium"> - ' .
price(
$object->price_min_ttc).
' '.$langs->trans(
'TTC') .
'</i>';
1481 print
'<tr class="field_price_label"><td>'.$form->textwithpicto($langs->trans(
"PackagingForThisProduct"), $langs->trans(
"PackagingForThisProductDesc")).
'</td><td>';
1487 print
'<tr class="field_price_label"><td>'.$langs->trans(
"PriceLabel").
'</td><td>';
1494 print
'<tr><td>'.$langs->trans(
"PriceByQuantity");
1495 if (
$object->prices_by_qty[0] == 0) {
1496 print
' <a href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=activate_price_by_qty&level=1&token='.
newToken().
'">('.$langs->trans(
"Activate").
')';
1498 print
' <a href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=disable_price_by_qty&level=1&token='.
newToken().
'">('.$langs->trans(
"DisablePriceByQty").
')';
1502 if (
$object->prices_by_qty[0] == 1) {
1503 print
'<table width="50%" class="border" summary="List of quantities">';
1504 print
'<tr class="liste_titre">';
1506 print
'<td>'.$langs->trans(
"Quantity").
'</td>';
1507 print
'<td class="right">'.$langs->trans(
"Price").
'</td>';
1508 print
'<td class="right"></td>';
1509 print
'<td class="right">'.$langs->trans(
"UnitPrice").
'</td>';
1510 print
'<td class="right">'.$langs->trans(
"Discount").
'</td>';
1511 print
'<td> </td>';
1513 if ($action !=
'edit_price_by_qty') {
1514 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1515 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1516 print
'<input type="hidden" name="action" value="update_price_by_qty">';
1517 print
'<input type="hidden" name="priceid" value="'.$object->prices_by_qty_id[0].
'">';
1518 print
'<input type="hidden" value="0" name="rowid">';
1520 print
'<tr class="'.(($ii % 2) == 0 ?
'pair' :
'impair').
'">';
1521 print
'<td><input size="5" type="text" value="1" name="quantity"></td>';
1522 print
'<td class="right"><input class="width50 right" type="text" value="0" name="price"></td>';
1526 print
'<td class="right"> </td>';
1527 print
'<td class="right nowraponall"><input type="text" class="width50 right" value="0" name="remise_percent"> %</td>';
1528 print
'<td class="center"><input type="submit" value="'.$langs->trans(
"Add").
'" class="button"></td>';
1533 foreach (
$object->prices_by_qty_list[0] as $ii => $prices) {
1534 if ($action ==
'edit_price_by_qty' && $rowid == $prices[
'rowid'] && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1535 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1536 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1537 print
'<input type="hidden" name="action" value="update_price_by_qty">';
1538 print
'<input type="hidden" name="priceid" value="'.$object->prices_by_qty_id[0].
'">';
1539 print
'<input type="hidden" value="'.$prices[
'rowid'].
'" name="rowid">';
1540 print
'<tr class="'.($ii % 2 == 0 ?
'pair' :
'impair').
'">';
1541 print
'<td><input size="5" type="text" value="'.$prices[
'quantity'].
'" name="quantity"></td>';
1542 print
'<td class="right"><input class="width50 right" type="text" value="'.price2num($prices[
'price'],
'MU').
'" name="price"></td>';
1543 print
'<td class="right">';
1545 print $prices[
'price_base_type'];
1547 print
'<td class="right"> </td>';
1548 print
'<td class="right nowraponall"><input class="width50 right" type="text" value="'.$prices[
'remise_percent'].
'" name="remise_percent"> %</td>';
1549 print
'<td class="center"><input type="submit" value="'.$langs->trans(
"Modify").
'" class="button"></td>';
1553 print
'<tr class="'.($ii % 2 == 0 ?
'pair' :
'impair').
'">';
1554 print
'<td>'.$prices[
'quantity'].
'</td>';
1555 print
'<td class="right">'.price($prices[
'price']).
'</td>';
1556 print
'<td class="right">';
1558 print $prices[
'price_base_type'];
1560 print
'<td class="right">'.price($prices[
'unitprice']).
'</td>';
1561 print
'<td class="right">'.price($prices[
'remise_percent']).
' %</td>';
1562 print
'<td class="center">';
1563 if (($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1564 print
'<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit_price_by_qty&token='.
newToken().
'&rowid='.$prices[
"rowid"].
'">';
1566 print
'<a class="marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete_price_by_qty&token='.
newToken().
'&rowid='.$prices[
"rowid"].
'">';
1577 print $langs->trans(
"No");
1586print
'<div class="clearboth"></div>';
1595if (!$action || $action ==
'delete' || $action ==
'showlog_customer_price' || $action ==
'showlog_default_price' || $action ==
'add_customer_price'
1596 || $action ==
'activate_price_by_qty' || $action ==
'disable_price_by_qty') {
1597 print
"\n".
'<div class="tabsAction">'.
"\n";
1599 $parameters = array();
1600 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1601 if (empty($reshook)) {
1604 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"NoEditVariants")) .
'">' . $langs->trans(
"UpdateDefaultPrice") .
'</a></div>';
1608 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
1609 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
'PHP_SELF'] .
'?action=edit_price&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"UpdateDefaultPrice") .
'</a></div>';
1611 print
'<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">' . $langs->trans(
"UpdateDefaultPrice") .
'</span></div>';
1616 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
1617 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
"PHP_SELF"] .
'?action=add_customer_price&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"AddCustomerPrice") .
'</a></div>';
1619 print
'<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">' . $langs->trans(
"AddCustomerPrice") .
'</span></div>';
1624 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
1625 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
'PHP_SELF'] .
'?action=edit_vat&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"UpdateVAT") .
'</a></div>';
1627 print
'<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">' . $langs->trans(
"UpdateVAT") .
'</span></div>';
1630 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
1631 print
'<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER[
'PHP_SELF'] .
'?action=edit_level_price&token='.newToken().
'&id=' .
$object->id .
'">' . $langs->trans(
"UpdateLevelPrices") .
'</a></div>';
1633 print
'<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">' . $langs->trans(
"UpdateLevelPrices") .
'</span></div>';
1648if ($action ==
'edit_vat' && ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer'))) {
1651 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1652 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1653 print
'<input type="hidden" name="action" value="update_vat">';
1654 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1658 print
'<table class="border centpercent">';
1661 print
'<tr><td>'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
1671 print $form->buttonsSaveCancel();
1673 print
'<br></form><br>';
1676if (($action ==
'edit_price' || $action ==
'edit_level_price') &&
$object->getRights()->creer) {
1681 print
'<!-- Edit price -->'.
"\n";
1682 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1683 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1684 print
'<input type="hidden" name="action" value="update_price">';
1685 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1689 print
'<div class="div-table-responsive-no-min">';
1690 print
'<table class="border centpercent">';
1693 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
1699 print $langs->trans(
'PriceBase');
1702 print $form->selectPriceBaseType(
$object->price_base_type,
"price_base_type");
1709 print
'<!-- Show price mode of dynamicprices editor -->'.
"\n";
1710 print
'<tr><td>'.$langs->trans(
"PriceMode").
'</td><td>';
1711 print
img_picto(
'',
'dynamicprice',
'class="pictofixedwidth"');
1713 $price_expression_list = array(0 => $langs->trans(
"Numeric").
' <span class="opacitymedium">('.$langs->trans(
"NoDynamicPrice").
')</span>');
1714 foreach ($price_expression->list_price_expression() as $entry) {
1715 $price_expression_list[$entry->id] = $entry->title;
1717 $price_expression_preselection =
GETPOST(
'eid') ?
GETPOST(
'eid') : (
$object->fk_price_expression ?
$object->fk_price_expression :
'0');
1718 print $form->selectarray(
'eid', $price_expression_list, $price_expression_preselection);
1719 print
' <a id="expression_editor" class="classlink">'.$langs->trans(
"PriceExpressionEditor").
'</a>';
1725 <script
type=
"text/javascript">
1726 jQuery(document).ready(
function() {
1727 jQuery(
"#expression_editor").click(
function() {
1728 window.location =
"<?php echo DOL_URL_ROOT ?>/product/dynamic_price/editor.php?id=<?php echo $id ?>&tab=price&eid=" + $(
"#eid").val();
1730 jQuery(
"#eid").change(on_change);
1733 function on_change() {
1734 if ($(
"#eid").val() == 0) {
1735 jQuery(
"#price_numeric").show();
1737 jQuery(
"#price_numeric").hide();
1746 $product->fetch($id, $ref,
'',
'1');
1747 print
'<tr id="price_numeric"><td>';
1748 $text = $langs->trans(
'SellingPrice');
1749 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
1751 if (
$object->price_base_type ==
'TTC') {
1752 print
'<input name="price" size="10" value="'.price($product->price_ttc).
'">';
1754 print
'<input name="price" size="10" value="'.price($product->price).
'">';
1760 $text = $langs->trans(
'MinPrice');
1761 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
1763 if (
$object->price_base_type ==
'TTC') {
1764 print
'<input name="price_min" size="10" value="'.($object->price_min_ttc ?
price(
$object->price_min_ttc) :
'').
'">';
1766 print
'<input name="price_min" size="10" value="'.($object->price_min ?
price(
$object->price_min) :
'').
'">';
1769 print
' '.$langs->trans(
"MinimumRecommendedPrice",
price((
float) $maxpricesupplier, 0,
'', 1, -1, -1,
'auto')).
' '.
img_warning().
'</td>';
1777 print $form->textwithpicto($langs->trans(
"PackagingForThisProduct"), $langs->trans(
"PackagingForThisProductDesc"));
1779 $packaging =
$object->packaging;
1780 print
'<input class="flat" name="packaging" size="5" value="' . ($packaging ?
price($packaging, 0,
'', 1, -1, 2) :
'').
'">';
1787 print $langs->trans(
'PriceLabel');
1789 print
'<input name="price_label" maxlength="255" class="minwidth300 maxwidth400onsmartphone" value="'.$object->price_label.
'">';
1793 $parameters = array();
1794 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1801 print $form->buttonsSaveCancel();
1804 } elseif ($action ==
'edit_level_price' &&
$object->getRights()->creer) {
1805 print
'<!-- Edit price per level -->'.
"\n"; ?>
1808 var showHidePriceRules =
function () {
1809 var otherPrices = $(
'div.fiche form table tbody tr:not(:first)');
1810 var minPrice1 = $(
'div.fiche form input[name="price_min[1]"]');
1812 if (jQuery(
'input#usePriceRules').prop(
'checked')) {
1821 jQuery(document).ready(
function () {
1822 showHidePriceRules();
1824 jQuery(
'input#usePriceRules').click(showHidePriceRules);
1829 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
1830 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1831 print
'<input type="hidden" name="action" value="update_level_price">';
1832 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1837 print $langs->trans(
'UseMultipriceRules').
' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.(
$object->price_autogen ?
'checked' :
'').
'><br><br>';
1840 print
'<div class="div-table-responsive-no-min">';
1841 print
'<table class="noborder">';
1842 print
'<thead><tr class="liste_titre">';
1844 print
'<td>'.$langs->trans(
"PriceLevel").
'</td>';
1847 print
'<td style="text-align: center">'.$langs->trans(
"DefaultTaxRate").
'</td>';
1852 print
'<td class="center">'.$langs->trans(
"SellingPrice").
'</td>';
1854 print
'<td class="center">'.$langs->trans(
"MinPrice").
'</td>';
1861 $extrafields->fetch_name_optionals_label(
"product_price");
1862 if ($extrafields->attributes[
"product_price"] && array_key_exists(
'label', $extrafields->attributes[
"product_price"])) {
1863 $extralabels = $extrafields->attributes[
"product_price"][
'label'];
1864 if (!empty($extralabels)) {
1865 foreach ($extralabels as $key => $value) {
1867 if (!empty($extrafields->attributes[
"product_price"][
'list'][$key]) && $extrafields->attributes[
"product_price"][
'list'][$key] != 3) {
1868 if (!empty($extrafields->attributes[
"product_price"][
'langfile'][$key])) {
1869 $langs->load($extrafields->attributes[
"product_price"][
'langfile'][$key]);
1871 if (!empty($extrafields->attributes[
"product_price"][
'help'][$key])) {
1872 $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_price"][
'help'][$key]));
1874 $extratitle = $langs->trans($value);
1876 print
'<td style="text-align: right">'.$extratitle.
'</td>';
1881 print
'</tr></thead>';
1885 $produit_multiprices_limit =
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT');
1886 for ($i = 1; $i <= $produit_multiprices_limit; $i++) {
1887 print
'<tr class="oddeven">';
1889 $keyforlabel =
'PRODUIT_MULTIPRICES_LABEL'.$i;
1891 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
1897 print
'<input type="hidden" name="tva_tx['.$i.
']" value="'.(
$object->default_vat_code ?
$object->tva_tx.
' ('.
$object->default_vat_code.
')' :
$object->tva_tx).
'">';
1898 print
'<input type="hidden" name="tva_npr['.$i.
']" value="'.
$object->tva_npr.
'">';
1899 print
'<input type="hidden" name="localtax1_tx['.$i.
']" value="'.
$object->localtax1_tx.
'">';
1900 print
'<input type="hidden" name="localtax1_type['.$i.
']" value="'.
$object->localtax1_type.
'">';
1901 print
'<input type="hidden" name="localtax2_tx['.$i.
']" value="'.
$object->localtax2_tx.
'">';
1902 print
'<input type="hidden" name="localtax2_type['.$i.
']" value="'.
$object->localtax2_type.
'">';
1906 print
'<td style="text-align: center">';
1907 print $form->load_tva(
"tva_tx[".$i.
']',
$object->multiprices_tva_tx[$i],
$mysoc,
null,
$object->id, 0,
$object->type,
false, 1, 1);
1912 print
'<td style="text-align: center">';
1913 if (
$object->multiprices_base_type [$i] ==
'TTC') {
1914 print
'<input name="price['.$i.
']" size="10" value="'.
price(
$object->multiprices_ttc [$i]).
'">';
1916 print
'<input name="price['.$i.
']" size="10" value="'.
price(
$object->multiprices [$i]).
'">';
1918 print
' '.$form->selectPriceBaseType(
$object->multiprices_base_type [$i],
"multiprices_base_type[".$i.
"]");
1922 print
'<td style="text-align: center">';
1923 if (
$object->multiprices_base_type [$i] ==
'TTC') {
1924 print
'<input name="price_min['.$i.
']" size="10" value="'.
price(
$object->multiprices_min_ttc [$i]).
'">';
1926 print
'<input name="price_min['.$i.
']" size="10" value="'.
price(
$object->multiprices_min [$i]).
'">';
1929 print
'<td class="left">'.$langs->trans(
"MinimumRecommendedPrice",
price((
float) $maxpricesupplier, 0,
'', 1, -1, -1,
'auto')).
' '.
img_warning().
'</td>';
1933 if (!empty($extralabels)) {
1934 require_once DOL_DOCUMENT_ROOT .
'/core/class/genericobject.class.php';
1937 $genericObject->table_element =
'product_price';
1938 $sql1 =
"SELECT rowid";
1939 $sql1 .=
" FROM ".$object->db->prefix().
"product_price";
1940 $sql1 .=
" WHERE entity IN (".getEntity(
'productprice').
")";
1941 $sql1 .=
" AND price_level=".((int) $i);
1942 $sql1 .=
" AND fk_product = ".((int)
$object->id);
1943 $sql1 .=
" ORDER BY date_price DESC, rowid DESC";
1944 $sql1 .=
" LIMIT 1";
1945 $resql1 =
$object->db->query($sql1);
1946 if ($resql1 && $lineid =
$object->db->fetch_object($resql1)) {
1947 $genericObject->id = $lineid->rowid;
1948 $genericObject->fetch_optionals();
1950 foreach ($extralabels as $key => $value) {
1951 if (!empty($extrafields->attributes[
"product_price"][
'list'][$key]) && ($extrafields->attributes[
"product_price"][
'list'][$key] == 1 || $extrafields->attributes[
"product_price"][
'list'][$key] == 3 || ($action ==
"edit_level_price" && $extrafields->attributes[
"product_price"][
'list'][$key] == 4))) {
1952 if (!empty($extrafields->attributes[
"product_price"][
'langfile'][$key])) {
1953 $langs->load($extrafields->attributes[
"product_price"][
'langfile'][$key]);
1957 print
'<td align="center">';
1958 print $extrafields->showInputField($key, $genericObject->array_options[
'options_' . $key],
'', (
string) $i,
'',
'', $genericObject,
'product_price');
1974 print $form->buttonsSaveCancel();
1985 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
1986 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
1988 if (empty($page) || $page == -1) {
1991 $offset = $limit * $page;
1992 $pageprev = $page - 1;
1993 $pagenext = $page + 1;
1995 $sortorder =
"ASC,ASC";
1998 $sortfield =
"soc.nom,t.date_begin";
2002 $filter = array(
't.fk_product' => (
string)
$object->id);
2004 if (!empty($search_soc)) {
2005 $filter[
'soc.nom'] = (
string) $search_soc;
2008 if ($action ==
'add_customer_price') {
2010 $maxpricesupplier =
$object->min_recommended_price();
2012 print
'<!-- add_customer_price -->';
2015 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
2016 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2017 print
'<input type="hidden" name="action" value="add_customer_price_confirm">';
2018 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2020 print
'<div class="tabBar tabBarWithBottom">';
2022 print
'<table class="border centpercent">';
2024 print
'<td class="fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
2026 $filter =
'(s.client:IN:1,2,3)';
2027 print
img_picto(
'',
'company').$form->select_company(
GETPOSTINT(
'socid'),
'socid', $filter,
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300');
2032 print
'<tr><td>' . $langs->trans(
'RefCustomer') .
'</td>';
2033 print
'<td><input name="ref_customer" size="12"></td></tr>';
2037 print
'<tr><td>'.$langs->trans(
"AppliedPricesFrom").
'</td><td>';
2038 print $form->selectDate(!empty($date_begin) ? $date_begin :
dol_now(),
"date_begin", 0, 0, 1,
"date_begin");
2043 print
'<tr><td>'.$langs->trans(
"AppliedPricesTo").
'</td><td>';
2044 print $form->selectDate($date_end,
"date_end", 0, 0, 1,
"date_end");
2048 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
2053 print
'<tr><td class="fieldrequired">';
2054 print $langs->trans(
'PriceBase');
2057 print $form->selectPriceBaseType(
$object->price_base_type,
"price_base_type");
2062 print
'<tr><td class="fieldrequired">';
2063 $text = $langs->trans(
'SellingPrice');
2064 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
2066 if (
$object->price_base_type ==
'TTC') {
2067 print
'<input name="price" size="10" value="'.price(
$object->price_ttc).
'">';
2069 print
'<input name="price" size="10" value="'.price(
$object->price).
'">';
2075 $text = $langs->trans(
'MinPrice');
2076 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
2077 if (
$object->price_base_type ==
'TTC') {
2078 print
'<td><input name="price_min" size="10" value="'.price(
$object->price_min_ttc).
'">';
2080 print
'<td><input name="price_min" size="10" value="'.price(
$object->price_min).
'">';
2083 print
'<td class="left">'.$langs->trans(
"MinimumRecommendedPrice",
price($maxpricesupplier, 0,
'', 1, -1, -1,
'auto')).
' '.
img_warning().
'</td>';
2089 print $langs->trans(
'PriceLabel');
2091 print
'<input name="price_label" maxlength="255" class="minwidth300 maxwidth400onsmartphone" value="'.$object->price_label.
'">';
2097 print
'<tr><td>'.$langs->trans(
"Discount").
'</td><td>';
2098 print
'<input name="discount_percent" size="10" value="'.price($discount_percent).
'">';
2102 $extrafields->fetch_name_optionals_label(
"product_customer_price");
2103 $extralabels = !empty($extrafields->attributes[
"product_customer_price"][
'label']) ? $extrafields->attributes[
"product_customer_price"][
'label'] :
'';
2104 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_customer_price");
2105 if (!empty($extralabels)) {
2106 if (empty($prodcustprice->id)) {
2107 foreach ($extralabels as $key => $value) {
2108 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))) {
2109 if (!empty($extrafields->attributes[
"product_customer_price"][
'langfile'][$key])) {
2110 $langs->load($extrafields->attributes[
"product_customer_price"][
'langfile'][$key]);
2113 print
'<tr><td'.($extrafields->attributes[
"product_customer_price"][
'required'][$key] ?
' class="fieldrequired"' :
'').
'>';
2114 if (!empty($extrafields->attributes[
"product_customer_price"][
'help'][$key])) {
2115 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_customer_price"][
'help'][$key]));
2117 print $langs->trans($value);
2119 print
'</td><td>'.$extrafields->showInputField($key,
GETPOSTISSET(
'options_'.$key) ? $extrafield_values[
'options_'.$key] :
'',
'',
'',
'',
'', 0,
'product_customer_price').
'</td></tr>';
2130 print
'<div class="center">';
2133 print
'<div class="marginbottomonly">';
2134 print
'<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
2135 print
'<label for="updatechildprice">'.$langs->trans(
'ForceUpdateChildPriceSoc').
'</label>';
2138 print $form->buttonsSaveCancel();
2141 } elseif ($action ==
'edit_customer_price') {
2143 $maxpricesupplier =
$object->min_recommended_price();
2145 print
'<!-- edit_customer_price -->';
2148 $result = $prodcustprice->fetch(
GETPOSTINT(
'lineid'));
2153 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
2154 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2155 print
'<input type="hidden" name="action" value="update_customer_price_confirm">';
2156 print
'<input type="hidden" name="lineid" value="'.$prodcustprice->id.
'">';
2158 print
'<table class="liste centpercent">';
2160 print
'<td class="titlefield fieldrequired">'.$langs->trans(
'ThirdParty').
'</td>';
2162 $staticsoc->fetch($prodcustprice->fk_soc);
2163 print
"<td>".$staticsoc->getNomUrl(1).
"</td>";
2167 print
'<tr><td>' . $langs->trans(
'RefCustomer') .
'</td>';
2168 print
'<td><input name="ref_customer" size="12" value="' .
dol_escape_htmltag($prodcustprice->ref_customer) .
'"></td></tr>';
2171 print
'<tr><td>'.$langs->trans(
"AppliedPricesFrom").
'</td><td>';
2172 print $form->selectDate($prodcustprice->date_begin,
"date_begin", 0, 0, 1,
"date_begin");
2176 print
'<tr><td>'.$langs->trans(
"AppliedPricesTo").
'</td><td>';
2177 print $form->selectDate($prodcustprice->date_end,
"date_end", 0, 0, 1,
"date_end");
2181 print
'<tr><td class="fieldrequired">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
2182 print $form->load_tva(
"tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.
' ('.$prodcustprice->default_vat_code.
')' : $prodcustprice->tva_tx,
$mysoc, null,
$object->id, $prodcustprice->recuperableonly,
$object->
type, false, 1, 1);
2186 print
'<tr><td class="fieldrequired">';
2187 print $langs->trans(
'PriceBase');
2190 print $form->selectPriceBaseType($prodcustprice->price_base_type,
"price_base_type");
2195 print
'<tr><td class="fieldrequired">';
2196 $text = $langs->trans(
'SellingPrice');
2197 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
2199 if ($prodcustprice->price_base_type ==
'TTC') {
2200 print
'<input name="price" size="10" value="'.price($prodcustprice->price_ttc).
'">';
2202 print
'<input name="price" size="10" value="'.price($prodcustprice->price).
'">';
2208 $text = $langs->trans(
'MinPrice');
2209 print $form->textwithpicto($text, $langs->trans(
"PrecisionUnitIsLimitedToXDecimals",
getDolGlobalString(
'MAIN_MAX_DECIMALS_UNIT')), 1,
'help');
2211 if ($prodcustprice->price_base_type ==
'TTC') {
2212 print
'<input name="price_min" size="10" value="'.price($prodcustprice->price_min_ttc).
'">';
2214 print
'<input name="price_min" size="10" value="'.price($prodcustprice->price_min).
'">';
2218 print
'<td class="left">'.$langs->trans(
"MinimumRecommendedPrice",
price($maxpricesupplier, 0,
'', 1, -1, -1,
'auto')).
' '.
img_warning().
'</td>';
2224 print $langs->trans(
'PriceLabel');
2226 print
'<input name="price_label" maxlength="255" class="minwidth300 maxwidth400onsmartphone" value="'.$prodcustprice->price_label.
'">';
2231 print
'<tr><td>'.$langs->trans(
"Discount").
'</td><td>';
2232 print
'<input name="discount_percent" size="10" value="'.price($prodcustprice->discount_percent).
'">';
2236 $extrafields->fetch_name_optionals_label(
"product_customer_price");
2237 $extralabels = !empty($extrafields->attributes[
"product_customer_price"][
'label']) ? $extrafields->attributes[
"product_customer_price"][
'label'] :
'';
2238 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_customer_price");
2239 if (!empty($extralabels)) {
2241 foreach ($extralabels as $key => $value) {
2242 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_customer_price" && $extrafields->attributes[
"product_customer_price"][
'list'][$key] == 4))) {
2243 if (!empty($extrafields->attributes[
"product_customer_price"][
'langfile'][$key])) {
2244 $langs->load($extrafields->attributes[
"product_customer_price"][
'langfile'][$key]);
2247 print
'<tr><td'.($extrafields->attributes[
"product_customer_price"][
'required'][$key] ?
' class="fieldrequired"' :
'').
'>';
2248 if (!empty($extrafields->attributes[
"product_customer_price"][
'help'][$key])) {
2249 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_customer_price"][
'help'][$key]));
2251 print $langs->trans($value);
2253 print
'</td><td>'.$extrafields->showInputField($key,
GETPOSTISSET(
'options_'.$key) ? $extrafield_values[
'options_'.$key] :
'',
'',
'',
'',
'', 0,
'product_customer_price').
'</td></tr>';
2258 $sql .=
" fk_object";
2259 foreach ($extralabels as $key => $value) {
2260 $sql .=
", ".$db->sanitize($key);
2262 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_customer_price_extrafields";
2263 $sql .=
" WHERE fk_object = ".((int) $prodcustprice->id);
2264 $resql =
$db->query($sql);
2266 $obj =
$db->fetch_object($resql);
2267 foreach ($extralabels as $key => $value) {
2268 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_customer_price" && $extrafields->attributes[
"product_customer_price"][
'list'][$key] == 4))) {
2269 if (!empty($extrafields->attributes[
"product_customer_price"][
'langfile'][$key])) {
2270 $langs->load($extrafields->attributes[
"product_customer_price"][
'langfile'][$key]);
2273 print
'<tr><td'.($extrafields->attributes[
"product_customer_price"][
'required'][$key] ?
' class="fieldrequired"' :
'').
'>';
2274 if (!empty($extrafields->attributes[
"product_customer_price"][
'help'][$key])) {
2275 print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_customer_price"][
'help'][$key]));
2277 print $langs->trans($value);
2279 print
'</td><td>'.$extrafields->showInputField($key,
GETPOSTISSET(
'options_'.$key) ? $extrafield_values[
'options_'.$key] : $obj->{$key},
'',
'',
'',
'', 0,
'product_customer_price');
2291 print
'<div class="center">';
2292 print
'<div class="marginbottomonly">';
2293 print
'<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
2294 print
'<label for="updatechildprice">'.$langs->trans(
'ForceUpdateChildPriceSoc').
'</label>';
2297 print $form->buttonsSaveCancel();
2299 print
'<br></form>';
2300 } elseif ($action ==
'showlog_customer_price') {
2302 print
'<!-- list of all log of prices per customer -->'.
"\n";
2304 $sortfield =
't.datec';
2305 $filter = array(
't.fk_product' => (
string)
$object->id,
't.fk_soc' => (
string)
GETPOSTINT(
'socid'));
2308 $nbtotalofrecords =
'';
2310 $nbtotalofrecords = $prodcustprice->fetchAllLog($sortorder, $sortfield,
$conf->liste_limit, $offset, $filter);
2313 $result = $prodcustprice->fetchAllLog($sortorder, $sortfield,
$conf->liste_limit, $offset, $filter);
2318 $option =
'&socid='.GETPOSTINT(
'socid').
'&id='.
$object->id;
2323 $title = $langs->trans(
'PriceByCustomerLog');
2324 $title .=
' - '.$staticsoc->getNomUrl(1);
2326 $backbutton =
'<a class="justalink" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">'.$langs->trans(
"GoBack").
'</a>';
2329 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $option, $sortfield, $sortorder, $backbutton, count($prodcustprice->lines), $nbtotalofrecords,
'title_accountancy.png');
2331 if (count($prodcustprice->lines) > 0) {
2332 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
2333 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2334 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2336 print
'<div class="div-table-responsive-no-min">';
2337 print
'<table class="liste centpercent">';
2339 print
'<tr class="liste_titre">';
2340 print
'<td>'.$langs->trans(
"ThirdParty").
'</td>';
2341 print
'<td>'.$langs->trans(
'RefCustomer').
'</td>';
2342 print
'<td>'.$langs->trans(
"AppliedPricesFrom").
'</td>';
2343 print
'<td>'.$langs->trans(
"AppliedPricesTo").
'</td>';
2344 print
'<td class="center">'.$langs->trans(
"PriceBase").
'</td>';
2345 print
'<td class="right">'.$langs->trans(
"DefaultTaxRate").
'</td>';
2346 print
'<td class="right">'.$langs->trans(
"HT").
'</td>';
2347 print
'<td class="right">'.$langs->trans(
"TTC").
'</td>';
2348 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2349 print
'<td class="right">'.$langs->trans(
"INCT").
'</td>';
2351 print
'<td class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"HT").
'</td>';
2352 print
'<td class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"TTC").
'</td>';
2353 print
'<td class="right">'.$langs->trans(
"PriceLabel").
'</td>';
2354 print
'<td class="right">'.$langs->trans(
"Discount").
'</td>';
2355 print
'<td class="right">'.$langs->trans(
"ChangedBy").
'</td>';
2356 print
'<td>'.$langs->trans(
"DateCreation").
'</td>';
2359 foreach ($prodcustprice->lines as $line) {
2362 $staticsoc->fetch($line->fk_soc);
2364 $tva_tx = $line->default_vat_code ? $line->tva_tx.
' ('.$line->default_vat_code.
')' : $line->tva_tx;
2367 if ($line->price_base_type ==
'HT') {
2370 $pu = $line->price_ttc;
2374 $localtaxarray =
getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code ?
' ('.$line->default_vat_code.
')' :
''), 0, $staticsoc,
$mysoc);
2376 $resultarray =
calcul_price_total(1, $pu, 0, (
float) $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly,
$object->type,
$mysoc, $localtaxarray);
2378 $total_ht = $resultarray[0];
2379 $total_vat = $resultarray[1];
2380 $total_localtax1 = $resultarray[9];
2381 $total_localtax2 = $resultarray[10];
2382 $total_ttc = $resultarray[2];
2384 print
'<tr class="oddeven">';
2386 print
'<td class="tdoverflowmax125">'.$staticsoc->getNomUrl(1).
"</td>";
2387 print
'<td>'.$line->ref_customer.
'</td>';
2388 print
"<td>".dol_print_date($line->date_begin,
"day",
'tzuserrel').
"</td>";
2389 print
"<td>".dol_print_date($line->date_end,
"day",
'tzuserrel').
"</td>";
2390 print
'<td class="center">'.$langs->trans($line->price_base_type).
"</td>";
2391 print
'<td class="right nowraponall">';
2393 $positiverates =
'';
2395 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->tva_tx);
2398 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax1_tx);
2401 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax2_tx);
2403 if (empty($positiverates)) {
2404 $positiverates =
'0';
2407 echo
vatrate($positiverates.($line->default_vat_code ?
' ('.$line->default_vat_code.
')' :
''), true, ($line->tva_npr ? $line->tva_npr : $line->recuperableonly));
2411 print
'<td class="right"><span class="amount">'.price($line->price).
"</span></td>";
2413 print
'<td class="right"><span class="amount">'.price($line->price_ttc).
"</span></td>";
2414 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2415 print
'<td class="right">'.price($resultarray[2]).
'</td>';
2418 print
'<td class="right">'.price($line->price_min).
'</td>';
2419 print
'<td class="right">'.price($line->price_min_ttc).
'</td>';
2420 print
'<td class="right">'.dolPrintHTML($line->price_label).
'</td>';
2421 print
'<td class="right">'.price($line->discount_percent).
'</td>';
2424 print
'<td class="tdoverflowmax125">';
2426 if ($line->fk_user > 0) {
2428 $userstatic->fetch($line->fk_user);
2429 print $userstatic->getNomUrl(1,
'', 0, 0, 24, 0,
'login');
2433 print
"<td>".dol_print_date($line->datec,
"dayhour",
'tzuserrel').
"</td>";
2439 print $langs->trans(
'None');
2441 } elseif ($action !=
'showlog_default_price' && $action !=
'edit_price' && $action !=
'edit_level_price') {
2443 print
'<!-- list of all prices per customer -->'.
"\n";
2446 $nbtotalofrecords =
'';
2448 $nbtotalofrecords = $prodcustprice->fetchAll($sortorder, $sortfield, 0, 0, $filter);
2451 $result = $prodcustprice->fetchAll($sortorder, $sortfield,
$conf->liste_limit, $offset, $filter);
2456 $option =
'&search_soc='.$search_soc.
'&id='.
$object->id;
2459 print_barre_liste($langs->trans(
'PriceByCustomer'), $page, $_SERVER [
'PHP_SELF'], $option, $sortfield, $sortorder,
'', count($prodcustprice->lines), $nbtotalofrecords,
'title_accountancy.png');
2461 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
2462 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2463 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2465 print
'<!-- List of prices per customer -->'.
"\n";
2466 print
'<div class="div-table-responsive-no-min">'.
"\n";
2467 print
'<table class="liste centpercent">'.
"\n";
2469 if (count($prodcustprice->lines) > 0 || $search_soc) {
2470 $extrafields->fetch_name_optionals_label(
"product_customer_price");
2471 $custom_price_extralabels = !empty($extrafields->attributes[
"product_customer_price"][
'label']) ? $extrafields->attributes[
"product_customer_price"][
'label'] :
'';
2477 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2480 if (!empty($custom_price_extralabels) && is_array($custom_price_extralabels)) {
2481 $colspan += count($custom_price_extralabels);
2484 print
'<tr class="liste_titre">';
2485 print
'<td class="liste_titre"><input type="text" class="flat maxwidth125" name="search_soc" value="'.$search_soc.
'"></td>';
2486 print
'<td class="liste_titre" colspan="'.$colspan.
'"> </td>';
2488 print
'<td class="liste_titre maxwidthsearch">';
2489 $searchpicto = $form->showFilterAndCheckAddButtons(0);
2495 print
'<tr class="liste_titre">';
2496 print
'<td>'.$langs->trans(
"ThirdParty").
'</td>';
2497 print
'<td>'.$langs->trans(
'RefCustomer').
'</td>';
2498 print
'<td>'.$langs->trans(
"AppliedPricesFrom").
'</td>';
2499 print
'<td>'.$langs->trans(
"AppliedPricesTo").
'</td>';
2500 print
'<td class="center">'.$langs->trans(
"PriceBase").
'</td>';
2501 print
'<td class="right">'.$langs->trans(
"DefaultTaxRate").
'</td>';
2502 print
'<td class="right">'.$langs->trans(
"HT").
'</td>';
2503 print
'<td class="right">'.$langs->trans(
"TTC").
'</td>';
2504 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2505 print
'<td class="right">'.$langs->trans(
"INCT").
'</td>';
2507 print
'<td class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"HT").
'</td>';
2508 print
'<td class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"TTC").
'</td>';
2509 print
'<td class="right">'.$langs->trans(
"PriceLabel").
'</td>';
2510 print
'<td class="right">'.$langs->trans(
"Discount").
'</td>';
2512 $extrafields->fetch_name_optionals_label(
"product_customer_price");
2513 if ($extrafields->attributes[
"product_customer_price"] && array_key_exists(
'label', $extrafields->attributes[
"product_customer_price"])) {
2514 $extralabels = $extrafields->attributes[
"product_customer_price"][
'label'];
2515 if (!empty($extralabels)) {
2516 foreach ($extralabels as $key => $value) {
2518 if (!empty($extrafields->attributes[
"product_customer_price"][
'list'][$key]) && $extrafields->attributes[
"product_customer_price"][
'list'][$key] != 3) {
2519 if (!empty($extrafields->attributes[
"product_customer_price"][
'langfile'][$key])) {
2520 $langs->load($extrafields->attributes[
"product_customer_price"][
'langfile'][$key]);
2522 if (!empty($extrafields->attributes[
"product_customer_price"][
'help'][$key])) {
2523 $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_customer_price"][
'help'][$key]));
2525 $extratitle = $langs->trans($value);
2527 print
'<td style="text-align: right">'.$extratitle.
'</td>';
2532 print
'<td>'.$langs->trans(
"ChangedBy").
'</td>';
2537 if (
$object->price_base_type ==
'HT') {
2546 $resultarray =
calcul_price_total(1, $pu, 0,
$object->tva_tx, 1, 1, 0,
$object->price_base_type, 0,
$object->type,
$mysoc, $localtaxarray);
2548 $total_ht = $resultarray[0];
2549 $total_vat = $resultarray[1];
2550 $total_localtax1 = $resultarray[9];
2551 $total_localtax2 = $resultarray[10];
2552 $total_ttc = $resultarray[2];
2555 print
'<!-- PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES -->'.
"\n";
2556 print
'<tr class="oddeven">';
2557 print
'<td colspan="4">' . $langs->trans(
'Default') .
'</td>';
2559 print
'<td class="center">'.$langs->trans(
$object->price_base_type).
"</td>";
2562 print
'<td class="right nowraponall">';
2564 $positiverates =
'';
2569 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax1_tx);
2572 $positiverates .= ($positiverates ?
'/' :
'').
price2num(
$object->localtax2_tx);
2574 if (empty($positiverates)) {
2575 $positiverates =
'0';
2577 echo
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''), true,
$object->tva_npr);
2581 print
'<td class="right"><span class="amount">'.price(
$object->price).
"</span></td>";
2583 print
'<td class="right"><span class="amount">'.price(
$object->price_ttc).
"</span></td>";
2584 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2586 print
'<td class="right"><span class="amount">'.price($resultarray[2]).
'</span></td>';
2589 print
'<td class="right">'.price(
$object->price_min).
'</td>';
2590 print
'<td class="right">'.price(
$object->price_min_ttc).
'</td>';
2591 print
'<td class="right">'.dolPrintHTML(
$object->price_label).
'</td>';
2592 print
'<td class="right"></td>';
2593 print
'<td class="right"></td>';
2594 if (!empty($extralabels)) {
2595 foreach ($extralabels as $key) {
2597 if (!empty($extrafields->attributes[
"product_customer_price"][
'list'][$key]) && $extrafields->attributes[
"product_customer_price"][
'list'][$key] != 3) {
2598 print
'<td class="right"></td>';
2602 if ($user->hasRight(
'produit',
'supprimer') || $user->hasRight(
'service',
'supprimer')) {
2603 print
'<td class="nowraponall">';
2604 print
'<a class="marginleftonly marginrightonly" href="'.$_SERVER[
"PHP_SELF"].
'?action=showlog_default_price&token='.
newToken().
'&id='.
$object->id.
'">';
2605 print
img_info($langs->trans(
'PriceByCustomerLog'));
2608 print
'<a class="marginleftonly marginrightonly editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_price&token='.
newToken().
'&id='.
$object->id.
'">';
2609 print
img_edit(
'default', 0,
'style="vertical-align: middle;"');
2616 if (count($prodcustprice->lines) > 0) {
2617 foreach ($prodcustprice->lines as $line) {
2620 $staticsoc->fetch($line->fk_soc);
2622 $tva_tx = $line->default_vat_code ? $line->tva_tx.
' ('.$line->default_vat_code.
')' : $line->tva_tx;
2625 if ($line->price_base_type ==
'HT') {
2628 $pu = $line->price_ttc;
2632 $localtaxarray =
getLocalTaxesFromRate($line->tva_tx.($line->default_vat_code ?
' ('.$line->default_vat_code.
')' :
''), 0, $staticsoc,
$mysoc);
2634 $resultarray =
calcul_price_total(1, $pu, 0, (
float) $line->tva_tx, 1, 1, 0, $line->price_base_type, $line->recuperableonly,
$object->type,
$mysoc, $localtaxarray);
2636 $total_ht = $resultarray[0];
2637 $total_vat = $resultarray[1];
2638 $total_localtax1 = $resultarray[9];
2639 $total_localtax2 = $resultarray[10];
2640 $total_ttc = $resultarray[2];
2642 print
'<tr class="oddeven">';
2644 print
'<td class="tdoverflowmax125">'.$staticsoc->getNomUrl(1).
"</td>";
2645 print
'<td>'.dolPrintHTML($line->ref_customer).
'</td>';
2646 print
"<td>".dol_print_date($line->date_begin,
"day",
'tzuserrel').
"</td>";
2647 print
"<td>".dol_print_date($line->date_end,
"day",
'tzuserrel').
"</td>";
2648 print
'<td class="center">'.$langs->trans($line->price_base_type).
"</td>";
2650 print
'<td class="right nowraponall">';
2652 $positiverates =
'';
2654 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->tva_tx);
2657 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax1_tx);
2660 $positiverates .= ($positiverates ?
'/' :
'').
price2num($line->localtax2_tx);
2662 if (empty($positiverates)) {
2663 $positiverates =
'0';
2666 echo
vatrate($positiverates.($line->default_vat_code ?
' ('.$line->default_vat_code.
')' :
''), true, (!empty($line->tva_npr) ? $line->tva_npr : $line->recuperableonly));
2670 print
'<td class="right"><span class="amount">'.price($line->price).
"</span></td>";
2672 print
'<td class="right"><span class="amount">'.price($line->price_ttc).
"</span></td>";
2673 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2675 print
'<td class="right"><span class="amount">'.price($resultarray[2]).
'</span></td>';
2678 print
'<td class="right">'.price($line->price_min).
'</td>';
2679 print
'<td class="right">'.price($line->price_min_ttc).
'</td>';
2680 print
'<td class="right">'.dolPrintHTMLForAttribute($line->price_label).
'</td>';
2681 print
'<td class="right">'.price($line->discount_percent).
'</td>';
2684 $extrafields->fetch_name_optionals_label(
"product_customer_price");
2685 $extralabels = $extrafields->attributes[
"product_customer_price"][
'label'] ?? array();
2686 if (!empty($extralabels)) {
2688 $sql .=
" fk_object";
2689 foreach ($extralabels as $key => $value) {
2690 $sql .=
", ".$db->sanitize($key);
2692 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_customer_price_extrafields";
2693 $sql .=
" WHERE fk_object = ".((int) $line->id);
2694 $resql =
$db->query($sql);
2696 if (
$db->num_rows($resql) != 1) {
2697 foreach ($extralabels as $key => $value) {
2698 if (!empty($extrafields->attributes[
"product_customer_price"][
'list'][$key]) && $extrafields->attributes[
"product_customer_price"][
'list'][$key] != 3) {
2703 $obj =
$db->fetch_object($resql);
2704 foreach ($extralabels as $key => $value) {
2705 if (!empty($extrafields->attributes[
"product_customer_price"][
'list'][$key]) && $extrafields->attributes[
"product_customer_price"][
'list'][$key] != 3) {
2706 print
'<td align="right">'.$extrafields->showOutputField($key, $obj->{$key},
'',
'product_customer_price').
"</td>";
2715 print
'<td class="tdoverflowmax125">';
2716 if ($line->fk_user > 0) {
2718 $userstatic->fetch($line->fk_user);
2720 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 0,
'login');
2726 print
'<td class="right nowraponall">';
2727 if ($user->hasRight(
'produit',
'creer') || $user->hasRight(
'service',
'creer')) {
2728 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=showlog_customer_price&token='.
newToken().
'&id='.
$object->id.
'&socid='.$line->fk_soc.
'">';
2729 print
img_info($langs->trans(
'PriceByCustomerLog'));
2732 print
'<a class="marginleftonly editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_customer_price&token='.
newToken().
'&id='.
$object->id.
'&lineid='.$line->id.
'">';
2733 print
img_edit(
'default', 0,
'style="vertical-align: middle;"');
2737 if ($user->hasRight(
'produit',
'supprimer') || $user->hasRight(
'service',
'supprimer')) {
2738 print
'<a class="marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?action=ask_remove_customer_price&token='.
newToken().
'&id='.
$object->id.
'&lineid='.$line->id.
'">';
2739 print
img_delete(
'default',
'style="vertical-align: middle;"');
2757if ((!
getDolGlobalString(
'PRODUIT_CUSTOMER_PRICES') || $action ==
'showlog_default_price') && !in_array($action, array(
'edit_price',
'edit_level_price',
'edit_vat'))) {
2758 $sql =
"SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.recuperableonly, p.localtax1_tx, p.localtax1_type, p.localtax2_tx, p.localtax2_type,";
2759 $sql .=
" p.price_level, p.price_min, p.price_min_ttc,p.price_by_qty,";
2760 $sql .=
" p.date_price as dp, p.fk_price_expression, u.rowid as user_id, u.login";
2761 $sql .=
" ,p.price_label";
2762 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_price as p,";
2763 $sql .=
" ".MAIN_DB_PREFIX.
"user as u";
2764 $sql .=
" WHERE fk_product = ".((int)
$object->id);
2765 $sql .=
" AND p.entity IN (".getEntity(
'productprice').
")";
2766 $sql .=
" AND p.fk_user_author = u.rowid";
2768 $sql .=
" AND p.price_level = ".((int) $soc->price_level);
2770 $sql .=
" ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
2774 $result =
$db->query($sql);
2776 print
'<div class="divlogofpreviouscustomerprice">';
2778 $num =
$db->num_rows($result);
2787 $ret =
$object->updatePrice((
$object->multiprices_base_type[1] ==
'TTC' ?
$object->multiprices_ttc[1] :
$object->multiprices[1]),
$object->multiprices_base_type[1], $user, (empty(
$object->multiprices_tva_tx[1]) ? 0 :
$object->multiprices_tva_tx[1]), (
$object->multiprices_base_type[1] ==
'TTC' ?
$object->multiprices_min_ttc[1] :
$object->multiprices_min[1]), 1, 0, 0, 0, array(),
$object->default_vat_code);
2789 $ret =
$object->updatePrice((
$object->price_base_type ==
'TTC' ?
$object->price_ttc :
$object->
price),
$object->price_base_type, $user,
$object->tva_tx, (
$object->price_base_type ==
'TTC' ?
$object->price_min_ttc :
$object->price_min), 0,
$object->tva_npr, 0, 0, array(),
$object->default_vat_code);
2795 $result =
$db->query($sql);
2796 $num =
$db->num_rows($result);
2803 $backbutton =
'<a class="justalink" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">'.$langs->trans(
"GoBack").
'</a>';
2807 print_barre_liste($langs->trans(
"DefaultPriceLog"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'', $backbutton, 0, $num,
'title_accountancy.png');
2810 print_barre_liste($langs->trans(
"PriceByCustomerLog"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, $num,
'title_accountancy.png');
2813 print
'<!-- List of log prices -->'.
"\n";
2814 print
'<div class="div-table-responsive">'.
"\n";
2815 print
'<table class="liste centpercent noborder">'.
"\n";
2817 print
'<tr class="liste_titre">';
2818 print
'<th>'.$langs->trans(
"AppliedPricesFrom").
'</tg>';
2821 print
'<th class="center">'.$langs->trans(
"PriceLevel").
'</th>';
2824 print
'<th class="center">'.$langs->trans(
"Type").
'</th>';
2827 print
'<th class="center">'.$langs->trans(
"PriceBase").
'</th>';
2829 print
'<th class="right">'.$langs->trans(
"DefaultTaxRate").
'</th>';
2831 print
'<th class="right">'.$langs->trans(
"HT").
'</th>';
2832 print
'<th class="right">'.$langs->trans(
"TTC").
'</th>';
2833 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2834 print
'<th class="right">'.$langs->trans(
"INCT").
'</th>';
2837 print
'<th class="right">'.$langs->trans(
"PriceExpressionSelected").
'</th>';
2839 print
'<th class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"HT").
'</th>';
2840 print
'<th class="right">'.$langs->trans(
"MinPrice").
' '.$langs->trans(
"TTC").
'</th>';
2841 print
'<th class="right">'.$langs->trans(
"Label").
'</th>';
2842 print
'<th>'.$langs->trans(
"ChangedBy").
'</th>';
2843 if ($user->hasRight(
'produit',
'supprimer')) {
2844 print
'<th class="right"> </th>';
2848 $notfirstlineforlevel = array();
2852 $objp =
$db->fetch_object($result);
2854 print
'<tr class="oddeven">';
2856 print
"<td>".dol_print_date(
$db->jdate($objp->dp),
"dayhour",
'tzuserrel').
"</td>";
2860 print
'<td class="center">'.$objp->price_level.
"</td>";
2864 $type = ($objp->price_by_qty == 1) ?
'PriceByQuantity' :
'Standard';
2865 print
'<td class="center">'.$langs->trans($type).
"</td>";
2868 print
'<td class="center">';
2869 if (empty($objp->price_by_qty)) {
2870 print $langs->trans($objp->price_base_type);
2875 print
'<td class="right">';
2877 if (empty($objp->price_by_qty)) {
2878 $positiverates =
'';
2880 $positiverates .= ($positiverates ?
'/' :
'').
price2num($objp->tva_tx);
2883 $positiverates .= ($positiverates ?
'/' :
'').
price2num($objp->localtax1_tx);
2886 $positiverates .= ($positiverates ?
'/' :
'').
price2num($objp->localtax2_tx);
2888 if (empty($positiverates)) {
2889 $positiverates =
'0';
2891 echo
vatrate($positiverates.($objp->default_vat_code ?
' ('.$objp->default_vat_code.
')' :
''), true, !empty($objp->tva_npr) ? $objp->tva_npr : 0);
2904 if ($objp->price_base_type ==
'HT') {
2907 $pu = $objp->price_ttc;
2913 $resultarray =
calcul_price_total(1, $pu, 0, $objp->tva_tx, 1, 1, 0, $objp->price_base_type, $objp->recuperableonly,
$object->type,
$mysoc, $localtaxarray);
2915 $total_ht = $resultarray[0];
2916 $total_vat = $resultarray[1];
2917 $total_localtax1 = $resultarray[9];
2918 $total_localtax2 = $resultarray[10];
2919 $total_ttc = $resultarray[2];
2922 if (!empty($objp->fk_price_expression) && !empty(
$conf->dynamicprices->enabled)) {
2924 $res = $price_expression->fetch($objp->fk_price_expression);
2925 $title = $price_expression->title;
2926 print
'<td class="right"></td>';
2927 print
'<td class="right"></td>';
2928 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2929 print
'<td class="right"></td>';
2931 print
'<td class="right">'.$title.
"</td>";
2934 print
'<td class="right">';
2935 if (empty($objp->price_by_qty)) {
2936 print
'<span class="amount">'.price($objp->price).
'</span>';
2940 print
'<td class="right">';
2941 if (empty($objp->price_by_qty)) {
2942 $price_ttc = $objp->price_ttc;
2943 print
'<span class="amount">'.price($price_ttc).
'<span>';
2946 if (
$mysoc->localtax1_assuj ==
"1" ||
$mysoc->localtax2_assuj ==
"1") {
2947 print
'<td class="right">';
2948 print $resultarray[2];
2952 print
'<td class="right"></td>';
2957 print
'<td class="right">';
2958 if (empty($objp->price_by_qty)) {
2959 print
price($objp->price_min);
2964 print
'<td class="right">';
2965 if (empty($objp->price_by_qty)) {
2966 $price_min_ttc = $objp->price_min_ttc;
2967 print
price($price_min_ttc);
2977 print
'<td class="tdoverflowmax125">';
2978 if ($objp->user_id > 0) {
2981 $userstatic->fetch($objp->user_id);
2982 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 0,
'login');
2987 if ($user->hasRight(
'produit',
'supprimer')) {
2990 if (empty($notfirstlineforlevel[$objp->price_level])) {
2991 $notfirstlineforlevel[$objp->price_level] = 1;
2999 print
'<td class="right">';
3000 if ($candelete || (
$db->jdate($objp->dp) >=
dol_now())) {
3001 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id.
'&lineid='.$objp->rowid.
'">';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class of a generic business object.
Class for accessing price expression table.
Class to parse product price expressions.
File of class to manage predefined price products or services by customer.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
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.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
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_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
get_localtax($vatrate, $local, $thirdparty_buyer=null, $thirdparty_seller=null, $vatnpr=0)
Return localtax rate for a particular VAT rate, when selling a product with vat $vatrate,...
img_info($titlealt='default')
Show info logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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
calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $notused, $price_base_type, $info_bits, $type, $seller=null, $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='')
Calculate totals (net, vat, ...) of a line.
product_prepare_head($object)
Prepare array with list of tabs.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.