25require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
44 public $cache_warehouses = array();
45 public $cache_lot = array();
46 public $cache_workstations = array();
77 public function loadWarehouses($fk_product = 0, $batch =
'', $status =
'', $sumStock =
true, $exclude = array(), $stockMin =
false, $orderBy =
'e.ref')
81 if (empty($fk_product) && count($this->cache_warehouses)) {
85 $warehouseStatus = array();
87 if (preg_match(
'/warehouseclosed/', $status)) {
90 if (preg_match(
'/warehouseopen/', $status)) {
93 if (preg_match(
'/warehouseinternal/', $status)) {
97 $sql =
"SELECT e.rowid, e.ref as label, e.description, e.fk_parent";
98 if (!empty($fk_product) && $fk_product > 0) {
100 $sql .=
", pb.qty as stock";
102 $sql .=
", ps.reel as stock";
104 } elseif ($sumStock) {
105 $sql .=
", sum(ps.reel) as stock";
107 $sql .=
" FROM ".$this->db->prefix().
"entrepot as e";
108 $sql .=
" LEFT JOIN ".$this->db->prefix().
"product_stock as ps on ps.fk_entrepot = e.rowid";
109 if (!empty($fk_product) && $fk_product > 0) {
110 $sql .=
" AND ps.fk_product = ".((int) $fk_product);
111 if (!empty($batch)) {
112 $sql .=
" LEFT JOIN ".$this->db->prefix().
"product_batch as pb on pb.fk_product_stock = ps.rowid AND pb.batch = '".$this->db->escape($batch).
"'";
115 $sql .=
" WHERE e.entity IN (".getEntity(
'stock').
")";
116 if (count($warehouseStatus)) {
117 $sql .=
" AND e.statut IN (".$this->db->sanitize(implode(
',', $warehouseStatus)).
")";
119 $sql .=
" AND e.statut = 1";
122 if (is_array($exclude) && !empty($exclude)) {
123 $sql .=
' AND e.rowid NOT IN('.$this->db->sanitize(implode(
',', $exclude)).
')';
127 if ($stockMin !==
false) {
128 if (!empty($fk_product) && $fk_product > 0) {
129 if (!empty($batch)) {
130 $sql .=
" AND pb.qty > ".((float) $stockMin);
132 $sql .=
" AND ps.reel > ".((float) $stockMin);
137 if ($sumStock && empty($fk_product)) {
138 $sql .=
" GROUP BY e.rowid, e.ref, e.description, e.fk_parent";
141 if ($stockMin !==
false) {
142 $sql .=
" HAVING sum(ps.reel) > ".((float) $stockMin);
145 $sql .=
" ORDER BY ".$orderBy;
147 dol_syslog(get_class($this).
'::loadWarehouses', LOG_DEBUG);
148 $resql = $this->db->query($sql);
150 $num = $this->db->num_rows($resql);
153 $obj = $this->db->fetch_object($resql);
157 $this->cache_warehouses[$obj->rowid][
'id'] = $obj->rowid;
158 $this->cache_warehouses[$obj->rowid][
'label'] = $obj->label;
159 $this->cache_warehouses[$obj->rowid][
'parent_id'] = $obj->fk_parent;
160 $this->cache_warehouses[$obj->rowid][
'description'] = $obj->description;
161 $this->cache_warehouses[$obj->rowid][
'stock'] = $obj->stock;
166 foreach ($this->cache_warehouses as $obj_rowid => $tab) {
167 $this->cache_warehouses[$obj_rowid][
'full_label'] = $this->
get_parent_path($tab);
189 global $conf, $langs;
191 if (empty($fk_product) && count($this->cache_workstations)) {
195 $sql =
"SELECT w.rowid, w.ref as ref, w.label as label, w.type, w.nb_operators_required,w.thm_operator_estimated,w.thm_machine_estimated";
196 $sql .=
" FROM ".$this->db->prefix().
"workstation_workstation as w";
197 $sql .=
" WHERE 1 = 1";
198 if (!empty($fk_product) && $fk_product > 0) {
199 $sql .=
" AND w.fk_product = ".((int) $fk_product);
201 $sql .=
" AND w.entity IN (".getEntity(
'workstation').
")";
203 if (is_array($exclude) && !empty($exclude)) {
204 $sql .=
' AND w.rowid NOT IN('.$this->db->sanitize(implode(
',', $exclude)).
')';
207 $sql .=
" ORDER BY ".$orderBy;
209 dol_syslog(get_class($this).
'::loadWorkstations', LOG_DEBUG);
210 $resql = $this->db->query($sql);
212 $num = $this->db->num_rows($resql);
215 $obj = $this->db->fetch_object($resql);
217 $this->cache_workstations[$obj->rowid][
'id'] = $obj->rowid;
218 $this->cache_workstations[$obj->rowid][
'ref'] = $obj->ref;
219 $this->cache_workstations[$obj->rowid][
'label'] = $obj->label;
220 $this->cache_workstations[$obj->rowid][
'type'] = $obj->type;
221 $this->cache_workstations[$obj->rowid][
'nb_operators_required'] = $obj->nb_operators_required;
222 $this->cache_workstations[$obj->rowid][
'thm_operator_estimated'] = $obj->thm_operator_estimated;
223 $this->cache_workstations[$obj->rowid][
'thm_machine_estimated'] = $obj->thm_machine_estimated;
245 if (empty($final_label)) {
246 $final_label = $tab[
'label'];
249 if (empty($tab[
'parent_id'])) {
252 if (!empty($this->cache_warehouses[$tab[
'parent_id']])) {
253 $final_label = $this->cache_warehouses[$tab[
'parent_id']][
'label'].
' >> '.$final_label;
254 return $this->
get_parent_path($this->cache_warehouses[$tab[
'parent_id']], $final_label);
287 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', $multiselect = 0)
289 global $conf, $langs, $user, $hookmanager;
291 dol_syslog(get_class($this).
"::selectWarehouses " . (is_array($selected) ?
'selected is array' : $selected) .
", $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG);
297 if (!empty($fk_product) && $fk_product > 0) {
298 $this->cache_warehouses = array();
301 $this->
loadWarehouses($fk_product,
'', $filterstatus,
true, $exclude, $stockMin, $orderBy);
302 $nbofwarehouses = count($this->cache_warehouses);
304 if ($conf->use_javascript_ajax && !$forcecombo) {
305 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
307 $out .= $comboenhancement;
310 if (strpos($htmlname,
'search_') !== 0) {
311 if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) {
312 if (is_scalar($selected) && ($selected ==
'-2' || $selected ==
'ifone') &&
getDolGlobalString(
'MAIN_DEFAULT_WAREHOUSE')) {
316 if (is_scalar($selected) && ($selected ==
'-2' || $selected ==
'ifone') &&
getDolGlobalString(
'MAIN_DEFAULT_WAREHOUSE_USER')) {
317 $selected = $user->fk_warehouse;
322 $out .=
'<select '.($multiselect ?
'multiple ' :
'').
'class="flat'.($morecss ?
' '.$morecss :
'').
'"'.($disabled ?
' disabled' :
'');
323 $out .=
' id="'.$htmlname.
'" name="'.($htmlname.($multiselect ?
'[]' :
'').($disabled ?
'_disabled' :
'')).
'"';
327 $out .=
'<option value="-1">'.($empty_label ? $empty_label :
' ').
'</option>';
329 foreach ($this->cache_warehouses as $id => $arraytypes) {
332 $label .= $arraytypes[
'full_label'];
334 $label .= $arraytypes[
'label'];
336 if (($fk_product || ($showstock > 0)) && ($arraytypes[
'stock'] != 0 || ($showstock > 0))) {
337 if ($arraytypes[
'stock'] <= 0) {
338 $label .=
' <span class="text-warning">('.$langs->trans(
"Stock").
':'.$arraytypes[
'stock'].
')</span>';
340 $label .=
' <span class="opacitymedium">('.$langs->trans(
"Stock").
':'.$arraytypes[
'stock'].
')</span>';
344 $out .=
'<option value="'.$id.
'"';
345 if (is_array($selected)) {
346 if (in_array($id, $selected)) {
350 if ($selected == $id || (!empty($selected) && preg_match(
'/^ifone/', $selected) && $nbofwarehouses == 1)) {
354 $out .=
' data-html="'.dol_escape_htmltag($label).
'"';
361 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.(($selected > 0) ? $selected :
'').
'">';
365 'selected' => $selected,
366 'htmlname' => $htmlname,
367 'filterstatus' => $filterstatus,
369 'disabled ' => $disabled,
370 'fk_product' => $fk_product,
371 'empty_label' => $empty_label,
372 'showstock' => $showstock,
373 'forcecombo' => $forcecombo,
375 'morecss' => $morecss,
376 'exclude' => $exclude,
377 'showfullpath' => $showfullpath,
378 'stockMin' => $stockMin,
379 'orderBy' => $orderBy
382 $reshook = $hookmanager->executeHooks(
'selectWarehouses', $parameters, $this);
384 $out = $hookmanager->resPrint;
385 } elseif ($reshook == 0) {
386 $out .= $hookmanager->resPrint;
411 public function selectWorkstations($selected =
'', $htmlname =
'idworkstations', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label =
'', $forcecombo = 0, $events = array(), $morecss =
'minwidth200', $exclude = array(), $showfullpath = 1, $orderBy =
'e.ref')
413 global $conf, $langs, $user, $hookmanager;
415 dol_syslog(get_class($this).
"::selectWorkstations $selected, $htmlname, $empty, $disabled, $fk_product, $empty_label, $forcecombo, $morecss", LOG_DEBUG);
419 if (!empty($fk_product) && $fk_product > 0) {
420 $this->cache_workstations = array();
424 $nbofworkstations = count($this->cache_workstations);
426 if ($conf->use_javascript_ajax && !$forcecombo) {
427 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
429 $out .= $comboenhancement;
432 if (strpos($htmlname,
'search_') !== 0) {
433 if (empty($user->fk_workstation) || $user->fk_workstation == -1) {
434 if (($selected ==
'-2' || $selected ==
'ifone') &&
getDolGlobalString(
'MAIN_DEFAULT_WORKSTATION')) {
438 if (($selected ==
'-2' || $selected ==
'ifone') &&
getDolGlobalString(
'MAIN_DEFAULT_WORKSTATION')) {
439 $selected = $user->fk_workstation;
444 $out .=
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'"'.($disabled ?
' disabled' :
'').
' id="'.$htmlname.
'" name="'.($htmlname.($disabled ?
'_disabled' :
'')).
'">';
446 $out .=
'<option value="-1">'.($empty_label ? $empty_label :
' ').
'</option>';
448 foreach ($this->cache_workstations as $id => $arraytypes) {
449 $label = $arraytypes[
'label'];
451 $out .=
'<option value="'.$id.
'"';
452 if ($selected == $id || (preg_match(
'/^ifone/', $selected) && $nbofworkstations == 1)) {
455 $out .=
' data-html="'.dol_escape_htmltag($label).
'"';
462 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.(($selected > 0) ? $selected :
'').
'">';
466 'selected' => $selected,
467 'htmlname' => $htmlname,
468 'filterstatus' => $filterstatus,
470 'disabled ' => $disabled,
471 'fk_product' => $fk_product,
472 'empty_label' => $empty_label,
473 'forcecombo' => $forcecombo,
475 'morecss' => $morecss,
476 'exclude' => $exclude,
477 'showfullpath' => $showfullpath,
478 'orderBy' => $orderBy
481 $reshook = $hookmanager->executeHooks(
'selectWorkstations', $parameters, $this);
483 $out = $hookmanager->resPrint;
484 } elseif ($reshook == 0) {
485 $out .= $hookmanager->resPrint;
503 if ($htmlname !=
"none") {
504 print
'<form method="POST" action="'.$page.
'">';
505 print
'<input type="hidden" name="action" value="setwarehouse">';
506 print
'<input type="hidden" name="token" value="'.newToken().
'">';
507 print
'<table class="nobordernopadding">';
511 print
'<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
512 print
'</tr></table></form>';
515 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
516 $warehousestatic =
new Entrepot($this->db);
517 $warehousestatic->fetch($selected);
518 print $warehousestatic->getNomUrl();
538 public function select_measuring_units($name =
'measuring_units', $measuring_style =
'', $selected =
'0', $adddefault = 0, $mode = 0)
556 public function selectMeasuringUnits($name =
'measuring_units', $measuring_style =
'', $selected =
'0', $adddefault = 0, $mode = 0, $morecss =
'maxwidth125')
560 $langs->load(
"other");
565 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
566 $measuringUnits =
new CUnits($db);
569 $filter[
't.active'] = 1;
570 if ($measuring_style) {
571 $filter[
't.unit_type'] = $measuring_style;
574 $result = $measuringUnits->fetchAll(
585 $return .=
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'" name="'.$name.
'" id="'.$name.
'">';
586 if ($adddefault || $adddefault ===
'') {
587 $return .=
'<option value="0"'.($selected ===
'0' ?
' selected' :
'').
'>'.($adddefault ?
'('.$langs->trans(
"Default").
')' :
'').
'</option>';
590 foreach ($measuringUnits->records as $lines) {
591 $return .=
'<option value="';
593 $return .= $lines->short_label;
594 } elseif ($mode == 2) {
595 $return .= $lines->scale;
597 $return .= $lines->id;
600 if ($mode == 1 && $lines->short_label == $selected) {
601 $return .=
' selected';
602 } elseif ($mode == 2 && $lines->scale == $selected) {
603 $return .=
' selected';
604 } elseif ($mode == 0 && $lines->id == $selected) {
605 $return .=
' selected';
608 if ($measuring_style ==
'time') {
609 $return .= $langs->trans(ucfirst($lines->label));
611 $return .= $langs->trans($lines->label);
613 $return .=
'</option>';
615 $return .=
'</select>';
637 $langs->load(
'products');
642 require_once DOL_DOCUMENT_ROOT.
'/core/class/cproductnature.class.php';
646 $filter[
't.active'] = 1;
648 $result = $productNature->fetchAll(
'',
'', 0, 0, $filter);
654 $return .=
'<select class="flat" name="'.$name.
'" id="'.$name.
'">';
655 if ($showempty || ($selected ==
'' || $selected ==
'-1')) {
656 $return .=
'<option value="-1"';
657 if ($selected ==
'' || $selected ==
'-1') {
658 $return .=
' selected';
660 $return .=
'></option>';
662 if (!empty($productNature->records) && is_array($productNature->records)) {
663 foreach ($productNature->records as $lines) {
664 $return .=
'<option value="';
666 $return .= $lines->label;
668 $return .= $lines->code;
673 if ($mode == 1 && $lines->label == $selected) {
674 $return .=
' selected';
675 } elseif ($lines->code == $selected) {
676 $return .=
' selected';
680 $return .= $langs->trans($lines->label);
681 $return .=
'</option>';
684 $return .=
'</select>';
710 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')
712 global $conf, $langs;
714 dol_syslog(get_class($this).
"::selectLotStock $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $fk_entrepot, $empty_label, $forcecombo, $morecss", LOG_DEBUG);
717 $productIdArray = array();
718 if (!is_array($objectLines) || !count($objectLines)) {
719 if (!empty($fk_product) && $fk_product > 0) {
720 $productIdArray[] = (int) $fk_product;
723 foreach ($objectLines as $line) {
724 if ($line->fk_product) {
725 $productIdArray[] = $line->fk_product;
732 if ($conf->use_javascript_ajax && !$forcecombo) {
733 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
735 $out .= $comboenhancement;
738 $out .=
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'"'.($disabled ?
' disabled' :
'').
' id="'.$htmlname.
'" name="'.($htmlname.($disabled ?
'_disabled' :
'')).
'">';
740 $out .=
'<option value="-1">'.($empty_label ? $empty_label :
' ').
'</option>';
742 if (!empty($fk_product) && $fk_product > 0) {
743 $productIdArray = array((
int) $fk_product);
745 foreach ($this->cache_lot as $key => $value) {
746 $productIdArray[] = $key;
750 foreach ($productIdArray as $productId) {
751 foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
752 if (empty($fk_entrepot) || $fk_entrepot == $arraytypes[
'entrepot_id']) {
753 $label = $arraytypes[
'entrepot_label'].
' - ';
754 $label .= $arraytypes[
'batch'];
755 if ($arraytypes[
'qty'] <= 0) {
756 $label .=
' <span class=\'text-warning\'>('.$langs->trans(
"Stock").
' '.$arraytypes[
'qty'].
')</span>';
758 $label .=
' <span class=\'opacitymedium\'>('.$langs->trans(
"Stock").
' '.$arraytypes[
'qty'].
')</span>';
761 $out .=
'<option value="'.$id.
'"';
763 if ($selected == $id || ($selected ==
'ifone' && $nboflot == 1)) {
766 $out .=
' data-html="'.dol_escape_htmltag($label).
'"';
775 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.(($selected > 0) ? $selected :
'').
'">';
793 public function selectLotDataList($htmlname =
'batch_id', $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
795 global $langs, $hookmanager;
797 dol_syslog(get_class($this).
"::selectLotDataList $htmlname, $empty, $fk_product, $fk_entrepot", LOG_DEBUG);
800 $productIdArray = array();
801 if (!is_array($objectLines) || !count($objectLines)) {
802 if (!empty($fk_product) && $fk_product > 0) {
803 $productIdArray[] = (int) $fk_product;
806 foreach ($objectLines as $line) {
807 if ($line->fk_product) {
808 $productIdArray[] = $line->fk_product;
815 if (!empty($fk_product) && $fk_product > 0) {
816 $productIdArray = array((
int) $fk_product);
818 foreach ($this->cache_lot as $key => $value) {
819 $productIdArray[] = $key;
823 if (empty($hookmanager)) {
824 include_once DOL_DOCUMENT_ROOT .
'/core/class/hookmanager.class.php';
827 $hookmanager->initHooks(array(
'productdao'));
828 $parameters = array(
'productIdArray' => $productIdArray,
'htmlname' => $htmlname);
829 $reshook = $hookmanager->executeHooks(
'selectLotDataList', $parameters, $this);
831 return $hookmanager->error;
832 } elseif ($reshook > 0) {
833 return $hookmanager->resPrint;
835 $out .= $hookmanager->resPrint;
838 $out .=
'<datalist id="'.$htmlname.
'" >';
839 foreach ($productIdArray as $productId) {
840 if (array_key_exists($productId, $this->cache_lot)) {
841 foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
842 if (empty($fk_entrepot) || $fk_entrepot == $arraytypes[
'entrepot_id']) {
843 $label = $arraytypes[
'entrepot_label'] .
' - ';
844 $label .= $arraytypes[
'batch'];
845 $out .=
'<option data-warehouse="'.dol_escape_htmltag($label).
'" value="' . $arraytypes[
'batch'] .
'">(' . $langs->trans(
'Stock Total') .
': ' . $arraytypes[
'qty'] .
')</option>';
850 $out .=
'</datalist>';
865 global $conf, $langs;
867 $cacheLoaded =
false;
868 if (empty($productIdArray)) {
870 $this->cache_lot = array();
873 if (count($productIdArray) && count($this->cache_lot)) {
875 foreach ($productIdArray as $productId) {
876 $cacheLoaded = !empty($this->cache_lot[$productId]) ? true :
false;
880 return count($this->cache_lot);
883 $this->cache_lot = array();
884 $productIdList = implode(
',', $productIdArray);
888 if (empty($hookmanager)) {
889 include_once DOL_DOCUMENT_ROOT .
'/core/class/hookmanager.class.php';
892 $hookmanager->initHooks(array(
'productdao'));
893 $parameters = array(
'productIdList' => $productIdList);
894 $reshook = $hookmanager->executeHooks(
'loadLotStock', $parameters, $this);
896 $this->error = $hookmanager->error;
899 if (!empty($hookmanager->resArray[
'batch_list']) && is_array($hookmanager->resArray[
'batch_list'])) {
900 $this->cache_lot = $hookmanager->resArray[
'batch_list'];
901 $batch_count = (int) $hookmanager->resArray[
'batch_count'];
907 $sql =
"SELECT pb.batch, pb.rowid, ps.fk_entrepot, pb.qty, e.ref as label, ps.fk_product";
908 $sql .=
" FROM ".$this->db->prefix().
"product_batch as pb";
909 $sql .=
" LEFT JOIN ".$this->db->prefix().
"product_stock as ps on ps.rowid = pb.fk_product_stock";
910 $sql .=
" LEFT JOIN ".$this->db->prefix().
"entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (".
getEntity(
'stock').
")";
911 if (!empty($productIdList)) {
912 $sql .=
" WHERE ps.fk_product IN (".$this->db->sanitize($productIdList).
")";
914 $sql .=
" ORDER BY e.ref, pb.batch";
916 dol_syslog(get_class($this).
'::loadLotStock', LOG_DEBUG);
917 $resql = $this->db->query($sql);
919 $num = $this->db->num_rows($resql);
922 $obj = $this->db->fetch_object($resql);
923 $this->cache_lot[$obj->fk_product][$obj->rowid][
'id'] = $obj->rowid;
924 $this->cache_lot[$obj->fk_product][$obj->rowid][
'batch'] = $obj->batch;
925 $this->cache_lot[$obj->fk_product][$obj->rowid][
'entrepot_id'] = $obj->fk_entrepot;
926 $this->cache_lot[$obj->fk_product][$obj->rowid][
'entrepot_label'] = $obj->label;
927 $this->cache_lot[$obj->fk_product][$obj->rowid][
'qty'] = $obj->qty;
931 return $batch_count + $num;
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class of dictionary of nature of product (used by imports)
Class of dictionary type of thirdparty (used by imports)
Class to manage warehouses.
const STATUS_OPEN_INTERNAL
Warehouse open and only operations for stock transfers/corrections allowed (not for customer shipping...
const STATUS_OPEN_ALL
Warehouse open and any operations are allowed (customer shipping, supplier dispatch,...
const STATUS_CLOSED
Warehouse closed, inactive.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.