20 require
'../main.inc.php';
21 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
22 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
23 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductAttribute.class.php';
24 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductAttributeValue.class.php';
25 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination2ValuePair.class.php';
28 $langs->loadLangs(array(
"products",
"other"));
31 $valueid =
GETPOST(
'valueid',
'int');
33 $weight_impact =
GETPOST(
'weight_impact',
'alpha');
34 $price_impact =
GETPOST(
'price_impact',
'alpha');
35 $price_impact_percent = (bool)
GETPOST(
'price_impact_percent');
37 $level_price_impact =
GETPOST(
'level_price_impact',
'array');
38 $level_price_impact_percent =
GETPOST(
'level_price_impact_percent',
'array');
40 $reference =
GETPOST(
'reference',
'alpha');
41 $form =
new Form($db);
43 $action =
GETPOST(
'action',
'aZ09');
44 $massaction =
GETPOST(
'massaction',
'alpha');
45 $show_files =
GETPOST(
'show_files',
'int');
46 $confirm =
GETPOST(
'confirm',
'alpha');
47 $toselect =
GETPOST(
'toselect',
'array');
48 $cancel =
GETPOST(
'cancel',
'alpha');
49 $delete_product =
GETPOST(
'delete_product',
'alpha');
52 $fieldvalue = (!empty($id) ? $id : $ref);
53 $fieldtype = (!empty($ref) ?
'ref' :
'rowid');
54 $result =
restrictedArea($user,
'produit|service', $fieldvalue,
'product&product',
'',
'', $fieldtype);
63 $object->fetch($id, $ref);
66 $selectedvariant = $_SESSION[
'addvariant_'.$object->id];
76 unset($_SESSION[
'addvariant_'.$object->id]);
79 if (!$object->isProduct() && !$object->isService()) {
80 header(
'Location: '.
dol_buildpath(
'/product/card.php?id='.$object->id, 2));
85 unset($selectedvariant);
86 unset($_SESSION[
'addvariant_'.$object->id]);
88 if ($action ==
'create' &&
GETPOST(
'selectvariant',
'alpha'))
94 $_SESSION[
'addvariant_'.$object->id] = $selectedvariant;
102 $productCombination2ValuePairs1 = array();
104 if (($action ==
'add' || $action ==
'create') && empty($massaction) && !
GETPOST(
'selectvariant',
'alpha'))
107 $features = $_SESSION[
'addvariant_'.$object->id];
110 if ($action ==
'create') {
114 $reference = trim($reference);
115 if (empty($reference)) {
118 $weight_impact =
price2num($weight_impact);
119 $price_impact =
price2num($price_impact);
122 if ($conf->global->PRODUIT_MULTIPRICES) {
123 $level_price_impact = array_map(
'price2num', $level_price_impact);
126 $level_price_impact = array(1 => $price_impact);
127 $level_price_impact_percent = array(1 => $price_impact_percent);
130 $sanit_features = array();
133 foreach ($features as $feature) {
134 $explode = explode(
':', $feature);
136 if ($prodattr->fetch($explode[0]) < 0) {
140 if ($prodattr_val->fetch($explode[1]) < 0) {
145 $sanit_features[$explode[0]] = $explode[1];
148 $tmp->fk_prod_attr = $explode[0];
149 $tmp->fk_prod_attr_val = $explode[1];
151 $productCombination2ValuePairs1[] = $tmp;
159 if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features))
161 $result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $level_price_impact_percent, $level_price_impact, $weight_impact, $reference);
165 unset($_SESSION[
'addvariant_'.$object->id]);
168 header(
'Location: '.
dol_buildpath(
'/variants/combinations.php?id='.$id, 2));
171 $langs->load(
"errors");
175 setEventMessages($langs->trans(
'ErrorRecordAlreadyExists'), null,
'errors');
180 } elseif (!empty($massaction)) {
181 $bulkaction = $massaction;
188 foreach ($toselect as $prodid) {
190 $prodstatic =
new Product($db);
192 if ($prodstatic->fetch($prodid) < 0) {
196 if ($bulkaction ==
'on_sell') {
197 $prodstatic->status = 1;
198 $res = $prodstatic->update($prodstatic->id, $user);
199 } elseif ($bulkaction ==
'on_buy') {
200 $prodstatic->status_buy = 1;
201 $res = $prodstatic->update($prodstatic->id, $user);
202 } elseif ($bulkaction ==
'not_sell') {
203 $prodstatic->status = 0;
204 $res = $prodstatic->update($prodstatic->id, $user);
205 } elseif ($bulkaction ==
'not_buy') {
206 $prodstatic->status_buy = 0;
207 $res = $prodstatic->update($prodstatic->id, $user);
208 } elseif ($bulkaction ==
'delete') {
209 $res = $prodstatic->delete($user, $prodstatic->id);
223 if ($prodstatic->error) {
232 } elseif ($action ===
'update' && $valueid > 0) {
233 if ($prodcomb->fetch($valueid) < 0) {
238 $prodcomb->variation_weight = $weight_impact;
241 if ($conf->global->PRODUIT_MULTIPRICES) {
242 $level_price_impact = array_map(
'price2num', $level_price_impact);
244 $prodcomb->variation_price = $level_price_impact[1];
245 $prodcomb->variation_price_percentage = (bool) $level_price_impact_percent[1];
248 $level_price_impact = array(1 => $price_impact);
249 $level_price_impact_percent = array(1 => $price_impact_percent);
251 $prodcomb->variation_price = $price_impact;
252 $prodcomb->variation_price_percentage = $price_impact_percent;
255 if ($conf->global->PRODUIT_MULTIPRICES) {
256 $prodcomb->combination_price_levels = array();
257 for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
259 $productCombinationLevel->fk_product_attribute_combination = $prodcomb->id;
260 $productCombinationLevel->fk_price_level = $i;
261 $productCombinationLevel->variation_price = $level_price_impact[$i];
262 $productCombinationLevel->variation_price_percentage = (bool) $level_price_impact_percent[$i];
263 $prodcomb->combination_price_levels[$i] = $productCombinationLevel;
267 if ($prodcomb->update($user) > 0) {
269 header(
'Location: '.
dol_buildpath(
'/variants/combinations.php?id='.$id, 2));
278 $productCombinations = $prodcomb->fetchAllByFkProductParent($object->id);
280 if ($action ===
'confirm_deletecombination') {
281 if ($prodcomb->fetch($valueid) > 0) {
284 if ($prodcomb->delete($user) > 0 && (empty($delete_product) || ($delete_product ==
'on' && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0))) {
287 header(
'Location: '.
dol_buildpath(
'/variants/combinations.php?id='.$object->id, 2));
292 setEventMessages($langs->trans(
'ProductCombinationAlreadyUsed'), null,
'errors');
295 } elseif ($action ===
'edit') {
296 if ($prodcomb->fetch($valueid) < 0) {
301 $weight_impact = $prodcomb->variation_weight;
302 $price_impact = $prodcomb->variation_price;
303 $price_impact_percent = $prodcomb->variation_price_percentage;
305 $productCombination2ValuePairs1 = $prodcomb2val->fetchByFkCombination($valueid);
306 } elseif ($action ===
'confirm_copycombination') {
308 $dest_product =
GETPOST(
'dest_product');
310 if ($prodstatic->fetch(
'', $dest_product) > 0) {
312 if ($prodstatic->ref != $object->ref) {
313 if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
314 header(
'Location: '.
dol_buildpath(
'/variants/combinations.php?id='.$prodstatic->id, 2));
317 setEventMessages($langs->trans(
'ErrorCopyProductCombinations'), null,
'errors');
321 setEventMessages($langs->trans(
'ErrorDestinationProductNotFound'), null,
'errors');
331 $form =
new Form($db);
333 if (!empty($id) || !empty($ref))
335 llxHeader(
"",
"", $langs->trans(
"CardProduct".$object->type));
337 $showbarcode = empty($conf->barcode->enabled) ? 0 : 1;
338 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode = 0;
341 $titre = $langs->trans(
"CardProduct".$object->type);
346 $linkback =
'<a href="'.DOL_URL_ROOT.
'/product/list.php?type='.$object->type.
'">'.$langs->trans(
"BackToList").
'</a>';
347 $object->next_prev_filter =
" fk_product_type = ".$object->type;
349 dol_banner_tab($object,
'ref', $linkback, ($user->socid ? 0 : 1),
'ref',
'',
'',
'', 0,
'',
'', 1);
351 print '<div class="fichecenter">';
353 print '<div class="underbanner clearboth"></div>';
354 print '<table class="border tableforfield" width="100%">';
357 print '<tr><td class="titlefield">'.$langs->trans(
"DefaultTaxRate").
'</td><td>';
360 if (
price2num($object->tva_tx)) $positiverates .= ($positiverates ?
'/' :
'').
price2num($object->tva_tx);
361 if (
price2num($object->localtax1_type)) $positiverates .= ($positiverates ?
'/' :
'').price2num($object->localtax1_tx);
362 if (
price2num($object->localtax2_type)) $positiverates .= ($positiverates ?
'/' :
'').
price2num($object->localtax2_tx);
363 if (empty($positiverates)) $positiverates =
'0';
364 echo
vatrate($positiverates.($object->default_vat_code ?
' ('.$object->default_vat_code.
')' :
''),
'%', $object->tva_npr);
374 print
'<tr><td>'.$langs->trans(
"SellingPrice").
'</td><td>';
375 if ($object->price_base_type ==
'TTC') {
376 print
price($object->price_ttc).
' '.$langs->trans($object->price_base_type);
378 print
price($object->price).
' '.$langs->trans($object->price_base_type);
383 print
'<tr><td>'.$langs->trans(
"MinPrice").
'</td><td>';
384 if ($object->price_base_type ==
'TTC') {
385 print
price($object->price_min_ttc).
' '.$langs->trans($object->price_base_type);
387 print
price($object->price_min).
' '.$langs->trans($object->price_base_type);
392 print
'<tr><td>'.$langs->trans(
"Weight").
'</td><td>';
393 if ($object->weight !=
'')
399 print
"</td></tr>\n";
407 print
'<div style="clear:both"></div>';
411 $listofvariantselected =
'';
414 if ($action ==
'add' || ($action ==
'edit')) {
415 if ($action ==
'add') {
416 $title = $langs->trans(
'NewProductCombination');
418 $features = $_SESSION[
'addvariant_'.$object->id];
420 $listofvariantselected =
'<div id="parttoaddvariant">';
421 if (!empty($features)) {
422 foreach ($features as $feature) {
423 $explode = explode(
':', $feature);
425 if ($prodattr->fetch($explode[0]) < 0) {
429 if ($prodattr_val->fetch($explode[1]) < 0) {
433 $listofvariantselected .=
'<i>'.$prodattr->label.
'</i>:'.$prodattr_val->value.
' ';
436 $listofvariantselected .=
'</div>';
439 $title = $langs->trans(
'EditProductCombination');
442 if ($action ==
'add') {
443 $prodattr_all = $prodattr->fetchAll();
446 $selected = $prodattr_all[key($prodattr_all)]->id;
449 $prodattr_alljson = array();
451 foreach ($prodattr_all as $each) {
452 $prodattr_alljson[$each->id] = $each;
457 <script
type=
"text/javascript">
459 variants_available = <?php echo json_encode($prodattr_alljson); ?>;
460 variants_selected = {
466 foreach ($productCombination2ValuePairs1 as $pc2v) {
467 $prodattr_val->fetch($pc2v->fk_prod_attr_val);
469 variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>);
470 variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = {
471 attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>],
473 id: <?php echo $pc2v->fk_prod_attr_val ?>,
474 label:
'<?php echo $prodattr_val->value ?>'
481 restoreAttributes =
function() {
482 jQuery(
"select[name=attribute]").empty().append(
'<option value="-1"> </option>');
484 jQuery.each(variants_available,
function (key, val) {
485 if (jQuery.inArray(val.id, variants_selected.index) == -1) {
486 jQuery(
"select[name=attribute]").append(
'<option value="' + val.id +
'">' + val.label +
'</option>');
492 jQuery(document).ready(
function() {
493 jQuery(
"select#attribute").change(
function () {
494 console.log(
"Change of field variant attribute");
495 var select = jQuery(
"select#value");
497 if (!jQuery(
this).val().length || jQuery(
this).val() ==
'-1') {
499 select.append(
'<option value="-1"> </option>');
503 select.empty().append(
'<option value="">Loading...</option>');
505 jQuery.getJSON(
"ajax/get_attribute_values.php", {
506 id: jQuery(
this).val()
510 select.append(
'<option value="-1"> </option>');
511 return alert(data.error);
515 select.append(
'<option value="-1"> </option>');
517 jQuery(data).each(
function (key, val) {
518 keyforoption = val.id
519 valforoption = val.value
520 select.append(
'<option value="' + keyforoption +
'">' + valforoption +
'</option>');
534 print
'<form method="post" id="combinationform" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
535 print
'<input type="hidden" name="token" value="'.newToken().
'">';
536 print
'<input type="hidden" name="id" value="'.dol_escape_htmltag($id).
'">'.
"\n";
537 print
'<input type="hidden" name="action" value="'.(($valueid > 0) ?
"update" :
"create").
'">'.
"\n";
539 print
'<input type="hidden" name="valueid" value="'.$valueid.
'">'.
"\n";
545 if ($action ==
'add') {
546 print
'<table class="border" style="width: 100%">';
547 print
"<!-- Variant -->\n";
549 print
'<td class="titlefieldcreate fieldrequired"><label for="attribute">'.$langs->trans(
'ProductAttribute').
'</label></td>';
551 if (is_array($prodattr_all)) {
552 print
'<select class="flat minwidth100" id="attribute" name="attribute">';
553 print
'<option value="-1"> </option>';
554 foreach ($prodattr_all as $attr) {
556 print
'<option value="'.$attr->id.
'">'.$attr->label.
'</option>';
561 $htmltext = $langs->trans(
"GoOnMenuToCreateVairants", $langs->transnoentities(
"Product"), $langs->transnoentities(
"VariantAttributes"));
562 print $form->textwithpicto(
'', $htmltext);
572 <td
class=
"fieldrequired"><label
for=
"value"><?php echo $langs->trans(
'Value') ?></label></td>
574 <select
class=
"flat minwidth100" id=
"value" name=
"value">
575 <option value=
"-1"> </option>
578 $htmltext = $langs->trans(
"GoOnMenuToCreateVairants", $langs->transnoentities(
"Product"), $langs->transnoentities(
"VariantAttributes"));
579 print $form->textwithpicto(
'', $htmltext);
590 <input type=
"submit" class=
"button" name=
"selectvariant" id=
"selectvariant" value=
"<?php echo dol_escape_htmltag($langs->trans("SelectCombination
")); ?>">
594 print
'<tr><td></td><td>';
595 print $listofvariantselected;
603 if (is_array($productCombination2ValuePairs1)) {
604 print
'<table class="border" style="width: 100%">';
607 if (is_array($productCombination2ValuePairs1) && count($productCombination2ValuePairs1))
611 <td
class=
"titlefieldcreate tdtop"><label
for=
"features"><?php echo $langs->trans(
'Combination') ?></label></td>
613 <div
class=
"inline-block valignmiddle quatrevingtpercent">
615 foreach ($productCombination2ValuePairs1 as $key => $val) {
616 $result1 = $prodattr->fetch($val->fk_prod_attr);
617 $result2 = $prodattr_val->fetch($val->fk_prod_attr_val);
619 if ($result1 > 0 && $result2 > 0)
621 print $prodattr->label.
' - '.$prodattr_val->value.
'<br>';
627 <!-- <div
class=
"inline-block valignmiddle">
628 <a href=
"#" class=
"inline-block valignmiddle button" id=
"delfeature"><?php echo
img_edit_remove() ?></a>
638 <td><label
for=
"reference"><?php echo $langs->trans(
'Reference') ?></label></td>
639 <td><input type=
"text" id=
"reference" name=
"reference" value=
"<?php echo trim($reference) ?>"></td>
642 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
645 <td><label
for=
"price_impact"><?php echo $langs->trans(
'PriceImpact') ?></label></td>
646 <td><input type=
"text" id=
"price_impact" name=
"price_impact" value=
"<?php echo price($price_impact) ?>">
647 <input type=
"checkbox" id=
"price_impact_percent" name=
"price_impact_percent" <?php echo $price_impact_percent ?
' checked' :
'' ?>> <label
for=
"price_impact_percent"><?php echo $langs->trans(
'PercentageVariation') ?></label>
652 $prodcomb->fetchCombinationPriceLevels();
654 for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
657 print
'<td><label for="level_price_impact_'.$i.
'">'.$langs->trans(
'ImpactOnPriceLevel', $i).
'</label>';
659 print
' <a id="apply-price-impact-to-all-level" class="classfortooltip" href="#" title="'.$langs->trans(
'ApplyToAllPriceImpactLevelHelp').
'">('.$langs->trans(
'ApplyToAllPriceImpactLevel').
')</a>';
662 print
'<td><input type="text" class="level_price_impact" id="level_price_impact_'.$i.
'" name="level_price_impact['.$i.
']" value="'.
price($prodcomb->combination_price_levels[$i]->variation_price).
'">';
663 print
'<input type="checkbox" class="level_price_impact_percent" id="level_price_impact_percent_'.$i.
'" name="level_price_impact_percent['.$i.
']" '.(!empty($prodcomb->combination_price_levels[$i]->variation_price_percentage) ?
' checked' :
'').
'> <label for="level_price_impact_percent_'.$i.
'">'.$langs->trans(
'PercentageVariation').
'</label>';
670 if ($object->isProduct()) {
672 print
'<td><label for="weight_impact">'.$langs->trans(
'WeightImpact').
'</label></td>';
673 print
'<td><input type="text" id="weight_impact" name="weight_impact" value="'.price($weight_impact).
'"></td>';
680 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
683 $(document).ready(
function() {
685 $(
'body').on(
'click',
'#apply-price-impact-to-all-level',
function(e) {
687 let priceImpact = $(
"#level_price_impact_1" ).val();
688 let priceImpactPrecent = $(
"#level_price_impact_percent_1" ).prop(
"checked");
690 var multipricelimit = <?php print intval($conf->global->PRODUIT_MULTIPRICES_LIMIT); ?>
692 for (let i = 2; i <= multipricelimit; i++) {
693 $(
"#level_price_impact_" + i ).val(priceImpact);
694 $(
"#level_price_impact_percent_" + i ).prop(
"checked", priceImpactPrecent);
705 <div style=
"text-align: center">
706 <input type=
"submit" name=
"create" <?php
if (!is_array($productCombination2ValuePairs1)) print
' disabled="disabled"'; ?> value=
"<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans("Save
") ?>" class=
"button button-save">
708 <input type=
"submit" name=
"cancel" value=
"<?php echo $langs->trans("Cancel
"); ?>" class=
"button button-cancel">
715 if ($action ===
'delete') {
716 if ($prodcomb->fetch($valueid) > 0) {
717 $prodstatic->fetch($prodcomb->fk_product_child);
719 print $form->formconfirm(
720 "combinations.php?id=".$id.
"&valueid=".$valueid,
721 $langs->trans(
'Delete'),
722 $langs->trans(
'ProductCombinationDeleteDialog', $prodstatic->ref),
723 "confirm_deletecombination",
724 array(array(
'label'=> $langs->trans(
'DeleteLinkedProduct'),
'type'=>
'checkbox',
'name' =>
'delete_product',
'value' =>
false)),
729 } elseif ($action ===
'copy') {
730 print $form->formconfirm(
'combinations.php?id='.$id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneProductCombinations'),
'confirm_copycombination', array(array(
'type' =>
'text',
'label' => $langs->trans(
'CloneDestinationReference'),
'name' =>
'dest_product')), 0, 1);
735 if ($productCombinations)
739 <script type=
"text/javascript">
740 jQuery(document).ready(
function() {
742 jQuery(
'input[name="select_all"]').click(
function() {
744 if (jQuery(
this).prop(
'checked')) {
750 jQuery(
'table.liste input[type="checkbox"]').prop(
'checked', checked);
753 jQuery(
'input[name^="select["]').click(
function() {
754 jQuery(
'input[name="select_all"]').prop(
'checked',
false);
764 print
'<div class="tabsAction">';
766 print
' <div class="inline-block divButAction">';
768 print
'<a href="combinations.php?id='.$object->id.
'&action=add&token='.
newToken().
'" class="butAction">'.$langs->trans(
'NewProductCombination').
'</a>';
770 if ($productCombinations)
772 print
'<a href="combinations.php?id='.$object->id.
'&action=copy&token='.
newToken().
'" class="butAction">'.$langs->trans(
'PropagateVariant').
'</a>';
781 $arrayofselected = is_array($toselect) ? $toselect : array();
785 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
786 print
'<input type="hidden" name="token" value="'.newToken().
'">';
787 print
'<input type="hidden" name="action" value="massaction">';
788 print
'<input type="hidden" name="id" value="'.$id.
'">';
789 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
803 if (count($productCombinations))
805 $aaa =
'<label for="massaction">'.$langs->trans(
'BulkActions').
'</label>';
806 $aaa .=
'<select id="bulk_action" name="massaction" class="flat">';
807 $aaa .=
' <option value="nothing"> </option>';
808 $aaa .=
' <option value="not_buy">'.$langs->trans(
'ProductStatusNotOnBuy').
'</option>';
809 $aaa .=
' <option value="not_sell">'.$langs->trans(
'ProductStatusNotOnSell').
'</option>';
810 $aaa .=
' <option value="on_buy">'.$langs->trans(
'ProductStatusOnBuy').
'</option>';
811 $aaa .=
' <option value="on_sell">'.$langs->trans(
'ProductStatusOnSell').
'</option>';
812 $aaa .=
' <option value="delete">'.$langs->trans(
'Delete').
'</option>';
814 $aaa .=
'<input type="submit" value="'.dol_escape_htmltag($langs->trans(
"Apply")).
'" class="button">';
816 $massactionbutton = $aaa;
818 $title = $langs->trans(
"ProductCombinations");
822 print
'<div class="div-table-responsive">';
824 <table
class=
"liste">
825 <tr
class=
"liste_titre">
826 <td
class=
"liste_titre"><?php echo $langs->trans(
'Product') ?></td>
827 <td
class=
"liste_titre"><?php echo $langs->trans(
'Combination') ?></td>
828 <td
class=
"liste_titre right"><?php echo $langs->trans(
'PriceImpact') ?></td>
829 <?php
if ($object->isProduct()) print
'<td class="liste_titre right">'.$langs->trans(
'WeightImpact').
'</td>'; ?>
830 <td
class=
"liste_titre center"><?php echo $langs->trans(
'OnSell') ?></td>
831 <td
class=
"liste_titre center"><?php echo $langs->trans(
'OnBuy') ?></td>
832 <td
class=
"liste_titre"></td>
834 print
'<td class="liste_titre center">';
835 $searchpicto = $form->showCheckAddButtons(
'checkforselect', 1);
842 if (count($productCombinations))
844 foreach ($productCombinations as $currcomb)
846 $prodstatic->fetch($currcomb->fk_product_child);
847 print
'<tr class="oddeven">';
848 print
'<td>'.$prodstatic->getNomUrl(1).
'</td>';
851 $productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id);
852 $iMax = count($productCombination2ValuePairs);
854 for ($i = 0; $i < $iMax; $i++) {
856 if ($i !== ($iMax - 1)) {
861 print
'<td class="right">'.($currcomb->variation_price >= 0 ?
'+' :
'').
price($currcomb->variation_price).($currcomb->variation_price_percentage ?
' %' :
'').
'</td>';
862 if ($object->isProduct()) {
863 print
'<td class="right">'.($currcomb->variation_weight >= 0 ?
'+' :
'').
price($currcomb->variation_weight).
' '.
measuringUnitString(0,
'weight', $prodstatic->weight_units).
'</td>';
865 print
'<td class="center">'.$prodstatic->getLibStatut(2, 0).
'</td>';
866 print
'<td class="center">'.$prodstatic->getLibStatut(2, 1).
'</td>';
867 print
'<td class="right">';
868 print
'<a class="paddingleft paddingright editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=edit&valueid='.$currcomb->id.
'">'.
img_edit().
'</a>';
869 print
'<a class="paddingleft paddingright" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&action=delete&token='.
newToken().
'&valueid='.$currcomb->id.
'">'.
img_delete().
'</a>';
871 print
'<td class="nowrap center">';
872 if ($productCombinations || $massactionbutton || $massaction)
875 if (in_array($prodstatic->id, $arrayofselected)) $selected = 1;
876 print
'<input id="cb'.$prodstatic->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
882 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
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 manage products or services.
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
const TYPE_SERVICE
Service.
Class ProductAttributeValue Used to represent a product attribute value.
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Class ProductAttribute Used to represent a product attribute.
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...
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.
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 ProductCombinationLevel Used to represent a product combination Level.
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.
Class ProductCombination Used to represent a product combination.
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.
img_edit_remove($titlealt= 'default', $other= '')
Show logo -.
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.
Class ProductCombination2ValuePair Used to represent the relation between a product combination...
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
product_prepare_head($object)
Prepare array with list of tabs.
measuringUnitString($unit, $measuring_style= '', $scale= '', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.