dolibarr  16.0.5
html.formproduct.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2015-2017 Francis Appels <francis.appels@yahoo.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
24 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
25 
31 {
35  public $db;
36 
40  public $error = '';
41 
42  // Cache arrays
43  public $cache_warehouses = array();
44  public $cache_lot = array();
45 
46 
52  public function __construct($db)
53  {
54  $this->db = $db;
55  }
56 
57 
75  public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = array(), $stockMin = false, $orderBy = 'e.ref')
76  {
77  global $conf, $langs;
78 
79  if (empty($fk_product) && count($this->cache_warehouses)) {
80  return 0; // Cache already loaded and we do not want a list with information specific to a product
81  }
82 
83  $warehouseStatus = array();
84 
85  if (preg_match('/warehouseclosed/', $status)) {
86  $warehouseStatus[] = Entrepot::STATUS_CLOSED;
87  }
88  if (preg_match('/warehouseopen/', $status)) {
89  $warehouseStatus[] = Entrepot::STATUS_OPEN_ALL;
90  }
91  if (preg_match('/warehouseinternal/', $status)) {
92  $warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL;
93  }
94 
95  $sql = "SELECT e.rowid, e.ref as label, e.description, e.fk_parent";
96  if (!empty($fk_product) && $fk_product > 0) {
97  if (!empty($batch)) {
98  $sql .= ", pb.qty as stock";
99  } else {
100  $sql .= ", ps.reel as stock";
101  }
102  } elseif ($sumStock) {
103  $sql .= ", sum(ps.reel) as stock";
104  }
105  $sql .= " FROM ".$this->db->prefix()."entrepot as e";
106  $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_entrepot = e.rowid";
107  if (!empty($fk_product) && $fk_product > 0) {
108  $sql .= " AND ps.fk_product = ".((int) $fk_product);
109  if (!empty($batch)) {
110  $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$this->db->escape($batch)."'";
111  }
112  }
113  $sql .= " WHERE e.entity IN (".getEntity('stock').")";
114  if (count($warehouseStatus)) {
115  $sql .= " AND e.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")";
116  } else {
117  $sql .= " AND e.statut = 1";
118  }
119 
120  if (is_array($exclude) && !empty($exclude)) {
121  $sql .= ' AND e.rowid NOT IN('.$this->db->sanitize(implode(',', $exclude)).')';
122  }
123 
124  // minimum stock
125  if ($stockMin !== false) {
126  if (!empty($fk_product) && $fk_product > 0) {
127  if (!empty($batch)) {
128  $sql .= " AND pb.qty > ".((float) $stockMin);
129  } else {
130  $sql .= " AND ps.reel > ".((float) $stockMin);
131  }
132  }
133  }
134 
135  if ($sumStock && empty($fk_product)) {
136  $sql .= " GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
137 
138  // minimum stock
139  if ($stockMin !== false) {
140  $sql .= " HAVING sum(ps.reel) > ".((float) $stockMin);
141  }
142  }
143  $sql .= " ORDER BY ".$orderBy;
144 
145  dol_syslog(get_class($this).'::loadWarehouses', LOG_DEBUG);
146  $resql = $this->db->query($sql);
147  if ($resql) {
148  $num = $this->db->num_rows($resql);
149  $i = 0;
150  while ($i < $num) {
151  $obj = $this->db->fetch_object($resql);
152  if ($sumStock) {
153  $obj->stock = price2num($obj->stock, 5);
154  }
155  $this->cache_warehouses[$obj->rowid]['id'] = $obj->rowid;
156  $this->cache_warehouses[$obj->rowid]['label'] = $obj->label;
157  $this->cache_warehouses[$obj->rowid]['parent_id'] = $obj->fk_parent;
158  $this->cache_warehouses[$obj->rowid]['description'] = $obj->description;
159  $this->cache_warehouses[$obj->rowid]['stock'] = $obj->stock;
160  $i++;
161  }
162 
163  // Full label init
164  foreach ($this->cache_warehouses as $obj_rowid => $tab) {
165  $this->cache_warehouses[$obj_rowid]['full_label'] = $this->get_parent_path($tab);
166  }
167 
168  return $num;
169  } else {
170  dol_print_error($this->db);
171  return -1;
172  }
173  }
174 
175  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
183  private function get_parent_path($tab, $final_label = '')
184  {
185  //phpcs:enable
186  if (empty($final_label)) {
187  $final_label = $tab['label'];
188  }
189 
190  if (empty($tab['parent_id'])) {
191  return $final_label;
192  } else {
193  if (!empty($this->cache_warehouses[$tab['parent_id']])) {
194  $final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label;
195  return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
196  }
197  }
198 
199  return $final_label;
200  }
201 
227  public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref')
228  {
229  global $conf, $langs, $user, $hookmanager;
230 
231  dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG);
232 
233  $out = '';
234  if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
235  $filterstatus = '';
236  }
237  if (!empty($fk_product) && $fk_product > 0) {
238  $this->cache_warehouses = array();
239  }
240 
241  $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy);
242  $nbofwarehouses = count($this->cache_warehouses);
243 
244  if ($conf->use_javascript_ajax && !$forcecombo) {
245  include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
246  $comboenhancement = ajax_combobox($htmlname, $events);
247  $out .= $comboenhancement;
248  }
249 
250  if (strpos($htmlname, 'search_') !== 0) {
251  if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) {
252  if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
253  $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE;
254  }
255  } else {
256  if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
257  $selected = $user->fk_warehouse;
258  }
259  }
260  }
261 
262  $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled' : '').' id="'.$htmlname.'" name="'.($htmlname.($disabled ? '_disabled' : '')).'">';
263  if ($empty) {
264  $out .= '<option value="-1">'.($empty_label ? $empty_label : '&nbsp;').'</option>';
265  }
266  foreach ($this->cache_warehouses as $id => $arraytypes) {
267  $label = '';
268  if ($showfullpath) {
269  $label .= $arraytypes['full_label'];
270  } else {
271  $label .= $arraytypes['label'];
272  }
273  if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) {
274  if ($arraytypes['stock'] <= 0) {
275  $label .= ' <span class= \'text-warning\'>('.$langs->trans("Stock").':'.$arraytypes['stock'].')</span>';
276  } else {
277  $label .= ' <span class=\'opacitymedium\'>('.$langs->trans("Stock").':'.$arraytypes['stock'].')</span>';
278  }
279  }
280 
281  $out .= '<option value="'.$id.'"';
282  if ($selected == $id || (preg_match('/^ifone/', $selected) && $nbofwarehouses == 1)) {
283  $out .= ' selected';
284  }
285  $out .= ' data-html="'.dol_escape_htmltag($label).'"';
286  $out .= '>';
287  $out .= $label;
288  $out .= '</option>';
289  }
290  $out .= '</select>';
291  if ($disabled) {
292  $out .= '<input type="hidden" name="'.$htmlname.'" value="'.(($selected > 0) ? $selected : '').'">';
293  }
294 
295  $parameters = array(
296  'selected' => $selected,
297  'htmlname' => $htmlname,
298  'filterstatus' => $filterstatus,
299  'empty' => $empty,
300  'disabled ' => $disabled,
301  'fk_product' => $fk_product,
302  'empty_label' => $empty_label,
303  'showstock' => $showstock,
304  'forcecombo' => $forcecombo,
305  'events' => $events,
306  'morecss' => $morecss,
307  'exclude' => $exclude,
308  'showfullpath' => $showfullpath,
309  'stockMin' => $stockMin,
310  'orderBy' => $orderBy
311  );
312 
313  $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this);
314  if ($reshook > 0) {
315  $out = $hookmanager->resPrint;
316  } elseif ($reshook == 0) {
317  $out .= $hookmanager->resPrint;
318  }
319 
320  return $out;
321  }
322 
332  public function formSelectWarehouses($page, $selected = '', $htmlname = 'warehouse_id', $addempty = 0)
333  {
334  global $langs;
335  if ($htmlname != "none") {
336  print '<form method="POST" action="'.$page.'">';
337  print '<input type="hidden" name="action" value="setwarehouse">';
338  print '<input type="hidden" name="token" value="'.newToken().'">';
339  print '<table class="nobordernopadding">';
340  print '<tr><td>';
341  print $this->selectWarehouses($selected, $htmlname, '', $addempty);
342  print '</td>';
343  print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
344  print '</tr></table></form>';
345  } else {
346  if ($selected) {
347  require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
348  $warehousestatic = new Entrepot($this->db);
349  $warehousestatic->fetch($selected);
350  print $warehousestatic->getNomUrl();
351  } else {
352  print "&nbsp;";
353  }
354  }
355  }
356 
357  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
370  public function select_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0, $mode = 0)
371  {
372  //phpcs:enable
373  print $this->selectMeasuringUnits($name, $measuring_style, $default, $adddefault, $mode);
374  }
375 
388  public function selectMeasuringUnits($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0, $mode = 0, $morecss = 'maxwidth125')
389  {
390  global $langs, $conf, $mysoc, $db;
391 
392  $langs->load("other");
393 
394  $return = '';
395 
396  // TODO Use a cache
397  require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
398  $measuringUnits = new CUnits($db);
399 
400  $filter = array();
401  $filter['t.active'] = 1;
402  if ($measuring_style) {
403  $filter['t.unit_type'] = $measuring_style;
404  }
405 
406  $result = $measuringUnits->fetchAll(
407  '',
408  '',
409  0,
410  0,
411  $filter
412  );
413  if ($result < 0) {
414  dol_print_error($db);
415  return -1;
416  } else {
417  $return .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$name.'" id="'.$name.'">';
418  if ($adddefault || $adddefault === '') {
419  $return .= '<option value="0">'.($adddefault ? $langs->trans("Default") : '').'</option>';
420  }
421 
422  foreach ($measuringUnits->records as $lines) {
423  $return .= '<option value="';
424  if ($mode == 1) {
425  $return .= $lines->short_label;
426  } elseif ($mode == 2) {
427  $return .= $lines->scale;
428  } else {
429  $return .= $lines->id;
430  }
431  $return .= '"';
432  if ($mode == 1 && $lines->short_label == $default) {
433  $return .= ' selected';
434  } elseif ($mode == 2 && $lines->scale == $default) {
435  $return .= ' selected';
436  } elseif ($mode == 0 && $lines->id == $default) {
437  $return .= ' selected';
438  }
439  $return .= '>';
440  if ($measuring_style == 'time') {
441  $return .= $langs->trans(ucfirst($lines->label));
442  } else {
443  $return .= $langs->trans($lines->label);
444  }
445  $return .= '</option>';
446  }
447  $return .= '</select>';
448  }
449 
450  $return .= ajax_combobox($name);
451 
452  return $return;
453  }
454 
465  public function selectProductNature($name = 'finished', $selected = '', $mode = 0, $showempty = 1)
466  {
467  global $langs, $db;
468 
469  $langs->load('products');
470 
471  $return = '';
472 
473  // TODO Use a cache
474  require_once DOL_DOCUMENT_ROOT.'/core/class/cproductnature.class.php';
475  $productNature = new CProductNature($db);
476 
477  $filter = array();
478  $filter['t.active'] = 1;
479 
480  $result = $productNature->fetchAll('', '', 0, 0, $filter);
481 
482  if ($result < 0) {
483  dol_print_error($db);
484  return -1;
485  } else {
486  $return .= '<select class="flat" name="'.$name.'" id="'.$name.'">';
487  if ($showempty || ($selected == '' || $selected == '-1')) {
488  $return .= '<option value="-1"';
489  if ($selected == '' || $selected == '-1') {
490  $return .= ' selected';
491  }
492  $return .= '></option>';
493  }
494  if (!empty($productNature->records) && is_array($productNature->records)) {
495  foreach ($productNature->records as $lines) {
496  $return .= '<option value="';
497  if ($mode == 1) {
498  $return .= $lines->label;
499  } else {
500  $return .= $lines->code;
501  }
502 
503  $return .= '"';
504 
505  if ($mode == 1 && $lines->label == $selected) {
506  $return .= ' selected';
507  } elseif ($lines->code == $selected) {
508  $return .= ' selected';
509  }
510 
511  $return .= '>';
512  $return .= $langs->trans($lines->label);
513  $return .= '</option>';
514  }
515  }
516  $return .= '</select>';
517  }
518 
519  $return .= ajax_combobox($name);
520 
521  return $return;
522  }
523 
542  public function selectLotStock($selected = '', $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, $events = array(), $morecss = 'minwidth200')
543  {
544  global $conf, $langs;
545 
546  dol_syslog(get_class($this)."::selectLotStock $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $fk_entrepot, $empty_label, $forcecombo, $morecss", LOG_DEBUG);
547 
548  $out = '';
549  $productIdArray = array();
550  if (!is_array($objectLines) || !count($objectLines)) {
551  if (!empty($fk_product) && $fk_product > 0) {
552  $productIdArray[] = (int) $fk_product;
553  }
554  } else {
555  foreach ($objectLines as $line) {
556  if ($line->fk_product) {
557  $productIdArray[] = $line->fk_product;
558  }
559  }
560  }
561 
562  $nboflot = $this->loadLotStock($productIdArray);
563 
564  if ($conf->use_javascript_ajax && !$forcecombo) {
565  include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
566  $comboenhancement = ajax_combobox($htmlname, $events);
567  $out .= $comboenhancement;
568  }
569 
570  $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled' : '').' id="'.$htmlname.'" name="'.($htmlname.($disabled ? '_disabled' : '')).'">';
571  if ($empty) {
572  $out .= '<option value="-1">'.($empty_label ? $empty_label : '&nbsp;').'</option>';
573  }
574  if (!empty($fk_product) && $fk_product > 0) {
575  $productIdArray = array((int) $fk_product); // only show lot stock for product
576  } else {
577  foreach ($this->cache_lot as $key => $value) {
578  $productIdArray[] = $key;
579  }
580  }
581 
582  foreach ($productIdArray as $productId) {
583  foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
584  if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
585  $label = $arraytypes['entrepot_label'].' - ';
586  $label .= $arraytypes['batch'];
587  if ($arraytypes['qty'] <= 0) {
588  $label .= ' <span class=\'text-warning\'>('.$langs->trans("Stock").' '.$arraytypes['qty'].')</span>';
589  } else {
590  $label .= ' <span class=\'opacitymedium\'>('.$langs->trans("Stock").' '.$arraytypes['qty'].')</span>';
591  }
592 
593  $out .= '<option value="'.$id.'"';
594 
595  if ($selected == $id || ($selected == 'ifone' && $nboflot == 1)) {
596  $out .= ' selected';
597  }
598  $out .= ' data-html="'.dol_escape_htmltag($label).'"';
599  $out .= '>';
600  $out .= $label;
601  $out .= '</option>';
602  }
603  }
604  }
605  $out .= '</select>';
606  if ($disabled) {
607  $out .= '<input type="hidden" name="'.$htmlname.'" value="'.(($selected > 0) ? $selected : '').'">';
608  }
609 
610  return $out;
611  }
612 
613 
614 
625  public function selectLotDataList($htmlname = 'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
626  {
627  global $conf, $langs;
628 
629  dol_syslog(get_class($this)."::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot,$objectLines", LOG_DEBUG);
630 
631  $out = '';
632  $productIdArray = array();
633  if (!is_array($objectLines) || !count($objectLines)) {
634  if (!empty($fk_product) && $fk_product > 0) {
635  $productIdArray[] = (int) $fk_product;
636  }
637  } else {
638  foreach ($objectLines as $line) {
639  if ($line->fk_product) {
640  $productIdArray[] = $line->fk_product;
641  }
642  }
643  }
644 
645  $nboflot = $this->loadLotStock($productIdArray);
646 
647  $out .= '<datalist id="'.$htmlname.'" >';
648 
649  if (!empty($fk_product) && $fk_product > 0) {
650  $productIdArray = array((int) $fk_product); // only show lot stock for product
651  } else {
652  foreach ($this->cache_lot as $key => $value) {
653  $productIdArray[] = $key;
654  }
655  }
656 
657  foreach ($productIdArray as $productId) {
658  if (array_key_exists($productId, $this->cache_lot)) {
659  foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
660  if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
661  $label = $arraytypes['entrepot_label'] . ' - ';
662  $label .= $arraytypes['batch'];
663  $out .= '<option>' . $arraytypes['batch'] . '</option>';
664  }
665  }
666  }
667  }
668  $out .= '</datalist>';
669 
670  return $out;
671  }
672 
673 
681  private function loadLotStock($productIdArray = array())
682  {
683  global $conf, $langs;
684 
685  $cacheLoaded = false;
686  if (empty($productIdArray)) {
687  // only Load lot stock for given products
688  $this->cache_lot = array();
689  return 0;
690  }
691  if (count($productIdArray) && count($this->cache_lot)) {
692  // check cache already loaded for product id's
693  foreach ($productIdArray as $productId) {
694  $cacheLoaded = !empty($this->cache_lot[$productId]) ? true : false;
695  }
696  }
697  if ($cacheLoaded) {
698  return count($this->cache_lot);
699  } else {
700  // clear cache
701  $this->cache_lot = array();
702  $productIdList = implode(',', $productIdArray);
703  $sql = "SELECT pb.batch, pb.rowid, ps.fk_entrepot, pb.qty, e.ref as label, ps.fk_product";
704  $sql .= " FROM ".$this->db->prefix()."product_batch as pb";
705  $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.rowid = pb.fk_product_stock";
706  $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (".getEntity('stock').")";
707  if (!empty($productIdList)) {
708  $sql .= " WHERE ps.fk_product IN (".$this->db->sanitize($productIdList).")";
709  }
710  $sql .= " ORDER BY e.ref, pb.batch";
711 
712  dol_syslog(get_class($this).'::loadLotStock', LOG_DEBUG);
713  $resql = $this->db->query($sql);
714  if ($resql) {
715  $num = $this->db->num_rows($resql);
716  $i = 0;
717  while ($i < $num) {
718  $obj = $this->db->fetch_object($resql);
719  $this->cache_lot[$obj->fk_product][$obj->rowid]['id'] = $obj->rowid;
720  $this->cache_lot[$obj->fk_product][$obj->rowid]['batch'] = $obj->batch;
721  $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_id'] = $obj->fk_entrepot;
722  $this->cache_lot[$obj->fk_product][$obj->rowid]['entrepot_label'] = $obj->label;
723  $this->cache_lot[$obj->fk_product][$obj->rowid]['qty'] = $obj->qty;
724  $i++;
725  }
726 
727  return $num;
728  } else {
729  dol_print_error($this->db);
730  return -1;
731  }
732  }
733  }
734 }
ajax_combobox
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:438
db
$conf db
API class for accounts.
Definition: inc.php:41
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
Entrepot\STATUS_OPEN_INTERNAL
const STATUS_OPEN_INTERNAL
Warehouse open and operations for stock transfers/corrections allowed (not for customer shipping and ...
Definition: entrepot.class.php:161
CProductNature
Class of dictionary of nature of product (used by imports)
Definition: cproductnature.class.php:29
FormProduct\selectLotStock
selectLotStock($selected='', $htmlname='batch_id', $filterstatus='', $empty=0, $disabled=0, $fk_product=0, $fk_entrepot=0, $objectLines=array(), $empty_label='', $forcecombo=0, $events=array(), $morecss='minwidth200')
Return list of lot numbers (stock from product_batch) with stock location and stock qty.
Definition: html.formproduct.class.php:542
FormProduct\formSelectWarehouses
formSelectWarehouses($page, $selected='', $htmlname='warehouse_id', $addempty=0)
Display form to select warehouse.
Definition: html.formproduct.class.php:332
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
Entrepot\STATUS_OPEN_ALL
const STATUS_OPEN_ALL
Warehouse open and operations for customer shipping, supplier dispatch, internal stock transfers/corr...
Definition: entrepot.class.php:156
FormProduct\selectMeasuringUnits
selectMeasuringUnits($name='measuring_units', $measuring_style='', $default='0', $adddefault=0, $mode=0, $morecss='maxwidth125')
Return a combo box with list of units Units labels are defined in llx_c_units.
Definition: html.formproduct.class.php:388
FormProduct\selectLotDataList
selectLotDataList($htmlname='batch_id', $empty=0, $fk_product=0, $fk_entrepot=0, $objectLines=array())
Return list of lot numbers (stock from product_batch) for product and warehouse.
Definition: html.formproduct.class.php:625
getEntity
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
Definition: functions.lib.php:148
CUnits
Class of dictionary type of thirdparty (used by imports)
Definition: cunits.class.php:28
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
FormProduct
Class with static methods for building HTML components related to products Only components common to ...
Definition: html.formproduct.class.php:30
FormProduct\loadLotStock
loadLotStock($productIdArray=array())
Load in cache array list of lot available in stock from a given list of products.
Definition: html.formproduct.class.php:681
FormProduct\loadWarehouses
loadWarehouses($fk_product=0, $batch='', $status='', $sumStock=true, $exclude=array(), $stockMin=false, $orderBy='e.ref')
Load in cache array list of warehouses If fk_product is not 0, we do not use cache.
Definition: html.formproduct.class.php:75
FormProduct\get_parent_path
get_parent_path($tab, $final_label='')
Return full path to current warehouse in $tab (recursive function)
Definition: html.formproduct.class.php:183
FormProduct\selectProductNature
selectProductNature($name='finished', $selected='', $mode=0, $showempty=1)
Return a combo box with list of units NAture of product labels are defined in llx_c_product_nature.
Definition: html.formproduct.class.php:465
Entrepot\STATUS_CLOSED
const STATUS_CLOSED
Warehouse closed, inactive.
Definition: entrepot.class.php:151
Entrepot
Class to manage warehouses.
Definition: entrepot.class.php:35
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
FormProduct\select_measuring_units
select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0, $mode=0)
Output a combo box with list of units pour l'instant on ne definit pas les unites dans la base.
Definition: html.formproduct.class.php:370
FormProduct\selectWarehouses
selectWarehouses($selected='', $htmlname='idwarehouse', $filterstatus='', $empty=0, $disabled=0, $fk_product=0, $empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude=array(), $showfullpath=1, $stockMin=false, $orderBy='e.ref')
Return list of warehouses.
Definition: html.formproduct.class.php:227
FormProduct\__construct
__construct($db)
Constructor.
Definition: html.formproduct.class.php:52
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25