28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
42 public $parent_element =
'';
47 public $fk_parent_attribute =
'';
66 public $picto =
'line';
78 public $date_debut_prevue;
82 public $date_debut_reel;
86 public $date_fin_prevue;
90 public $date_fin_reel;
101 public $weight_units;
109 public $length_units;
125 public $height_units;
133 public $surface_units;
141 public $volume_units;
150 public $product_type;
184 public $product_label;
189 public $product_barcode;
194 public $product_desc;
199 public $product_custom_code;
204 public $product_custom_country_code;
209 public $product_custom_country_id;
214 public $fk_product_type;
227 public $remise_percent;
240 public $special_code;
252 public $subprice_ttc;
262 public $fk_multicurrency;
267 public $multicurrency_code;
272 public $multicurrency_subprice;
277 public $multicurrency_subprice_ttc;
282 public $multicurrency_total_ht;
287 public $multicurrency_total_tva;
292 public $multicurrency_total_localtax1;
297 public $multicurrency_total_localtax2;
302 public $multicurrency_total_ttc;
324 public function getLabelOfUnit($type =
'long', $outputlangs =
null, $noentities = 0)
328 if (empty($this->fk_unit)) {
331 if (empty($outputlangs)) {
332 $outputlangs = $langs;
335 $outputlangs->load(
'products');
338 $sql =
"SELECT code, label, short_label FROM ".$this->db->prefix().
"c_units where rowid = ".((int) $this->fk_unit);
340 $resql = $this->db->query($sql);
342 $this->error = $this->db->error();
343 dol_syslog(get_class($this).
"::getLabelOfUnit Error ".$this->error, LOG_ERR);
345 } elseif ($this->db->num_rows($resql) > 0 && $res = $this->db->fetch_array($resql)) {
346 if ($type ==
'short') {
348 $label = $outputlangs->transnoentitiesnoconv($res[
'short_label']);
350 $label = $outputlangs->trans($res[
'short_label']);
352 } elseif ($type ==
'code') {
353 $label = $res[
'code'];
355 if ($outputlangs->trans(
'unit'.$res[
'code']) ==
'unit'.$res[
'code']) {
357 $label = $res[
'label'];
361 $label = $outputlangs->transnoentitiesnoconv(
'unit'.$res[
'code']);
363 $label = $outputlangs->trans(
'unit'.$res[
'code']);
368 $this->db->free($resql);
385 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
398 public function getNomUrl($withpicto = 0)
400 $parentattribute = $this->fk_parent_attribute;
411 $parent_classname = $parent_element_properties[
'classname'];
412 $parent_element =
new $parent_classname($this->db);
414 $parentattribute = $this->fk_parent_attribute;
415 if ($parentattribute && method_exists($parent_element,
'fetch')) {
416 $parent_element->fetch($this->$parentattribute);
419 return $parent_element->getNomUrl($withpicto).
' - Line #'.$this->id;
432 return isset($this->subprice_ttc) && (float) $this->subprice_ttc != 0;
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
wasEnteredIncludingTax()
Return true if the unit price was originally entered including tax (TTC mode).
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Empty function to prevent errors on call of this function.
getPriceBaseType()
Return the price base type ('TTC' or 'HT') matching how the unit price was entered.
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.