Browse Source

Maj comparaison Proweb / RH

stany.ferer 1 year ago
parent
commit
1e0cbb2778

+ 16 - 15
core/class/proweb.class.php

@@ -69,9 +69,11 @@ class proweb
         $_return["dateNaissance"] = self::archiveExcelValuesDate($_array[4]);
         $_return["jourEntree"] = self::archiveExcelValuesDate($_array[5]);
         $_return["jourSortie"] = self::archiveExcelValuesDate($_array[6]);
-        $_return["actif"] = self::archiveExcelValuesActif($_array[7]);
-        $_return["lieu"] = self::archiveExcelValuesLieu($_array[8]);
-        $_return["loginId"] = self::archiveExcelValuesloginId($_array[9]);
+        $_return["meyclubSubv"] = self::archiveExcelValuesActif($_array[7]);
+        $_return["meyclubAccess"] = self::archiveExcelValuesActif($_array[8]);
+        $_return["Webaccess"] = self::archiveExcelValuesActif($_array[9]);
+        $_return["lieu"] = self::archiveExcelValuesLieu($_array[10]);
+        $_return["loginId"] = self::archiveExcelValuesloginId($_array[11]);
 
         $verifRH = self::checksalarieByLoginId($_return["loginId"], $_return["nom"], $_return["prenom"]);
 
@@ -90,7 +92,7 @@ class proweb
             $_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;
-            $_return["actif"] = (isset($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;
 
             // ----
@@ -125,20 +127,19 @@ class proweb
                 array_push($_return["errorJson"], "jourEntree");
             }
 
-            if ($_return["jourEntree"] != "N/A") { // On ignore les nouveaux salariés qui se sont inscrits post import du fichier RH
+            if ($_return["jourSortie"] != "N/A" and $_return["RHBase"] == 1) {
+                $_return["error"] = 1;
+                array_push($_return["errorJson"], "jourSortie");
+            }
 
+            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"], $_return["jourSortie"])) {
+                    if (!self::checkValuesRHBase($_return["RHBase"], $_return["actif"])) {  
                         $_return["error"] = 1;
                         array_push($_return["errorJson"], "RHBase");
                     }
                 }
             }
-
-            //            if ($_return["contrat"] == 0 AND $_return["jourSortie"] == "N/A") {
-            //                $_return["error"] = 1;
-            //                array_push($_return["errorJson"], "contrat");
-            //            }
         }
 
         $_return["errorJson"] = (!empty($_return["errorJson"][0])) ? json_encode($_return["errorJson"]) : NULL;
