@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | return $this->LibStatut($this->status, $mode); |
649 | 649 | } |
650 | 650 | |
651 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
651 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
652 | 652 | /** |
653 | 653 | * Return the status |
654 | 654 | * |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | public static function LibStatut($status, $mode = 0) |
660 | 660 | { |
661 | - // phpcs:enable |
|
661 | + // phpcs:enable |
|
662 | 662 | global $langs; |
663 | 663 | |
664 | 664 | $labelStatus = array(); |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | return $this->LibStatut($this->status, $mode); |
856 | 856 | } |
857 | 857 | |
858 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
858 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
859 | 859 | /** |
860 | 860 | * Return the status |
861 | 861 | * |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | */ |
866 | 866 | public function LibStatut($status, $mode = 0) |
867 | 867 | { |
868 | - // phpcs:enable |
|
868 | + // phpcs:enable |
|
869 | 869 | if (empty($this->labelStatus) || empty($this->labelStatusShort)) { |
870 | 870 | global $langs; |
871 | 871 | //$langs->load("stocktransfer@stocktransfer"); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * $price Can be set to update AWP (Average Weighted Price) when you make a stock increase |
157 | 157 | * $dlc Eat-by date. Will be used if lot does not exists yet and will be created. |
158 | 158 | * $dluo Sell-by date. Will be used if lot does not exists yet and will be created. |
159 | - * |
|
159 | + * |
|
160 | 160 | * @param int $product_id Id product id {@min 1} {@from body} {@required true} |
161 | 161 | * @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true} |
162 | 162 | * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true} |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | |
281 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
281 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
282 | 282 | /** |
283 | 283 | * Clean sensible object datas |
284 | 284 | * |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | protected function _cleanObjectDatas($object) |
289 | 289 | { |
290 | - // phpcs:enable |
|
290 | + // phpcs:enable |
|
291 | 291 | $object = parent::_cleanObjectDatas($object); |
292 | 292 | |
293 | 293 | // Remove useless data |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | return $this->LibStatut($this->status, $mode); |
548 | 548 | } |
549 | 549 | |
550 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
550 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
551 | 551 | /** |
552 | 552 | * Renvoi le libelle d'un status donne |
553 | 553 | * |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | */ |
558 | 558 | public function LibStatut($status, $mode = 0) |
559 | 559 | { |
560 | - // phpcs:enable |
|
560 | + // phpcs:enable |
|
561 | 561 | global $langs; |
562 | 562 | |
563 | 563 | if ($mode == 0) { |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | return $this->LibStatut(0, $mode); |
1063 | 1063 | } |
1064 | 1064 | |
1065 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1065 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1066 | 1066 | /** |
1067 | 1067 | * Return label of a given status |
1068 | 1068 | * |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | */ |
1073 | 1073 | public function LibStatut($status, $mode = 0) |
1074 | 1074 | { |
1075 | - // phpcs:enable |
|
1075 | + // phpcs:enable |
|
1076 | 1076 | //global $langs; |
1077 | 1077 | |
1078 | 1078 | //$langs->load('stocks'); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | |
566 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
566 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
567 | 567 | /** |
568 | 568 | * Return list of all warehouses |
569 | 569 | * |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function list_array($status = 1) |
574 | 574 | { |
575 | - // phpcs:enable |
|
575 | + // phpcs:enable |
|
576 | 576 | $liste = array(); |
577 | 577 | |
578 | 578 | $sql = "SELECT rowid, ref as label"; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | return $liste; |
595 | 595 | } |
596 | 596 | |
597 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
597 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
598 | 598 | /** |
599 | 599 | * Return number of unique different product into a warehouse |
600 | 600 | * |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | */ |
603 | 603 | public function nb_different_products() |
604 | 604 | { |
605 | - // phpcs:enable |
|
605 | + // phpcs:enable |
|
606 | 606 | $ret = array(); |
607 | 607 | |
608 | 608 | $sql = "SELECT count(distinct p.rowid) as nb"; |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | return $ret; |
626 | 626 | } |
627 | 627 | |
628 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
628 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
629 | 629 | /** |
630 | 630 | * Return stock and value of warehosue |
631 | 631 | * |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | public function nb_products() |
635 | 635 | { |
636 | 636 | global $conf; |
637 | - // phpcs:enable |
|
637 | + // phpcs:enable |
|
638 | 638 | $ret = array(); |
639 | 639 | |
640 | 640 | //For MultiCompany PMP per entity |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | return $this->LibStatut($this->statut, $mode); |
685 | 685 | } |
686 | 686 | |
687 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
687 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
688 | 688 | /** |
689 | 689 | * Return label of a given status |
690 | 690 | * |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | */ |
695 | 695 | public function LibStatut($status, $mode = 0) |
696 | 696 | { |
697 | - // phpcs:enable |
|
697 | + // phpcs:enable |
|
698 | 698 | global $langs; |
699 | 699 | |
700 | 700 | $statusType = 'status5'; |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | return 1; |
869 | 869 | } |
870 | 870 | |
871 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
871 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
872 | 872 | /** |
873 | 873 | * Return full path to current warehouse |
874 | 874 | * |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | */ |
877 | 877 | public function get_full_arbo() |
878 | 878 | { |
879 | - // phpcs:enable |
|
879 | + // phpcs:enable |
|
880 | 880 | global $user, $langs, $conf; |
881 | 881 | |
882 | 882 | $TArbo = array($this->label); |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | return implode(' >> ', array_reverse($TArbo)); |
910 | 910 | } |
911 | 911 | |
912 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
912 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
913 | 913 | /** |
914 | 914 | * Return array of children warehouses ids from $id warehouse (recursive function) |
915 | 915 | * |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | */ |
920 | 920 | public function get_children_warehouses($id, &$TChildWarehouses) |
921 | 921 | { |
922 | - // phpcs:enable |
|
922 | + // phpcs:enable |
|
923 | 923 | |
924 | 924 | $sql = "SELECT rowid |
925 | 925 | FROM " . $this->db->prefix() . "entrepot |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | return $this->LibStatut($this->status, $mode); |
577 | 577 | } |
578 | 578 | |
579 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
579 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
580 | 580 | /** |
581 | 581 | * Return the status |
582 | 582 | * |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function LibStatut($status, $mode = 0) |
589 | 589 | { |
590 | - // phpcs:enable |
|
590 | + // phpcs:enable |
|
591 | 591 | global $langs; |
592 | 592 | |
593 | 593 | if (empty($this->labelStatus) || empty($this->labelStatusShort)) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | ); |
296 | 296 | } |
297 | 297 | |
298 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
298 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
299 | 299 | /** |
300 | 300 | * Clean sensible object datas |
301 | 301 | * |
@@ -304,30 +304,30 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function _cleanObjectDatas($object) |
306 | 306 | { |
307 | - // phpcs:disable |
|
308 | - $object = parent::_cleanObjectDatas($object); |
|
309 | - |
|
310 | - return $object; |
|
311 | - } |
|
312 | - |
|
313 | - /** |
|
314 | - * Validate fields before create or update object |
|
315 | - * |
|
316 | - * @param array $data Array of data to validate |
|
317 | - * @param array $fields Array of fields needed |
|
318 | - * @return array |
|
319 | - * |
|
320 | - * @throws RestException |
|
321 | - */ |
|
322 | - private function validate($data, $fields) |
|
323 | - { |
|
324 | - $hook = array(); |
|
325 | - foreach ($fields as $field) { |
|
326 | - if (!isset($data[$field])) { |
|
327 | - throw new RestException(400, $field." field missing"); |
|
328 | - } |
|
329 | - $hook[$field] = $data[$field]; |
|
330 | - } |
|
331 | - return $hook; |
|
332 | - } |
|
307 | + // phpcs:disable |
|
308 | + $object = parent::_cleanObjectDatas($object); |
|
309 | + |
|
310 | + return $object; |
|
311 | + } |
|
312 | + |
|
313 | + /** |
|
314 | + * Validate fields before create or update object |
|
315 | + * |
|
316 | + * @param array $data Array of data to validate |
|
317 | + * @param array $fields Array of fields needed |
|
318 | + * @return array |
|
319 | + * |
|
320 | + * @throws RestException |
|
321 | + */ |
|
322 | + private function validate($data, $fields) |
|
323 | + { |
|
324 | + $hook = array(); |
|
325 | + foreach ($fields as $field) { |
|
326 | + if (!isset($data[$field])) { |
|
327 | + throw new RestException(400, $field." field missing"); |
|
328 | + } |
|
329 | + $hook[$field] = $data[$field]; |
|
330 | + } |
|
331 | + return $hook; |
|
332 | + } |
|
333 | 333 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return $object; |
82 | 82 | } |
83 | 83 | |
84 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
84 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
85 | 85 | /** |
86 | 86 | * Set content of ->tpl array, to use into template |
87 | 87 | * |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function assign_values(&$action, $id) |
93 | 93 | { |
94 | - // phpcs:enable |
|
94 | + // phpcs:enable |
|
95 | 95 | global $conf, $langs, $user, $canvas; |
96 | 96 | global $form, $formcompany, $objsoc; |
97 | 97 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
278 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
279 | 279 | /** |
280 | 280 | * Assign POST values into object |
281 | 281 | * |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | private function assign_post() |
285 | 285 | { |
286 | - // phpcs:enable |
|
286 | + // phpcs:enable |
|
287 | 287 | global $langs, $mysoc; |
288 | 288 | |
289 | 289 | $this->object->socid = GETPOSTINT("socid"); |