dolibarr 24.0.0-beta
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$productCombination2ValuePairs1 = array();
154
155if (($action == 'add' || $action == 'create') && $usercancreate && empty($massaction) && !GETPOST('selectvariant', 'alpha') && empty($subaction)) { // We click on Create all defined combinations
156 //$features = GETPOST('features', 'array');
157 $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
158
159 if (!$features) {
160 if ($action == 'create') { // Test on permission already done
161 setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
162 }
163 } else {
164 $reference = trim($reference);
165 if (empty($reference)) {
166 $reference = false;
167 }
168 $weight_impact = price2num($weight_impact);
169 $price_impact = price2num($price_impact);
170
171 if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
172 $level_price_impact = array(1 => $price_impact);
173 $level_price_impact_percent = array(1 => $price_impact_percent);
174 }
175
176 $sanit_features = array();
177
178 //First, sanitize
179 foreach ($features as $feature) {
180 $explode = explode('-', $feature);
181 if ($prodattr->fetch((int) $explode[0]) <= 0 || $prodattr_val->fetch((int) $explode[1]) <= 0) {
182 continue;
183 }
184
185 // Valuepair
186 $sanit_features[(int) $explode[0]] = (int) $explode[1];
187
189 $tmp->fk_prod_attr = (int) $explode[0];
190 $tmp->fk_prod_attr_val = (int) $explode[1];
191
192 $productCombination2ValuePairs1[] = $tmp;
193 }
194
195 $db->begin();
196
197 // sanit_feature is an array with 1 (and only 1) value per attribute.
198 // For example: Color->blue, Size->Small, Option->2
199 if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) {
200 $result = $prodcomb->createProductCombination($user, $object, $sanit_features, array(), $level_price_impact_percent, $level_price_impact, (float) $weight_impact, $reference, '', $clone_categories);
201 if ($result > 0) {
202 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
203 unset($_SESSION['addvariant_'.$object->id]);
204
205 $db->commit();
206 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
207 exit();
208 } else {
209 $langs->load("errors");
210 setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
211 }
212 } else {
213 setEventMessages($langs->trans('ErrorRecordAlreadyExists'), null, 'errors');
214 }
215
216 $db->rollback();
217 }
218} elseif (!empty($massaction)) {
219 $bulkaction = $massaction;
220 $error = 0;
221
222 $db->begin();
223
224 foreach ($toselect as $prodid) {
225 // need create new of Product to prevent rename dir behavior
226 $prodstatic = new Product($db);
227 if ($prodstatic->fetch($prodid) < 0) {
228 continue;
229 }
230
231 if ($bulkaction == 'on_sell') {
232 $prodstatic->status = 1;
233 $res = $prodstatic->update($prodstatic->id, $user);
234 if ($res <= 0) {
235 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
236 $error++;
237 break;
238 }
239 } elseif ($bulkaction == 'on_buy') {
240 $prodstatic->status_buy = 1;
241 $res = $prodstatic->update($prodstatic->id, $user);
242 if ($res <= 0) {
243 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
244 $error++;
245 break;
246 }
247 } elseif ($bulkaction == 'not_sell') {
248 $prodstatic->status = 0;
249 $res = $prodstatic->update($prodstatic->id, $user);
250 if ($res <= 0) {
251 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
252 $error++;
253 break;
254 }
255 } elseif ($bulkaction == 'not_buy') {
256 $prodstatic->status_buy = 0;
257 $res = $prodstatic->update($prodstatic->id, $user);
258 if ($res <= 0) {
259 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
260 $error++;
261 break;
262 }
263 } elseif ($bulkaction == 'delete') {
264 $res = $prodstatic->delete($user, $prodstatic->id);
265 if ($res <= 0) {
266 setEventMessages($prodstatic->error, $prodstatic->errors, 'errors');
267 $error++;
268 break;
269 }
270 } else {
271 break;
272 }
273 }
274
275 if ($error) {
276 $db->rollback();
277 if (empty($prodstatic->error)) {
278 setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
279 }
280 } else {
281 $db->commit();
282 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
283 }
284} elseif ($action === 'update' && $combination_id > 0 && $usercancreate) {
285 if ($prodcomb->fetch($combination_id) < 0) {
286 dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
287 exit();
288 }
289
290 $prodcomb->variation_weight = (float) price2num($weight_impact);
291
292 // for conf PRODUIT_MULTIPRICES
293 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
294 $prodcomb->variation_price = $level_price_impact[1];
295 $prodcomb->variation_price_percentage = $level_price_impact_percent[1];
296 } else {
297 $level_price_impact = array(1 => $price_impact);
298 $level_price_impact_percent = array(1 => $price_impact_percent);
299
300 $prodcomb->variation_price = $price_impact;
301 $prodcomb->variation_price_percentage = $price_impact_percent;
302 }
303
304 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
305 $prodcomb->combination_price_levels = array();
306 $maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
307 for ($i = 1; $i <= $maxi; $i++) {
308 $productCombinationLevel = new ProductCombinationLevel($db);
309 $productCombinationLevel->fk_product_attribute_combination = $prodcomb->id;
310 $productCombinationLevel->fk_price_level = $i;
311 $productCombinationLevel->variation_price = (float) $level_price_impact[$i];
312 $productCombinationLevel->variation_price_percentage = (bool) $level_price_impact_percent[$i];
313 $prodcomb->combination_price_levels[$i] = $productCombinationLevel;
314 }
315 }
316
317 $error = 0;
318 $db->begin();
319
320 // Update product variant ref
321 $product_child = new Product($db);
322 $product_child->fetch($prodcomb->fk_product_child);
323 $product_child->oldcopy = clone $product_child; // @phan-suppress-current-line PhanTypeMismatchProperty
324 $product_child->ref = $reference;
325
326 $result = $product_child->update($product_child->id, $user);
327 if ($result < 0) {
328 setEventMessages($product_child->error, $product_child->errors, 'errors');
329 $error++;
330 }
331
332 if (!$error) {
333 // Update product variant infos
334 $result = $prodcomb->update($user);
335 if ($result < 0) {
336 setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
337 $error++;
338 }
339 }
340
341 if (!$error) {
342 $db->commit();
343 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
344 header('Location: ' . dol_buildpath('/variants/combinations.php?id=' . $id, 2));
345 exit();
346 } else {
347 $db->rollback();
348 }
349}
350
351
352// Reload variants
353$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id, true);
354
355if ($action === 'confirm_deletecombination' && $usercancreate) {
356 if ($prodcomb->fetch($combination_id) > 0) {
357 $db->begin();
358
359 if ($prodcomb->delete($user) > 0 && (empty($delete_product) || ($delete_product == 'on' && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0))) {
360 $db->commit();
361 setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
362 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));
363 exit();
364 }
365
366 $db->rollback();
367 setEventMessages($langs->trans('ProductCombinationAlreadyUsed'), null, 'errors');
368 $action = '';
369 }
370} elseif ($action === 'edit' && $usercancreate) {
371 if ($prodcomb->fetch($combination_id) < 0) {
372 dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
373 exit();
374 }
375
376 $product_child = new Product($db);
377 $product_child->fetch($prodcomb->fk_product_child);
378 $reference = (string) $product_child->ref;
379 $weight_impact = $prodcomb->variation_weight;
380 $price_impact = $prodcomb->variation_price;
381 $price_impact_percent = $prodcomb->variation_price_percentage;
382
383 $productCombination2ValuePairs1 = $prodcomb2val->fetchByFkCombination($combination_id);
384} elseif ($action === 'confirm_copycombination' && $usercancreate) {
385 //Check destination product
386 $dest_product = GETPOST('dest_product');
387
388 if ($prodstatic->fetch(0, $dest_product) > 0) {
389 //To prevent from copying to the same product
390 if ($prodstatic->ref != $object->ref) {
391 if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
392 header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
393 exit();
394 } else {
395 setEventMessages($langs->trans('ErrorCopyProductCombinations'), null, 'errors');
396 }
397 }
398 } else {
399 setEventMessages($langs->trans('ErrorDestinationProductNotFound'), null, 'errors');
400 }
401}
402
403
404
405/*
406 * View
407 */
408
409$form = new Form($db);
410
411$title = $langs->trans("Variant");
412
413llxHeader("", $title);
414
415
416if (!empty($id) || !empty($ref)) {
417 $showbarcode = isModEnabled('barcode');
418 if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'lire_advance')) {
419 $showbarcode = 0;
420 }
421
422 $head = product_prepare_head($object);
423 $titre = $langs->trans("CardProduct".$object->type);
424 $picto = $object->isService() ? 'service' : 'product';
425
426 print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto);
427
428 $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.((int) $object->type).'">'.$langs->trans("BackToList").'</a>';
429 $object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
430
431 dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '');
432
433 print '<div class="fichecenter">';
434
435 print '<div class="underbanner clearboth"></div>';
436 print '<table class="border centpercent tableforfield">';
437
438 // Type
439 if (isModEnabled("product") && isModEnabled("service")) {
440 $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
441 print '<tr><td class="titlefieldcreate">';
442 print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', (string) $object->type, $object, 0, $typeformat) : $langs->trans('Type');
443 print '</td><td>';
444 print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
445 print '</td></tr>';
446 }
447
448 // TVA
449 print '<tr><td class="titlefieldcreate">'.$langs->trans("DefaultTaxRate").'</td><td>';
450
451 $positiverates = '';
452 if (price2num($object->tva_tx)) {
453 $positiverates .= ($positiverates ? '/' : '').price2num($object->tva_tx);
454 }
455 if (price2num($object->localtax1_type)) {
456 $positiverates .= ($positiverates ? '/' : '').price2num($object->localtax1_tx);
457 }
458 if (price2num($object->localtax2_type)) {
459 $positiverates .= ($positiverates ? '/' : '').price2num($object->localtax2_tx);
460 }
461 if (empty($positiverates)) {
462 $positiverates = '0';
463 }
464 echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), true, $object->tva_npr);
465 /*
466 if ($object->default_vat_code)
467 {
468 print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
469 }
470 else print vatrate($object->tva_tx, true, $object->tva_npr, true);*/
471 print '</td></tr>';
472
473 // Price
474 print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
475 if ($object->price_base_type == 'TTC') {
476 print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
477 } else {
478 print price($object->price).' '.$langs->trans($object->price_base_type);
479 }
480 print '</td></tr>';
481
482 // Price minimum
483 print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
484 if ($object->price_base_type == 'TTC') {
485 print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type);
486 } else {
487 print price($object->price_min).' '.$langs->trans($object->price_base_type);
488 }
489 print '</td></tr>';
490
491 // Weight
492 print '<tr><td>'.$langs->trans("Weight").'</td><td>';
493 if ($object->weight != '') {
494 print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
495 } else {
496 print '&nbsp;';
497 }
498 print "</td></tr>\n";
499
500 print "</table>\n";
501
502 print '</div>';
503 print '<div class="clearboth"></div>';
504
505 print dol_get_fiche_end();
506
507 $listofvariantselected = '';
508
509 // Create or edit a variant
510 if ($action == 'add' || ($action == 'edit')) {
511 if ($action == 'add') {
512 $title = $langs->trans('NewProductCombination');
513 // print dol_get_fiche_head();
514 $features = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
515 //First, sanitize
516 $listofvariantselected = '<div id="parttoaddvariant">';
517 if (!empty($features)) {
518 $toprint = array();
519 foreach ($features as $feature) {
520 $explode = explode('-', $feature);
521 if ($prodattr->fetch((int) $explode[0]) <= 0 || $prodattr_val->fetch((int) $explode[1]) <= 0) {
522 continue;
523 }
524 $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #ddd;">' . $prodattr->label.' : '.$prodattr_val->value .
525 ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&subaction=delete&feature='.urlencode($feature).'">' . img_delete() . '</a></li>';
526 }
527 $listofvariantselected .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
528 }
529 $listofvariantselected .= '</div>';
530 //print dol_get_fiche_end();
531 } else {
532 $title = $langs->trans('EditProductCombination');
533 }
534
535 $prodattr_alljson = null;
536 $prodattr_all = null;
537 if ($action == 'add') {
538 $prodattr_all = $prodattr->fetchAll();
539
540 if (!$selected && !empty($prodattr_all)) {
541 $selected = $prodattr_all[key($prodattr_all)]->id;
542 }
543
544 $prodattr_alljson = array();
545
546 foreach ($prodattr_all as $each) {
547 $prodattr_alljson[$each->id] = $each;
548 } ?>
549
550 <script type="text/javascript">
551
552 variants_available = <?php echo json_encode($prodattr_alljson, JSON_PARTIAL_OUTPUT_ON_ERROR); ?>;
553 variants_selected = {
554 index: [],
555 info: []
556 };
557
558 <?php
559 foreach ($productCombination2ValuePairs1 as $pc2v) {
560 $prodattr_val->fetch($pc2v->fk_prod_attr_val); ?>
561 variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>);
562 variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = {
563 attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>],
564 value: {
565 id: <?php echo $pc2v->fk_prod_attr_val ?>,
566 label: '<?php echo $prodattr_val->value ?>'
567 }
568 };
569 <?php
570 } ?>
571
572 restoreAttributes = function() {
573 jQuery("select[name=attribute]").empty().append('<option value="-1">&nbsp;</option>');
574
575 jQuery.each(variants_available, function (key, val) {
576 if (jQuery.inArray(val.id, variants_selected.index) == -1) {
577 jQuery("select[name=attribute]").append('<option value="' + val.id + '">' + val.label + '</option>');
578 }
579 });
580 };
581
582
583 jQuery(document).ready(function() {
584 jQuery("select#attribute").change(function () {
585 console.log("Change of field variant attribute");
586 var select = jQuery("select#value");
587
588 if (!jQuery(this).val().length || jQuery(this).val() == '-1') {
589 select.empty();
590 select.append('<option value="-1">&nbsp;</option>');
591 return;
592 }
593
594 select.empty().append('<option value="">Loading...</option>');
595
596 jQuery.getJSON("ajax/get_attribute_values.php", {
597 id: jQuery(this).val()
598 }, function(data) {
599 if (data.error) {
600 select.empty();
601 select.append('<option value="-1">&nbsp;</option>');
602 return alert(data.error);
603 }
604
605 select.empty();
606 select.append('<option value="-1">&nbsp;</option>');
607
608 jQuery(data).each(function (key, val) {
609 keyforoption = val.id
610 valforoption = val.value
611 select.append('<option value="' + keyforoption + '">' + valforoption + '</option>');
612 });
613 });
614 });
615 });
616 </script>
617
618 <?php
619 }
620
621 print '<br>';
622
623 print load_fiche_titre($title);
624
625 print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">'."\n";
626 print '<input type="hidden" name="token" value="'.newToken().'">';
627 print '<input type="hidden" name="action" value="'.(($combination_id > 0) ? "update" : "create").'">'."\n";
628 if ($combination_id > 0) {
629 print '<input type="hidden" name="combination_id" value="'.$combination_id.'">'."\n";
630 }
631
632 print dol_get_fiche_head();
633
634
635 if ($action == 'add') {
636 print '<table class="border" style="width: 100%">';
637 print "<!-- Variant -->\n";
638 print '<tr>';
639 print '<td class="titlefieldcreate fieldrequired"><label for="attribute">'.$langs->trans('ProductAttribute').'</label></td>';
640 print '<td>';
641 if (is_array($prodattr_all)) {
642 print '<select class="flat minwidth100" id="attribute" name="attribute">';
643 print '<option value="-1">&nbsp;</option>';
644 foreach ($prodattr_all as $attr) {
645 //print '<option value="'.$attr->id.'"'.($attr->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
646 print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
647 }
648 print '</select>';
649 }
650
651 $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
652 print $form->textwithpicto('', $htmltext);
653 /*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).'">';
654 print $langs->trans("Create");
655 print '</a>';*/
656
657 print '</td>';
658 print '</tr>'; ?>
659 <!-- Value -->
660 <tr>
661 <td class="fieldrequired"><label for="value"><?php echo $langs->trans('Value') ?></label></td>
662 <td>
663 <select class="flat minwidth100" id="value" name="value">
664 <option value="-1">&nbsp;</option>
665 </select>
666 <?php
667 $htmltext = $langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
668 print $form->textwithpicto('', $htmltext);
669 /*
670 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).'">';
671 print $langs->trans("Create");
672 print '</a>';
673 */ ?>
674 </td>
675 </tr>
676 <tr>
677 <td></td><td>
678 <input type="submit" class="button" name="selectvariant" id="selectvariant" value="<?php echo dol_escape_htmltag($langs->trans("SelectCombination")); ?>">
679 </td>
680 </tr>
681 <?php
682 print '<tr><td></td><td>';
683 print $listofvariantselected;
684 print '</td>';
685 print '</tr>';
686
687 print '</table>';
688 print '<hr>';
689 }
690
691 if (is_array($productCombination2ValuePairs1)) {
692 print '<table class="border" style="width: 100%">';
693
694 // When in edit mode
695 if (is_array($productCombination2ValuePairs1) && count($productCombination2ValuePairs1)) {
696 ?>
697 <tr>
698 <td class="titlefieldcreate tdtop"><label for="features"><?php echo $langs->trans('Attributes') ?></label></td>
699 <td class="tdtop">
700 <div class="inline-block valignmiddle quatrevingtpercent">
701 <?php
702 foreach ($productCombination2ValuePairs1 as $pc2v) {
703 $result1 = $prodattr->fetch($pc2v->fk_prod_attr);
704 $result2 = $prodattr_val->fetch($pc2v->fk_prod_attr_val);
705 if ($result1 > 0 && $result2 > 0) {
706 print $prodattr->label.' : '.$prodattr_val->value.'<br>';
707 // TODO Add delete link
708 }
709 } ?>
710 </div>
711 <!-- <div class="inline-block valignmiddle">
712 <a href="#" class="inline-block valignmiddle button" id="delfeature"><?php echo img_edit_remove() ?></a>
713 </div>-->
714 </td>
715 <td>
716 </td>
717 </tr>
718 <?php
719 } ?>
720 <tr>
721 <td><label for="reference"><?php echo $langs->trans('Reference') ?></label></td>
722 <td><input type="text" id="reference" name="reference" value="<?php echo trim($reference) ?>" spellcheck="false"></td>
723 </tr>
724 <?php
725 if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
726 ?>
727 <tr>
728 <td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td>
729 <td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
730
731 <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>
732 </td>
733 </tr>
734 <?php
735 } else {
736 $prodcomb->fetchCombinationPriceLevels();
737
738 $maxi = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT');
739 for ($i = 1; $i <= $maxi; $i++) {
740 $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i;
741 $text = $langs->trans('ImpactOnPriceLevel', $i).' - '.getDolGlobalString($keyforlabel);
742 print '<tr>';
743 print '<td><label for="level_price_impact_'.$i.'">'.$text.'</label>';
744 if ($i === 1) {
745 print '<br/><a id="apply-price-impact-to-all-level" class="classfortooltip" href="#" title="'.$langs->trans('ApplyToAllPriceImpactLevelHelp').'">('.$langs->trans('ApplyToAllPriceImpactLevel').')</a>';
746 }
747 print '</td>';
748 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).'">';
749 print '<span class="paddingleft"></span>';
750 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>';
751
752 print '</td>';
753 print '</tr>';
754 }
755 }
756
757 if ($object->isProduct()) {
758 print '<tr>';
759 print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>';
760 print '<td><input type="text" id="weight_impact" name="weight_impact" value="'.price($weight_impact).'"></td>';
761 print '</tr>';
762 }
763
764 print '<tr>';
765 print '<td><label for="clone_categories">'.$langs->trans('CloneCategoriesProduct').'</label></td>';
766 print '<td><input type="checkbox" id="clone_categories" name="clone_categories"></td>';
767 print '</tr>';
768
769 print '</table>';
770 }
771
772 if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
773 ?>
774 <script>
775 $(document).ready(function() {
776 // Apply level 1 impact to all prices impact levels
777 $('body').on('click', '#apply-price-impact-to-all-level', function(e) {
778 e.preventDefault();
779 let priceImpact = $( "#level_price_impact_1" ).val();
780 let priceImpactPrecent = $( "#level_price_impact_percent_1" ).prop("checked");
781
782 let multipricelimit = <?php print getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); ?>
783
784 for (let i = 2; i <= multipricelimit; i++) {
785 $( "#level_price_impact_" + i ).val(priceImpact);
786 $( "#level_price_impact_percent_" + i ).prop("checked", priceImpactPrecent);
787 }
788 });
789 });
790 </script>
791 <?php
792 }
793
794 print dol_get_fiche_end(); ?>
795
796 <div style="text-align: center">
797 <input type="submit" name="create" <?php if (!is_array($productCombination2ValuePairs1)) {
798 print ' disabled="disabled"';
799 } ?> value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans("Save") ?>" class="button button-save">
800 &nbsp;
801 <input type="submit" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>" class="button button-cancel">
802 </div>
803
804 <?php
805
806 print '</form>';
807 } else {
808 if ($action === 'delete') {
809 if ($prodcomb->fetch($combination_id) > 0) {
810 $prodstatic->fetch($prodcomb->fk_product_child);
811
812 print $form->formconfirm(
813 "combinations.php?id=".urlencode((string) ($id))."&combination_id=".urlencode((string) ($combination_id)),
814 $langs->trans('Delete'),
815 $langs->trans('ProductCombinationDeleteDialog', $prodstatic->ref),
816 "confirm_deletecombination",
817 array(array('label' => $langs->trans('DeleteLinkedProduct'), 'type' => 'checkbox', 'name' => 'delete_product', 'value' => false)),
818 0,
819 1
820 );
821 }
822 } elseif ($action === 'copy') {
823 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);
824 }
825
826 $comb2val = new ProductCombination2ValuePair($db);
827
828 if ($productCombinations) {
829 ?>
830
831 <script type="text/javascript">
832 jQuery(document).ready(function() {
833
834 jQuery('input[name="select_all"]').click(function() {
835
836 if (jQuery(this).prop('checked')) {
837 var checked = true;
838 } else {
839 var checked = false;
840 }
841
842 jQuery('table.liste input[type="checkbox"]').prop('checked', checked);
843 });
844
845 jQuery('input[name^="select["]').click(function() {
846 jQuery('input[name="select_all"]').prop('checked', false);
847 });
848
849 });
850 </script>
851
852 <?php
853 }
854
855 // Buttons
856 print '<div class="tabsAction">';
857
858 print ' <div class="inline-block divButAction">';
859
860 print '<a href="combinations.php?id='.$object->id.'&action=add&token='.newToken().'" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; // NewVariant
861
862 if ($productCombinations) {
863 print '<a href="combinations.php?id='.$object->id.'&action=copy&token='.newToken().'" class="butAction">'.$langs->trans('PropagateVariant').'</a>';
864 }
865
866 print ' </div>';
867
868 print '</div>';
869
870
871
872 $arrayofselected = is_array($toselect) ? $toselect : array();
873
874
875 // List of variants
876 print '<form method="POST" action="'.$_SERVER["PHP_SELF"] .'?id='.$object->id.'">';
877 print '<input type="hidden" name="token" value="'.newToken().'">';
878 print '<input type="hidden" name="action" value="massaction">';
879 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
880
881 // List of mass actions available
882
883 $aaa = '';
884 if (count($productCombinations)) {
885 $aaa = '<select id="bulk_action" name="massaction" class="minwidth250">';
886 $aaa .= ' <option value="nothing">&nbsp;</option>';
887 $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>';
888 $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>';
889 $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>';
890 $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>';
891 $aaa .= ' <option value="delete" data-html="'.dol_escape_htmltag(img_picto($langs->trans("Delete"), 'delete', 'class="pictofixedwidth"').$langs->trans('Delete')).'">'.$langs->trans('Delete').'</option>';
892 $aaa .= '</select>';
893 $aaa .= ajax_combobox("bulk_action");
894 $aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button small">';
895 }
896 $massactionbutton = $aaa;
897
898 $title = $langs->trans("ProductCombinations");
899
900 print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $aaa, 0);
901
902 print '<div class="div-table-responsive">'; ?>
903 <table class="liste">
904 <tr class="liste_titre">
905 <?php
906 // Action column
907 if ($conf->main_checkbox_left_column) {
908 print '<td class="liste_titre center">';
909 $searchpicto = $form->showCheckAddButtons('checkforselect', 1);
910 print $searchpicto;
911 print '</td>';
912 } ?>
913 <td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
914 <td class="liste_titre"><?php echo $langs->trans('Attributes') ?></td>
915 <td class="liste_titre right"><?php echo $langs->trans('PriceImpact') ?></td>
916 <?php if ($object->isProduct()) {
917 print'<td class="liste_titre right">'.$langs->trans('WeightImpact').'</td>';
918 } ?>
919 <td class="liste_titre center"><?php echo $langs->trans('OnSell') ?></td>
920 <td class="liste_titre center"><?php echo $langs->trans('OnBuy') ?></td>
921 <td class="liste_titre"></td>
922 <?php
923 // Action column
924 if (!$conf->main_checkbox_left_column) {
925 print '<td class="liste_titre center">';
926 $searchpicto = $form->showCheckAddButtons('checkforselect', 1);
927 print $searchpicto;
928 print '</td>';
929 } ?>
930 </tr>
931 <?php
932
933 if (count($productCombinations)) {
934 foreach ($productCombinations as $currcomb) {
935 $prodstatic->fetch($currcomb->fk_product_child);
936 print '<tr class="oddeven">';
937
938 // Action column
939 if ($conf->main_checkbox_left_column) {
940 print '<td class="nowrap center">';
941 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
942 $selected = 0;
943 if (in_array($prodstatic->id, $arrayofselected)) {
944 $selected = 1;
945 }
946 print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
947 }
948 print '</td>';
949 }
950
951 print '<td>'.$prodstatic->getNomUrl(1).'</td>';
952 print '<td>';
953 $arraycomb = $comb2val->fetchByFkCombination($currcomb->id);
954 if (is_array($arraycomb)) {
955 foreach ($arraycomb as $pc2v) {
956 print dolPrintHTML((string) $pc2v).'<br>'; // $pc2v is object ProductCombination2ValuePair, the (string) use the __toString to output it.
957 }
958 }
959 print '</td>';
960 print '<td class="right">'.($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '').'</td>';
961 if ($object->isProduct()) {
962 print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuringUnitString(0, 'weight', $prodstatic->weight_units).'</td>';
963 }
964 print '<td class="center">'.$prodstatic->getLibStatut(2, 0).'</td>';
965 print '<td class="center">'.$prodstatic->getLibStatut(2, 1).'</td>';
966
967 print '<td class="right">';
968 print '<a class="paddingleft paddingright editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=edit&token='.newToken().'&combination_id='.$currcomb->id.'">'.img_edit().'</a>';
969 print '<a class="paddingleft paddingright" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=delete&token='.newToken().'&combination_id='.$currcomb->id.'">'.img_delete().'</a>';
970 print '</td>';
971
972 // Action column
973 if (!$conf->main_checkbox_left_column) {
974 print '<td class="nowrap center">';
975 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
976 $selected = 0;
977 if (in_array($prodstatic->id, $arrayofselected)) {
978 $selected = 1;
979 }
980 print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected ? ' checked="checked"' : '').'>';
981 }
982 print '</td>';
983 }
984
985 print '</tr>';
986 }
987 } else {
988 print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
989 }
990 print '</table>';
991 print '</div>';
992 print '</form>';
993 }
994}
995
996// End of page
997llxFooter();
998$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.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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:130
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:133
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.