19 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
34 public $module =
'variants';
39 public $element =
'productattribute';
44 public $table_element =
'product_attribute';
49 public $table_element_line =
'product_attribute_value';
54 public $fk_element =
'fk_product_attribute';
60 public $ismultientitymanaged = 1;
65 public $isextrafieldmanaged = 0;
70 public $picto =
'product';
100 public $fields=array(
101 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>1,
'notnull'=>1,
'visible'=>0,
'noteditable'=>
'1',
'index'=>1,
'css'=>
'left',
'comment'=>
"Id"),
102 'ref' => array(
'type'=>
'varchar(255)',
'label'=>
'Ref',
'visible'=>1,
'enabled'=>1,
'position'=>10,
'notnull'=>1,
'index'=>1,
'searchall'=>1,
'comment'=>
"Reference of object",
'css'=>
''),
103 'ref_ext' => array(
'type' =>
'varchar(255)',
'label' =>
'ExternalRef',
'enabled' => 1,
'visible' => 0,
'position' => 20,
'searchall'=>1),
104 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>
'1',
'position'=>30,
'notnull'=>1,
'visible'=>1,
'searchall'=>1,
'css'=>
'minwidth300',
'help'=>
"",
'showoncombobox'=>
'1',),
105 'position' => array(
'type'=>
'integer',
'label'=>
'Rank',
'enabled'=>1,
'visible'=>0,
'default'=>0,
'position'=>40,
'notnull'=>1,),
116 public $lines = array();
130 global $conf, $langs;
133 $this->entity = $conf->entity;
135 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid'])) {
136 $this->fields[
'rowid'][
'visible'] = 0;
138 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
139 $this->fields[
'entity'][
'enabled'] = 0;
143 foreach ($this->fields as $key => $val) {
144 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
145 unset($this->fields[$key]);
150 if (is_object($langs)) {
151 foreach ($this->fields as $key => $val) {
152 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
153 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
154 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
175 $this->label = trim($this->label);
176 $this->position = $this->position > 0 ? $this->position : 0;
179 if (empty($this->position)) {
181 $this->position = $positionmax + 1;
185 if (empty($this->
ref)) {
186 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref"));
189 if (empty($this->label)) {
190 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label"));
200 $sql =
"INSERT INTO " . MAIN_DB_PREFIX . $this->table_element .
" (";
201 $sql .=
" ref, ref_ext, label, entity, position";
204 $sql .=
" '" . $this->
db->escape($this->
ref) .
"'";
205 $sql .=
", '" . $this->
db->escape($this->ref_ext) .
"'";
206 $sql .=
", '" . $this->
db->escape($this->label) .
"'";
207 $sql .=
", " . ((int) $this->entity);
208 $sql .=
", " . ((int) $this->position);
214 $this->errors[] =
"Error " . $this->
db->lasterror();
219 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
222 if (!$error && !$notrigger) {
224 $result = $this->
call_trigger(
'PRODUCT_ATTRIBUTE_CREATE', $user);
235 $this->
db->rollback();
252 $id = $id > 0 ? $id : 0;
256 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
264 $sql =
"SELECT rowid, ref, ref_ext, label, position";
265 $sql .=
" FROM " . MAIN_DB_PREFIX . $this->table_element;
266 $sql .=
" WHERE rowid = " . ((int) $id);
267 $sql .=
" AND entity IN (" .
getEntity(
'product') .
")";
272 $this->errors[] =
"Error " . $this->
db->lasterror();
277 $numrows = $this->
db->num_rows(
$resql);
279 $obj = $this->
db->fetch_object(
$resql);
281 $this->
id = $obj->rowid;
282 $this->
ref = $obj->ref;
283 $this->ref_ext = $obj->ref_ext;
284 $this->label = $obj->label;
285 $this->rang = $obj->position;
286 $this->position = $obj->position;
302 $sql =
"SELECT rowid, ref, ref_ext, label, position";
303 $sql .=
" FROM " . MAIN_DB_PREFIX . $this->table_element;
304 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
305 $sql .= $this->
db->order(
"position",
"asc");
310 $this->errors[] =
"Error " . $this->
db->lasterror();
315 while ($obj = $this->
db->fetch_object(
$resql)) {
318 $tmp->id = $obj->rowid;
319 $tmp->ref = $obj->ref;
320 $tmp->ref_ext = $obj->ref_ext;
321 $tmp->label = $obj->label;
322 $tmp->rang = $obj->position;
323 $tmp->position = $obj->position;
344 $this->
id = $this->
id > 0 ? $this->id : 0;
346 $this->label = trim($this->label);
349 if (empty($this->
id)) {
350 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
353 if (empty($this->
ref)) {
354 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref"));
357 if (empty($this->label)) {
358 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label"));
368 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET";
370 $sql .=
" ref = '" . $this->
db->escape($this->
ref) .
"'";
371 $sql .=
", ref_ext = '" . $this->
db->escape($this->ref_ext) .
"'";
372 $sql .=
", label = '" . $this->
db->escape($this->label) .
"'";
373 $sql .=
", position = " . ((int) $this->position);
375 $sql .=
" WHERE rowid = " . ((int) $this->
id);
380 $this->errors[] =
"Error " . $this->
db->lasterror();
384 if (!$error && !$notrigger) {
386 $result = $this->
call_trigger(
'PRODUCT_ATTRIBUTE_MODIFY', $user);
397 $this->
db->rollback();
409 public function delete(
User $user, $notrigger = 0)
415 $this->
id = $this->
id > 0 ? $this->id : 0;
418 if (empty($this->
id)) {
419 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
427 $result = $this->
isUsed();
430 } elseif ($result > 0) {
431 $this->errors[] = $langs->trans(
'ErrorAttributeIsUsedIntoProduct');
439 $result = $this->
call_trigger(
'PRODUCT_ATTRIBUTE_DELETE', $user);
448 $sql =
"DELETE FROM " . MAIN_DB_PREFIX . $this->table_element_line;
449 $sql .=
" WHERE " . $this->fk_element .
" = " . ((int) $this->
id);
451 dol_syslog(__METHOD__ .
' - Delete values', LOG_DEBUG);
454 $this->errors[] =
"Error " . $this->
db->lasterror();
460 $sql =
"DELETE FROM " . MAIN_DB_PREFIX . $this->table_element;
461 $sql .=
" WHERE rowid = " . ((int) $this->
id);
463 dol_syslog(__METHOD__ .
' - Delete attribute', LOG_DEBUG);
466 $this->errors[] =
"Error " . $this->
db->lasterror();
475 $this->
db->rollback();
492 $this->lines = array();
497 $this->
id = $this->
id > 0 ? $this->id : 0;
500 if (empty($this->
id)) {
501 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
509 $sql =
"SELECT td.rowid, td.fk_product_attribute, td.ref, td.value, td.position";
510 $sql .=
" FROM " . MAIN_DB_PREFIX . $this->table_element_line .
" AS td";
511 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $this->table_element .
" AS t ON t.rowid = td." . $this->fk_element;
512 $sql .=
" WHERE t.rowid = " . ((int) $this->
id);
513 $sql .=
" AND t.entity IN (" .
getEntity(
'product') .
")";
517 $sql .= $this->
db->order(
"td.position",
"asc");
522 $this->errors[] =
"Error " . $this->
db->lasterror();
531 $obj = $this->
db->fetch_object(
$resql);
535 $line->id = $obj->rowid;
536 $line->fk_product_attribute = $obj->fk_product_attribute;
537 $line->ref = $obj->ref;
538 $line->value = $obj->value;
539 $line->position = $obj->position;
541 $this->lines[$i] = $line;
574 public function addLine($ref, $value, $position = -1, $notrigger = 0)
576 global $langs, $user;
577 dol_syslog(__METHOD__ .
" id={$this->id}, ref=$ref, value=$value, notrigger=$notrigger");
581 $this->
id = $this->
id > 0 ? $this->id : 0;
584 if (empty($this->
id)) {
585 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
599 $positiontouse = $position;
600 if ($positiontouse == -1) {
602 $positiontouse = $positionmax + 1;
605 $this->line->context = $this->context;
606 $this->line->fk_product_attribute = $this->id;
607 $this->line->ref = $ref;
608 $this->line->value = $value;
609 $this->line->position = $positiontouse;
611 $result = $this->line->create($user, $notrigger);
614 $this->error = $this->line->error;
615 $this->errors = $this->line->errors;
616 $this->
db->rollback();
620 return $this->line->id;
634 public function updateLine($lineid, $ref, $value, $notrigger = 0)
638 dol_syslog(__METHOD__ .
" lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger");
641 $lineid = $lineid > 0 ? $lineid : 0;
647 $result = $this->line->fetch($lineid);
649 $this->line->oldcopy = clone $this->line;
651 $this->line->context = $this->context;
652 $this->line->ref = $ref;
653 $this->line->value = $value;
655 $result = $this->line->update($user, $notrigger);
659 $this->error = $this->line->error;
660 $this->errors = $this->line->errors;
661 $this->
db->rollback();
679 dol_syslog(__METHOD__ .
" lineid=$lineid, notrigger=$notrigger");
682 $lineid = $lineid > 0 ? $lineid : 0;
688 $result = $this->line->fetch($lineid);
690 $this->line->context = $this->context;
692 $result = $this->line->delete($user, $notrigger);
696 $this->error = $this->line->error;
697 $this->errors = $this->line->errors;
698 $this->
db->rollback();
718 $this->
id = $this->
id > 0 ? $this->id : 0;
721 if (empty($this->
id)) {
722 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
730 $sql =
"SELECT COUNT(*) AS count";
731 $sql .=
" FROM " . MAIN_DB_PREFIX . $this->table_element_line;
732 $sql .=
" WHERE " . $this->fk_element .
" = " . ((int) $this->
id);
737 $this->errors[] =
"Error " . $this->
db->lasterror();
742 if ($obj = $this->
db->fetch_object(
$resql)) {
743 $count = $obj->count;
761 $this->
id = $this->
id > 0 ? $this->id : 0;
764 if (empty($this->
id)) {
765 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
773 $sql =
"SELECT COUNT(*) AS count";
774 $sql .=
" FROM " . MAIN_DB_PREFIX .
"product_attribute_combination2val AS pac2v";
775 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid";
776 $sql .=
" WHERE pac2v.fk_prod_attr = " . ((int) $this->
id);
777 $sql .=
" AND pac.entity IN (" .
getEntity(
'product') .
")";
782 $this->errors[] =
"Error " . $this->
db->lasterror();
787 if ($obj = $this->
db->fetch_object(
$resql)) {
788 $count = $obj->count;
805 $this->
id = $this->
id > 0 ? $this->id : 0;
808 if (empty($this->
id)) {
809 $this->errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TechnicalID"));
817 $sql =
"SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX .
"product_attribute_combination2val WHERE fk_prod_attr = " . ((int) $this->
id);
822 $this->errors[] =
"Error " . $this->
db->lasterror();
827 if ($obj = $this->
db->fetch_object(
$resql)) {
831 return $used ? 1 : 0;
846 $sql =
"SELECT count(rowid) FROM " . MAIN_DB_PREFIX . $this->table_element;
847 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
849 $sql .=
" AND position = 0";
851 $sql .=
" AND position <> 0";
857 $row = $this->
db->fetch_row(
$resql);
867 $sql =
"SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element;
868 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
869 $sql .=
" ORDER BY position ASC, rowid " . $rowidorder;
871 dol_syslog(__METHOD__ .
" search all attributes", LOG_DEBUG);
877 $row = $this->
db->fetch_row(
$resql);
884 foreach ($rows as $key => $row) {
906 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET position = " . ((int) $position);
907 $sql .=
" WHERE rowid = " . ((int) $rowid);
910 if (!$this->
db->query($sql)) {
914 $parameters = array(
'rowid' => $rowid,
'position' => $position);
916 $reshook = $hookmanager->executeHooks(
'afterPositionOfAttributeUpdate', $parameters, $this, $action);
929 $sql =
"SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element;
930 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
935 $row = $this->
db->fetch_row(
$resql);
989 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET position = " . ((int) $position);
990 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
991 $sql .=
" AND position = " . ((int) ($position - 1));
992 if ($this->
db->query($sql)) {
993 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET position = " . ((int) ($position - 1));
994 $sql .=
" WHERE rowid = " . ((int) $rowid);
995 if (!$this->
db->query($sql)) {
1014 if ($position < $max) {
1015 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET position = " . ((int) $position);
1016 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
1017 $sql .=
" AND position = " . ((int) ($position + 1));
1018 if ($this->
db->query($sql)) {
1019 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element .
" SET position = " . ((int) ($position + 1));
1020 $sql .=
" WHERE rowid = " . ((int) $rowid);
1021 if (!$this->
db->query($sql)) {
1038 $sql =
"SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element;
1039 $sql .=
" WHERE entity IN (" .
getEntity(
'product') .
")";
1044 $row = $this->
db->fetch_row(
$resql);
1059 $num = count($rows);
1060 for ($i = 0; $i < $num; $i++) {
1075 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
1077 global $conf, $langs, $hookmanager;
1079 if (!empty($conf->dol_no_mouse_hover)) {
1085 $label =
img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"ProductAttribute") .
'</u>';
1086 if (isset($this->status)) {
1090 $label .=
'<b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
1091 if (!empty($this->label)) {
1092 $label .=
'<br><b>' . $langs->trans(
'Label') .
':</b> ' . $this->label;
1095 $url =
dol_buildpath(
'/variants/card.php', 1) .
'?id=' . $this->id;
1097 if ($option !=
'nolink') {
1099 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
1100 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
1101 $add_save_lastsearch_values = 1;
1103 if ($url && $add_save_lastsearch_values) {
1104 $url .=
'&save_lastsearch_values=1';
1109 if (empty($notooltip)) {
1110 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1111 $label = $langs->trans(
"ShowProductAttribute");
1115 $linkclose .=
' class="classfortooltip' . ($morecss ?
' ' . $morecss :
'') .
'"';
1117 $linkclose = ($morecss ?
' class="' . $morecss .
'"' :
'');
1120 if ($option ==
'nolink' || empty($url)) {
1121 $linkstart =
'<span';
1123 $linkstart =
'<a href="' . $url .
'"';
1125 $linkstart .= $linkclose .
'>';
1126 if ($option ==
'nolink' || empty($url)) {
1127 $linkend =
'</span>';
1132 $result .= $linkstart;
1134 if (empty($this->showphoto_on_popup)) {
1136 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="' . (($withpicto != 2) ?
'paddingright ' :
'') .
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1140 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
1142 list($class, $module) = explode(
'@', $this->picto);
1145 $filename = $filearray[0][
'name'];
1146 if (!empty($filename)) {
1147 $pospoint = strpos($filearray[0][
'name'],
'.');
1149 $pathtophoto = $class .
'/' . $this->
ref .
'/thumbs/' . substr($filename, 0, $pospoint) .
'_mini' . substr($filename, $pospoint);
1150 if (empty($conf->global->{strtoupper($module .
'_' . $class) .
'_FORMATLISTPHOTOSASUSERS'})) {
1151 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module .
'" alt="No photo" border="0" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=' . $module .
'&entity=' . $conf->entity .
'&file=' . urlencode($pathtophoto) .
'"></div></div>';
1153 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=' . $module .
'&entity=' . $conf->entity .
'&file=' . urlencode($pathtophoto) .
'"></div>';
1156 $result .=
'</div>';
1158 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="' . (($withpicto != 2) ?
'paddingright ' :
'') .
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1163 if ($withpicto != 2) {
1164 $result .= $this->ref;
1167 $result .= $linkend;
1170 global $action, $hookmanager;
1171 $hookmanager->initHooks(array(
'variantsdao'));
1172 $parameters = array(
'id' => $this->
id,
'getnomurl' => $result);
1173 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
1175 $result = $hookmanager->resPrint;
1177 $result .= $hookmanager->resPrint;
1191 return $this->LibStatut(0, $mode);
1202 return $this->LibStatut(0, $mode);
1236 global $conf, $user, $langs, $object, $hookmanager;
1242 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array($defaulttpldir));
1243 foreach ($dirtpls as $module => $reldir) {
1244 if (!empty($module)) {
1245 $tpl =
dol_buildpath($reldir .
'/productattributevalueline_create.tpl.php');
1247 $tpl = DOL_DOCUMENT_ROOT . $reldir .
'/productattributevalueline_create.tpl.php';
1250 if (empty($conf->file->strict_mode)) {
1251 $res = @include $tpl;
1253 $res = include $tpl;
1278 public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir =
'/variants/tpl', $addcreateline = 0)
1280 global $conf, $hookmanager, $langs, $user,
$form, $object;
1283 global $disableedit, $disablemove, $disableremove;
1285 $num = count($this->lines);
1287 $parameters = array(
'num' => $num,
'selected' => $selected,
'table_element_line' => $this->table_element_line);
1288 $reshook = $hookmanager->executeHooks(
'printObjectLineTitle', $parameters, $this, $action);
1289 if (empty($reshook)) {
1293 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array($defaulttpldir));
1294 foreach ($dirtpls as $module => $reldir) {
1295 if (!empty($module)) {
1296 $tpl =
dol_buildpath($reldir .
'/productattributevalueline_title.tpl.php');
1298 $tpl = DOL_DOCUMENT_ROOT . $reldir .
'/productattributevalueline_title.tpl.php';
1300 if (empty($conf->file->strict_mode)) {
1301 $res = @include $tpl;
1303 $res = include $tpl;
1312 if ($addcreateline) {
1314 if ($action !=
'selectlines') {
1315 if ($action !=
'editline') {
1318 $parameters = array();
1319 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
1320 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1321 if (empty($reshook))
1322 $object->formAddObjectLine(1, $mysoc, $buyer);
1329 print
"<!-- begin printObjectLines() -->\n";
1330 foreach ($this->lines as $line) {
1331 if (is_object($hookmanager)) {
1332 $parameters = array(
'line' => $line,
'num' => $num,
'i' => $i,
'selected' => $selected,
'table_element_line' => $line->table_element);
1333 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters, $this, $action);
1335 if (empty($reshook)) {
1336 $this->printObjectLine($action, $line,
'', $num, $i, $dateSelector, $seller, $buyer, $selected,
null, $defaulttpldir);
1341 print
"<!-- end printObjectLines() -->\n";
1361 public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafields =
null, $defaulttpldir =
'/variants/tpl')
1363 global $conf, $langs, $user, $object, $hookmanager;
1365 global $object_rights, $disableedit, $disablemove, $disableremove;
1367 $object_rights = $user->rights->variants;
1370 if ($action !=
'editline' || $selected != $line->id) {
1374 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array($defaulttpldir));
1375 foreach ($dirtpls as $module => $reldir) {
1376 if (!empty($module)) {
1377 $tpl =
dol_buildpath($reldir .
'/productattributevalueline_view.tpl.php');
1379 $tpl = DOL_DOCUMENT_ROOT . $reldir .
'/productattributevalueline_view.tpl.php';
1382 if (empty($conf->file->strict_mode)) {
1383 $res = @include $tpl;
1385 $res = include $tpl;
1394 if ($action ==
'editline' && $selected == $line->id) {
1398 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array($defaulttpldir));
1399 foreach ($dirtpls as $module => $reldir) {
1400 if (!empty($module)) {
1401 $tpl =
dol_buildpath($reldir .
'/productattributevalueline_edit.tpl.php');
1403 $tpl = DOL_DOCUMENT_ROOT . $reldir .
'/productattributevalueline_edit.tpl.php';
1406 if (empty($conf->file->strict_mode)) {
1407 $res = @include $tpl;
1409 $res = include $tpl;
Parent class of all other business classes (invoices, contracts, proposals, orders,...
errorsToString()
Method to output saved errors.
line_max($fk_parent_line=0)
Get max value used for position of line (rang)
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class ProductAttribute Used to represent a product attribute.
updateAttributePositionDown($rowid, $position, $max)
Update position of attribute (down)
updatePositionOfAttribute($rowid, $position)
Update position of line (rang)
addLine($ref, $value, $position=-1, $notrigger=0)
attributeMoveDown($rowid)
Update a attribute to have a lower position.
fetch($id)
Fetches the properties of a product attribute.
update(User $user, $notrigger=0)
Updates a product attribute.
attributeOrder($renum=false, $rowidorder='ASC')
Save a new position (field position) for details lines.
fetchAll()
Returns an array of all product variants.
updateAttributePositionUp($rowid, $position)
Update position of attribute (up)
isUsed()
Test if used by a product.
updateLine($lineid, $ref, $value, $notrigger=0)
Update a line.
__construct(DoliDB $db)
Constructor.
getMaxAttributesPosition()
Get max value used for position of attributes.
LibStatut($status, $mode=1)
Return label of a status.
attributesAjaxOrder($rows)
Update position of attributes with ajax.
getLinesArray($filters='')
Retrieve an array of proposal lines.
fetch_lines($filters='')
Load array lines.
attributeMoveUp($rowid)
Update a attribute to have a higher position.
create(User $user, $notrigger=0)
Creates a product attribute.
countChildProducts()
Returns the number of products that are using this attribute.
deleteLine(User $user, $lineid, $notrigger=0)
Delete a line.
formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir='/variants/tpl')
Show add free and predefined products/services form.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
getLibStatut($mode=0)
Return label of status of product attribute.
getPositionOfAttribute($rowid)
Get position of attribute.
printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected=0, $extrafields=null, $defaulttpldir='/variants/tpl')
Return HTML content of a detail line TODO Move this into an output class file (htmlline....
printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $defaulttpldir='/variants/tpl', $addcreateline=0)
Return HTML table for object lines TODO Move this into an output class file (htmlline....
getLabelStatus($mode=0)
Return the label of the status.
countChildValues()
Returns the number of values for this attribute.
Class ProductAttributeValue Used to represent a product attribute value.
Class to manage Dolibarr users.
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_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
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...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
$conf db
API class for accounts.