27require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
41 public $parent_element =
'';
46 public $fk_parent_attribute =
'';
65 public $picto =
'line';
77 public $date_debut_prevue;
81 public $date_debut_reel;
85 public $date_fin_prevue;
89 public $date_fin_reel;
100 public $weight_units;
108 public $length_units;
124 public $height_units;
132 public $surface_units;
140 public $volume_units;
149 public $product_type;
183 public $product_label;
188 public $product_barcode;
193 public $product_desc;
198 public $product_custom_code;
203 public $product_custom_country_code;
208 public $product_custom_country_id;
213 public $fk_product_type;
226 public $remise_percent;
239 public $special_code;
251 public $subprice_ttc;
261 public $fk_multicurrency;
266 public $multicurrency_code;
271 public $multicurrency_subprice;
276 public $multicurrency_subprice_ttc;
281 public $multicurrency_total_ht;
286 public $multicurrency_total_tva;
291 public $multicurrency_total_localtax1;
296 public $multicurrency_total_localtax2;
301 public $multicurrency_total_ttc;
323 public function getLabelOfUnit($type =
'long', $outputlangs =
null, $noentities = 0)
327 if (empty($this->fk_unit)) {
330 if (empty($outputlangs)) {
331 $outputlangs = $langs;
334 $outputlangs->load(
'products');
337 $sql =
"SELECT code, label, short_label FROM ".$this->db->prefix().
"c_units where rowid = ".((int) $this->fk_unit);
339 $resql = $this->db->query($sql);
341 $this->error = $this->db->error();
342 dol_syslog(get_class($this).
"::getLabelOfUnit Error ".$this->error, LOG_ERR);
344 } elseif ($this->db->num_rows($resql) > 0 && $res = $this->db->fetch_array($resql)) {
345 if ($type ==
'short') {
347 $label = $outputlangs->transnoentitiesnoconv($res[
'short_label']);
349 $label = $outputlangs->trans($res[
'short_label']);
351 } elseif ($type ==
'code') {
352 $label = $res[
'code'];
354 if ($outputlangs->trans(
'unit'.$res[
'code']) ==
'unit'.$res[
'code']) {
356 $label = $res[
'label'];
360 $label = $outputlangs->transnoentitiesnoconv(
'unit'.$res[
'code']);
362 $label = $outputlangs->trans(
'unit'.$res[
'code']);
367 $this->db->free($resql);
384 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
397 public function getNomUrl($withpicto = 0)
399 $parentattribute = $this->fk_parent_attribute;
410 $parent_classname = $parent_element_properties[
'classname'];
411 $parent_element =
new $parent_classname($this->db);
413 $parentattribute = $this->fk_parent_attribute;
414 if ($parentattribute && method_exists($parent_element,
'fetch')) {
415 $parent_element->fetch($this->$parentattribute);
418 return $parent_element->getNomUrl($withpicto).
' - Line #'.$this->id;
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Empty function to prevent errors on call of this function.
getLabelOfUnit($type='long', $outputlangs=null, $noentities=0)
Reads the units dictionary to return the translation code of a unit (if type='code'),...
__construct($db)
Constructor.
getElementProperties($elementType)
Get an array with properties of an element.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.