diff --git a/Controleur/ControleurAjaxgenererqrcode.php b/Controleur/ControleurAjaxgenererqrcode.php index 88f4f746..f308e43b 100755 --- a/Controleur/ControleurAjaxgenererqrcode.php +++ b/Controleur/ControleurAjaxgenererqrcode.php @@ -20,113 +20,5 @@ class ControleurAjaxgenererqrcode extends Controleur { public function index() { - /* - header('Content-Type: application/json'); - - try { - $matricule = $this->requete->getParametreFormulaire("matricule"); - - - - if (empty($matricule)) { - throw new Exception("Matricule manquant"); - } - - $success = $this->genererEtStockerQRCodeFichier($matricule); - - - $message = (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US") ? "QR code generated successfully!" : "QR code généré avec succès !"; - - echo json_encode([ - 'success' => $success, - 'message' => $message - ]); - - - } catch (Exception $e) { - http_response_code(400); - echo json_encode([ - 'success' => false, - 'error' => $e->getMessage() - ]); - } - */ - } - - function genererEtStockerQRCodeFichier($matricule) { - - /* - $cheminDossier = $_SESSION['dossierSociete'].'/qrcodes/'; - - - try { - // 1. Validation du matricule - if (empty($matricule) || !preg_match('/^[A-Z0-9_-]+$/i', $matricule)) { - throw new Exception("Matricule invalide"); - } - - // 2. Gestion du dossier - $cheminDossier = rtrim($cheminDossier, '/') . '/'; - - if (!file_exists($cheminDossier)) { - if (!mkdir($cheminDossier, 0777, true)) { - throw new Exception("Impossible de créer le dossier QR"); - } - } - - if (!is_writable($cheminDossier)) { - throw new Exception("Dossier non accessible en écriture"); - } - - // 3. Suppression ancien QR code - $ancienChemin = $this->qrcode->getAncienChemin($matricule); - - - if ($ancienChemin) { - $ancienFichier = $cheminDossier . $ancienChemin; - if (file_exists($ancienFichier) && !unlink($ancienFichier)) { - error_log("Avertissement: Impossible de supprimer l'ancien QR"); - } - } - - // 4. Génération avec endroid/qr-code - //$nomFichier = 'qr_' . preg_replace('/[^A-Z0-9]/i', '_', $matricule) . '_' . time() . '.png'; - - $nomFichier = $matricule.'.png'; - - $cheminComplet = $cheminDossier . $nomFichier; - - - // Création du QR Code - $qrCode = QrCode::create($matricule) - ->setSize(150) - ->setMargin(5) - ->setForegroundColor(new Color(0, 0, 0)) // Noir - ->setBackgroundColor(new Color(255, 255, 255)) // Blanc - ->setErrorCorrectionLevel(ErrorCorrectionLevel::High); - - // Création du writer - $writer = new PngWriter(); - $result = $writer->write($qrCode); - - // Sauvegarde du fichier - $result->saveToFile($cheminComplet); - - - // 5. Vérification fichier généré - if (!file_exists($cheminComplet)) { - throw new Exception("Échec de la génération du fichier"); - } - - $this->qrcode->majBeneficiaireQr($nomFichier, $matricule); - - return true; - - } catch (Exception $e) { - error_log("Erreur QR Code: " . $e->getMessage()); - return false; - } - */ - } - + } } \ No newline at end of file diff --git a/Controleur/ControleurAjaximporterlisteassure.php b/Controleur/ControleurAjaximporterlisteassure.php index 0b4e42d7..9b552a4b 100755 --- a/Controleur/ControleurAjaximporterlisteassure.php +++ b/Controleur/ControleurAjaximporterlisteassure.php @@ -361,86 +361,4 @@ class ControleurAjaximporterlisteassure extends Controleurrequete { $this->beneficiaire->majetape(); } - - - public function genererAssuresImportesQR() { - $results = ['success' => [], 'errors' => []]; - /* - $matricules = $this->qrcode->getMatriculesAssuresImportes(); - - if (empty($matricules)) { - return ['errors' => ['Aucun matricule trouvé pour générer les QR codes']]; - } - - foreach ($matricules as $matricule) { - try { - $reussi = $this->genererEtStockerQRCodeFichier($matricule); - if ($reussi) { - $results['success'][] = $matricule; - } else { - $results['errors'][$matricule] = "Erreur inconnue lors de la génération"; - } - } catch (Exception $e) { - $results['errors'][$matricule] = $e->getMessage(); - } - } - */ - return $results; - } - - - function genererEtStockerQRCodeFichier($matricule) { - /* - $cheminDossier = rtrim($_SESSION['dossierSociete'] . '/qrcodes/', '/') . '/'; - - // Validation - if (empty($matricule) || !preg_match('/^[A-Z0-9_-]+$/i', $matricule)) { - throw new Exception("Matricule invalide"); - } - - // Création dossier si nécessaire - if (!is_dir($cheminDossier) && !mkdir($cheminDossier, 0777, true)) { - throw new Exception("Impossible de créer le dossier QR"); - } - - if (!is_writable($cheminDossier)) { - throw new Exception("Dossier non accessible en écriture"); - } - - // Suppression QR précédent - $ancienFichier = $this->qrcode->getAncienChemin($matricule); - if ($ancienFichier) { - $ancienCheminComplet = $cheminDossier . $ancienFichier; - if (is_file($ancienCheminComplet)) { - @unlink($ancienCheminComplet); - } - } - - // Nom fichier standardisé - $nomFichier = $matricule . '.png'; - $cheminComplet = $cheminDossier . $nomFichier; - - // Génération QR - $qrCode = QrCode::create($matricule) - ->setSize(150) - ->setMargin(5) - ->setForegroundColor(new Color(0, 0, 0)) - ->setBackgroundColor(new Color(255, 255, 255)) - ->setErrorCorrectionLevel(ErrorCorrectionLevel::High); - - $writer = new PngWriter(); - $result = $writer->write($qrCode); - $result->saveToFile($cheminComplet); - - if (!file_exists($cheminComplet)) { - throw new Exception("Échec de la sauvegarde du fichier QR"); - } - - // Mise à jour BDD - $this->qrcode->majBeneficiaireQr($nomFichier, $matricule); - */ - - return true; - } - } \ No newline at end of file diff --git a/Controleur/ControleurCreerbeneficiaire.php b/Controleur/ControleurCreerbeneficiaire.php index e082852c..91515f69 100755 --- a/Controleur/ControleurCreerbeneficiaire.php +++ b/Controleur/ControleurCreerbeneficiaire.php @@ -193,10 +193,6 @@ class ControleurCreerbeneficiaire extends Controleur { $matricule = $this->beneficiaire->getMatriculeBeneficiaire($idBeneficiaire); - if (!empty($matricule)){ - // $success = $this->genererEtStockerQRCodeFichier($matricule); - } - $this->beneficiaire->setDenierNumeroBeneficiaire($idAdherent, $dernierNumeroBeneficiaire); // On va calculuer la prime @@ -211,76 +207,4 @@ class ControleurCreerbeneficiaire extends Controleur { $this->rediriger("Ficheadherent/".$idAdherent); } - function genererEtStockerQRCodeFichier($matricule) { - /* - $cheminDossier = $_SESSION['dossierSociete'].'/qrcodes/'; - - try { - // 1. Validation du matricule - if (empty($matricule) || !preg_match('/^[A-Z0-9_-]+$/i', $matricule)) { - throw new Exception("Matricule invalide"); - } - - // 2. Gestion du dossier - $cheminDossier = rtrim($cheminDossier, '/') . '/'; - - if (!file_exists($cheminDossier)) { - if (!mkdir($cheminDossier, 0777, true)) { - throw new Exception("Impossible de créer le dossier QR"); - } - } - - if (!is_writable($cheminDossier)) { - throw new Exception("Dossier non accessible en écriture"); - } - - // 3. Suppression ancien QR code - $ancienChemin = $this->qrcode->getAncienChemin($matricule); - - if ($ancienChemin) { - $ancienFichier = $cheminDossier . $ancienChemin; - if (file_exists($ancienFichier) && !unlink($ancienFichier)) { - error_log("Avertissement: Impossible de supprimer l'ancien QR"); - } - } - - // 4. Génération avec endroid/qr-code - //$nomFichier = 'qr_' . preg_replace('/[^A-Z0-9]/i', '_', $matricule) . '_' . time() . '.png'; - - $nomFichier = $matricule.'.png'; - - $cheminComplet = $cheminDossier . $nomFichier; - - // Création du QR Code - $qrCode = QrCode::create($matricule) - ->setSize(150) - ->setMargin(5) - ->setForegroundColor(new Color(0, 0, 0)) // Noir - ->setBackgroundColor(new Color(255, 255, 255)) // Blanc - ->setErrorCorrectionLevel(ErrorCorrectionLevel::High); - - // Création du writer - $writer = new PngWriter(); - $result = $writer->write($qrCode); - - // Sauvegarde du fichier - $result->saveToFile($cheminComplet); - - - // 5. Vérification fichier généré - if (!file_exists($cheminComplet)) { - throw new Exception("Échec de la génération du fichier"); - } - - $this->qrcode->majBeneficiaireQr($nomFichier, $matricule); - - return true; - - } catch (Exception $e) { - error_log("Erreur QR Code: " . $e->getMessage()); - return false; - } - */ - } - } \ No newline at end of file diff --git a/Vue/Fichebeneficiaire/index.php b/Vue/Fichebeneficiaire/index.php index 3807198f..375cd250 100755 --- a/Vue/Fichebeneficiaire/index.php +++ b/Vue/Fichebeneficiaire/index.php @@ -54,11 +54,7 @@ $vip = $beneficiaire['vip']; - $cheminDossier = $_SESSION['dossierSociete'].'/qrcodes/'; $matricule = $this->nettoyer($beneficiaire['numeroBeneficiaire']); - $qrPath = $beneficiaire['qr_code_path']; - - $cheminComplet = trim($cheminDossier).$qrPath; $carteEditee = $this->nettoyer($beneficiaire['carteEditee']); diff --git a/Vue/Modifierbeneficiaire/index.php b/Vue/Modifierbeneficiaire/index.php index 679eb0a3..b8fbe977 100755 --- a/Vue/Modifierbeneficiaire/index.php +++ b/Vue/Modifierbeneficiaire/index.php @@ -1,21 +1,9 @@ titre = "INTER SANTE - Modification Bénéficiaire"; - $cheminDossier = $_SESSION['dossierSociete'].'/qrcodes/'; $matricule = $this->nettoyer($beneficiaire['numeroBeneficiaire']); - $qrPath = $beneficiaire['qr_code_path']; - ?> - -