108 public function index($sortfield =
"t.ref", $sortorder =
'ASC', $limit = 100, $page = 0, $sqlfilters =
'', $properties =
'')
112 if (!DolibarrApiAccess::$user->rights->workstation->workstation->read) {
113 throw new RestException(403);
118 $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid :
'';
120 $sql =
"SELECT t.rowid, t.ref";
121 $sql .=
" FROM ".$this->db->prefix().
"workstation_workstation as t";
128 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
133 $sqlTotals = str_replace(
'SELECT t.rowid, t.ref',
'SELECT count(t.rowid) as total', $sql);
135 $sql .= $this->db->order($sortfield, $sortorder);
140 $offset = $limit * $page;
142 $sql .= $this->db->plimit($limit + 1, $offset);
145 $result = $this->db->query($sql);
147 $num = $this->db->num_rows($result);
148 $min = min($num, ($limit <= 0 ? $num : $limit));
151 $obj = $this->db->fetch_object($result);
153 if ($workstation_static->fetch($obj->rowid)) {
159 throw new RestException(503,
'Error when retrieve workstation list : '.$this->db->lasterror());
164 $totalsResult = $this->db->query($sqlTotals);
165 $total = $this->db->fetch_object($totalsResult)->total;
170 $obj_ret[
'data'] = $tmp;
171 $obj_ret[
'pagination'] = array(
172 'total' => (
int) $total,
174 'page_count' => ceil((
int) $total / $limit),
198 unset(
$object->prices_by_qty_id);
200 unset(
$object->product_id_already_linked);
215 unset(
$object->fourn_price_base_type);
219 unset(
$object->product_fourn_id);
222 unset(
$object->linked_objects);
223 unset(
$object->linkedObjectsIds);
231 unset(
$object->commandeFournisseur);
237 unset(
$object->barcode_type_coder);
238 unset(
$object->shipping_method);
239 unset(
$object->fk_multicurrency);
240 unset(
$object->multicurrency_code);
241 unset(
$object->multicurrency_tx);
242 unset(
$object->multicurrency_total_ht);
243 unset(
$object->multicurrency_total_tva);
244 unset(
$object->multicurrency_total_ttc);
245 unset(
$object->multicurrency_total_localtax1);
246 unset(
$object->multicurrency_total_localtax2);
250 unset(
$object->total_localtax1);
251 unset(
$object->total_localtax2);
255 unset(
$object->labelStatusShort);
257 unset(
$object->showphoto_on_popup);
262 unset(
$object->cond_reglement_supplier_id);
263 unset(
$object->deposit_percent);
264 unset(
$object->retained_warranty_fk_cond_reglement);
268 unset(
$object->mode_reglement_id);
269 unset(
$object->cond_reglement_id);
270 unset(
$object->demand_reason_id);
271 unset(
$object->transport_mode_id);
272 unset(
$object->cond_reglement);
273 unset(
$object->shipping_method_id);
278 unset(
$object->recuperableonly);
279 unset(
$object->multiprices_recuperableonly);
285 unset(
$object->supplierprices);
288 unset(
$object->stock_theorique);
289 unset(
$object->stock_warehouse);