@@ -179,9 +180,9 @@ class proweb
 
     private static function archiveExcelValuesActif(string $_string)
     {
-        if ($_string == "Actif") {
+        if ($_string == "O") {
             return  1;
-        } elseif ($_string == "Inactif") {
+        } elseif ($_string == "N") {
             return 0;
         } else {
             return "N/A";
@@ -233,9 +234,9 @@ class proweb
         }
     }
 
-    private static function checkValuesRHBase(string $_string, int $_actif, string $_sortie)
+    private static function checkValuesRHBase(int $_RH, int $_actif)
     {
-        return ($_string == 0 and $_actif == 1 and $_sortie == "N/A") ? FALSE : TRUE;
+        return ($_RH == 0 and $_actif == 1) ? FALSE : TRUE;
     }
 
     private static function checkValuesJourEntree(string $_string)

+ 10 - 6
core/submit/cms.proweb-import-salaries.php

@@ -50,9 +50,11 @@ if (core::ifPost("from") AND core::getPost("from") == $name["files"]) {
                             OR $excelValues[4] != "od_date_naiss" 
                             OR $excelValues[5] != "date_deb_anciennete()" 
                             OR $excelValues[6] != "date_fin_anciennete()" 
-                            OR $excelValues[7] != "od_31" 
-                            OR $excelValues[8] != "site_nom"
-                            OR $excelValues[9] != "od_login" ){
+                            OR $excelValues[7] != "od_meyclub_subv" 
+                            OR $excelValues[8] != "od_meyclub_actif" 
+                            OR $excelValues[9] != "od_acces_web" 
+                            OR $excelValues[10] != "site_nom"
+                            OR $excelValues[11] != "od_login" ){
 
                         alert::recError("Le fichier " . $_FILES[$name["files"]]['name'] . " n'est pas un export ProWeb global.");
 
@@ -63,9 +65,11 @@ if (core::ifPost("from") AND core::getPost("from") == $name["files"]) {
                         ($excelValues[4] != "od_date_naiss") ? alert::recError("La 5em colonne doit se nommer od_date_naiss") : "";
                         ($excelValues[5] != "date_deb_anciennete()") ? alert::recError("La 6em colonne doit se nommer date_deb_anciennete()") : "";
                         ($excelValues[6] != "date_fin_anciennete()") ? alert::recError("La 7em colonne doit se nommer date_fin_anciennete()") : "";
-                        ($excelValues[7] != "od_31") ? alert::recError("La 8em colonne doit se nommer od_31") : "";
-                        ($excelValues[8] != "site_nom") ? alert::recError("La 9em colonne doit se nommer site_nom") : "";
-                        ($excelValues[9] != "od_login") ? alert::recError("La 10em colonne doit se nommer od_login") : "";
+                        ($excelValues[7] != "od_meyclub_subv") ? alert::recError("La 8em colonne doit se nommer od_meyclub_subv") : "";
+                        ($excelValues[8] != "od_meyclub_actif") ? alert::recError("La 8em colonne doit se nommer od_meyclub_actif") : "";
+                        ($excelValues[9] != "od_acces_web") ? alert::recError("La 8em colonne doit se nommer od_acces_web") : "";
+                        ($excelValues[10] != "site_nom") ? alert::recError("La 9em colonne doit se nommer site_nom") : "";
+                        ($excelValues[11] != "od_login") ? alert::recError("La 10em colonne doit se nommer od_login") : "";
 
                         header("Location: /".$name["returnKo"] . ".html");
                         exit();

+ 98 - 29
core/views/pages/cms.proweb-salaries.php

@@ -1,36 +1,38 @@
-<?php 
-    $dateData = get::jsonDateDataExcelProweb();
-    $date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
+<?php
+$dateData = get::jsonDateDataExcelProweb();
+$date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
 ?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Proweb : Liste des salariés<?php echo $date ?></span>
         <a href="proweb-salaries-upload.html" style="position: absolute; right: 0; margin: 0 40px 0 0;"><button type="submit" class="btn btn-outline-success btn-sm"><span data-feather="file-plus"></span> Importer un fichier Excel</button></a>
         <a href="https://www.cse-invent.com/gestion/beneficiaire/od/export-etat/124/excel?type=EtatListe_od" target="_blank" style="position: absolute; right: 0; margin: 0 250px 0 0;"><button type="submit" class="btn btn-outline-secondary btn-sm"><span data-feather="link"></span> Exporter tous les salariés depuis Proweb</button></a>
-    </h2> 
+    </h2>
 </header>
-<?php   
-        echo core::filAriane(array(
-            "current" => "Liste des salariés", 
-            "arbo" => array( 
-                "Proweb" => NULL,
-                "Liste des salariés" => "proweb-salaries.html")
-        )); 
+<?php
+echo core::filAriane(array(
+    "current" => "Liste des salariés",
+    "arbo" => array(
+        "Proweb" => NULL,
+        "Liste des salariés" => "proweb-salaries.html"
+    )
+));
 ?>
 <div>
-    <table
-        id="table"
-        class="table-striped table-hover table-sm" 
-        data-page-size="25"
-        data-toggle="table"
-        data-show-columns="true"
-        data-search="true"
-        data-buttons-align="left"
-        data-pagination="true"
-        data-filter-control="true"
-        data-flat="true"
-        data-show-columns-toggle-all="true"
-        data-url="/json.php?file=salaries-proweb">
+    <div id="toolbar" style="margin-bottom:10px;">
+        <select id="errorFilter" class="form-select">
+            <option value="" selected>Aucun filtre</option>
+            <option value="errorRHProweb">Filtre : Problème car le compte Proweb est actif alors qu'absent de la base RH</option>
+            <option value="errorLoginID">Filtre : Problème car l'identifiant Proweb est différent de l'identifiant RH</option>
+            <option value="errorjourSortie">Filtre : Problème sur la date de jour de sortie renseignée alors que présent sur la base RH</option>
+            <option value="errorDateNaissance">Filtre : Problème sur la date de naissance</option>
+            <option value="errorNom">Filtre : Problème sur nom</option>
+            <option value="errorPrenom">Filtre : Problème sur le prénom</option>
+            <option value="errorjourEntree">Filtre : Problème sur la date de jour d'entrée qui est différence entre Proweb et la RH</option>
+            <option value="errorAbsent">Filtre : Problème car le salarié n'est plus présent et aucune date de sortie sur Proweb</option>
+        </select>
+    </div>
+    <table id="ProWebSalary" class="table-striped table-hover table-sm" data-page-size="25" data-toggle="table" data-buttons-align="left" data-pagination="true" data-filter-control="true" data-flat="true" data-show-columns-toggle-all="true" data-url="/json.php?file=salaries-proweb">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="idProweb" data-filter-control="input" data-formatter="selectFicheProweb" data-width="35">#</th>
@@ -38,12 +40,10 @@
                 <th data-sortable="true" data-field="loginIdRH" data-filter-control="input">Dif. RH</th>
                 <th data-sortable="true" data-field="nom" data-filter-control="input">Nom</th>
                 <th data-sortable="true" data-field="prenom" data-filter-control="input">Prénom</th>
-                <th data-sortable="true" data-field="sexe" data-filter-control="select">Sexe</th>
                 <th data-sortable="true" data-field="dateNaissance" data-filter-control="input">Naissance</th>
                 <th data-sortable="true" data-field="jourEntree" data-filter-control="input">Entrée Proweb</th>
                 <th data-sortable="true" data-field="jourEntreeRH" data-filter-control="input">Entrée RH</th>
                 <th data-sortable="true" data-field="jourSortie" data-filter-control="input">Sortie</th>
-                <th data-sortable="true" data-field="lieu" data-filter-control="select">Localité</th>
                 <th data-sortable="true" data-field="texteContrat" data-filter-control="select">Contrat</th>
                 <th data-sortable="true" data-field="texteActif" data-filter-control="select">Actif</th>
                 <th data-sortable="true" data-field="texteRHBase" data-filter-control="select">Base RH</th>
@@ -51,11 +51,80 @@
                 <th data-sortable="true" data-field="errorJson" data-filter-control="input">Erreur info</th>
             </tr>
         </thead>
-    </table> 
+    </table>
 </div>
 
 <script>
-        function selectFicheProweb(value, row) { 
-            return '<a href="<?php echo FICHE_SALARIE_PROWEB ?>' + row.idProweb + '" target="_blank" class="btn btn-secondary btn-sm" style="width:60px;">' + row.idProweb + '</a>'; 
+
+    function selectFicheProweb(value, row) {
+        return '<a href="<?php echo FICHE_SALARIE_PROWEB ?>' + row.idProweb + '" target="_blank" class="btn btn-secondary btn-sm" style="width:60px;">' + row.idProweb + '</a>';
+    }
+
+    function initFilter(col, data){
+        if(data === ""){
+            $(".bootstrap-table-filter-control-"+col).val("").change();
+        } else {
+            $(".bootstrap-table-filter-control-"+col).val('"'+data+'"').change();
         }
+        $(".bootstrap-table-filter-control-"+col).trigger('keyup');
+    }
+
+    function initAllFilter(){
+        initFilter("idProweb", "");
+        initFilter("loginId", "");
+        initFilter("loginIdRH", "");
+        initFilter("nom", "");
+        initFilter("prenom", "");
+        initFilter("dateNaissance", "");
+        initFilter("jourEntree", "");
+        initFilter("jourEntreeRH", "");
+        initFilter("jourSortie", "");
+        initFilter("texteContrat", "");
+        initFilter("texteActif", "");
+        initFilter("texteRHBase", "");
+        initFilter("texteError", "");
+        initFilter("errorJson", "");
+    }
+
+    $(document).ready(function() {
+        $(function() {
+        $('#errorFilter').on( "change", function() {
+
+            initAllFilter();
+
+            switch($(this).val()) {
+            case "errorRHProweb":
+                $(".bootstrap-table-filter-control-texteRHBase").val("Absent").change();
+                $(".bootstrap-table-filter-control-texteActif").val("Actif").change();
+                break;
+            case "errorLoginID":
+                initFilter("errorJson", "loginId");
+                break;
+            case "errorDateNaissance":
+                initFilter("errorJson", "dateNaissance");
+                break;
+            case "errorNom":
+                initFilter("errorJson", "nom");
+                break;
+            case "errorPrenom":
+                initFilter("errorJson", "prenom");
+                break;
+            case "errorjourEntree":
+                initFilter("errorJson", "jourEntree");
+                break;
+            case "errorAbsent":
+                initFilter("errorJson", "absent");
+                break;
+            case "errorjourSortie":
+                initFilter("errorJson", "jourSortie");
+                break;
+            default:
+                initAllFilter();
+            }
+        });
+    });
+
+    });
+
+    
 </script>