35 require
'../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_expression.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_parser.class.php';
43 if (!empty($conf->barcode->enabled))
dol_include_once(
'/core/class/html.formbarcode.class.php');
45 $langs->loadLangs(array(
'products',
'suppliers',
'bills',
'margins',
'stocks'));
49 $rowid =
GETPOST(
'rowid',
'int');
50 $action =
GETPOST(
'action',
'aZ09');
51 $cancel =
GETPOST(
'cancel',
'alpha');
52 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'pricesuppliercard';
54 $socid =
GETPOST(
'socid',
'int');
55 $cost_price =
GETPOST(
'cost_price',
'alpha');
56 $backtopage =
GETPOST(
'backtopage',
'alpha');
62 if (!empty($_REQUEST[
'search_fourn_id']))
64 $_GET[
'id_fourn'] = $_GET[
'search_fourn_id'];
65 $_POST[
'id_fourn'] = $_POST[
'search_fourn_id'];
66 $_REQUEST[
'id_fourn'] = $_REQUEST[
'search_fourn_id'];
70 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref :
''));
71 $fieldtype = (!empty($ref) ?
'ref' :
'rowid');
72 if ($user->socid) $socid = $user->socid;
73 $result =
restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
77 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
78 $sortfield =
GETPOST(
"sortfield",
'alpha');
79 $sortorder =
GETPOST(
"sortorder",
'alpha');
81 if (empty($page) || $page == -1) { $page = 0; }
82 $offset = $limit * $page;
83 $pageprev = $page - 1;
84 $pagenext = $page + 1;
85 if (!$sortfield) $sortfield =
"s.nom";
86 if (!$sortorder) $sortorder =
"ASC";
89 $hookmanager->initHooks(array(
'pricesuppliercard',
'globalcard'));
94 $object->fetch($id, $ref);
97 $sortfield =
GETPOST(
"sortfield",
'alpha');
98 $sortorder =
GETPOST(
"sortorder",
'alpha');
100 if (!$sortfield) $sortfield =
"s.nom";
101 if (!$sortorder) $sortorder =
"ASC";
108 if ($cancel) $action =
'';
113 $parameters = array(
'socid'=>$socid,
'id_prod'=>$id);
114 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
115 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
119 if ($action ==
'setcost_price')
123 $result = $object->fetch($id);
124 $object->cost_price =
price2num($cost_price);
125 $result = $object->update($object->id, $user);
137 if ($action ==
'confirm_remove_pf')
142 $result = $object->remove_product_fournisseur_price($rowid);
144 $db->query(
"DELETE FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields WHERE fk_object = $rowid");
153 if ($action ==
'save_price')
155 $id_fourn =
GETPOST(
"id_fourn");
156 if (empty($id_fourn)) $id_fourn =
GETPOST(
"search_id_fourn");
157 $ref_fourn =
GETPOST(
"ref_fourn");
158 if (empty($ref_fourn)) $ref_fourn =
GETPOST(
"search_ref_fourn");
159 $ref_fourn_old =
GETPOST(
"ref_fourn_old");
160 if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn;
164 $npr = preg_match(
'/\*/', $_POST[
'tva_tx']) ? 1 : 0;
165 $tva_tx = str_replace(
'*',
'',
GETPOST(
'tva_tx',
'alpha'));
166 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
170 $price_expression =
GETPOST(
'eid',
'int') ?
GETPOST(
'eid',
'int') :
'';
171 $delivery_time_days =
GETPOST(
'delivery_time_days',
'int') ?
GETPOST(
'delivery_time_days',
'int') :
'';
172 $supplier_reputation =
GETPOST(
'supplier_reputation');
173 $supplier_description =
GETPOST(
'supplier_description',
'restricthtml');
174 $barcode =
GETPOST(
'barcode',
'alpha');
175 $fk_barcode_type =
GETPOST(
'fk_barcode_type',
'int');
181 $langs->load(
"errors");
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"VATRateForSupplierProduct")), null,
'errors');
184 if (!is_numeric($tva_tx))
187 $langs->load(
"errors");
188 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"VATRateForSupplierProduct")), null,
'errors');
190 if (empty($quantity))
193 $langs->load(
"errors");
194 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Qty")), null,
'errors');
196 if (empty($ref_fourn))
199 $langs->load(
"errors");
200 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"RefSupplier")), null,
'errors');
205 $langs->load(
"errors");
206 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Supplier")), null,
'errors');
208 if (
price2num($_POST[
"price"]) < 0 || $_POST[
"price"] ==
'')
210 if ($price_expression ===
'')
213 $langs->load(
"errors");
214 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Price")), null,
'errors');
219 if (!empty($conf->multicurrency->enabled)) {
220 if (empty($_POST[
"multicurrency_code"])) {
222 $langs->load(
"errors");
223 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Currency")), null,
'errors');
225 if (
price2num($_POST[
"multicurrency_tx"]) <= 0 || $_POST[
"multicurrency_tx"] ==
'') {
227 $langs->load(
"errors");
228 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"CurrencyRate")), null,
'errors');
230 if (
price2num($_POST[
"multicurrency_price"]) < 0 || $_POST[
"multicurrency_price"] ==
'') {
232 $langs->load(
"errors");
233 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"PriceCurrency")), null,
'errors');
243 $ret = $object->add_fournisseur($user, $id_fourn, $ref_fourn_old, $quantity);
248 $object->fetch($object->product_id_already_linked);
249 $productLink = $object->getNomUrl(1,
'supplier');
251 setEventMessages($langs->trans(
"ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null,
'errors');
262 $result = $supplier->fetch($id_fourn);
264 $object->fetch_product_fournisseur_price(
GETPOST(
'ref_fourn_price_id',
'int'));
267 $extralabels = $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
268 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_fournisseur_price");
269 if (!empty($extrafield_values)) {
270 $resql = $db->query(
"SELECT fk_object FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields WHERE fk_object = ".$object->product_fourn_price_id);
272 if ($db->num_rows(
$resql) != 1) {
273 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields (fk_object, ";
274 foreach ($extrafield_values as $key => $value) {
275 $sql .= str_replace(
'options_',
'', $key).
', ';
277 $sql = substr($sql, 0, strlen($sql) - 2).
") VALUES (".$object->product_fourn_price_id.
", ";
278 foreach ($extrafield_values as $key => $value) {
279 $sql .=
'"'.$value.
'", ';
281 $sql = substr($sql, 0, strlen($sql) - 2).
')';
284 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields SET ";
285 foreach ($extrafield_values as $key => $value) {
286 $sql .= str_replace(
'options_',
'', $key).
' = "'.$value.
'", ';
288 $sql = substr($sql, 0, strlen($sql) - 2).
' WHERE fk_object = '.$object->product_fourn_price_id;
297 if (empty($packaging)) $packaging = 1;
298 if ($packaging < $quantity) $packaging = $quantity;
299 $object->packaging = $packaging;
301 if (!empty($conf->multicurrency->enabled))
305 $multicurrency_code =
GETPOST(
"multicurrency_code",
'alpha');
307 $ret = $object->update_buyprice($quantity, $newprice, $user,
GETPOST(
"price_base_type"), $supplier,
GETPOST(
"oselDispo"), $ref_fourn, $tva_tx,
GETPOST(
"charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(),
'', $multicurrency_price,
GETPOST(
"multicurrency_price_base_type"), $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type);
309 $ret = $object->update_buyprice($quantity, $newprice, $user,
GETPOST(
"price_base_type"), $supplier,
GETPOST(
"oselDispo"), $ref_fourn, $tva_tx,
GETPOST(
"charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(),
'', 0,
'HT', 1,
'', $supplier_description, $barcode, $fk_barcode_type);
316 if (!empty($conf->dynamicprices->enabled) && $price_expression !==
'')
320 $object->fk_supplier_price_expression = $price_expression;
321 $price_result = $priceparser->parseProductSupplier($object);
322 if ($price_result < 0) {
327 if (!$error && !empty($conf->dynamicprices->enabled))
330 $ret = $object->setSupplierPriceExpression($price_expression);
348 $action =
'add_price';
358 $title = $langs->trans(
'ProductServiceCard');
360 $shortlabel =
dol_trunc($object->label, 16);
363 $title = $langs->trans(
'Product').
" ".$shortlabel.
" - ".$langs->trans(
'BuyingPrices');
364 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
368 $title = $langs->trans(
'Service').
" ".$shortlabel.
" - ".$langs->trans(
'BuyingPrices');
369 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
372 llxHeader(
'', $title, $helpurl,
'', 0, 0,
'',
'',
'',
'classforhorizontalscrolloftabs');
374 $form =
new Form($db);
380 if ($action ==
'ask_remove_pf') {
381 $form =
new Form($db);
382 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&rowid='.$rowid, $langs->trans(
'DeleteProductBuyPrice'), $langs->trans(
'ConfirmDeleteProductBuyPrice'),
'confirm_remove_pf',
'', 0, 1);
386 if ($action <>
'edit' && $action <>
're-edit')
389 $titre = $langs->trans(
"CardProduct".$object->type);
394 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
395 $object->next_prev_filter =
" fk_product_type = ".$object->type;
398 if ($user->socid && !in_array(
'product', explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
402 print '<div class="fichecenter">';
404 print '<div class="underbanner clearboth"></div>';
405 print '<table class="border tableforfield centpercent">';
409 $textdesc = $langs->trans(
"CostPriceDescription");
410 $textdesc .=
"<br>".$langs->trans(
"CostPriceUsage");
411 $text = $form->textwithpicto($langs->trans(
"CostPrice"), $textdesc, 1,
'help',
'');
412 print $form->editfieldkey($text,
'cost_price', $object->cost_price, $object, $usercancreate,
'amount:6');
413 print '</td><td colspan="2">';
414 print $form->editfieldval($text,
'cost_price', $object->cost_price, $object, $usercancreate,
'amount:6');
418 print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"AverageUnitPricePMPShort"), $langs->trans(
"AverageUnitPricePMPDesc")).
'</td>';
420 if ($object->pmp > 0)
print price($object->pmp).
' '.$langs->trans(
"HT");
425 print '<tr><td class="titlefieldcreate">'.$langs->trans(
"BuyingPriceMin").
'</td>';
426 print '<td colspan="2">';
428 if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0)
430 if ($product_fourn->product_fourn_price_id > 0)
print $product_fourn->display_price_product_fournisseur();
431 else print $langs->trans(
"NotDefined");
438 print '<div style="clear:both"></div>';
444 if (($action ==
'add_price' || $action ==
'update_price') && $usercancreate)
446 $langs->load(
"suppliers");
450 $object->fetch_product_fournisseur_price($rowid, 1);
456 print '<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" method="POST">';
457 print '<input type="hidden" name="token" value="'.newToken().
'">';
458 print '<input type="hidden" name="action" value="save_price">';
462 print '<table class="border centpercent">';
465 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Supplier").
'</td><td>';
469 $supplier->fetch($socid);
470 print $supplier->getNomUrl(1);
471 print '<input type="hidden" name="id_fourn" value="'.$socid.
'">';
472 print '<input type="hidden" name="ref_fourn_price_id" value="'.$rowid.
'">';
473 print '<input type="hidden" name="rowid" value="'.$rowid.
'">';
474 print '<input type="hidden" name="socid" value="'.$socid.
'">';
477 $events[] = array(
'method' =>
'getVatRates',
'url' =>
dol_buildpath(
'/core/ajax/vatrates.php', 1),
'htmlname' =>
'tva_tx',
'params' => array());
478 print $form->select_company(
GETPOST(
"id_fourn",
'alpha'),
'id_fourn',
'fournisseur=1',
'SelectThirdParty', 0, 0, $events);
480 $parameters = array(
'filtre'=>
"fournisseur=1",
'html_name'=>
'id_fourn',
'selected'=>
GETPOST(
"id_fourn"),
'showempty'=>1,
'prod_id'=>$object->id);
481 $reshook = $hookmanager->executeHooks(
'formCreateThirdpartyOptions', $parameters, $object, $action);
484 if (empty($form->result))
486 print ' - <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&type=f&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action='.$action).
'">'.$langs->trans(
"CreateDolibarrThirdPartySupplier").
'</a>';
493 print '<tr><td class="fieldrequired">'.$langs->trans(
"SupplierRef").
'</td><td>';
496 print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.
'">';
497 print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.$object->ref_supplier.
'">';
499 print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.(GETPOST(
"ref_fourn") ?
GETPOST(
"ref_fourn") :
'').
'">';
505 if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY))
507 $langs->load(
"propal");
508 print '<tr><td>'.$langs->trans(
"Availability").
'</td><td>';
509 $form->selectAvailabilityDelay($object->fk_availability,
"oselDispo", 1);
510 print '</td></tr>'.
"\n";
515 print '<td class="fieldrequired">'.$langs->trans(
"QtyMin").
'</td>';
520 print '<input type="hidden" name="qty" value="'.$object->fourn_qty.
'">';
521 print $object->fourn_qty;
523 print '<input class="flat" name="qty" size="5" value="'.$quantity.
'">';
526 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
527 $unit = $object->getLabelOfUnit();
529 print ' '.$langs->trans($unit);
534 if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
538 print '<td class="fieldrequired">'.$form->textwithpicto($langs->trans(
"PackagingForThisProduct"), $langs->trans(
"PackagingForThisProductDesc")).
'</td>';
541 print '<input class="flat" name="packaging" size="5" value="'.$packaging.
'">';
544 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
545 $unit = $object->getLabelOfUnit();
547 print ' '.$langs->trans($unit);
556 $mysoc2 = clone $mysoc;
557 $mysoc2->name =
'Fictive seller with same country';
558 $mysoc2->tva_assuj = 1;
561 if (empty($default_vat)) $default_npr = $default_vat;
563 print '<tr><td class="fieldrequired">'.$langs->trans(
"VATRateForSupplierProduct").
'</td>';
569 $tmpproductsupplier->fetch_product_fournisseur_price($rowid, 1);
570 $default_vat = $tmpproductsupplier->fourn_tva_tx;
571 $default_npr = $tmpproductsupplier->fourn_tva_npr;
573 if (empty($default_vat))
575 $default_vat = $object->tva_tx;
579 $vattosuggest = preg_replace(
'/\s*\(.*\)$/',
'', $vattosuggest);
580 print '<input type="text" class="flat" size="5" name="tva_tx" value="'.$vattosuggest.
'">';
583 if (!empty($conf->dynamicprices->enabled))
586 print '<tr><td class="fieldrequired">'.$langs->trans(
"PriceMode").
'</td><td>';
588 $price_expression_list = array(0 => $langs->trans(
"PriceNumeric"));
589 foreach ($price_expression->list_price_expression() as $entry) {
590 $price_expression_list[$entry->id] = $entry->title;
592 $price_expression_preselection =
GETPOST(
'eid') ?
GETPOST(
'eid') : ($object->fk_supplier_price_expression ? $object->fk_supplier_price_expression :
'0');
593 print $form->selectarray(
'eid', $price_expression_list, $price_expression_preselection);
594 print ' <div id="expression_editor" class="button">'.$langs->trans(
"PriceExpressionEditor").
'</div>';
597 print '<script type="text/javascript">
598 jQuery(document).ready(run);
600 jQuery("#expression_editor").click(on_click);
601 jQuery("#eid").change(on_change);
604 function on_click() {
605 window.location = "'.DOL_URL_ROOT.
'/product/dynamic_price/editor.php?id='.$id.
'&tab=fournisseurs&eid=" + $("#eid").val();
607 function on_change() {
608 if ($("#eid").val() == 0) {
609 jQuery("#price_numeric").show();
611 jQuery("#price_numeric").hide();
617 if (!empty($conf->multicurrency->enabled)) {
619 print '<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
621 $currencycodetouse =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code :
'');
622 if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) $currencycodetouse = $conf->currency;
623 print $form->selectMultiCurrency($currencycodetouse,
"multicurrency_code", 1);
624 print ' '.$langs->trans(
"CurrencyRate").
' ';
625 print '<input class="flat" name="multicurrency_tx" size="4" value="'.vatrate(
GETPOST(
'multicurrency_tx') ?
GETPOST(
'multicurrency_tx') : (isset($object->fourn_multicurrency_tx) ? $object->fourn_multicurrency_tx :
'')).
'">';
630 print '<tr><td class="fieldrequired">'.$langs->trans(
"PriceQtyMinCurrency").
'</td>';
631 $pricesupplierincurrencytouse = (
GETPOST(
'multicurrency_price') ?
GETPOST(
'multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price :
''));
632 print '<td><input class="flat" name="multicurrency_price" size="8" value="'.price($pricesupplierincurrencytouse).
'">';
634 print $form->selectPriceBaseType((
GETPOST(
'multicurrency_price_base_type') ?
GETPOST(
'multicurrency_price_base_type') :
'HT'),
"multicurrency_price_base_type");
638 print '<tr><td class="fieldrequired">'.$langs->trans(
"PriceQtyMin").
'</td>';
639 print '<td><input class="flat" name="disabled_price" size="8" value="">';
640 print '<input type="hidden" name="price" value="">';
641 print '<input type="hidden" name="price_base_type" value="">';
643 print $form->selectPriceBaseType(
'',
"disabled_price_base_type");
646 $currencies = array();
647 $sql =
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'multicurrency WHERE entity = '.$conf->entity;
648 $resql = $db->query($sql);
651 while ($obj = $db->fetch_object(
$resql)) {
652 $currency->fetch($obj->rowid);
653 $currencies[$currency->code] = $currency->rate->rate;
656 $currencies = json_encode($currencies);
659 <script
type=
"text/javascript">
660 function update_price_from_multicurrency() {
661 var multicurrency_price = $(
'input[name="multicurrency_price"]').val();
662 var multicurrency_tx = $(
'input[name="multicurrency_tx"]').val();
663 $(
'input[name="price"]').val(multicurrency_price / multicurrency_tx);
664 $(
'input[name="disabled_price"]').val(multicurrency_price / multicurrency_tx);
666 jQuery(document).ready(
function () {
667 $(
'input[name="disabled_price"]').prop(
'disabled',
true);
668 $(
'select[name="disabled_price_base_type"]').prop(
'disabled',
true);
669 update_price_from_multicurrency();
671 $(
'input[name="multicurrency_price"]').keyup(
function () {
672 update_price_from_multicurrency();
673 }).change(
function () {
674 update_price_from_multicurrency();
675 }).on(
'paste',
function () {
676 update_price_from_multicurrency();
679 $(
'input[name="multicurrency_tx"]').keyup(
function () {
680 update_price_from_multicurrency();
681 }).change(
function () {
682 update_price_from_multicurrency();
683 }).on(
'paste',
function () {
684 update_price_from_multicurrency();
687 $(
'select[name="multicurrency_price_base_type"]').change(
function () {
688 $(
'input[name="price_base_type"]').val($(
this).val());
689 $(
'select[name="disabled_price_base_type"]').val($(
this).val());
692 var currencies_array = $currencies;
693 $(
'select[name="multicurrency_code"]').change(
function () {
694 $(
'input[name="multicurrency_tx"]').val(currencies_array[$(
this).val()]);
701 print '<tr><td class="fieldrequired">'.$langs->trans(
"PriceQtyMin").
'</td>';
702 print '<td><input class="flat" name="price" size="8" value="'.(GETPOST(
'price') ?
price(
GETPOST(
'price')) : (isset($object->fourn_price) ?
price($object->fourn_price) :
'')).
'">';
704 print $form->selectPriceBaseType((
GETPOST(
'price_base_type') ?
GETPOST(
'price_base_type') :
'HT'),
"price_base_type");
710 print '<tr><td>'.$langs->trans(
"DiscountQtyMin").
'</td>';
711 print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOST(
'remise_percent') ?
vatrate(
GETPOST(
'remise_percent')) : (isset($object->fourn_remise_percent) ?
vatrate($object->fourn_remise_percent) :
'')).
'"> %';
717 print '<td>'.$langs->trans(
'NbDaysToDelivery').
'</td>';
718 print '<td><input class="flat" name="delivery_time_days" size="4" value="'.($rowid ? $object->delivery_time_days :
'').
'"> '.$langs->trans(
'days').
'</td>';
722 print '<tr><td>'.$langs->trans(
"ReferenceReputation").
'</td><td>';
723 echo $form->selectarray(
'supplier_reputation', $object->reputations, $supplier_reputation ? $supplier_reputation : $object->supplier_reputation);
727 if (!empty($conf->barcode->enabled))
731 print '<td>'.$langs->trans(
'BarcodeValue').
'</td>';
732 print '<td>'.img_picto(
'',
'barcode',
'class="pictofixedwidth"').
'<input class="flat" name="barcode" value="'.($rowid ? $object->supplier_barcode :
'').
'"></td>';
738 print '<td>'.$langs->trans(
'BarcodeType').
'</td>';
740 print $formbarcode->selectBarcodeType(($rowid ? $object->supplier_fk_barcode_type : $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE),
'fk_barcode_type', 1);
746 if ($conf->global->PRODUCT_CHARGES)
748 if (!empty($conf->margin->enabled))
751 print '<td>'.$langs->trans(
"Charges").
'</td>';
752 print '<td><input class="flat" name="charges" size="8" value="'.(GETPOST(
'charges') ?
price(
GETPOST(
'charges')) : (isset($object->fourn_charges) ?
price($object->fourn_charges) :
'')).
'">';
759 if (!empty($conf->global->PRODUIT_FOURN_TEXTS))
762 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
765 print '<td>'.$langs->trans(
'ProductSupplierDescription').
'</td>';
768 $doleditor =
new DolEditor(
'supplier_description', $object->desc_supplier,
'', 160,
'dolibarr_details',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4,
'90%');
769 $doleditor->Create();
776 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
777 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
778 $extrafield_values = $extrafields->getOptionalsFromPost(
"product_fournisseur_price");
779 if (!empty($extralabels)) {
781 foreach ($extralabels as $key => $value) {
782 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && ($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 1 || $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 3 || ($action ==
"update_price" && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 4))) {
783 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key])) $langs->load($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key]);
785 print '<tr><td'.($extrafields->attributes[
"product_fournisseur_price"][
'required'][$key] ?
' class="fieldrequired"' :
'').
'>';
786 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]))
print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]));
787 else print $langs->trans($value);
788 print '</td><td>'.$extrafields->showInputField($key,
GETPOSTISSET(
'options_'.$key) ? $extrafield_values[
'options_'.$key] :
'',
'',
'',
'',
'', 0,
'product_fournisseur_price').
'</td></tr>';
793 $sql .=
" fk_object";
794 foreach ($extralabels as $key => $value) {
797 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields";
798 $sql .=
" WHERE fk_object = ".$rowid;
799 $resql = $db->query($sql);
801 $obj = $db->fetch_object(
$resql);
802 foreach ($extralabels as $key => $value) {
803 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && ($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 1 || $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 3 || ($action ==
"update_price" && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] == 4))) {
804 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key])) $langs->load($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key]);
806 print '<tr><td'.($extrafields->attributes[
"product_fournisseur_price"][
'required'][$key] ?
' class="fieldrequired"' :
'').
'>';
807 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]))
print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]));
808 else print $langs->trans($value);
809 print '</td><td>'.$extrafields->showInputField($key,
GETPOSTISSET(
'options_'.$key) ? $extrafield_values[
'options_'.$key] : $obj->{$key},
'',
'',
'',
'', 0,
'product_fournisseur_price');
819 if (is_object($hookmanager))
821 $parameters = array(
'id_fourn'=>$id_fourn,
'prod_id'=>$object->id);
822 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
823 print $hookmanager->resPrint;
830 print '<div class="center">';
831 print '<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
832 print ' ';
833 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
841 print "\n<div class=\"tabsAction\">\n";
843 if ($action !=
'add_price' && $action !=
'update_price')
845 $parameters = array();
846 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
851 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/product/fournisseurs.php?id='.$object->id.
'&action=add_price">';
852 print $langs->trans(
"AddSupplierPrice").
'</a>';
860 if ($user->rights->fournisseur->lire)
863 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
864 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
865 $param .=
'&ref='.urlencode($object->ref);
868 $product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, $limit, $offset);
869 $product_fourn_list_all = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder, 0, 0);
870 $nbtotalofrecords = count($product_fourn_list_all);
871 $num = count($product_fourn_list);
872 if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++;
874 print_barre_liste($langs->trans(
'SupplierPrices'), $page,
$_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_accountancy.png', 0,
'',
'', $limit, 1);
878 $arrayfields = array(
879 'pfp.datec'=>array(
'label'=>$langs->trans(
"AppliedPricesFrom"),
'checked'=>1,
'position'=>1),
880 's.nom'=>array(
'label'=>$langs->trans(
"Suppliers"),
'checked'=>1,
'position'=>2),
881 'pfp.fk_availability'=>array(
'label'=>$langs->trans(
"Availability"),
'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY),
'checked'=>0,
'position'=>4),
882 'pfp.quantity'=>array(
'label'=>$langs->trans(
"QtyMin"),
'checked'=>1,
'position'=>5),
883 'pfp.unitprice'=>array(
'label'=>$langs->trans(
"UnitPriceHT"),
'checked'=>1,
'position'=>9),
884 'pfp.multicurrency_unitprice'=>array(
'label'=>$langs->trans(
"UnitPriceHTCurrency"),
'enabled' => $conf->multicurrency->enabled,
'checked'=>0,
'position'=>10),
885 'pfp.delivery_time_days'=>array(
'label'=>$langs->trans(
"NbDaysToDelivery"),
'checked'=>1,
'position'=>13),
886 'pfp.supplier_reputation'=>array(
'label'=>$langs->trans(
"ReputationForThisProduct"),
'checked'=>1,
'position'=>14),
887 'pfp.barcode'=>array(
'label'=>$langs->trans(
"BarcodeValue"),
'enabled' => $conf->barcode->enabled,
'checked'=>0,
'position'=>15),
888 'pfp.fk_barcode_type'=>array(
'label'=>$langs->trans(
"BarcodeType"),
'enabled' => $conf->barcode->enabled,
'checked'=>0,
'position'=>16),
889 'pfp.packaging'=>array(
'label'=>$langs->trans(
"PackagingForThisProduct"),
'enabled' => !empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING),
'checked'=>0,
'position'=>17),
890 'pfp.tms'=>array(
'label'=>$langs->trans(
"DateModification"),
'enabled' => $conf->barcode->enabled,
'checked'=>1,
'position'=>18),
894 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
895 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
897 if (!empty($extralabels)) {
898 foreach ($extralabels as $key => $value) {
900 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] != 3) {
901 $extratitle = $langs->trans($value);
902 $arrayfields[
'ef.'.$key] = array(
'label'=>$extratitle,
'checked'=>0,
'position'=>(end($arrayfields)[
'position'] + 1),
'langfile'=>$extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key],
'help'=>$extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]);
908 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
910 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
911 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
913 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formulaire">';
914 print '<input type="hidden" name="token" value="'.newToken().
'">';
915 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
916 print '<input type="hidden" name="action" value="list">';
917 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
918 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
921 print '<div class="div-table-responsive">';
922 print '<table class="liste centpercent">';
924 $param =
"&id=".$object->id;
926 print '<tr class="liste_titre">';
927 if (!empty($arrayfields[
'pfp.datec'][
'checked']))
print_liste_field_titre(
"AppliedPricesFrom", $_SERVER[
"PHP_SELF"],
"pfp.datec",
"", $param,
"", $sortfield, $sortorder,
'',
'', 1);
928 if (!empty($arrayfields[
's.nom'][
'checked']))
print_liste_field_titre(
"Suppliers", $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder,
'',
'', 1);
929 print_liste_field_titre(
"SupplierRef", $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder,
'',
'', 1);
930 if (!empty($arrayfields[
'pfp.fk_availability'][
'checked']))
print_liste_field_titre(
"Availability", $_SERVER[
"PHP_SELF"],
"pfp.fk_availability",
"", $param,
"", $sortfield, $sortorder);
931 if (!empty($arrayfields[
'pfp.quantity'][
'checked']))
print_liste_field_titre(
"QtyMin", $_SERVER[
"PHP_SELF"],
"pfp.quantity",
"", $param,
'', $sortfield, $sortorder,
'right ');
932 print_liste_field_titre(
"VATRate", $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
933 print_liste_field_titre(
"PriceQtyMinHT", $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
934 if (!empty($conf->multicurrency->enabled))
print_liste_field_titre(
"PriceQtyMinHTCurrency", $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
935 if (!empty($arrayfields[
'pfp.unitprice'][
'checked']))
print_liste_field_titre(
"UnitPriceHT", $_SERVER[
"PHP_SELF"],
"pfp.unitprice",
"", $param,
'', $sortfield, $sortorder,
'right ');
936 if (!empty($arrayfields[
'pfp.multicurrency_unitprice'][
'checked']))
print_liste_field_titre(
"UnitPriceHTCurrency", $_SERVER[
"PHP_SELF"],
"pfp.multicurrency_unitprice",
"", $param,
'', $sortfield, $sortorder,
'right ');
937 if (!empty($conf->multicurrency->enabled))
print_liste_field_titre(
"Currency", $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
938 print_liste_field_titre(
"DiscountQtyMin", $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
939 if (!empty($arrayfields[
'pfp.delivery_time_days'][
'checked']))
print_liste_field_titre(
"NbDaysToDelivery", $_SERVER[
"PHP_SELF"],
"pfp.delivery_time_days",
"", $param,
'', $sortfield, $sortorder,
'right ');
940 if (!empty($arrayfields[
'pfp.supplier_reputation'][
'checked']))
print_liste_field_titre(
"ReputationForThisProduct", $_SERVER[
"PHP_SELF"],
"pfp.supplier_reputation",
"", $param,
'', $sortfield, $sortorder,
'center ');
941 if (!empty($arrayfields[
'pfp.barcode'][
'checked']))
print_liste_field_titre(
"BarcodeValue", $_SERVER[
"PHP_SELF"],
"pfp.barcode",
"", $param,
'', $sortfield, $sortorder,
'center ');
942 if (!empty($arrayfields[
'pfp.fk_barcode_type'][
'checked']))
print_liste_field_titre(
"BarcodeType", $_SERVER[
"PHP_SELF"],
"pfp.fk_barcode_type",
"", $param,
'', $sortfield, $sortorder,
'center ');
943 if (!empty($arrayfields[
'pfp.packaging'][
'checked']))
print_liste_field_titre(
"PackagingForThisProduct", $_SERVER[
"PHP_SELF"],
"pfp.packaging",
"", $param,
'align="center"', $sortfield, $sortorder);
944 if (!empty($arrayfields[
'pfp.tms'][
'checked']))
print_liste_field_titre(
"DateModification", $_SERVER[
"PHP_SELF"],
"pfp.tms",
"", $param,
'', $sortfield, $sortorder,
'right ',
'', 1);
947 $extrafields->fetch_name_optionals_label(
"product_fournisseur_price");
948 $extralabels = $extrafields->attributes[
"product_fournisseur_price"][
'label'];
950 if (!empty($extralabels)) {
951 foreach ($extralabels as $key => $value) {
953 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] != 3) {
954 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key])) $langs->load($extrafields->attributes[
"product_fournisseur_price"][
'langfile'][$key]);
955 if (!empty($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes[
"product_fournisseur_price"][
'help'][$key]));
956 else $extratitle = $langs->trans($value);
957 if (!empty($arrayfields[
'ef.'.$key][
'checked']))
print_liste_field_titre($extratitle, $_SERVER[
"PHP_SELF"],
'ef.'.$key,
'', $param,
'', $sortfield, $sortorder,
'right ');
962 if (is_object($hookmanager))
964 $parameters = array(
'id_fourn'=>$id_fourn,
'prod_id'=>$object->id);
965 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
967 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
970 if (is_array($product_fourn_list))
972 foreach ($product_fourn_list as $productfourn)
974 print '<tr class="oddeven">';
977 if (!empty($arrayfields[
'pfp.datec'][
'checked'])) {
978 print '<td>'.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation),
'dayhour').
'</td>';
982 if (!empty($arrayfields[
's.nom'][
'checked'])) {
983 print '<td class="tdoverflowmax200">'.$productfourn->getSocNomUrl(1,
'supplier').
'</td>';
987 if ($usercancreate) {
988 print '<td class="left">'.$productfourn->getNomUrl().
'</td>';
990 print '<td class="left">'.$productfourn->fourn_ref.
'</td>';
994 if (!empty($arrayfields[
'pfp.fk_availability'][
'checked']))
996 $form->load_cache_availability();
997 $availability = $form->cache_availability[$productfourn->fk_availability][
'label'];
998 print '<td class="left">'.$availability.
'</td>';
1002 if (!empty($arrayfields[
'pfp.quantity'][
'checked'])) {
1003 print '<td class="right">';
1004 print $productfourn->fourn_qty;
1006 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1007 $unit = $object->getLabelOfUnit();
1009 print ' '.$langs->trans($unit);
1016 print '<td class="right">';
1021 print '<td class="right">';
1022 print $productfourn->fourn_price ?
price($productfourn->fourn_price) :
"";
1025 if (!empty($conf->multicurrency->enabled)) {
1027 print '<td class="right">';
1028 print $productfourn->fourn_multicurrency_price ?
price($productfourn->fourn_multicurrency_price) :
"";
1033 if (!empty($arrayfields[
'pfp.unitprice'][
'checked'])) {
1034 print '<td class="right">';
1041 if (!empty($arrayfields[
'pfp.multicurrency_unitprice'][
'checked'])) {
1042 print '<td class="right">';
1043 print price($productfourn->fourn_multicurrency_unitprice);
1047 if (!empty($conf->multicurrency->enabled)) {
1048 print '<td class="right">';
1049 print $productfourn->fourn_multicurrency_code ?
currency_name($productfourn->fourn_multicurrency_code) :
'';
1054 print '<td class="right">';
1059 if (!empty($arrayfields[
'pfp.delivery_time_days'][
'checked'])) {
1060 print '<td class="right">';
1061 print $productfourn->delivery_time_days;
1066 if (!empty($arrayfields[
'pfp.supplier_reputation'][
'checked'])) {
1067 print '<td class="center">';
1068 if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) {
1069 print $object->reputations[$productfourn->supplier_reputation];
1075 if (!empty($arrayfields[
'pfp.barcode'][
'checked'])) {
1076 print '<td align="right">';
1077 print $productfourn->supplier_barcode;
1082 if (!empty($arrayfields[
'pfp.fk_barcode_type'][
'checked'])) {
1083 print '<td class="center">';
1084 $productfourn->barcode_type = !empty($productfourn->supplier_fk_barcode_type) ? $productfourn->supplier_fk_barcode_type : 0;
1085 $productfourn->fetch_barcode();
1086 print $productfourn->barcode_type_label ? $productfourn->barcode_type_label : ($productfourn->supplier_barcode ?
'<div class="warning">'.$langs->trans(
"SetDefaultBarcodeType").
'<div>' :
'');
1091 if (!empty($arrayfields[
'pfp.packaging'][
'checked'])) {
1092 print '<td align="center">';
1098 if (!empty($arrayfields[
'pfp.tms'][
'checked'])) {
1099 print '<td align="right">';
1100 print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification),
"dayhour");
1105 if (!empty($extralabels)) {
1107 $sql .=
" fk_object";
1108 foreach ($extralabels as $key => $value) {
1111 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price_extrafields";
1112 $sql .=
" WHERE fk_object = ".$productfourn->product_fourn_price_id;
1113 $resql = $db->query($sql);
1115 if ($db->num_rows(
$resql) != 1) {
1116 foreach ($extralabels as $key => $value) {
1117 if (!empty($arrayfields[
'ef.'.$key][
'checked']) && !empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] != 3) {
1122 $obj = $db->fetch_object(
$resql);
1123 foreach ($extralabels as $key => $value) {
1124 if (!empty($arrayfields[
'ef.'.$key][
'checked']) && !empty($extrafields->attributes[
"product_fournisseur_price"][
'list'][$key]) && $extrafields->attributes[
"product_fournisseur_price"][
'list'][$key] != 3) {
1125 print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key}).
"</td>";
1133 if (is_object($hookmanager))
1135 $parameters = array(
'id_pfp'=>$productfourn->product_fourn_price_id,
'id_fourn'=>$id_fourn,
'prod_id'=>$object->id);
1136 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1140 print '<td class="center nowraponall">';
1144 print '<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$productfourn->fourn_id.
'&action=update_price&rowid='.$productfourn->product_fourn_price_id.
'">'.
img_edit().
"</a>";
1146 print '<a href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$productfourn->fourn_id.
'&action=ask_remove_pf&rowid='.$productfourn->product_fourn_price_id.
'">'.
img_picto($langs->trans(
"Remove"),
'delete').
'</a>';
1164 print $langs->trans(
"ErrorUnknown");
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
Class to parse product price expressions.
const TYPE_SERVICE
Service.
const TYPE_PRODUCT
Regular product.
get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Fonction qui renvoie si tva doit etre tva percue recuperable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Class to manage suppliers.
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...
currency_name($code_iso, $withcode= '', $outputlangs=null)
Return label of currency or code+label.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
Class for accesing price expression table.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) Si ...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
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.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Class to manage predefined suppliers products.
product_prepare_head($object)
Prepare array with list of tabs.