dolibarr  16.0.5
api_mos.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
3  * Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
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 
19 use Luracast\Restler\RestException;
20 
21 require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
22 
23 
36 class Mos extends DolibarrApi
37 {
41  public $mo;
42 
46  public function __construct()
47  {
48  global $db, $conf;
49  $this->db = $db;
50  $this->mo = new Mo($this->db);
51  }
52 
64  public function get($id)
65  {
66  if (!DolibarrApiAccess::$user->rights->mrp->read) {
67  throw new RestException(401);
68  }
69 
70  $result = $this->mo->fetch($id);
71  if (!$result) {
72  throw new RestException(404, 'MO not found');
73  }
74 
75  if (!DolibarrApi::_checkAccessToResource('mrp', $this->mo->id, 'mrp_mo')) {
76  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
77  }
78 
79  return $this->_cleanObjectDatas($this->mo);
80  }
81 
82 
97  public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
98  {
99  global $db, $conf;
100 
101  if (!DolibarrApiAccess::$user->rights->mrp->read) {
102  throw new RestException(401);
103  }
104 
105  $obj_ret = array();
106  $tmpobject = new Mo($this->db);
107 
108  $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
109 
110  $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object
111 
112  // If the internal user must only see his customers, force searching by him
113  $search_sale = 0;
114  if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) {
115  $search_sale = DolibarrApiAccess::$user->id;
116  }
117 
118  $sql = "SELECT t.rowid";
119  if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
120  $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
121  }
122  $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
123 
124  if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
125  $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
126  }
127  $sql .= " WHERE 1 = 1";
128 
129  // Example of use $mode
130  //if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
131  //if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
132 
133  if ($tmpobject->ismultientitymanaged) {
134  $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
135  }
136  if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
137  $sql .= " AND t.fk_soc = sc.fk_soc";
138  }
139  if ($restrictonsocid && $socid) {
140  $sql .= " AND t.fk_soc = ".((int) $socid);
141  }
142  if ($restrictonsocid && $search_sale > 0) {
143  $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
144  }
145  // Insert sale filter
146  if ($restrictonsocid && $search_sale > 0) {
147  $sql .= " AND sc.fk_user = ".((int) $search_sale);
148  }
149  if ($sqlfilters) {
150  $errormessage = '';
151  if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
152  throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
153  }
154  $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
155  $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
156  }
157 
158  $sql .= $this->db->order($sortfield, $sortorder);
159  if ($limit) {
160  if ($page < 0) {
161  $page = 0;
162  }
163  $offset = $limit * $page;
164 
165  $sql .= $this->db->plimit($limit + 1, $offset);
166  }
167 
168  $result = $this->db->query($sql);
169  if ($result) {
170  $num = $this->db->num_rows($result);
171  $i = 0;
172  while ($i < $num) {
173  $obj = $this->db->fetch_object($result);
174  $tmp_object = new Mo($this->db);
175  if ($tmp_object->fetch($obj->rowid)) {
176  $obj_ret[] = $this->_cleanObjectDatas($tmp_object);
177  }
178  $i++;
179  }
180  } else {
181  throw new RestException(503, 'Error when retrieve MO list');
182  }
183  if (!count($obj_ret)) {
184  throw new RestException(404, 'No MO found');
185  }
186  return $obj_ret;
187  }
188 
195  public function post($request_data = null)
196  {
197  if (!DolibarrApiAccess::$user->rights->mrp->write) {
198  throw new RestException(401);
199  }
200  // Check mandatory fields
201  $result = $this->_validate($request_data);
202 
203  foreach ($request_data as $field => $value) {
204  $this->mo->$field = $value;
205  }
206  if (!$this->mo->create(DolibarrApiAccess::$user)) {
207  throw new RestException(500, "Error creating MO", array_merge(array($this->mo->error), $this->mo->errors));
208  }
209  return $this->mo->id;
210  }
211 
220  public function put($id, $request_data = null)
221  {
222  if (!DolibarrApiAccess::$user->rights->mrp->write) {
223  throw new RestException(401);
224  }
225 
226  $result = $this->mo->fetch($id);
227  if (!$result) {
228  throw new RestException(404, 'MO not found');
229  }
230 
231  if (!DolibarrApi::_checkAccessToResource('mrp', $this->mo->id, 'mrp_mo')) {
232  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
233  }
234 
235  foreach ($request_data as $field => $value) {
236  if ($field == 'id') {
237  continue;
238  }
239  $this->mo->$field = $value;
240  }
241 
242  if ($this->mo->update(DolibarrApiAccess::$user) > 0) {
243  return $this->get($id);
244  } else {
245  throw new RestException(500, $this->mo->error);
246  }
247  }
248 
255  public function delete($id)
256  {
257  if (!DolibarrApiAccess::$user->rights->mrp->delete) {
258  throw new RestException(401);
259  }
260  $result = $this->mo->fetch($id);
261  if (!$result) {
262  throw new RestException(404, 'MO not found');
263  }
264 
265  if (!DolibarrApi::_checkAccessToResource('mrp', $this->mo->id, 'mrp_mo')) {
266  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
267  }
268 
269  if (!$this->mo->delete(DolibarrApiAccess::$user)) {
270  throw new RestException(500, 'Error when deleting MO : '.$this->mo->error);
271  }
272 
273  return array(
274  'success' => array(
275  'code' => 200,
276  'message' => 'MO deleted'
277  )
278  );
279  }
280 
281 
301  public function produceAndConsume($id, $request_data = null)
302  {
303  global $langs;
304 
305  $error = 0;
306 
307  if (!DolibarrApiAccess::$user->rights->mrp->write) {
308  throw new RestException(401, 'Not enough permission');
309  }
310  $result = $this->mo->fetch($id);
311  if (!$result) {
312  throw new RestException(404, 'MO not found');
313  }
314 
315  if ($this->mo->status != Mo::STATUS_VALIDATED && $this->mo->status != Mo::STATUS_INPROGRESS) {
316  throw new RestException(401, 'Error bad status of MO');
317  }
318 
319  $labelmovement = '';
320  $codemovement = '';
321  $autoclose = 1;
322  $arraytoconsume = array();
323  $arraytoproduce = array();
324 
325  foreach ($request_data as $field => $value) {
326  if ($field == 'inventorylabel') {
327  $labelmovement = $value;
328  }
329  if ($field == 'inventorycode') {
330  $codemovement = $value;
331  }
332  if ($field == 'autoclose') {
333  $autoclose = $value;
334  }
335  if ($field == 'arraytoconsume') {
336  $arraytoconsume = $value;
337  }
338  if ($field == 'arraytoproduce') {
339  $arraytoproduce = $value;
340  }
341  }
342 
343  if (empty($labelmovement)) {
344  throw new RestException(500, "Field inventorylabel not prodivded");
345  }
346  if (empty($codemovement)) {
347  throw new RestException(500, "Field inventorycode not prodivded");
348  }
349 
350  // Code for consume and produce...
351  require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
352  require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
353  dol_include_once('/mrp/lib/mrp_mo.lib.php');
354 
355  $stockmove = new MouvementStock($this->db);
356 
357  $consumptioncomplete = true;
358  $productioncomplete = true;
359 
360  if (!empty($arraytoconsume) && !empty($arraytoproduce)) {
361  $pos = 0;
362  $arrayofarrayname = array("arraytoconsume","arraytoproduce");
363  foreach ($arrayofarrayname as $arrayname) {
364  foreach ($$arrayname as $value) {
365  $tmpproduct = new Product($this->db);
366  if (empty($value["objectid"])) {
367  throw new RestException(500, "Field objectid required in ".$arrayname);
368  }
369  $tmpproduct->fetch($value["qty"]);
370  if (empty($value["qty"])) {
371  throw new RestException(500, "Field qty required in ".$arrayname);
372  }
373  if ($value["qty"]!=0) {
374  $qtytoprocess = $value["qty"];
375  if (isset($value["fk_warehouse"])) { // If there is a warehouse to set
376  if (!($value["fk_warehouse"] > 0)) { // If there is no warehouse set.
377  $error++;
378  throw new RestException(500, "Field fk_warehouse must be > 0 in ".$arrayname);
379  }
380  if ($tmpproduct->status_batch) {
381  $error++;
382  throw new RestException(500, "Product ".$tmpproduct->ref."must be in batch");
383  }
384  }
385  $idstockmove = 0;
386  if (!$error && $value["fk_warehouse"] > 0) {
387  // Record stock movement
388  $id_product_batch = 0;
389 
390  $stockmove->setOrigin($this->mo->element, $this->mo->id);
391 
392  if ($qtytoprocess >= 0) {
393  $moline = new MoLine($this->db);
394  $moline->fk_mo = $this->mo->id;
395  $moline->position = $pos;
396  $moline->fk_product = $value["objectid"];
397  $moline->fk_warehouse = $value["fk_warehouse"];
398  $moline->qty = $qtytoprocess;
399  $moline->batch = $tmpproduct->status_batch;
400  $moline->role = 'toproduce';
401  $moline->fk_mrp_production = "";
402  $moline->fk_stock_movement = $idstockmove;
403  $moline->fk_user_creat = DolibarrApiAccess::$user->id;
404 
405  $resultmoline = $moline->create(DolibarrApiAccess::$user);
406  if ($resultmoline <= 0) {
407  $error++;
408  throw new RestException(500, $moline->error);
409  }
410  $idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
411  } else {
412  $moline = new MoLine($this->db);
413  $moline->fk_mo = $this->mo->id;
414  $moline->position = $pos;
415  $moline->fk_product = $value["objectid"];
416  $moline->fk_warehouse = $value["fk_warehouse"];
417  $moline->qty = $qtytoprocess;
418  $moline->batch = $tmpproduct->status_batch;
419  $moline->role = 'toconsume';
420  $moline->fk_mrp_production = "";
421  $moline->fk_stock_movement = $idstockmove;
422  $moline->fk_user_creat = DolibarrApiAccess::$user->id;
423 
424  $resultmoline = $moline->create(DolibarrApiAccess::$user);
425  if ($resultmoline <= 0) {
426  $error++;
427  throw new RestException(500, $moline->error);
428  }
429  $idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
430  }
431  if ($idstockmove < 0) {
432  $error++;
433  throw new RestException(500, $stockmove->error);
434  }
435  }
436  if (!$error) {
437  // Record consumption
438  $moline = new MoLine($this->db);
439  $moline->fk_mo = $this->mo->id;
440  $moline->position = $pos;
441  $moline->fk_product = $value["objectid"];
442  $moline->fk_warehouse = $value["fk_warehouse"];
443  $moline->qty = $qtytoprocess;
444  $moline->batch = $tmpproduct->status_batch;
445  if ($arrayname == "arraytoconsume") {
446  $moline->role = 'consumed';
447  } else {
448  $moline->role = 'produced';
449  }
450  $moline->fk_mrp_production = "";
451  $moline->fk_stock_movement = $idstockmove;
452  $moline->fk_user_creat = DolibarrApiAccess::$user->id;
453 
454  $resultmoline = $moline->create(DolibarrApiAccess::$user);
455  if ($resultmoline <= 0) {
456  $error++;
457  throw new RestException(500, $moline->error);
458  }
459 
460  $pos++;
461  }
462  }
463  }
464  }
465  if (!$error) {
466  if ($autoclose <= 0) {
467  $consumptioncomplete = false;
468  $productioncomplete = false;
469  }
470  }
471  } else {
472  $pos = 0;
473  foreach ($this->mo->lines as $line) {
474  if ($line->role == 'toconsume') {
475  $tmpproduct = new Product($this->db);
476  $tmpproduct->fetch($line->fk_product);
477  if ($line->qty != 0) {
478  $qtytoprocess = $line->qty;
479  if (isset($line->fk_warehouse)) { // If there is a warehouse to set
480  if (!($line->fk_warehouse > 0)) { // If there is no warehouse set.
481  $langs->load("errors");
482  $error++;
483  throw new RestException(500, $langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref));
484  }
485  if ($tmpproduct->status_batch) {
486  $langs->load("errors");
487  $error++;
488  throw new RestException(500, $langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref));
489  }
490  }
491  $idstockmove = 0;
492  if (!$error && $line->fk_warehouse > 0) {
493  // Record stock movement
494  $id_product_batch = 0;
495  $stockmove->origin_type = 'mo';
496  $stockmove->origin_id = $this->mo->id;
497  if ($qtytoprocess >= 0) {
498  $idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
499  } else {
500  $idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
501  }
502  if ($idstockmove < 0) {
503  $error++;
504  throw new RestException(500, $stockmove->error);
505  }
506  }
507  if (!$error) {
508  // Record consumption
509  $moline = new MoLine($this->db);
510  $moline->fk_mo = $this->mo->id;
511  $moline->position = $pos;
512  $moline->fk_product = $line->fk_product;
513  $moline->fk_warehouse = $line->fk_warehouse;
514  $moline->qty = $qtytoprocess;
515  $moline->batch = $tmpproduct->status_batch;
516  $moline->role = 'consumed';
517  $moline->fk_mrp_production = $line->id;
518  $moline->fk_stock_movement = $idstockmove;
519  $moline->fk_user_creat = DolibarrApiAccess::$user->id;
520 
521  $resultmoline = $moline->create(DolibarrApiAccess::$user);
522  if ($resultmoline <= 0) {
523  $error++;
524  throw new RestException(500, $moline->error);
525  }
526 
527  $pos++;
528  }
529  }
530  }
531  }
532  $pos = 0;
533  foreach ($this->mo->lines as $line) {
534  if ($line->role == 'toproduce') {
535  $tmpproduct = new Product($this->db);
536  $tmpproduct->fetch($line->fk_product);
537  if ($line->qty != 0) {
538  $qtytoprocess = $line->qty;
539  if (isset($line->fk_warehouse)) { // If there is a warehouse to set
540  if (!($line->fk_warehouse > 0)) { // If there is no warehouse set.
541  $langs->load("errors");
542  $error++;
543  throw new RestException(500, $langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref));
544  }
545  if ($tmpproduct->status_batch) {
546  $langs->load("errors");
547  $error++;
548  throw new RestException(500, $langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref));
549  }
550  }
551  $idstockmove = 0;
552  if (!$error && $line->fk_warehouse > 0) {
553  // Record stock movement
554  $id_product_batch = 0;
555  $stockmove->origin_type = 'mo';
556  $stockmove->origin_id = $this->mo->id;
557  if ($qtytoprocess >= 0) {
558  $idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
559  } else {
560  $idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
561  }
562  if ($idstockmove < 0) {
563  $error++;
564  throw new RestException(500, $stockmove->error);
565  }
566  }
567  if (!$error) {
568  // Record consumption
569  $moline = new MoLine($this->db);
570  $moline->fk_mo = $this->mo->id;
571  $moline->position = $pos;
572  $moline->fk_product = $line->fk_product;
573  $moline->fk_warehouse = $line->fk_warehouse;
574  $moline->qty = $qtytoprocess;
575  $moline->batch = $tmpproduct->status_batch;
576  $moline->role = 'produced';
577  $moline->fk_mrp_production = $line->id;
578  $moline->fk_stock_movement = $idstockmove;
579  $moline->fk_user_creat = DolibarrApiAccess::$user->id;
580 
581  $resultmoline = $moline->create(DolibarrApiAccess::$user);
582  if ($resultmoline <= 0) {
583  $error++;
584  throw new RestException(500, $moline->error);
585  }
586 
587  $pos++;
588  }
589  }
590  }
591  }
592 
593  if (!$error) {
594  if ($autoclose > 0) {
595  foreach ($this->mo->lines as $line) {
596  if ($line->role == 'toconsume') {
597  $arrayoflines = $this->mo->fetchLinesLinked('consumed', $line->id);
598  $alreadyconsumed = 0;
599  foreach ($arrayoflines as $line2) {
600  $alreadyconsumed += $line2['qty'];
601  }
602 
603  if ($alreadyconsumed < $line->qty) {
604  $consumptioncomplete = false;
605  }
606  }
607  if ($line->role == 'toproduce') {
608  $arrayoflines = $this->mo->fetchLinesLinked('produced', $line->id);
609  $alreadyproduced = 0;
610  foreach ($arrayoflines as $line2) {
611  $alreadyproduced += $line2['qty'];
612  }
613 
614  if ($alreadyproduced < $line->qty) {
615  $productioncomplete = false;
616  }
617  }
618  }
619  } else {
620  $consumptioncomplete = false;
621  $productioncomplete = false;
622  }
623  }
624  }
625 
626  // Update status of MO
627  dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete);
628  //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete);
629  if ($consumptioncomplete && $productioncomplete) {
630  $result = $this->mo->setStatut(self::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
631  } else {
632  $result = $this->mo->setStatut(self::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED');
633  }
634  if ($result <= 0) {
635  throw new RestException(500, $this->mo->error);
636  }
637 
638  return $this->mo->id;
639  }
640 
641 
642  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
649  protected function _cleanObjectDatas($object)
650  {
651  // phpcs:enable
652  $object = parent::_cleanObjectDatas($object);
653 
654  unset($object->rowid);
655  unset($object->canvas);
656 
657  unset($object->name);
658  unset($object->lastname);
659  unset($object->firstname);
660  unset($object->civility_id);
661  unset($object->statut);
662  unset($object->state);
663  unset($object->state_id);
664  unset($object->state_code);
665  unset($object->region);
666  unset($object->region_code);
667  unset($object->country);
668  unset($object->country_id);
669  unset($object->country_code);
670  unset($object->barcode_type);
671  unset($object->barcode_type_code);
672  unset($object->barcode_type_label);
673  unset($object->barcode_type_coder);
674  unset($object->total_ht);
675  unset($object->total_tva);
676  unset($object->total_localtax1);
677  unset($object->total_localtax2);
678  unset($object->total_ttc);
679  unset($object->fk_account);
680  unset($object->comments);
681  unset($object->note);
682  unset($object->mode_reglement_id);
683  unset($object->cond_reglement_id);
684  unset($object->cond_reglement);
685  unset($object->shipping_method_id);
686  unset($object->fk_incoterms);
687  unset($object->label_incoterms);
688  unset($object->location_incoterms);
689 
690  // If object has lines, remove $db property
691  if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
692  $nboflines = count($object->lines);
693  for ($i = 0; $i < $nboflines; $i++) {
694  $this->_cleanObjectDatas($object->lines[$i]);
695 
696  unset($object->lines[$i]->lines);
697  unset($object->lines[$i]->note);
698  }
699  }
700 
701  return $object;
702  }
703 
712  private function _validate($data)
713  {
714  $myobject = array();
715  foreach ($this->mo->fields as $field => $propfield) {
716  if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) {
717  continue; // Not a mandatory field
718  }
719  if (!isset($data[$field])) {
720  throw new RestException(400, "$field field missing");
721  }
722  $myobject[$field] = $data[$field];
723  }
724  return $myobject;
725  }
726 }
db
$conf db
API class for accounts.
Definition: inc.php:41
Mos\index
index($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='')
List Mos.
Definition: api_mos.class.php:97
dol_include_once
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
Definition: functions.lib.php:1033
MoLine
Class MoLine.
Definition: mo.class.php:1562
DolibarrApi\_checkAccessToResource
static _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
Check access by user to a given resource.
Definition: api.class.php:283
Mos\__construct
__construct()
Constructor.
Definition: api_mos.class.php:46
Mo
Class for Mo.
Definition: mo.class.php:35
DolibarrApi
Class for API REST v1.
Definition: api.class.php:30
Mos\post
post($request_data=null)
Create MO object.
Definition: api_mos.class.php:195
Mos\_validate
_validate($data)
Validate fields before create or update object.
Definition: api_mos.class.php:712
Mos
Definition: api_mos.class.php:36
MouvementStock
Class to manage stock movements.
Definition: mouvementstock.class.php:31
DolibarrApi\_checkFilters
_checkFilters($sqlfilters, &$error='')
Return if a $sqlfilters parameter is valid.
Definition: api.class.php:310
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
Mos\_cleanObjectDatas
_cleanObjectDatas($object)
Clean sensible object datas.
Definition: api_mos.class.php:649
Mos\put
put($id, $request_data=null)
Update MO.
Definition: api_mos.class.php:220
Product
Class to manage products or services.
Definition: product.class.php:46
Mos\produceAndConsume
produceAndConsume($id, $request_data=null)
Produce and consume.
Definition: api_mos.class.php:301
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845