Browse Source

Clean code

Laurent Destailleur 2 years ago
parent
commit
ac75406e35
3 changed files with 8 additions and 8 deletions
  1. 1 1
      htdocs/fichinter/card-rec.php
  2. 4 7
      htdocs/fichinter/class/fichinterrec.class.php
  3. 3 0
      qodana.yaml

+ 1 - 1
htdocs/fichinter/card-rec.php

@@ -234,7 +234,7 @@ if ($action == 'add') {
 } elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) {
 	// delete modele
 	$object->fetch($id);
-	$object->delete();
+	$object->delete($user);
 	$id = 0;
 	header('Location: '.$_SERVER["PHP_SELF"]);
 	exit;

+ 4 - 7
htdocs/fichinter/class/fichinterrec.class.php

@@ -411,16 +411,13 @@ class FichinterRec extends Fichinter
 	/**
 	 * 	Delete template fichinter rec
 	 *
-	 *	@param	 	int		$rowid	  	    Id of fichinter rec to delete. If empty, we delete current instance of fichinter rec
-	 *	@param		int		$notrigger	    1=Does not execute triggers, 0= execute triggers
-	 *	@param		int		$idwarehouse    Id warehouse to use for stock change.
+	 *	@param      User	$user			Object user who delete
+	 *	@param		int		$notrigger		Disable trigger
 	 *	@return		int						<0 if KO, >0 if OK
 	 */
-	public function delete($rowid = 0, $notrigger = 0, $idwarehouse = -1)
+	public function delete(User $user, $notrigger = 0)
 	{
-		if (empty($rowid)) {
-			$rowid = $this->id;
-		}
+		$rowid = $this->id;
 
 		dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
 

+ 3 - 0
qodana.yaml

@@ -76,4 +76,7 @@ exclude:
   - name: PhpMissingParentConstructorInspection  
   - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection
   - name: PhpArrayUsedOnlyForWriteInspection
+  - name: PhpArrayIndexImmediatelyRewrittenInspection
+  - name: PhpParameterNameChangedDuringInheritanceInspection
+  - name: PhpDuplicateSwitchCaseBodyInspection