Laurent Destailleur пре 1 година
родитељ
комит
c1b0f187bc

+ 7 - 6
htdocs/societe/class/api_thirdparties.class.php

@@ -350,18 +350,18 @@ class Thirdparties extends DolibarrApi
 			throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
 		}
 
-		$this->companytoremove = new Societe($this->db);
+		$companytoremove = new Societe($this->db);
 
-		$result = $this->companytoremove->fetch($idtodelete); // include the fetch of extra fields
+		$result = $companytoremove->fetch($idtodelete); // include the fetch of extra fields
 		if (!$result) {
 			throw new RestException(404, 'Thirdparty not found');
 		}
 
-		if (!DolibarrApi::_checkAccessToResource('societe', $this->companytoremove->id)) {
+		if (!DolibarrApi::_checkAccessToResource('societe', $companytoremove->id)) {
 			throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
 		}
 
-		$soc_origin = $this->companytoremove;
+		$soc_origin = $companytoremove;
 		$object = $this->company;
 		$user = DolibarrApiAccess::$user;
 
@@ -476,7 +476,8 @@ class Thirdparties extends DolibarrApi
 		// External modules should update their ones too
 		if (!$error) {
 			$parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id);
-			$reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $soc_dest, $action);
+			$action = '';
+			$reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $object, $action);
 
 			if ($reshook < 0) {
 				//setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -509,7 +510,7 @@ class Thirdparties extends DolibarrApi
 		if ($error) {
 			$this->db->rollback();
 
-			throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.');
+			throw new RestException(500, 'Error failed to merged thirdparty '.$companytoremove->id.' into '.$id.'. Enable and read log file for more information.');
 		} else {
 			$this->db->commit();
 		}

+ 5 - 0
phpstan.neon

@@ -51,6 +51,11 @@ parameters:
 		- '#Result of function fieldList#'
 		- '#Caught class Stripe#'
 		- '#Function llxHeaderVierge invoked with#'
+		- '#If condition is always true#'
+		- '#always exists and is not falsy#'
+		- '#has no return type specified#'
+		- '#expression is always#'
+		- '#always exists and is not nullable#'
 	internalErrorsCountLimit: 50
 	cache:
 	    nodesByFileCountMax: 512

+ 1 - 1
scripts/contracts/email_expire_services_to_customers.php

@@ -237,7 +237,7 @@ if ($resql) {
  * @param string 	$userlang			Code lang to use for email output.
  * @param string 	$oldtarget			Target name
  * @param int 		$duration_value		duration value
- * @return int 							<0 if KO, >0 if OK
+ * @return int 							Int <0 if KO, >0 if OK
  */
 function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
 {

+ 1 - 1
scripts/contracts/email_expire_services_to_representatives.php

@@ -186,7 +186,7 @@ if ($resql) {
  * @param string 	$userlang				Code lang to use for email output.
  * @param string 	$oldtarget				Target name of sale representative
  * @param int 		$duration_value			Duration value
- * @return int 								<0 if KO, >0 if OK
+ * @return int 								Int <0 if KO, >0 if OK
  */
 function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
 {

+ 1 - 1
scripts/invoices/email_unpaid_invoices_to_customers.php

@@ -239,7 +239,7 @@ if ($resql) {
  * @param string $total				Total amount of unpayed invoices
  * @param string $userlang			Code lang to use for email output.
  * @param string $oldtarget			Target name
- * @return int 						<0 if KO, >0 if OK
+ * @return int 						Int <0 if KO, >0 if OK
  */
 function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 {

+ 1 - 1
scripts/invoices/email_unpaid_invoices_to_representatives.php

@@ -195,7 +195,7 @@ if ($resql) {
  * @param string $total						Total amount of unpayed invoices
  * @param string $userlang					Code lang to use for email output.
  * @param string $oldtarget					Target name of sale representative
- * @return int 								<0 if KO, >0 if OK
+ * @return int 								Int <0 if KO, >0 if OK
  */
 function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 {

+ 1 - 1
scripts/members/sync_members_ldap2dolibarr.php

@@ -98,7 +98,7 @@ if (!isset($argv[2]) || !is_numeric($argv[2])) {
 	exit(-1);
 }
 
-$typeid = $argv[2];
+$typeid = (int) $argv[2];
 foreach ($argv as $key => $val) {
 	if ($val == 'commitiferror') {
 		$forcecommit = 1;