Nb = ".$jmax; //exit(); if ($jmax > 0) { // VIDAGE DE LA TABLE "ca_rdv_calendar" $q = "TRUNCATE TABLE ca_rdv_calendar"; $r = excuteQuery($q); } //echo "Nb = ".$jmax; $s = ""; while ($j < $jmax) { //var_dump($data["agenda"][$j]); $rdvemaco = $data["agenda"][$j]["rdvemaco"]; $rdvtype = $data["agenda"][$j]["rdvtype"]; $rdvnumtel = $data["agenda"][$j]["rdvnumtel"]; $matricule = $data["agenda"][$j]["conseillermat"]; $eds = $data["agenda"][$j]["eds"]; // UID/NUMPERS => PROBLEMATIQUE PERSONNES PHYSIQUES Vs PARTENAIRES $type_client = 0; // Personnes Physiques = 1 | Partenaires = 2 $idpartgppp = $data["agenda"][$j]["idpartgppp"]; if ($idpartgppp == 'IDPARTEN_GP_PP') { // PERSONNE PHYSIQUE $uid_client = $data["agenda"][$j]["clientid"]; $type_client = 1; } else { // PARTENAIRE / GROUPEMENT $uid_client = $idpartgppp; $type_client = 2; } // CIVILITE : MAPPING $civ_client = $data["agenda"][$j]["clientciv"]; if ($civ_client == 'MONSIEUR') $civ_client ='M.'; if (($civ_client == 'MADAME')OR($civ_client == 'MADEMOISELLE')) $civ_client ='Mme'; $nom_client = addslashes($data["agenda"][$j]["clientnompatr"]); //if ($nom_client == "") $nom_client = addslashes($data["agenda"][$j]["clientnompatr"]); $nom_client_mari = addslashes($data["agenda"][$j]["clientnommari"]); $nom_client_usage = addslashes($data["agenda"][$j]["clientnomusage"]); $prenom_client = addslashes($data["agenda"][$j]["clientprenom"]); // PCZ : 20220307 : CHAMPS SPECIAUX RECHERCHE $nom_client_clean = str_replace("-","",$nom_client); $nom_client_clean = str_replace(" ","",$nom_client_clean); $nom_client_clean = str_replace("'","",$nom_client_clean); $nom_client_mari_clean = str_replace("-","",$nom_client_mari); $nom_client_mari_clean = str_replace(" ","",$nom_client_mari_clean); $nom_client_mari_clean = str_replace("'","",$nom_client_mari_clean); $nom_client_usage_clean = str_replace("-","",$nom_client_usage); $nom_client_usage_clean = str_replace(" ","",$nom_client_usage_clean); $nom_client_usage_clean = str_replace("'","",$nom_client_usage_clean); $prenom_client_clean = str_replace("-","",$prenom_client); $prenom_client_clean = str_replace(" ","",$prenom_client_clean); $prenom_client_clean = str_replace("'","",$prenom_client_clean); $theme = $data["agenda"][$j]["rdvtheme"]; $date_debut = getRdvDate($data["agenda"][$j]["rdvannee"], $data["agenda"][$j]["rdvmois"], $data["agenda"][$j]["rdvjour"], $data["agenda"][$j]["rdvdebutheure"], $data["agenda"][$j]["rdvdebutminutes"]); $date_fin = getRdvDate($data["agenda"][$j]["rdvannee"], $data["agenda"][$j]["rdvmois"], $data["agenda"][$j]["rdvjour"], $data["agenda"][$j]["rdvfinheure"], $data["agenda"][$j]["rdvfinminutes"]); $q = "INSERT INTO ca_rdv_calendar (rdvemaco, rdvtype, rdvnumtel, matricule, eds, uid_client, type_client, civ_client, nom_client, nom_client_clean, nom_client_mari, nom_client_mari_clean, nom_client_usage, nom_client_usage_clean, prenom_client, prenom_client_clean, theme, date_debut, date_fin) VALUES ('$rdvemaco', '$rdvtype', '$rdvnumtel', '$matricule', '$eds', '$uid_client', '$type_client', '$civ_client', '$nom_client', '$nom_client_clean', '$nom_client_mari', '$nom_client_mari_clean', '$nom_client_usage', '$nom_client_usage_clean', '$prenom_client', '$prenom_client_clean', $theme, '$date_debut', '$date_fin')"; $r = excuteQuery($q); //echo "
  • ".$q."


  • "; $j++; // if ($j == 5) exit(); } echo "
  • Decompte JSON : ".$jmax. " | Decompte insertions : ".$j; $timeend=microtime(true); $time = ($timeend-$timestart); $page_load_time = number_format(intval($time), 3); echo "
  • Duree du script : ".$page_load_time."\r\n"; $LOG = "##########################################\r\n"; $LOG .= date('Y-m-d H:i:s')." | ".$time." sec\r\n"; $LOG .= "Nombre de rdv : ".$j."\r\n"; $fp = fopen ("./logs/cron_GetRdv.txt", "a+"); fwrite($fp, $LOG); fclose ($fp); echo $LOG; ?>