@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | |
1746 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1746 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1747 | 1747 | /** |
1748 | 1748 | * Clean sensible object datas |
1749 | 1749 | * |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | */ |
1753 | 1753 | protected function _cleanObjectDatas($object) |
1754 | 1754 | { |
1755 | - // phpcs:enable |
|
1755 | + // phpcs:enable |
|
1756 | 1756 | $object = parent::_cleanObjectDatas($object); |
1757 | 1757 | |
1758 | 1758 | unset($object->nom); // ->name already defined and nom deprecated |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | return $this->_cleanObjectDatas($this->contact); |
551 | 551 | } |
552 | 552 | |
553 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
553 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
554 | 554 | /** |
555 | 555 | * Clean sensible object datas |
556 | 556 | * |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | */ |
560 | 560 | protected function _cleanObjectDatas($object) |
561 | 561 | { |
562 | - // phpcs:enable |
|
562 | + // phpcs:enable |
|
563 | 563 | $object = parent::_cleanObjectDatas($object); |
564 | 564 | |
565 | 565 | unset($object->total_ht); |
@@ -294,7 +294,7 @@ |
||
294 | 294 | $this->amount = $totalamount; |
295 | 295 | $this->total = $totalamount; // deprecated |
296 | 296 | $this->db->commit(); |
297 | - return $this->id; // id of the last payment inserted |
|
297 | + return $this->id; // id of the last payment inserted |
|
298 | 298 | } else { |
299 | 299 | $this->error = $this->db->error(); |
300 | 300 | $this->db->rollback(); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | } |
691 | 691 | |
692 | 692 | |
693 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
693 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
694 | 694 | /** |
695 | 695 | * Mise a jour du lien entre le paiement de salaire et la ligne dans llx_bank generee |
696 | 696 | * |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | */ |
700 | 700 | public function update_fk_bank($id_bank) |
701 | 701 | { |
702 | - // phpcs:enable |
|
702 | + // phpcs:enable |
|
703 | 703 | $sql = "UPDATE " . MAIN_DB_PREFIX . "payment_salary SET fk_bank = " . ((int) $id_bank) . " WHERE rowid = " . ((int) $this->id); |
704 | 704 | |
705 | 705 | dol_syslog(get_only_class($this) . "::update_fk_bank", LOG_DEBUG); |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | return $this->LibStatut($this->statut, $mode); |
779 | 779 | } |
780 | 780 | |
781 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
781 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
782 | 782 | /** |
783 | 783 | * Return the status |
784 | 784 | * |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public function LibStatut($status, $mode = 0) |
790 | 790 | { |
791 | - // phpcs:enable |
|
791 | + // phpcs:enable |
|
792 | 792 | global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage |
793 | 793 | |
794 | 794 | $langs->load('compta'); |
@@ -619,7 +619,7 @@ |
||
619 | 619 | } elseif ($multicurrency) { |
620 | 620 | //$this->sumpayed_multicurrency = $obj->multicurrency_amount; |
621 | 621 | //return (float) $obj->multicurrency_amount; |
622 | - return -1; // Not yet supported |
|
622 | + return -1; // Not yet supported |
|
623 | 623 | } else { |
624 | 624 | //$this->sumpayed = $obj->amount; |
625 | 625 | return (float) $obj->amount; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
453 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
453 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
454 | 454 | /** |
455 | 455 | * Update link between payment salary and line generate into llx_bank |
456 | 456 | * |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function update_fk_bank($id_bank) |
461 | 461 | { |
462 | - // phpcs:enable |
|
462 | + // phpcs:enable |
|
463 | 463 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'salary SET fk_bank = ' . ((int) $id_bank); |
464 | 464 | $sql .= " WHERE rowid = " . ((int) $this->id); |
465 | 465 | $result = $this->db->query($sql); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
670 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
671 | 671 | /** |
672 | 672 | * Tag social contribution as paid completely |
673 | 673 | * |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function set_paid($user) |
680 | 680 | { |
681 | - // phpcs:enable |
|
681 | + // phpcs:enable |
|
682 | 682 | dol_syslog(get_only_class($this) . "::set_paid is deprecated, use setPaid instead", LOG_NOTICE); |
683 | 683 | return $this->setPaid($user); |
684 | 684 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | } |
706 | 706 | } |
707 | 707 | |
708 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
708 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
709 | 709 | /** |
710 | 710 | * Remove tag paid on social contribution |
711 | 711 | * |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function set_unpaid($user) |
716 | 716 | { |
717 | - // phpcs:enable |
|
717 | + // phpcs:enable |
|
718 | 718 | $sql = "UPDATE " . MAIN_DB_PREFIX . "salary SET"; |
719 | 719 | $sql .= " paye = 0"; |
720 | 720 | $sql .= " WHERE rowid = " . ((int) $this->id); |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | return $this->LibStatut($this->paye, $mode, $alreadypaid); |
743 | 743 | } |
744 | 744 | |
745 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
745 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
746 | 746 | /** |
747 | 747 | * Return label of a given status |
748 | 748 | * |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | */ |
754 | 754 | public function LibStatut($status, $mode = 0, $alreadypaid = -1) |
755 | 755 | { |
756 | - // phpcs:enable |
|
756 | + // phpcs:enable |
|
757 | 757 | global $langs; |
758 | 758 | |
759 | 759 | // Load translation files required by the page |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | return $return; |
837 | 837 | } |
838 | 838 | |
839 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
839 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
840 | 840 | /** |
841 | 841 | * Create a withdrawal request for a direct debit order or a credit transfer order. |
842 | 842 | * Use the remain to pay excluding all existing open direct debit requests. |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | */ |
851 | 851 | public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'salaire', $checkduplicateamongall = 0) |
852 | 852 | { |
853 | - // phpcs:enable |
|
853 | + // phpcs:enable |
|
854 | 854 | global $conf, $mysoc; |
855 | 855 | |
856 | 856 | $error = 0; |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | } |
958 | 958 | } |
959 | 959 | |
960 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
960 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
961 | 961 | /** |
962 | 962 | * Remove a direct debit request or a credit transfer request |
963 | 963 | * |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | */ |
968 | 968 | public function demande_prelevement_delete($fuser, $did) |
969 | 969 | { |
970 | - // phpcs:enable |
|
970 | + // phpcs:enable |
|
971 | 971 | $sql = 'DELETE FROM ' . $this->db->prefix() . 'prelevement_demande'; |
972 | 972 | $sql .= ' WHERE rowid = ' . ((int) $did); |
973 | 973 | $sql .= ' AND traite = 0'; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | return $paymentsalary; |
456 | 456 | } |
457 | 457 | |
458 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
458 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
459 | 459 | /** |
460 | 460 | * Clean sensible object datas |
461 | 461 | * |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | protected function _cleanObjectDatas($object) |
466 | 466 | { |
467 | - // phpcs:enable |
|
467 | + // phpcs:enable |
|
468 | 468 | $object = parent::_cleanObjectDatas($object); |
469 | 469 | |
470 | 470 | unset($object->rowid); |
@@ -445,7 +445,9 @@ |
||
445 | 445 | { |
446 | 446 | $paymentsalary = array(); |
447 | 447 | $fields = Salaries::$FIELDSPAYMENT; |
448 | - if (isModEnabled("bank")) array_push($fields, "accountid"); |
|
448 | + if (isModEnabled("bank")) { |
|
449 | + array_push($fields, "accountid"); |
|
450 | + } |
|
449 | 451 | foreach ($fields as $field) { |
450 | 452 | if (!isset($data[$field])) { |
451 | 453 | throw new RestException(400, "$field field missing"); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $sql .= ' t.rowid'; |
404 | 404 | // TODO Get all fields |
405 | 405 | $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
406 | - $sql .= ' WHERE t.entity = ' . ((int)$conf->entity); |
|
406 | + $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); |
|
407 | 407 | |
408 | 408 | // Manage filter |
409 | 409 | $errormessage = ''; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
612 | 612 | $sql .= ' fk_user_creat, fk_user_modif'; |
613 | 613 | $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
614 | - $sql .= ' WHERE t.rowid = ' . ((int)$id); |
|
614 | + $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
615 | 615 | $result = $this->db->query($sql); |
616 | 616 | if ($result) { |
617 | 617 | if ($this->db->num_rows($result)) { |
@@ -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 | } |
@@ -324,7 +324,7 @@ |
||
324 | 324 | $hook = array(); |
325 | 325 | foreach ($fields as $field) { |
326 | 326 | if (!isset($data[$field])) { |
327 | - throw new RestException(400, $field." field missing"); |
|
327 | + throw new RestException(400, $field . " field missing"); |
|
328 | 328 | } |
329 | 329 | $hook[$field] = $data[$field]; |
330 | 330 | } |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | return $this->LibStatut($this->status, $mode); |
894 | 894 | } |
895 | 895 | |
896 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
896 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
897 | 897 | /** |
898 | 898 | * Return the status |
899 | 899 | * |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | */ |
904 | 904 | public function LibStatut($status, $mode = 0) |
905 | 905 | { |
906 | - // phpcs:enable |
|
906 | + // phpcs:enable |
|
907 | 907 | if (empty($this->labelStatus) || empty($this->labelStatusShort)) { |
908 | 908 | global $langs; |
909 | 909 | //$langs->load("recruitment"); |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | return $this->LibStatut($this->status, $mode); |
817 | 817 | } |
818 | 818 | |
819 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
819 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
820 | 820 | /** |
821 | 821 | * Return the status |
822 | 822 | * |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | */ |
827 | 827 | public function LibStatut($status, $mode = 0) |
828 | 828 | { |
829 | - // phpcs:enable |
|
829 | + // phpcs:enable |
|
830 | 830 | if (empty($this->labelStatus) || empty($this->labelStatusShort)) { |
831 | 831 | global $langs; |
832 | 832 | //$langs->load("recruitment@recruitment"); |