26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductAttribute.class.php';
31 $langs->loadLangs(array(
"products",
"other"));
33 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
34 $massaction =
GETPOST(
'massaction',
'alpha');
35 $show_files =
GETPOST(
'show_files',
'int');
36 $confirm =
GETPOST(
'confirm',
'alpha');
37 $cancel =
GETPOST(
'cancel',
'alpha');
38 $toselect =
GETPOST(
'toselect',
'array');
39 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'productattributelist';
40 $backtopage =
GETPOST(
'backtopage',
'alpha');
41 $optioncss =
GETPOST(
'optioncss',
'aZ');
46 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
47 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
50 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
54 $offset = $limit * $page;
55 $pageprev = $page - 1;
56 $pagenext = $page + 1;
61 $diroutputmassaction = $conf->variants->dir_output.
'/temp/massgeneration/'.$user->id;
62 $hookmanager->initHooks(array(
'productattributelist'));
71 $sortfield =
"t.position";
78 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
80 foreach ($object->fields as $key => $val) {
81 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
82 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
84 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
85 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
86 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
89 $search[
'nb_of_values'] =
GETPOST(
'search_nb_of_values',
'alpha');
90 $search[
'nb_products'] =
GETPOST(
'search_nb_products',
'alpha');
93 $fieldstosearchall = array();
94 foreach ($object->fields as $key => $val) {
95 if (!empty($val[
'searchall'])) {
96 $fieldstosearchall[
't.'.$key] = $val[
'label'];
101 $arrayfields = array();
102 foreach ($object->fields as $key => $val) {
104 if (!empty($val[
'visible'])) {
105 $visible = (int)
dol_eval($val[
'visible'], 1);
106 $arrayfields[
't.'.$key] = array(
107 'label'=>$val[
'label'],
108 'checked'=>(($visible < 0) ? 0 : 1),
109 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1)),
110 'position'=>$val[
'position'],
111 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
115 $arrayfields[
'nb_of_values'] = array(
116 'label' => $langs->trans(
'NbOfDifferentValues'),
122 $arrayfields[
'nb_products'] = array(
123 'label' => $langs->trans(
'NbProducts'),
135 $permissiontoread = $user->rights->variants->read;
136 $permissiontoadd = $user->rights->variants->write;
137 $permissiontodelete = $user->rights->variants->delete;
144 if ($user->socid > 0) {
155 if (
GETPOST(
'cancel',
'alpha')) {
159 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
163 $parameters = array();
164 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
169 if (empty($reshook)) {
171 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
174 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
175 foreach ($object->fields as $key => $val) {
177 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
178 $search[$key.
'_dtstart'] =
'';
179 $search[$key.
'_dtend'] =
'';
182 $search[
'nb_of_values'] =
'';
183 $search[
'nb_products'] =
'';
185 $search_array_options = array();
187 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
188 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
192 if ($action ==
'up' && $permissiontoadd) {
193 $object->attributeMoveUp($rowid);
195 header(
'Location: '.$_SERVER[
'PHP_SELF']);
197 } elseif ($action ==
'down' && $permissiontoadd) {
198 $object->attributeMoveDown($rowid);
200 header(
'Location: '.$_SERVER[
'PHP_SELF']);
205 $objectclass =
'ProductAttribute';
206 $objectlabel =
'ProductAttribute';
207 $uploaddir = $conf->variants->dir_output;
208 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
222 $title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"ProductAttributes"));
230 $sql .=
" COUNT(DISTINCT pav.rowid) AS nb_of_values, COUNT(DISTINCT pac2v.fk_prod_combination) AS nb_products,";
231 $sql .= $object->getFieldList(
"t");
239 $parameters = array();
240 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
241 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
242 $sql = preg_replace(
'/,\s*$/',
'', $sql);
243 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
247 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_attribute_combination2val AS pac2v ON pac2v.fk_prod_attr = t.rowid";
248 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_attribute_value AS pav ON pav.fk_product_attribute = t.rowid";
250 $parameters = array();
251 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
252 $sql .= $hookmanager->resPrint;
253 if ($object->ismultientitymanaged == 1) {
254 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
256 $sql .=
" WHERE 1 = 1";
258 foreach ($search as $key => $val) {
259 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
260 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
261 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
262 if (preg_match(
'/_dtstart$/', $key)) {
263 $sql .=
" AND t.".$columnName.
" >= '".$db->idate($search[$key]).
"'";
265 if (preg_match(
'/_dtend$/', $key)) {
266 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
269 } elseif (array_key_exists($key, $object->fields)) {
270 if ($key ==
'status' && $search[$key] == -1) {
273 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
274 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
275 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
280 if ($search[$key] !=
'') {
281 $sql .=
natural_search(
"t.".$key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
286 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
292 $parameters = array();
293 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
294 $sql .= $hookmanager->resPrint;
297 $sql .=
" GROUP BY ";
298 foreach ($object->fields as $key => $val) {
299 $sql .=
"t." . $key .
", ";
308 $parameters = array();
309 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
310 $sql .= $hookmanager->resPrint;
311 $sql = preg_replace(
"/,\s*$/",
"", $sql);
313 $sql .=
" HAVING 1=1";
314 if ($search[
'nb_of_values'] !=
'') {
315 $sql .=
natural_search(
"nb_of_values", $search[
'nb_of_values'], 1);
317 if ($search[
'nb_products'] !=
'') {
321 $parameters = array();
322 $reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
323 $sql .= empty($hookmanager->resPrint) ?
"" :
" ".$hookmanager->resPrint;
327 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
338 $sqlforcount = preg_replace(
"/^SELECT[a-z0-9\._\s\(\),]+FROM/i",
"SELECT COUNT(*) as nbtotalofrecords FROM", $sql);
339 $resql = $db->query($sqlforcount);
344 $objforcount = $db->fetch_object(
$resql);
356 $sql .= $db->order($sortfield, $sortorder);
358 $sql .= $db->plimit($limit + 1, $offset);
361 $resql = $db->query($sql);
367 $num = $db->num_rows(
$resql);
371 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
372 $obj = $db->fetch_object(
$resql);
374 header(
"Location: " .
dol_buildpath(
'/variants/card.php', 2) .
'?id=' . $id);
384 $arrayofselected = is_array($toselect) ? $toselect : array();
387 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
388 $param .=
'&contextpage='.urlencode($contextpage);
390 if ($limit > 0 && $limit != $conf->liste_limit) {
391 $param .=
'&limit='.urlencode($limit);
393 foreach ($search as $key => $val) {
394 if (is_array($search[$key]) && count($search[$key])) {
395 foreach ($search[$key] as $skey) {
397 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
400 } elseif ($search[$key] !=
'') {
401 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
404 if ($optioncss !=
'') {
405 $param .=
'&optioncss='.urlencode($optioncss);
410 $parameters = array();
411 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
412 $param .= $hookmanager->resPrint;
415 $arrayofmassactions = array(
421 if ($permissiontodelete) {
422 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
424 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
425 $arrayofmassactions = array();
427 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
429 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
430 if ($optioncss !=
'') {
431 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
433 print
'<input type="hidden" name="token" value="'.newToken().
'">';
434 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
435 print
'<input type="hidden" name="action" value="list">';
436 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
437 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
438 print
'<input type="hidden" name="page" value="'.$page.
'">';
439 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
441 $newcardbutton =
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/variants/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
443 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
446 $topicmail =
"SendProductAttributeRef";
447 $modelmail =
"productattribute";
449 $trackid =
'pa'.$object->id;
450 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
453 foreach ($fieldstosearchall as $key => $val) {
454 $fieldstosearchall[$key] = $langs->trans($val);
456 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
464 $parameters = array();
465 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
466 if (empty($reshook)) {
467 $moreforfilter .= $hookmanager->resPrint;
469 $moreforfilter = $hookmanager->resPrint;
472 if (!empty($moreforfilter)) {
473 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
474 print $moreforfilter;
478 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
479 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
480 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
482 print
'<div class="div-table-responsive">';
483 print
'<table id="tableattributes" class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
488 print
'<tr class="liste_titre">';
489 foreach ($object->fields as $key => $val) {
490 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
491 if ($key ==
'status') {
492 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
493 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
494 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
495 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
496 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
497 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
498 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
500 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
501 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
502 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
503 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
504 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
505 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
506 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
507 print
'<div class="nowrap">';
508 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
510 print
'<div class="nowrap">';
511 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
513 } elseif ($key ==
'lang') {
514 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
516 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
518 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
525 $key =
'nb_of_values';
526 if (!empty($arrayfields[$key][
'checked'])) {
527 print
'<td class="liste_titre center">';
528 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
531 $key =
'nb_products';
532 if (!empty($arrayfields[$key][
'checked'])) {
533 print
'<td class="liste_titre center">';
534 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
538 $parameters = array(
'arrayfields'=>$arrayfields);
539 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
540 print $hookmanager->resPrint;
542 print
'<td class="liste_titre linecoledit width25"></td>';
543 print
'<td class="liste_titre maxwidthsearch">';
544 $searchpicto =
$form->showFilterButtons();
547 print
'<td class="liste_titre linecolmove width25"></td>';
553 print
'<tr class="liste_titre">';
554 foreach ($object->fields as $key => $val) {
555 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
556 if ($key ==
'status') {
557 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
558 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
559 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
560 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
561 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
562 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
563 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
565 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
566 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
571 $key =
'nb_of_values';
572 if (!empty($arrayfields[$key][
'checked'])) {
573 print
getTitleFieldOfList($arrayfields[$key][
'label'], 0, $_SERVER[
'PHP_SELF'], $key,
'', $param,
'class="center"', $sortfield, $sortorder,
'center ').
"\n";
575 $key =
'nb_products';
576 if (!empty($arrayfields[$key][
'checked'])) {
577 print
getTitleFieldOfList($arrayfields[$key][
'label'], 0, $_SERVER[
'PHP_SELF'], $key,
'', $param,
'class="center"', $sortfield, $sortorder,
'center ').
"\n";
580 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
581 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
582 print $hookmanager->resPrint;
585 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
591 $needToFetchEachLine = 0;
604 $totalarray = array();
605 $totalarray[
'nbfield'] = 0;
606 while ($i < ($limit ? min($num, $limit) : $num)) {
607 $obj = $db->fetch_object(
$resql);
612 $object->setVarsFromFetchObj($obj);
615 print
'<tr id="row-' . $obj->rowid .
'" class="oddeven drag drop">';
616 foreach ($object->fields as $key => $val) {
617 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
618 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
619 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
620 } elseif ($key ==
'status') {
621 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
624 if (in_array($val[
'type'], array(
'timestamp'))) {
625 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
626 } elseif ($key ==
'ref') {
627 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
630 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
631 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
635 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
636 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
637 if ($key ==
'status') {
638 print $object->getLibStatut(5);
639 } elseif ($key ==
'rowid') {
640 print $object->showOutputField($val, $key, $object->id,
'');
642 print $object->showOutputField($val, $key, $object->$key,
'');
646 $totalarray[
'nbfield']++;
648 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
650 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
652 if (!isset($totalarray[
'val'])) {
653 $totalarray[
'val'] = array();
655 if (!isset($totalarray[
'val'][
't.' . $key])) {
656 $totalarray[
'val'][
't.' . $key] = 0;
658 $totalarray[
'val'][
't.' . $key] += $object->$key;
664 $key =
'nb_of_values';
665 if (!empty($arrayfields[$key][
'checked'])) {
666 print
'<td class="center">';
670 $totalarray[
'nbfield']++;
673 $key =
'nb_products';
674 if (!empty($arrayfields[$key][
'checked'])) {
675 print
'<td class="center">';
679 $totalarray[
'nbfield']++;
683 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
684 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
685 print $hookmanager->resPrint;
687 print
'<td class="linecoledit center width25">';
688 if ($permissiontoadd) {
689 print
'<a class="editfielda reposition" href="' . DOL_URL_ROOT .
'/variants/card.php?id=' . $obj->rowid .
'&action=edit&save_lastsearch_values=1&backtopage=' . urlencode($_SERVER[
'PHP_SELF']) .
'">' .
img_edit() .
'</a>';
693 $totalarray[
'nbfield']++;
695 print
'<td class="nowrap center">';
696 if ($massactionbutton || $massaction) {
698 if (in_array($object->id, $arrayofselected)) {
701 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
705 $totalarray[
'nbfield']++;
707 print
'<td class="center linecolmove tdlineupdown">';
709 print
'<a class="lineupdown" href="' . $_SERVER[
'PHP_SELF'] .
'?action=up&rowid=' . $obj->rowid .
'">' .
img_up(
'default', 0,
'imgupforline') .
'</a>';
712 print
'<a class="lineupdown" href="' . $_SERVER[
'PHP_SELF'] .
'?action=down&rowid=' . $obj->rowid .
'">' .
img_down(
'default', 0,
'imgdownforline') .
'</a>';
716 $totalarray[
'nbfield']++;
719 print
'</tr>' .
"\n";
725 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
730 foreach ($arrayfields as $key => $val) {
731 if (!empty($val[
'checked'])) {
735 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
740 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
741 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
742 print $hookmanager->resPrint;
744 print
'</table>'.
"\n";
747 print
'</form>'.
"\n";
749 $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
750 $tagidfortablednd = (empty($tagidfortablednd) ?
'tableattributes' : $tagidfortablednd);
753 $(document).ready(
function(){
754 $(
".imgupforline, .imgdownforline").hide();
755 $(
".lineupdown").removeAttr(
'href');
757 .css(
"background-image",
'url(<?php echo DOL_URL_ROOT.'/theme/
'.$conf->theme.'/img/grip.png
'; ?>)')
758 .css(
"background-repeat",
"no-repeat")
759 .css(
"background-position",
"center center")
762 $(
this).addClass(
'showDragHandle');
764 $(
this).removeClass(
'showDragHandle');
768 $(
"#<?php echo $tagidfortablednd; ?>").tableDnD({
769 onDrop:
function(table, row) {
771 $(
'#<?php echo $tagidfortablednd; ?> tr[data-element=extrafield]').attr(
'id',
'');
772 $(
'#<?php echo $tagidfortablednd; ?> tr[data-ignoreidfordnd=1]').attr(
'id',
'');
773 var reloadpage =
"<?php echo $forcereloadpage; ?>";
774 var roworder = cleanSerialize(decodeURI($(
"#<?php echo $tagidfortablednd; ?>").tableDnDSerialize()));
775 $.post(
"<?php echo DOL_URL_ROOT; ?>/variants/ajax/orderAttribute.php",
778 token:
"<?php echo currentToken(); ?>"
781 if (reloadpage == 1) {
782 location.href =
'<?php echo dol_escape_htmltag($_SERVER['PHP_SELF
']).'?
'.dol_escape_htmltag($_SERVER['QUERY_STRING
']); ?>';
786 onDragClass:
"dragClass",
787 dragHandle:
"td.tdlineupdown"
794 $hidegeneratedfilelistifempty = 1;
795 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
796 $hidegeneratedfilelistifempty = 0;
799 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
803 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
804 $urlsource .= str_replace(
'&',
'&', $param);
806 $filedir = $diroutputmassaction;
807 $genallowed = $permissiontoread;
808 $delallowed = $permissiontoadd;
810 print $formfile->showdocuments(
'massfilesarea_productattribute',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class ProductAttribute Used to represent a product attribute.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.