Browse Source

fix(proweb): Remplace isset() par !empty() pour une vérification plus précise des valeurs

stany.ferer 1 week ago
parent
commit
d5036af839
1 changed files with 9 additions and 8 deletions
  1. 9 8
      core/class/proweb.class.php

+ 9 - 8
core/class/proweb.class.php

@@ -135,8 +135,9 @@ class proweb
         } else {
             $_return["loginIdRH"] = (empty($verifRH["loginId"]) or $verifRH["loginId"] == $_return["loginId"]) ? NULL : $verifRH["loginId"];
             $_return["jourEntreeRH"] = (empty($verifRH["jourEntree"]) or self::convertDateMoisAnJour($verifRH["jourEntree"]) == $_return["jourEntree"]) ? NULL : self::convertDateMoisAnJour($verifRH["jourEntree"]);
-            $_return["jourSortie"] = (isset($verifRH["jourSortie"])) ? $verifRH["jourSortie"] : $_return["jourSortie"];
-            $_return["RHBase"] = (isset($verifRH["jourSortie"]) or empty($verifRH["id"])) ? 0 : 1;
+            // Utiliser !empty() au lieu de isset() pour vérifier si jourSortie a une valeur non-nulle
+            $_return["jourSortie"] = (!empty($verifRH["jourSortie"])) ? $verifRH["jourSortie"] : $_return["jourSortie"];
+            $_return["RHBase"] = (!empty($verifRH["jourSortie"]) or empty($verifRH["id"])) ? 0 : 1;
             $_return["actif"] = ($_return["meyclubSubv"] == 1 or $_return["meyclubAccess"] == 1 or $_return["Webaccess"] == 1) ? 1 : 0;
             $_return["contrat"] = (isset($verifRH["contrat"])) ? $verifRH["contrat"] : 0;
 
@@ -179,7 +180,7 @@ class proweb
 
             if ($_return["jourEntree"] != "N/A") { // On ignore les nouveaux salariés qui se sont inscrits post import du fichier RH
                 if ($dateDataRH > $dateDataProWeb) {
-                    if (!self::checkValuesRHBase($_return["RHBase"], $_return["actif"])) {  
+                    if (!self::checkValuesRHBase($_return["RHBase"], $_return["actif"])) {
                         $_return["error"] = 1;
                         array_push($_return["errorJson"], "RHBase");
                     }
@@ -238,7 +239,7 @@ class proweb
      */
     private static function archiveExcelValuesDate(string $_string)
     {
-        if(!isset($_string) or $_string == "00-00-0000"){
+        if (!isset($_string) or $_string == "00-00-0000") {
             return "N/A";
         } else {
             return str_replace(" 00:00:00", "", $_string);
@@ -441,9 +442,9 @@ class proweb
      */
     private static function checkValuesNaissance(string $_string)
     {
-        if(empty($_string) OR $_string == "N/A") {
+        if (empty($_string) or $_string == "N/A") {
             return FALSE;
-        } elseif(self::calculAge($_string) > core::getConfig("AGE_MAX_ERROR")) {
+        } elseif (self::calculAge($_string) > core::getConfig("AGE_MAX_ERROR")) {
             return FALSE;
         } else {
             return TRUE;
@@ -461,7 +462,7 @@ class proweb
         $pieces = explode(" ", $_date);
         $birthDate = explode("-", $pieces[0]);
         return (date("md", date("U", mktime(0, 0, 0, $birthDate[2], $birthDate[1], $birthDate[0]))) > date("md")
-        ? ((date("Y") - $birthDate[0]) - 1)
-        : (date("Y") - $birthDate[0]));
+            ? ((date("Y") - $birthDate[0]) - 1)
+            : (date("Y") - $birthDate[0]));
     }
 }