Forráskód Böngészése

fix some phpstan errors (#26608)

Co-authored-by: Hystepik <lucas.marcouiller@gmail.com>
Lucas Marcouiller 1 éve
szülő
commit
68d996b482

+ 1 - 1
htdocs/core/class/commonobject.class.php

@@ -10450,7 +10450,7 @@ abstract class CommonObject
 
 					$project_result = $this->fetch_projet();
 					if ($project_result >= 0) {
-						$element = 'projet/'.dol_sanitizeFileName($object->project->ref).'/';
+						$element = 'projet/'.dol_sanitizeFileName($this->project->ref).'/';
 					}
 				default:
 					$element = $this->element;

+ 2 - 0
htdocs/core/modules/contract/doc/pdf_strato.modules.php

@@ -590,6 +590,8 @@ class pdf_strato extends ModelePDFContract
 		// phpcs:enable
 		global $conf, $langs, $hookmanager;
 
+		$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis : null));
+
 		$ltrdirection = 'L';
 		if ($outputlangs->trans("DIRECTION") == 'rtl') {
 			$ltrdirection = 'R';

+ 16 - 0
htdocs/core/triggers/dolibarrtriggers.class.php

@@ -143,6 +143,22 @@ abstract class DolibarrTriggers
 		}
 	}
 
+	/**
+	 * setErrorsFromObject
+	 *
+	 * @param CommonObject $object commonobject
+	 * @return void
+	 */
+	public function setErrorsFromObject($object)
+	{
+		if (!empty($object->error)) {
+			$this->errors = array_merge($this->errors, array($object->error));
+		}
+		if (!empty($object->errors)) {
+			$this->errors = array_merge($this->errors, $object->errors);
+		}
+	}
+
 	/**
 	 *  Function called when a Dolibarrr business event is done.
 	 *  All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)

+ 1 - 1
htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php

@@ -534,7 +534,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
 			if (isModEnabled('ficheinter') && isModEnabled('ticket') && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) {
 				$fichinter = new Fichinter($this->db);
 				$fichinter->socid = (int) $object->fk_soc;
-				$fichinter->fk_project = $projectid;
+				$fichinter->fk_project = (int) $object->fk_project;
 				$fichinter->fk_contrat = (int) $object->fk_contract;
 				$fichinter->author = $user->id;
 				$fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil';

+ 1 - 1
htdocs/datapolicy/class/actions_datapolicy.class.php

@@ -205,7 +205,7 @@ class ActionsDatapolicy extends CommonHookActions
 
 		/* print_r($parameters); print_r($object); echo "action: " . $action; */
 		if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) {  // do something only for the context 'somecontext1' or 'somecontext2'
-			$this->resprints = '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>'.$langs->trans("datapolicyMassAction").'</option>';
+			$this->resprints = '<option value="0"'.(!empty($disabled) ? ' disabled="disabled"' : '').'>'.$langs->trans("datapolicyMassAction").'</option>';
 		}
 
 		if (!$error) {

+ 1 - 0
htdocs/hrm/position_card.php

@@ -193,6 +193,7 @@ function displayPositionCard(&$object)
 	global $user, $langs, $db, $conf, $extrafields, $hookmanager, $action, $permissiontoadd, $permissiontodelete;
 
 	$id = $object->id;
+	$ref = $object->ref;
 
 	/*
 	 * View