118 lines
4.9 KiB
PHP
118 lines
4.9 KiB
PHP
<?php
|
|
require_once('php/inc_start_time.php');
|
|
require_once('php/inc_fonctions.php');
|
|
require_once('php/inc_fx_messages.php');
|
|
require_once('php/inc_fx_panier.php');
|
|
|
|
global $vDomaine, $objDatabase, $vRepertoireFichiers;
|
|
$strPage = "facture.php";
|
|
$_SESSION['vadmin_texte'] = false;
|
|
|
|
// récupérer le paramètre de langue, français par défaut
|
|
if (!empty($_GET['lang']))
|
|
$strLangue = $_GET['lang'];
|
|
else
|
|
$strLangue = 'fr';
|
|
|
|
$vtexte_page = obtenirTextepage($strPage, $strLangue, 2);
|
|
|
|
$strNoPanier = $_GET['no_panier'];
|
|
$tabPanier = fxlistPanier($strNoPanier);
|
|
$tabAcheteur = $tabPanier[0];
|
|
$tabEvenements = $tabPanier[1];
|
|
$tabDons = $tabPanier[12];
|
|
$strColor = $tabPanier[14];
|
|
|
|
if ($tabAcheteur != null) {
|
|
$tabEvenement = $tabPanier[1];
|
|
|
|
$no_commande = fxUnescape($tabAcheteur['no_commande']);
|
|
$to_name = fxUnescape($tabAcheteur['com_prenom']) . ' ' . fxUnescape($tabAcheteur['com_nom']);
|
|
$to_mail = fxUnescape($tabAcheteur['com_courriel']);
|
|
|
|
// Confirmation commande NEW - BEGIN
|
|
if (isset($tabPanier[12][1]['pd_recu_pdf']) && $tabPanier[12][1]['pd_recu'] == 1) {
|
|
$blnReceipt = true;
|
|
$attachment_url = $vDomaine . $vRepertoireFichiers . '/pdf/dons/' . $tabPanier[12][1]['pd_recu_pdf'];
|
|
} elseif (isset($tabPanier[13][1]['pd_recu_pdf'])) {
|
|
$blnReceipt = true;
|
|
$attachment_url = $vDomaine . $vRepertoireFichiers . '/pdf/dons/' . $tabPanier[13][1]['pd_recu_pdf'];
|
|
} else {
|
|
$blnReceipt = false;
|
|
}
|
|
|
|
$body = fxGetMailFormat(true, false, $blnReceipt, true, $strLangue, $tabEvenement['eve_gratuit']);
|
|
|
|
if (($tabAcheteur['receipt_text'] == 'APPROUVEE - MERCI' || $tabAcheteur['receipt_text'] == 'APPROVED - THANK YOU')) {
|
|
if ($strLangue == 'fr')
|
|
$strMessageEtat = "Félicitations ! Vous êtes maintenant inscrit à une activité présentée dans le cadre du %nom_evenement%.";
|
|
else
|
|
$strMessageEtat = "Congratulations ! You are now registered in %nom_evenement%.";
|
|
} else {
|
|
if ($strLangue == 'fr')
|
|
$strMessageEtat = "Il y a eu une erreur lors du traitement de votre commande pour %nom_evenement%.";
|
|
else
|
|
$strMessageEtat = "There has been an error during processing of your order for %nom_evenement%.";
|
|
}
|
|
|
|
if ($strLangue == 'fr') {
|
|
$subject = 'Confirmation de la commande No ' . $no_commande;
|
|
} else {
|
|
$subject = 'Confirmation of order #' . $no_commande;
|
|
}
|
|
|
|
$body = str_replace('%nom%', $to_name, $body);
|
|
$body = str_replace('%no_commande%', $no_commande, $body);
|
|
|
|
// générer les details
|
|
$details = '';
|
|
|
|
$arrLinks = fxGetLinksDonation($strNoPanier,$strLangue);
|
|
$details .= fxShowLinksDonation('mail', $arrLinks, $strLangue, $strColor);
|
|
$details .= fxShowAddress($strNoPanier, 'web',$strLangue);
|
|
$details .= fxShowPanier($strNoPanier, 0, 'web', 1, $strLangue);
|
|
|
|
// remplacer nom, logo et site web de l'événement
|
|
$sqlEvenement = "SELECT eve_nom_$strLangue, eve_trousses_$strLangue, eve_photo_$strLangue, eve_logo_facture_$strLangue, eve_siteweb, eve_contact, eve_courriel_autres_$strLangue, eve_msg_approbation_$strLangue FROM inscriptions_evenements WHERE eve_id = " . intval($tabEvenement['eve_id']);
|
|
$recEvenement = $objDatabase->fxGetRow($sqlEvenement);
|
|
|
|
$body = str_replace('%nom_evenement%', fxUnescape($recEvenement['eve_nom_' . $strLangue]), $body);
|
|
|
|
$strMessageEtat = fxShowApprobation($strNoPanier, $strLangue);
|
|
|
|
$body = str_replace('%message_etat%', $strMessageEtat, $body);
|
|
$body = str_replace('%logo_evenement%', $vDomaine . $vRepertoireFichiers . '/images/evenements/' . $recEvenement['eve_logo_facture_' . $strLangue], $body);
|
|
$body = str_replace('%web_evenement%', '<a href="' . $recEvenement['eve_siteweb'] . '" target="_blank">' . $recEvenement['eve_siteweb'] . '</a>', $body);
|
|
$body = str_replace('%contact_evenement%', '<a href="mailto:' . $recEvenement['eve_contact'] . '" target="_blank">' . $recEvenement['eve_contact'] . '</a>', $body);
|
|
|
|
$strTrousse = fxShowAdresseMagasin($strNoPanier, $strLangue);
|
|
|
|
$body = str_replace('%trousse%', $strTrousse, $body);
|
|
$body = str_replace('%to_mail%', $to_mail, $body);
|
|
$body = str_replace('%subject%', $subject, $body);
|
|
$body = str_replace('%details%', $details, $body);
|
|
$body = str_replace('%termes%', fxShowTermesAcceptes($strNoPanier, $strLangue), $body);
|
|
|
|
if ($blnReceipt) {
|
|
if ($strLangue == 'fr') {
|
|
$attachment_label = 'Voir le reçu d\'impôts';
|
|
} else {
|
|
$attachment_label = 'See the tax receipt';
|
|
}
|
|
$body = str_replace('%attachment_url%', $attachment_url, $body);
|
|
$body = str_replace('%attachment_label%', $attachment_label, $body);
|
|
}
|
|
// Confirmation commande NEW - END
|
|
|
|
echo fxUpdateLiensInternes($body);
|
|
} else {
|
|
if ($strLangue == 'fr') {
|
|
?>
|
|
<p>La facture est introuvable !</p>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<p>The invoice was not found !</p>
|
|
<?php
|
|
}
|
|
}
|