radiantproduction/api/nokanda/creer.php

680 lines
21 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
// Headers requis
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
//ajout du 26/01/2021
$seceretKey = '$2y$10$A0stANKY6LUCuSf/hdw9N.pVharAm/9U5wmUdhEbS2zjqdW9yIQNy';
$headers = apache_request_headers();
/*
if(isset($headers['Authorization'])){
$api_key = $headers['Authorization'];
if($api_key != $seceretKey)
{
http_response_code(403);
$message = "Autoirisation refusée! / Authorization faild!";
echo json_encode(["success" => "0", "message" => $message]);
exit;
}
}
else
{
http_response_code(403);
$message = "Autorisation refusée! / Authorization faild!";
echo json_encode(["success" => "0", "message" => $message]);
exit;
}
*/
// fin 26/01/2021
// On vérifie la méthode
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
require_once 'Modele_api.php';
require_once 'Police_api.php';
$_SESSION['codeTypeApporteur_C'] = "AP";
/*
$_SESSION['codeApporteur_C'] = "nikao";
$_SESSION['libelleApporteur_C'] = "NIKAO";
$_SESSION['login'] = "nikao";
*/
$_SESSION['codeApporteur_C'] = "nokanda";
$_SESSION['libelleApporteur_C'] = "NOKANDA";
$_SESSION['login'] = "nokanda";
$codeApporteur = "nokanda";
$codeTypeAvenant = "INC";
$motifavenant = "INCORPORATION NOKANDA";
$police= new Police_api();
$idPolice = $police->fn_get_id_police_familliale();
$dateEffetPolice = $police->fn_date_effet_police($idPolice);
$dateFinPolice = $police->fn_date_fin_police($idPolice);
$_SESSION['idPolice_C'] = $idPolice;
$idAvenant = $police->creeravenantapi($idPolice);
$_SESSION['idAvenant_C'] = $idAvenant;
$idSaisie = uniqid();
$_SESSION['idSaisie'] = $idSaisie;
$police->viderbeneficiairemodeltempapi();
$police->initIinsererLigneModeleAssureFamilialeApi($idPolice, $idSaisie);
$donnees = json_decode(file_get_contents("php://input"));
$nb = count($donnees);
if ($nb == 0)
{
http_response_code(503);
$message = "Pas de données! / No data!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
else
{
foreach ($donnees as $donnee)
{
$numeroAdherent = $donnee->{'numeroAdherent'};
$noFamille = $donnee->{'noFamille'};
$nom = $donnee->{'nom'};
$prenoms = $donnee->{'prenoms'};
$codeLienParente = $donnee->{'codeLienParente'};
$codeNaturePiece = $donnee->{'codeNaturePiece'};
$numeroPiece = $donnee->{'numeroPiece'};
$sexe = $donnee->{'sexe'};
$codeGroupeSanguin = $donnee->{'codeGroupeSanguin'};
$dateNaissance = $donnee->{'dateNaissance'};
$telephonePortable = $donnee->{'telephonePortable'};
$email = $donnee->{'email'};
$codeTypeEcheancier = $donnee->{'codeTypeEcheancier'};
$primeBase = $donnee->{'primeBase'};
$dateEntree = $donnee->{'dateEntree'};
$codecommercial = $donnee->{'codecommercial'};
$idExterne = $donnee->{'id'};
$referencePaiementApi = $donnee->{'numeroRef'};
if ($noFamille<=" ")
{
$noFamille = "0";
}
$primeBase = str_replace(",", "", $primeBase);
$primeBase = str_replace(".", "", $primeBase);
if ($primeBase<=" ")
{
$primeBase = "0";
}
settype($primeBase, "double");
$nomComplet = $nom . " " . $prenoms;
if ($idExterne<="0")
{
http_response_code(503);
$message = "$nomComplet => ID manquant / Missing ID!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
$liste_liens = array("A", "C", "E", "O");
if (!in_array($codeLienParente, $liste_liens))
{
http_response_code(503);
$message = "$nomComplet => Revoir lien de parenté! / Review relationship!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
$liste_sexes = array("M", "F");
if (!in_array($sexe, $liste_sexes))
{
http_response_code(503);
$message = "$nomComplet => Revoir le sexe! / Review the gender!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
if ( ($codeLienParente=="A") && ($codeTypeEcheancier<=" "))
{
http_response_code(503);
$message = "$nomComplet => Pas de type echéancier! / No schedule type!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
if ( ($codeLienParente=="A") && ($primeBase<="0"))
{
http_response_code(503);
$message = "$nomComplet => Pas de prime base! / No basic premium!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
if($dateEntree>$dateFinPolice || $dateEntree<$dateEffetPolice)
{
http_response_code(503);
$message = "$nomComplet => Revoir la date d'entrée! / Review the entry date!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
// Penser à gérer les erreurs de date
$police->insererLigneModeleAssureFamilialeApi($idAvenant, $numeroAdherent, $noFamille, $nom, $prenoms,
$codeLienParente, $codeNaturePiece, $numeroPiece, $sexe, $codeGroupeSanguin, $dateNaissance, $telephonePortable, $email,
$codecommercial, $codeTypeEcheancier, $primeBase, $dateEntree, $idExterne, $referencePaiementApi);
}
$police->gererIncorporationSurFamExistanteApi();
// Vérification de certaines erreurs :
// 1 => Si nouvelle famille sans Adhérent
$noFamilleSansAdherent = $police->getadhimpfamillesansadherentapi();
if ($noFamilleSansAdherent>"0")
{
$police->viderbeneficiairemodeltempapi();
http_response_code(405);
$message = "Famille $noFamilleSansAdherent => Adhérent Principal manquant! / Principal Member missing!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
// 2 => Si plus d'1 Adhérent dans une même famille
$noFamillePlusieursAdherent = $police->getadhimpfamilleplusieursadherentapi();
if ($noFamillePlusieursAdherent>"0")
{
$police->viderbeneficiairemodeltempapi();
http_response_code(405);
$message = "Famille $noFamillePlusieursAdherent => Plusieurs Adherents Principaux! / Several Main Members!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
// 3 => Incorporation sur une ancienne famille introuvable dans la police
$noFamilleExistantSansAdherent = $police->getadhimpfamilleexistantsansadherentapi();
if ($noFamilleExistantSansAdherent>"0")
{
$police->viderbeneficiairemodeltempapi();
http_response_code(405);
$message = "Famille $noFamilleExistantSansAdherent => Ancienne famille introuvable! / Old family not found!";
echo json_encode(["message" => $message]);
exit();
}
// Ajout du 03/12/2020 => renseigner les primes de base des dépendans
$police->recapitulerImportationAssuresFamlialeApi();
$police->incorpoerassuresimportesfamilialeapi();
/*
http_response_code(201);
$message = "Insertions réussies! / Successful insertions";
echo json_encode(["success" => "1", "message" => $message]);
exit();
*/
// retourner es données à NIKAO
$tableau_retour = array();
$tableau_member = array();
$donnees = $police->retourdonneesapi();
if(count($donnees)>"0")
{
$numeroAdherentRetour = $donnees['0']['numeroAdherent'];
foreach ($donnees as $donnee)
{
$tableau_member[] =
[
"id" => $donnee['idExterne'],
"nocarte" => $donnee['numeroBeneficiaire']
];
}
$tableau_retour[] =
[
"numeroAdherent" => $numeroAdherentRetour,
"member" => $tableau_member,
];
// envoi du mail
require_once 'Controleurrequete.php'; // OK
$numeroAdherent = $numeroAdherentRetour;
$adherent = $police->getadherentapi($numeroAdherent);
$beneficiaires = $police->getbeneficiaireapi($numeroAdherent);
$email = $adherent['email'];
// echo "mail : $email";
// exit();
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetMargins(15, 15, 15) ;
// $pdf->SetFont('Arial','BU',10);
$pdf->SetFont('Arial','B',10);
// $pdf->Image('entete_contrat.png',25,15,15,0,'','http://radiant.co.rw');
// $pdf->Image('entete_contrat.png',25,15,15,0,'','');
$pdf->Image('entete_contrat.jpg',15,15,180,0,'');
$pdf->sety(27);
$pdf->Cell(0,5,convertirc("AMASEZERANO YUBWISHINGIZI BWO KWIVUZA BWUMUNTU"),0,1,'C',false);
$pdf->Cell(0,5,convertirc("KU GITI HAMWE NABAGIZE UMURYANGO WE"),0,1,'C',false);
$pdf->Ln(10);
$hl = 6;
$pdf->Cell(45,$hl,convertirc("UBWISHINGIZI No"),0,0,'L',false);
$pdf->Cell(0,$hl,": " . convertirc($adherent['numeroAdherent']),0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("AMAZINA YOSE"),0,0,'L',false);
$pdf->Cell(0,$hl,": " . convertirc($adherent['nom'] . " " . $adherent['prenoms']),0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("Itariki yamavuko"),0,0,'L',false);
$pdf->Cell(0,6,": " . date_format(date_create($adherent['dateNaissance']),"d-m-Y"),0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("No yindangamuntu"),0,0,'L',false);
$pdf->Cell(0,$hl,": " . $adherent['numeroPiece'],0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("Ubwenegihugu"),0,0,'L',false);
$pdf->Cell(50,$hl,": ............................",0,0,'L',false);
$pdf->Cell(35,$hl,convertirc("Irangamimerere"),0,0,'L',false);
$pdf->Cell(0,$hl,": ............................",0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("Telefone"),0,0,'L',false);
$pdf->Cell(50,$hl,": " . $adherent['telephonePortable'],0,0,'L',false);
$pdf->Cell(35,$hl,convertirc("Email"),0,0,'L',false);
$pdf->Cell(0,$hl,": " . $adherent['email'],0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("Umudugudu"),0,0,'L',false);
$pdf->Cell(50,$hl,": ............................",0,0,'L',false);
$pdf->Cell(35,$hl,convertirc("Akagari"),0,0,'L',false);
$pdf->Cell(0,$hl,": ............................",0,1,'L',false);
$pdf->Cell(45,$hl,convertirc("Umurenge"),0,0,'L',false);
$pdf->Cell(50,$hl,": ............................",0,0,'L',false);
$pdf->Cell(35,$hl,convertirc("Akarere"),0,0,'L',false);
$pdf->Cell(0,$hl,": ............................",0,1,'L',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','',10);
$pdf->Cell(0,$hl,convertirc("Agiranye amasezerano na RADIANT INSURANCE COMPANY"),0,1,'L',false);
$pdf->Ln(2);
$pdf->Cell(0,$hl,convertirc("Italiki amasezerano akorewe : " . date_format(date_create($adherent['dateEntree']),"d-m-Y")) ,0,1,'L',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 1: IGIHE AMASEZERANO AMARA"),0,1,'L',false);
$pdf->Ln(2);
$pdf->SetFont('Arial','',10);
$pdf->Cell(0,$hl,convertirc("Aya masezerano amara umwaka wuzuye utangira kubarwa nyuma yukwezi kuzuye uhereye igihe"),0,1,'L',false);
$pdf->Cell(0,$hl,convertirc("uwabufashe yishyuriye umusanzu bwa mbere."),0,1,'L',false);
$pdf->Ln(2);
$pdf->Cell(0,$hl,convertirc("Igihe cyo gutangira kwivuza ku bivuza bataha : " . date_format(date_create($adherent['dateAmb']),"d-m-Y")) ,0,1,'L',false);
$pdf->Ln(2);
$pdf->Cell(0,$hl,convertirc("Igihe cyo gutangira kwivuza ku bivuza mu bitaro : " . date_format(date_create($adherent['dateHospit']),"d-m-Y")),0,1,'L',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 2: ABISHINGIRWA"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$pdf->Cell(0,$hl,convertirc("Buri muntu mu bagize umunyamuryango ufite hagati yimyaka 18 na 65, uwo bashakanye nabana"),0,1,'L',false);
$pdf->Cell(0,$hl,convertirc("babo batarengeje imyaka 21 nkuko bagaragara mu mbonerahamwe iri hasi hamwe nimisanzu yabo:"),0,1,'L',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(7,$hl,convertirc(_('No')),"1",0,'C');
$pdf->Cell(75,$hl,convertirc(_('Amazina')),"1",0,'C');
$pdf->Cell(32,$hl,convertirc(_('Itariki yamavuko')),"1",0,'C');
$pdf->Cell(35,$hl,convertirc(_('No yubwishingizi')),"1",0,'C');
$pdf->Cell(31,$hl,convertirc("Umusanzu (FRW)"),"1",1,'C');
$pdf->SetFont('Arial','I',10);
$nb = 1;
$primetotal = 0;
foreach ($beneficiaires as $beneficiaire)
{
$pdf->Cell(7,$hl,$nb,"1",0,'C');
$pdf->Cell(75,$hl,convertirc($beneficiaire['nomBeneficiaire'] . " " . $beneficiaire['prenomsBeneficiaire']),"1",0,'C');
$pdf->Cell(32,$hl, date_format(date_create($beneficiaire['dateNaissance']),"d-m-Y"),"1",0,'C');
$pdf->Cell(35,$hl,convertirc($beneficiaire['numeroBeneficiaire']),"1",0,'C');
$pdf->Cell(31,$hl,format_N($beneficiaire['primeTtc']),"1",1,'C');
$nb++;
$primetotal+=$beneficiaire['primeTtc'];
}
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(149,$hl,convertirc("UMUSANZU WOSE HAMWE"),"1",0,'C');
$pdf->Cell(31,$hl,format_N($primetotal),"1",1,'C');
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 3: IBYISHINGIRWA"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$text = convertirc("Amasezerano yubwishingizi bwo kwivuza akubiyemo serivise zo kwivuza biturutse ku mpamvu zo kubyara, impanuka, kwivuza amaso, amenyo ndetse nubundi burwayi busanzwe.");
// $text .= convertirc("personnes à assurer, pour les Garanties et moyennant les Cotisations ci-après :");
$pdf->MultiCell(0, $hl, $text);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 4: AHO BIVURIZA"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$text = convertirc("Abafashe ubu bwishingizi bahabwa serivise zubuvuzi zitangirwa mu bigo nderabuzima, ibitaro byuturere nintara ndetse nibitaro bya gisirikare byi Kanombe, CHUB, CHUK, nibitaro bya NDERA, bitabaye ngombwa gusaba taransiferi.
Uwishingiwe ahabwa imiti yandikiwe na muganga kandi muri farumasi zose mu Rwanda zikorana na Radiant Insurance Company.
Uwishingiwe yishyura buri 10% kuri fagitire yibyo yakorewe kwa muganga cyangwa imiti yahawe muri farumasi.
Nyuma yitangira ryaya masezerano, uwafashe ubwishingizi ku giti cye ashobora kongeramo uwo bashakanye mu gihe yashyingiwe cyangwa umwana bibarutse ku bafashe ubwishingizi nkumuryango.
Abagize umuryango wuwishingiwe bashya bazinjizwa muri aya masezerano hongeweho 50% byamafaranga yishyuwe nuwafashe ubwishingizi igihe yongeyemo uwo bashakanye na 25% ku mwana wavutse hatitawe ku minsi isigaye ngo umwaka wamasezerano urangire. Abagize umuryango we bazahita bagira uburenganzira bwo kwivuza kuva igihe amazina yabo nimyaka yamavuko byashyikirijwe RADIANT INSURANCE COMPANY.
Buri wese ahabwa ikarita yubwishingizi agomba kwitwaza igihe agiye kwivuza igafasha abamwakira nawe ubwe kumenya amafaranga yo kwivuza asigaranye ndetse nibyo yemerewe gukorerwa.");
$pdf->MultiCell(0, $hl, $text);
$pdf->SetFont('Arial','B',10);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("ICYITONDERWA :"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$text = convertirc("Ubu bwishingizi bumara umwaka wuzuye (amezi 12) ushobora kongera kuvugururwa ku bushake bwuwabufashe, bityo rero, iyo amafaranga yo kwivuza ashize uwafashe ubwishingizi nabagize umuryango we bongera gukoresha ubwishingizi nyuma yo kongera kwishyura imisanzu yumwaka ukurikiyeho kandi mu gihe amasezerano ahise avugururwa hatabayeho gukererwa.");
$pdf->MultiCell(0, $hl, $text);
$pdf->SetFont('Arial','B',10);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 5: AMAFARANGA YO KWIVUZA KU MWAKA"),0,1,'L',false);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(149,$hl,convertirc("IBITEGANYIJWE"),"1",0,'C');
$pdf->Cell(31,$hl,"Amafaranga","1",1,'C');
$pdf->SetFont('Arial','I',10);
$pdf->Cell(149,$hl,convertirc("IGIHE WIVUZA UTAHA HAMWE N'IMITI MURI ZA FARUMASI"),"1",0,'C');
$pdf->Cell(31,$hl,format_N($adherent['plafontOut']),"1",1,'C');
$pdf->Cell(149,$hl,convertirc("IGIHE URI MU BITARO"),"1",0,'C');
$pdf->Cell(31,$hl,format_N($adherent['plafontInp']),"1",1,'C');
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 6: IBITISHINGIRWA"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$text = convertirc("- Ibintu byose uwishingiwe yifuza gukorerwa kwa muganga bidaturutse ku mpamvu zuburwayi;
- Ubuvuzi nimiti yibibazo byo kubura urubyaro;
- Imbago, inyunganirangingo ninsimburangingo;
- Ibijyanye no kuyungurura impyiko (diyalize), imiti ya diabete, imiti yibibazo byumuvuduko wamaraso nibindi bikorwa cyangwa ibizamini byihariye bitagendanye nuburwayi;
- Guca mu byuma kabuhariwe nka MRI na Scanner igihe uwivuza atari mu bitaro
- Ibijyanye na serivisi zigenerwa abagore batwite bitangira kwishingirwa ku mwaka ukurikiyeho wubwishingizi kandi mu gihe amasezerano yahise avugururwa ku itariki yagombaga kurangiriraho;
- Kwikingiza no kuringaniza urubyaro kuko bikorerwa ubuntu mu mavuriro nibigonderabuzima bya Leta.");
$pdf->MultiCell(0, $hl, $text);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 7: IHAGARIKWA RYAMASEZERANO"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$text = convertirc("- Amasezerano ashobora guhagarikwa igihe uwafashe ubwishingizi ahisemo kubusesa agasubizwa umusanzu yishyuye mu gihe gusa hatarashira iminsi 30 uhereye igihe yishyuriye umusanzu wa mbere, bivuze ko aba ataratangira kwivuza cyangwa kuvuza abo yishingiye.
- Amasezerano ashobora guhagarikwa igihe bigaragaye ko uwafashe ubwishingizi yavuje cyangwa yagerageje kuvuza umuntu utari mubo yafatiye ubwishingizi cyangwa yashatse gukorerwa nkana ibyo azi neza ko bitishingirwa muri aya masezerano kandi umusanzu yishyuwe ntawusubizwa.");
$pdf->MultiCell(0, $hl, $text);
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("Ingingo ya 8: INGINGO ZISOZA"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$pdf->Ln(2);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("RADIANT INSURANCE COMPANY"),0,1,'L',false);
$pdf->SetFont('Arial','',10);
$text = convertirc("Ntishobora kuryozwa ingaruka zaba ku buzima bwuwakoresheje ubu ubwishingizi ziturutse ku buvuzi yakorewe kwa muganga cyangwa imiti yandikiwe.
Aya masezerano yemejwe nimpande zombi ziyagiranye kandi afite agaciro uhereye kuwa " . date_format(date_create($adherent['dateEntree']),"d-m-Y") );
$pdf->MultiCell(0, $hl, $text);
// Pied de page
$pdf->Ln(10);
$pdf->SetFont('Arial','BI',10);
$pdf->Cell(0,$hl,convertirc("Bikorewe i Kigali, kuwa " . date_format(date_create($adherent['dateEntree']),"d-m-Y")),0,1,'C',false);
$pdf->Ln(10);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(0,$hl,convertirc("RADIANT INSURANCE COMPANY"),0,1,'L',false);
$pdf->Ln(2);
$y= $pdf->GetY();
$pdf->Cell(0,$hl,"Y = ".$y,0,1,'L',false);
$pdf->Image('signature_compagnie.jpg', 15, $y,0,0,'');
$fichier="Temp/radiant_health_".uniqid().".pdf";
$pdf->Output($fichier,"F");
// exit();
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
require_once 'Ebenegmail.php';
$mail_C = $mail;
$mail_C->ClearAllRecipients();
$mail_C->clearAttachments();
$addr = explode(';', $email);
foreach ($addr as $ad)
{
if(tester_une_adresse_email($ad))
{
$mail_C->AddAddress(trim($ad) );
}
}
/*
var_dump($mail_C);
exit();
*/
$body = "Mukiliya Mwiza,";
$body .= "\n\n";
$body .= "Tubashimiye icyizere mwatugiriye mugura ubwishingizi bwa RADIANT INSURANCE COMPANY LTD";
$body .= "\n\n";
$body .= "Tuboherereje kandi ku mugereka amasezerano yubwishingizi.";
$body .= "\n\n";
$body .= "Mugihe mukeneye ubufasha mwahamagara izi numero:";
$body .= "\n\n";
$body .= "0788 500 877 / 0783 184 104 / 0788 355 647";
$body .= "\n\n";
$body .= "Murakoze.";
$obejt = "RADIANT HEALTH CONTRACT";
$pj = $fichier;
$mail_C->Subject = $obejt;
$mail->isHTML(false);
// $mail_C->AltBody = $altbody;
$mail_C->Body=$body;
$mail_C->addAttachment($pj);
$mail_C->send();
// exit();
/*
if (!$mail_C->send())
{
// echo "Erreur mail : " . $mail_C->ErrorInfo;
}
else
{
// echo "Message envoyé!";
}
*/
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
// supprimons le fichier
unlink ($pj);
// Fin envoi mail
}
else
{
http_response_code(503);
$message = "Pas de données à retourner! / No data to return!";
echo json_encode(["success" => "0", "message" => $message]);
exit();
}
echo json_encode($tableau_retour);
exit();
}
}
else
{
// On gère l'erreur
// $police->viderbeneficiairemodeltempapi();
http_response_code(405);
$message = "Méthode non autoirisée! / Method Not Allowed!";
echo json_encode(["success" => "0", "message" => $message]);
}