dolibarr 24.0.2
combinations.php
1<?php
2/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
3 * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2022 Open-Dsi <support@open-dsi.fr>
6 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2025 William Mead <william@m34d.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23// Load Dolibarr environment
24require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
35require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
36require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
37require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php';
38
39$langs->loadLangs(array("products", "other"));
40
41$id = GETPOSTINT('id'); // ID of the parent Product
42$ref = GETPOST('ref', 'alpha');
43
44$combination_id = GETPOSTINT('combination_id'); // ID of the combination
45
46$reference = GETPOST('reference', 'alpha'); // Reference of the variant Product
47
48$weight_impact = GETPOSTFLOAT('weight_impact', 2);
49$price_impact_percent = (bool) GETPOST('price_impact_percent');
50$price_impact = $price_impact_percent ? GETPOSTFLOAT('price_impact', 2) : GETPOSTFLOAT('price_impact', 'MU');
51
52// for PRODUIT_MULTIPRICES
53$level_price_impact = GETPOST('level_price_impact', 'array');
54$level_price_impact = array_map('price2num', $level_price_impact);
55$level_price_impact = array_map('floatval', $level_price_impact);
56$level_price_impact_percent = GETPOST('level_price_impact_percent', 'array');
57$level_price_impact_percent = array_map('boolval', $level_price_impact_percent);
58$clone_categories = (bool) GETPOST('clone_categories');
59
60$form = new Form($db);
61
62$action = GETPOST('action', 'aZ09');
63$massaction = GETPOST('massaction', 'alpha');
64$show_files = GETPOSTINT('show_files');
65$confirm = GETPOST('confirm', 'alpha');
66$toselect = GETPOST('toselect', 'array:int');
67$cancel = GETPOST('cancel', 'alpha');
68$delete_product = GETPOST('delete_product', 'alpha');
69$subaction = GETPOST('subaction', 'aZ09');
70$backtopage = GETPOST('backtopage', 'alpha');
71$sortfield = GETPOST('sortfield', 'aZ09comma');
72$sortorder = GETPOST('sortorder', 'aZ09comma');
73
74// Security check
75$fieldvalue = $id ?: $ref;
76$fieldtype = !empty($ref) ? 'ref' : 'rowid';
77
78$prodstatic = new Product($db);
79$prodattr = new ProductAttribute($db);
80$prodattr_val = new ProductAttributeValue($db);
81
82$object = new Product($db);
83if ($id > 0 || $ref) {
84 $object->fetch($id, $ref);
85}
86
87$selectedvariant = isset($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
88$selected = '';
89// Security check
90if (!isModEnabled('variants')) {
91 accessforbidden('Module not enabled');
92}
93if ($user->socid > 0) { // Protection if external user
95}
96
97if ($object->id > 0) {
98 if ($object->isProduct()) {
99 restrictedArea($user, 'produit', $object->id, 'product&product', '', '');
100 }
101 if ($object->isService()) {
102 restrictedArea($user, 'service', $object->id, 'product&product', '', '');
103 }
104} else {
105 restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
106}
107$usercanread = (($object->isProduct() && $user->hasRight('produit', 'lire')) || ($object->isService() && $user->hasRight('service', 'lire')));
108$usercancreate = (($object->isProduct() && $user->hasRight('produit', 'creer')) || ($object->isService() && $user->hasRight('service', 'creer')));
109$usercandelete = (($object->isProduct() && $user->hasRight('produit', 'supprimer')) || ($object->isService() && $user->hasRight('service', 'supprimer')));
110
111
112/*
113 * Actions
114 */
115
116if ($cancel) {
117 $action = '';
118 $massaction = '';
119 unset($_SESSION['addvariant_'.$object->id]);
120}
121
122if (!$object->isProduct() && !$object->isService()) {
123 header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2));
124 exit();
125}
126if ($action == 'add') { // Test on permission not required
127 unset($selectedvariant);
128 unset($_SESSION['addvariant_'.$object->id]);
129}
130if ($action == 'create' && GETPOST('selectvariant', 'alpha') && $usercancreate) { // We click on select combination
131 $action = 'add';
132 $attribute_id = GETPOSTINT('attribute');
133 $attribute_value_id = GETPOSTINT('value');
134 if ($attribute_id > 0 && $attribute_value_id > 0) {
135 $feature = $attribute_id . '-' . $attribute_value_id;
136 $selectedvariant[$feature] = $feature;
137 $_SESSION['addvariant_'.$object->id] = $selectedvariant;
138 }
139}
140if ($action == 'create' && $subaction == 'delete' && $usercancreate) { // We click on select combination
141 $action = 'add';
142 $feature = GETPOST('feature', 'intcomma');
143 if (isset($selectedvariant[$feature])) {
144 unset($selectedvariant[$feature]);
145 $_SESSION['addvariant_'.$object->id] = $selectedvariant;
146 }
147}
148
149
150$prodcomb = new ProductCombination($db);
151$prodcomb2val = new ProductCombination2ValuePair($db);
152
153// The combination to edit or delete must be a variant of the product shown
154if ($combination_id > 0) {
155 $tmpcomb = new ProductCombination($db);
156 if ($tmpcomb->fetch($combination_id) <= 0 || $tmpcomb->fk_product_parent != $object->id) {
157 setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
158 $combination_id = 0;
159 $action = '';
160 }
161}
162
163$productCombination2ValuePairs1 = array();
164
165if (($action == 'add' || $action == 'create') && $usercancreate && empty($massaction) && !GETPOST('selectvariant', 'alpha') && empty($subaction)) { // We click on Create all defined combinations
166 //$features = GETPOST('features', 'array');
167 $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
168
169 if (!$features) {
170 if ($action == 'create') { // Test on permission already done
171 setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
172 }
173 } else {
174 $reference = trim($reference);
175 if (empty($reference)) {
176 $reference = false;
177 }
178 $weight_impact = price2num($weight_impact);
179 $price_impact = price2num($price_impact);
180
181 if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
182 $level_price_impact = array(1 => $price_impact);
183 $level_price_impact_percent = array(1 => $price_impact_percent);
184 }
185
186 $sanit_features = array();
187
188 //First, sanitize
189 foreach ($features as $feature) {
190 $explode = explode('-', $feature);
191 if ($prodattr->fetch((int) $explode[0]) <= 0 || $prodattr_val->fetch((int) $explode[1]) <= 0) {
192 continue;
193 }
194
195 // Valuepair
196 $sanit_features[(int) $explode[0]] = (int) $explode[1];
197
199 $tmp->fk_prod_attr = (int) $explode[0];
200 $tmp->fk_prod_attr_val = (int) $explode[1];
201
202 $productCombination2ValuePairs1[] = $tmp;
203 }
204
205 $db->begin();
206
207 // sanit_feature is an array with 1 (and only 1) value per attribute.
208 // For example: Color->blue, Size->Small, Option->2
209 if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) {
210 $result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $level_price_impact_percent, $level_price_impact, (float) $weight_impact, $reference, '', $clone_categories);
211 if ($result > 0) {
212 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
213 unset($_SESSION['addvariant_'.$object->id]);
214
215 $db->commit();
216 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
217 exit();
218 } else {
219 $langs->load("errors");
220 setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
221 }
222 } else {
223 setEventMessages($langs->trans('ErrorRecordAlreadyExists'), null, 'errors');
224 }
225
226 $db->rollback();
227 }
228} elseif (!empty($massaction) && ($massaction == 'delete' ? $usercandelete : $usercancreate)) {
229 $bulkaction = $massaction;
230 $error = 0;
231
232 // The mass action can only target the variants of this product
233 $childids = array();
234 $tmpcombinations = $prodcomb->fetchAllByFkProductParent($object->id);
235 if (is_array($tmpcombinations)) {
236 foreach ($tmpcombinations as $tmpcombination) {
237 $childids[] = (int) $tmpcombination->fk_product_child;
238 }
239 }
240
241 $db->begin();
242
243 foreach ($toselect as $prodid) {
244 if (!in_array((int) $prodid, $childids)) {
245 continue;
246 }
247 // need create new of Product to prevent rename dir behavior
248 $prodstatic = new Product($db);
249 if ($prodstatic->fetch($prodid) < 0) {
250 continue;
251 }
252
253 if ($bulkaction == 'on_sell') {
254 $prodstatic->status = 1;
255 $res = $prodstatic->update($prodstatic->id, $user);
256 if ($res <= 0) {
257 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
258 $error++;
259 break;
260 }
261 } elseif ($bulkaction == 'on_buy') {
262 $prodstatic->status_buy = 1;
263 $res = $prodstatic->update($prodstatic->id, $user);
264 if ($res <= 0) {
265 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
266 $error++;
267 break;
268 }
269 } elseif ($bulkaction == 'not_sell') {
270 $prodstatic->status = 0;
271 $res = $prodstatic->update($prodstatic->id, $user);
272 if ($res <= 0) {
273 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
274 $error++;
275 break;
276 }
277 } elseif ($bulkaction == 'not_buy') {
278 $prodstatic->status_buy = 0;
279 $res = $prodstatic->update($prodstatic->id, $user);
280 if ($res <= 0) {
281 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
282 $error++;
283 break;
284 }
285 } elseif ($bulkaction == 'delete') {
286 $res = $prodstatic->delete($user, $prodstatic->id);
287 if ($res <= 0) {
288 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
289 $error++;
290 break;
291 }
292 } else {
293 break;
294 }
295 }
296
297 if ($error) {
298 $db->rollback();
299 if (empty($prodstatic->error)) {
300 setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
301 }
302 } else {
303 $db->commit();
304 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
305 }
306} elseif ($action === 'update' && $combination_id > 0 && $usercancreate) {
307 if ($prodcomb->fetch($combination_id) < 0) {
308 dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
309 exit();
310 }
311
312 $prodcomb->variation_weight = (float) price2num($weight_impact);
313
314 // for conf PRODUIT_MULTIPRICES
315 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
316 $prodcomb->variation_price = $level_price_impact[1];
317 $prodcomb->variation_price_percentage = $level_price_impact_percent[1];
318 } else {
319 $level_price_impact = array(1 => $price_impact);
320 $level_price_impact_percent = array(1 => $price_impact_percent);
321
322 $prodcomb->variation_price = $price_impact;
323 $prodcomb->variation_price_percentage = $price_impact_percent;
324 }
325
326 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
327 $prodcomb->combination_price_levels = array();
328 $maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
329 for ($i = 1; $i <= $maxi; $i++) {
330 $productCombinationLevel = new ProductCombinationLevel($db);
331 $productCombinationLevel->fk_product_attribute_combination = $prodcomb->id;
332 $productCombinationLevel->fk_price_level = $i;
333 $productCombinationLevel->variation_price = (float) $level_price_impact[$i];
334 $productCombinationLevel->variation_price_percentage = (bool) $level_price_impact_percent[$i];
335 $prodcomb->combination_price_levels[$i] = $productCombinationLevel;
336 }
337 }
338
339 $error = 0;
340 $db->begin();
341
342 // Update product variant ref
343 $product_child = new Product($db);
344 $product_child->fetch($prodcomb->fk_product_child);
345 $product_child->oldcopy = clone $product_child; // @phan-suppress-current-line PhanTypeMismatchProperty
346 $product_child->ref = $reference;
347
348 $result = $product_child->update($product_child->id, $user);
349 if ($result < 0) {
350 setEventMessages($product_child->error, $product_child->errors, 'errors');
351 $error++;
352 }
353
354 if (!$error) {
355 // Update product variant infos
356 $result = $prodcomb->update($user);
357 if ($result < 0) {
358 setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
359 $error++;
360 }
361 }
362
363 if (!$error) {
364 $db->commit();
365 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
366 header('Location: ' . dol_buildpath('/variants/combinations.php?id=' . $id, 2));
367 exit();
368 } else {
369 $db->rollback();
370 }
371}
372
373
374// Reload variants
375$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id, true);
376
377if ($action === 'confirm_deletecombination' && $usercancreate) {
378 if ($prodcomb->fetch($combination_id) > 0) {
379 $db->begin();
380
381 if ($prodcomb->delete($user) > 0 && (empty($delete_product) || ($delete_product == 'on' && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0))) {
382 $db->commit();
383 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
384 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));
385 exit();
386 }
387
388 $db->rollback();
389 setEventMessages($langs->trans('ProductCombinationAlreadyUsed'), null, 'errors');
390 $action = '';
391 }
392} elseif ($action === 'edit' && $usercancreate) {
393 if ($prodcomb->fetch($combination_id) < 0) {
394 dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
395 exit();
396 }
397
398 $product_child = new Product($db);
399 $product_child->fetch($prodcomb->fk_product_child);
400 $reference = (string) $product_child->ref;
401 $weight_impact = $prodcomb->variation_weight;
402 $price_impact = $prodcomb->variation_price;
403 $price_impact_percent = $prodcomb->variation_price_percentage;
404
405 $productCombination2ValuePairs1 = $prodcomb2val->fetchByFkCombination($combination_id);
406} elseif ($action === 'confirm_copycombination' && $usercancreate) {
407 //Check destination product
408 $dest_product = GETPOST('dest_product');
409
410 if ($prodstatic->fetch(0, $dest_product) > 0) {
411 //To prevent from copying to the same product
412 if ($prodstatic->ref != $object->ref) {
413 if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
414 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
415 exit();
416 } else {
417 setEventMessages($langs->trans('ErrorCopyProductCombinations'), null, 'errors');
418 }
419 }
420 } else {
421 setEventMessages($langs->trans('ErrorDestinationProductNotFound'), null, 'errors');
422 }
423}
424
425
426
427/*
428 * View
429 */
430
431$form = new Form($db);
432
433$title = $langs->trans("Variant");
434
435llxHeader("", $title);
436
437
438if (!empty($id) || !empty($ref)) {
439 $showbarcode = isModEnabled('barcode');
440 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'lire_advance')) {
441 $showbarcode = 0;
442 }
443
444 $head = product_prepare_head($object);
445 $titre = $langs->trans("CardProduct".$object->type);
446 $picto = $object->isService() ? 'service' : 'product';
447
448 print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto);
449
450 $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.((int) $object->type).'">'.$langs->trans("BackToList").'</a>';
451 $object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
452
453 dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '');
454
455 print '<div class="fichecenter">';
456
457 print '<div class="underbanner clearboth"></div>';
458 print '<table class="border centpercent tableforfield">';
459
460 // Type
461 if (isModEnabled("product") && isModEnabled("service")) {
462 $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
463 print '<tr><td class="titlefieldcreate">';
464 print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', (string) $object->type, $object, 0, $typeformat) : $langs->trans('Type');
465 print '</td><td>';
466 print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
467 print '</td></tr>';
468 }
469
470 // TVA
471 print '<tr><td class="titlefieldcreate">'.$langs->trans("DefaultTaxRate").'</td><td>';
472
473 $positiverates = '';
474 if (price2num($object->tva_tx)) {
475 $positiverates .= ($positiverates ? '/' : '').price2num($object->tva_tx);
476 }
477 if (price2num($object->localtax1_type)) {
478 $positiverates .= ($positiverates ? '/' : '').price2num($object->localtax1_tx);
479 }
480 if (price2num($object->localtax2_type)) {
481 $positiverates .= ($positiverates ? '/' : '').price2num($object->localtax2_tx);
482 }
483 if (empty($positiverates)) {
484 $positiverates = '0';
485 }
486 echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), true, $object->tva_npr);
487 /*
488 if ($object->default_vat_code)
489 {
490 print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
491 }
492 else print vatrate($object->tva_tx, true, $object->tva_npr, true);*/
493 print '</td></tr>';
494
495 // Price
496 print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
497 if ($object->price_base_type == 'TTC') {
498 print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
499 } else {
500 print price($object->price).' '.$langs->trans($object->price_base_type);
501 }
502 print '</td></tr>';
503
504 // Price minimum
505 print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
506 if ($object->price_base_type == 'TTC') {
507 print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type);
508 } else {
509 print price($object->price_min).' '.$langs->trans($object->price_base_type);
510 }
511 print '</td></tr>';
512
513 // Weight
514 print '<tr><td>'.$langs->trans("Weight").'</td><td>';
515 if ($object->weight != '') {
516 print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
517 } else {
518 print '&nbsp;';
519 }
520 print "</td></tr>\n";
521
522 print "</table>\n";
523
524 print '</div>';
525 print '<div class="clearboth"></div>';
526
527 print dol_get_fiche_end();
528
529 $listofvariantselected = '';
530
531 // Create or edit a variant
532 if ($action == 'add' || ($action == 'edit')) {
533 if ($action == 'add') {
534 $title = $langs->trans('NewProductCombination');
535 // print dol_get_fiche_head();
536 $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
537 //First, sanitize
538 $listofvariantselected = '<div id="parttoaddvariant">';
539 if (!empty($features)) {
540 $toprint = array();
541 foreach ($features as $feature) {
542 $explode = explode('-', $feature);
543 if ($prodattr->fetch((int) $explode[0]) <= 0 || $prodattr_val->fetch((int) $explode[1]) <= 0) {
544 continue;
545 }
546 $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #ddd;">' . $prodattr->label.' : '.$prodattr_val->value .
547 ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&subaction=delete&feature='.urlencode($feature).'">' . img_delete() . '</a></li>';
548 }
549 $listofvariantselected .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
550 }
551 $listofvariantselected .= '</div>';
552 //print dol_get_fiche_end();
553 } else {
554 $title = $langs->trans('EditProductCombination');
555 }
556
557 $prodattr_alljson = null;
558 $prodattr_all = null;
559 if ($action == 'add') {
560 $prodattr_all = $prodattr->fetchAll();
561
562 if (!$selected && !empty($prodattr_all)) {
563 $selected = $prodattr_all[key($prodattr_all)]->id;
564 }
565
566 $prodattr_alljson = array();
567
568 foreach ($prodattr_all as $each) {
569 $prodattr_alljson[$each->id] = $each;
570 } ?>
571
572 <script type="text/javascript">
573
574 variants_available = <?php echo json_encode($prodattr_alljson, JSON_PARTIAL_OUTPUT_ON_ERROR); ?>;
575 variants_selected = {
576 index: [],
577 info: []
578 };
579
580 <?php
581 foreach ($productCombination2ValuePairs1 as $pc2v) {
582 $prodattr_val->fetch($pc2v->fk_prod_attr_val); ?>
583 variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>);
584 variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = {
585 attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>],
586 value: {
587 id: <?php echo $pc2v->fk_prod_attr_val ?>,
588 label: '<?php echo $prodattr_val->value ?>'
589 }
590 };
591 <?php
592 } ?>
593
594 restoreAttributes = function() {
595 jQuery("select[name=attribute]").empty().append('<option value="-1">&nbsp;</option>');
596
597 jQuery.each(variants_available, function (key, val) {
598 if (jQuery.inArray(val.id, variants_selected.index) == -1) {
599 jQuery("select[name=attribute]").append('<option value="' + val.id + '">' + val.label + '</option>');
600 }
601 });
602 };
603
604
605 jQuery(document).ready(function() {
606 jQuery("select#attribute").change(function () {
607 console.log("Change of field variant attribute");
608 var select = jQuery("select#value");
609
610 if (!jQuery(this).val().length || jQuery(this).val() == '-1') {
611 select.empty();
612 select.append('<option value="-1">&nbsp;</option>');
613 return;
614 }
615
616 select.empty().append('<option value="">Loading...</option>');
617
618 jQuery.getJSON("ajax/get_attribute_values.php", {
619 id: jQuery(this).val()
620 }, function(data) {
621 if (data.error) {
622 select.empty();
623 select.append('<option value="-1">&nbsp;</option>');
624 return alert(data.error);
625 }
626
627 select.empty();
628 select.append('<option value="-1">&nbsp;</option>');
629
630 jQuery(data).each(function (key, val) {
631 keyforoption = val.id
632 valforoption = val.value
633 select.append('<option value="' + keyforoption + '">' + valforoption + '</option>');
634 });
635 });
636 });
637 });
638 </script>
639
640 <?php
641 }
642
643 print '<br>';
644
645 print load_fiche_titre($title);
646
647 print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">'."\n";
648 print '<input type="hidden" name="token" value="'.newToken().'">';
649 print '<input type="hidden" name="action" value="'.(($combination_id > 0) ? "update" : "create").'">'."\n";
650 if ($combination_id > 0) {
651 print '<input type="hidden" name="combination_id" value="'.$combination_id.'">'."\n";
652 }
653
654 print dol_get_fiche_head();
655
656
657 if ($action == 'add') {
658 print '<table class="border" style="width: 100%">';
659 print "<!-- Variant -->\n";
660 print '<tr>';
661 print '<td class="titlefieldcreate fieldrequired"><label for="attribute">'.$langs->trans('ProductAttribute').'</label></td>';
662 print '<td>';
663 if (is_array($prodattr_all)) {
664 print '<select class="flat minwidth100" id="attribute" name="attribute">';
665 print '<option value="-1">&nbsp;</option>';
666 foreach ($prodattr_all as $attr) {
667 //print '<option value="'.$attr->id.'"'.($attr->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
668 print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
669 }
670 print '</select>';
671 }
672
673 $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
674 print $form->textwithpicto('', $htmltext);
675 /*print ' &nbsp; &nbsp; <a href="'.DOL_URL_ROOT.'/variants/create.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=add&token='.newToken().'&id='.$object->id).'">';
676 print $langs->trans("Create");
677 print '</a>';*/
678
679 print '</td>';
680 print '</tr>'; ?>
681 <!-- Value -->
682 <tr>
683 <td class="fieldrequired"><label for="value"><?php echo $langs->trans('Value') ?></label></td>
684 <td>
685 <select class="flat minwidth100" id="value" name="value">
686 <option value="-1">&nbsp;</option>
687 </select>
688 <?php
689 $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
690 print $form->textwithpicto('', $htmltext);
691 /*
692 print ' &nbsp; &nbsp; <a href="'.DOL_URL_ROOT.'/variants/create.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=add&token='.newToken().'&id='.$object->id).'">';
693 print $langs->trans("Create");
694 print '</a>';
695 */ ?>
696 </td>
697 </tr>
698 <tr>
699 <td></td><td>
700 <input type="submit" class="button" name="selectvariant" id="selectvariant" value="<?php echo dol_escape_htmltag($langs->trans("SelectCombination")); ?>">
701 </td>
702 </tr>
703 <?php
704 print '<tr><td></td><td>';
705 print $listofvariantselected;
706 print '</td>';
707 print '</tr>';
708
709 print '</table>';
710 print '<hr>';
711 }
712
713 if (is_array($productCombination2ValuePairs1)) {
714 print '<table class="border" style="width: 100%">';
715
716 // When in edit mode
717 if (is_array($productCombination2ValuePairs1) && count($productCombination2ValuePairs1)) {
718 ?>
719 <tr>
720 <td class="titlefieldcreate tdtop"><label for="features"><?php echo $langs->trans('Attributes') ?></label></td>
721 <td class="tdtop">
722 <div class="inline-block valignmiddle quatrevingtpercent">
723 <?php
724 foreach ($productCombination2ValuePairs1 as $pc2v) {
725 $result1 = $prodattr->fetch($pc2v->fk_prod_attr);
726 $result2 = $prodattr_val->fetch($pc2v->fk_prod_attr_val);
727 if ($result1 > 0 && $result2 > 0) {
728 print $prodattr->label.' : '.$prodattr_val->value.'<br>';
729 // TODO Add delete link
730 }
731 } ?>
732 </div>
733 <!-- <div class="inline-block valignmiddle">
734 <a href="#" class="inline-block valignmiddle button" id="delfeature"><?php echo img_edit_remove() ?></a>
735 </div>-->
736 </td>
737 <td>
738 </td>
739 </tr>
740 <?php
741 } ?>
742 <tr>
743 <td><label for="reference"><?php echo $langs->trans('Reference') ?></label></td>
744 <td><input type="text" id="reference" name="reference" value="<?php echo trim($reference) ?>" spellcheck="false"></td>
745 </tr>
746 <?php
747 if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
748 ?>
749 <tr>
750 <td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td>
751 <td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
752
753 <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>
754 </td>
755 </tr>
756 <?php
757 } else {
758 $prodcomb->fetchCombinationPriceLevels();
759
760 $maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
761 for ($i = 1; $i <= $maxi; $i++) {
762 $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i;
763 $text = $langs->trans('ImpactOnPriceLevel', $i).' - '.getDolGlobalString($keyforlabel);
764 print '<tr>';
765 print '<td><label for="level_price_impact_'.$i.'">'.$text.'</label>';
766 if ($i === 1) {
767 print '<br/><a id="apply-price-impact-to-all-level" class="classfortooltip" href="#" title="'.$langs->trans('ApplyToAllPriceImpactLevelHelp').'">('.$langs->trans('ApplyToAllPriceImpactLevel').')</a>';
768 }
769 print '</td>';
770 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).'">';
771 print '<span class="paddingleft"></span>';
772 print '<input type="checkbox" class="level_price_impact_percent" id="level_price_impact_percent_'.$i.'" name="level_price_impact_percent['.$i.']" '.($prodcomb->combination_price_levels[$i]->variation_price_percentage ? ' checked' : '').'> <label for="level_price_impact_percent_'.$i.'">'.$langs->trans('PercentageVariation').'</label>';
773
774 print '</td>';
775 print '</tr>';
776 }
777 }
778
779 if ($object->isProduct()) {
780 print '<tr>';
781 print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>';
782 print '<td><input type="text" id="weight_impact" name="weight_impact" value="'.price($weight_impact).'"></td>';
783 print '</tr>';
784 }
785
786 print '<tr>';
787 print '<td><label for="clone_categories">'.$langs->trans('CloneCategoriesProduct').'</label></td>';
788 print '<td><input type="checkbox" id="clone_categories" name="clone_categories"></td>';
789 print '</tr>';
790
791 print '</table>';
792 }
793
794 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
795 ?>
796 <script>
797 $(document).ready(function() {
798 // Apply level 1 impact to all prices impact levels
799 $('body').on('click', '#apply-price-impact-to-all-level', function(e) {
800 e.preventDefault();
801 let priceImpact = $( "#level_price_impact_1" ).val();
802 let priceImpactPrecent = $( "#level_price_impact_percent_1" ).prop("checked");
803
804 let multipricelimit = <?php print getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); ?>
805
806 for (let i = 2; i <= multipricelimit; i++) {
807 $( "#level_price_impact_" + i ).val(priceImpact);
808 $( "#level_price_impact_percent_" + i ).prop("checked", priceImpactPrecent);
809 }
810 });
811 });
812 </script>
813 <?php
814 }
815
816 print dol_get_fiche_end(); ?>
817
818 <div style="text-align: center">
819 <input type="submit" name="create" <?php if (!is_array($productCombination2ValuePairs1)) {
820 print ' disabled="disabled"';
821 } ?> value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans("Save") ?>" class="button button-save">
822 &nbsp;
823 <input type="submit" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>" class="button button-cancel">
824 </div>
825
826 <?php
827
828 print '</form>';
829 } else {
830 if ($action === 'delete') {
831 if ($prodcomb->fetch($combination_id) > 0) {
832 $prodstatic->fetch($prodcomb->fk_product_child);
833
834 print $form->formconfirm(
835 "combinations.php?id=".urlencode((string) ($id))."&combination_id=".urlencode((string) ($combination_id)),
836 $langs->trans('Delete'),
837 $langs->trans('ProductCombinationDeleteDialog', $prodstatic->ref),
838 "confirm_deletecombination",
839 array(array('label' => $langs->trans('DeleteLinkedProduct'), 'type' => 'checkbox', 'name' => 'delete_product', 'value' => false)),
840 0,
841 1
842 );
843 }
844 } elseif ($action === 'copy') {
845 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);
846 }
847
848 $comb2val = new ProductCombination2ValuePair($db);
849
850 if ($productCombinations) {
851 ?>
852
853 <script type="text/javascript">
854 jQuery(document).ready(function() {
855
856 jQuery('input[name="select_all"]').click(function() {
857
858 if (jQuery(this).prop('checked')) {
859 var checked = true;
860 } else {
861 var checked = false;
862 }
863
864 jQuery('table.liste input[type="checkbox"]').prop('checked', checked);
865 });
866
867 jQuery('input[name^="select["]').click(function() {
868 jQuery('input[name="select_all"]').prop('checked', false);
869 });
870
871 });
872 </script>
873
874 <?php
875 }
876
877 // Buttons
878 print '<div class="tabsAction">';
879
880 print ' <div class="inline-block divButAction">';
881
882 print '<a href="combinations.php?id='.$object->id.'&action=add&token='.newToken().'" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; // NewVariant
883
884 if ($productCombinations) {
885 print '<a href="combinations.php?id='.$object->id.'&action=copy&token='.newToken().'" class="butAction">'.$langs->trans('PropagateVariant').'</a>';
886 }
887
888 print ' </div>';
889
890 print '</div>';
891
892
893
894 $arrayofselected = is_array($toselect) ? $toselect : array();
895
896
897 // List of variants
898 print '<form method="POST" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">';
899 print '<input type="hidden" name="token" value="'.newToken().'">';
900 print '<input type="hidden" name="action" value="massaction">';
901 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
902
903 // List of mass actions available
904
905 $aaa = '';
906 if (count($productCombinations)) {
907 $aaa = '<select id="bulk_action" name="massaction" class="minwidth250">';
908 $aaa .= ' <option value="nothing">&nbsp;</option>';
909 $aaa .= ' <option value="not_buy" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusNotOnBuy'))).'">'.$langs->trans('ProductStatusNotOnBuy').'</option>';
910 $aaa .= ' <option value="not_sell" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusNotOnSell'))).'">'.$langs->trans('ProductStatusNotOnSell').'</option>';
911 $aaa .= ' <option value="on_buy" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusOnBuy'))).'">'.$langs->trans('ProductStatusOnBuy').'</option>';
912 $aaa .= ' <option value="on_sell" data-html="'.dol_escape_htmltag(img_picto($langs->trans("SetToStatus"), 'stop-circle', 'class="pictofixedwidth"').$langs->trans('SetToStatus', $langs->transnoentitiesnoconv('ProductStatusOnSell'))).'">'.$langs->trans('ProductStatusOnSell').'</option>';
913 $aaa .= ' <option value="delete" data-html="'.dol_escape_htmltag(img_picto($langs->trans("Delete"), 'delete', 'class="pictofixedwidth"').$langs->trans('Delete')).'">'.$langs->trans('Delete').'</option>';
914 $aaa .= '</select>';
915 $aaa .= ajax_combobox("bulk_action");
916 $aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button small">';
917 }
918 $massactionbutton = $aaa;
919
920 $title = $langs->trans("ProductCombinations");
921
922 print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $aaa, 0);
923
924 print '<div class="div-table-responsive">'; ?>
925 <table class="liste">
926 <tr class="liste_titre">
927 <?php
928 // Action column
929 if ($conf->main_checkbox_left_column) {
930 print '<td class="liste_titre center">';
931 $searchpicto = $form->showCheckAddButtons('checkforselect', 1);
932 print $searchpicto;
933 print '</td>';
934 } ?>
935 <td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
936 <td class="liste_titre"><?php echo $langs->trans('Attributes') ?></td>
937 <td class="liste_titre right"><?php echo $langs->trans('PriceImpact') ?></td>
938 <?php if ($object->isProduct()) {
939 print'<td class="liste_titre right">'.$langs->trans('WeightImpact').'</td>';
940 } ?>
941 <td class="liste_titre center"><?php echo $langs->trans('OnSell') ?></td>
942 <td class="liste_titre center"><?php echo $langs->trans('OnBuy') ?></td>
943 <td class="liste_titre"></td>
944 <?php
945 // Action column
946 if (!$conf->main_checkbox_left_column) {
947 print '<td class="liste_titre center">';
948 $searchpicto = $form->showCheckAddButtons('checkforselect', 1);
949 print $searchpicto;
950 print '</td>';
951 } ?>
952 </tr>
953 <?php
954
955 if (count($productCombinations)) {
956 foreach ($productCombinations as $currcomb) {
957 $prodstatic->fetch($currcomb->fk_product_child);
958 print '<tr class="oddeven">';
959
960 // Action column
961 if ($conf->main_checkbox_left_column) {
962 print '<td class="nowrap center">';
963 if (!empty($productCombinations) || $massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
964 $selected = 0;
965 if (in_array($prodstatic->id, $arrayofselected)) {
966 $selected = 1;
967 }
968 print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
969 }
970 print '</td>';
971 }
972
973 print '<td>'.$prodstatic->getNomUrl(1).'</td>';
974 print '<td>';
975 $arraycomb = $comb2val->fetchByFkCombination($currcomb->id);
976 if (is_array($arraycomb)) {
977 foreach ($arraycomb as $pc2v) {
978 print dolPrintHTML((string) $pc2v).'<br>'; // $pc2v is object ProductCombination2ValuePair, the (string) use the __toString to output it.
979 }
980 }
981 print '</td>';
982 print '<td class="right">'.($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '').'</td>';
983 if ($object->isProduct()) {
984 print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuringUnitString(0, 'weight', $prodstatic->weight_units).'</td>';
985 }
986 print '<td class="center">'.$prodstatic->getLibStatut(2, 0).'</td>';
987 print '<td class="center">'.$prodstatic->getLibStatut(2, 1).'</td>';
988
989 print '<td class="right">';
990 print '<a class="paddingleft paddingright editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=edit&token='.newToken().'&combination_id='.$currcomb->id.'">'.img_edit().'</a>';
991 print '<a class="paddingleft paddingright" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=delete&token='.newToken().'&combination_id='.$currcomb->id.'">'.img_delete().'</a>';
992 print '</td>';
993
994 // Action column
995 if (!$conf->main_checkbox_left_column) {
996 print '<td class="nowrap center">';
997 if (!empty($productCombinations) || $massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
998 $selected = 0;
999 if (in_array($prodstatic->id, $arrayofselected)) {
1000 $selected = 1;
1001 }
1002 print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
1003 }
1004 print '</td>';
1005 }
1006
1007 print '</tr>';
1008 }
1009 } else {
1010 print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
1011 }
1012 print '</table>';
1013 print '</div>';
1014 print '</form>';
1015 }
1016}
1017
1018// End of page
1019llxFooter();
1020$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:476
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class ProductAttribute Used to represent a Product attribute Examples:
Class ProductAttributeValue Used to represent a product attribute value.
Class ProductCombination2ValuePair Used to represent the relation between a variant and its attribute...
Class ProductCombination Used to represent the relation between a product and one of its variants.
Class ProductCombinationLevel Used to represent a product combination Level.
Class to manage products or services.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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_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.
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.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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.
img_edit_remove($titlealt='default', $other='')
Show logo "-".
treeview li table
No Email.
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
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
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]]]',...
Definition repair.php:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.