526 lines
31 KiB
PHP
526 lines
31 KiB
PHP
<?php
|
|
// mets les totaux dans un tableau (JSP)
|
|
// param : id de l'vévénement, no panier, langue
|
|
// créé : 2021-05-12
|
|
function fxUpdateFinancesMembership($intEvenement) {
|
|
global $objDatabase;
|
|
$strOutput = '';
|
|
|
|
// SQL
|
|
$sqlTypeEvenement = "
|
|
SELECT
|
|
te_id
|
|
FROM
|
|
inscriptions_evenements
|
|
WHERE
|
|
eve_id = " . intval($intEvenement) . "
|
|
";
|
|
$intTypeEvenement = $objDatabase->fxGetVar($sqlTypeEvenement);
|
|
|
|
if (intval($intTypeEvenement) != 0) {
|
|
if (intval($intTypeEvenement) == 13) {
|
|
$sqlAcheteurs = "
|
|
SELECT
|
|
a.*, " . intval($intEvenement) . " AS eve_id_membership
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
WHERE
|
|
a.sta_id = 3
|
|
AND a.eve_id <> " . intval($intEvenement) . "
|
|
AND a.no_panier IN(
|
|
SELECT no_panier FROM inscriptions_panier_produits_new p WHERE p.eve_id = " . intval($intEvenement) . "
|
|
UNION
|
|
SELECT no_panier FROM inscriptions_panier_epreuves_commandees ec WHERE ec.eve_id = " . intval($intEvenement) . "
|
|
)
|
|
AND a.no_panier NOT IN(
|
|
SELECT no_panier FROM rapport_finances_membership
|
|
)
|
|
";
|
|
} else {
|
|
$sqlAcheteurs = "
|
|
SELECT
|
|
*
|
|
FROM
|
|
inscriptions_panier_acheteurs a
|
|
JOIN inscriptions_evenements e ON e.eve_id = a.eve_id
|
|
WHERE
|
|
a.sta_id = 3
|
|
AND a.eve_id = " . intval($intEvenement) . "
|
|
AND a.no_panier IN(
|
|
SELECT no_panier FROM inscriptions_panier_produits_new p WHERE p.eve_id = e.eve_id_membership
|
|
UNION
|
|
SELECT no_panier FROM inscriptions_panier_epreuves_commandees ec WHERE ec.eve_id = e.eve_id_membership
|
|
)
|
|
";
|
|
}
|
|
$tabAcheteurs = $objDatabase->fxGetResults($sqlAcheteurs);
|
|
|
|
if ($tabAcheteurs != null) {
|
|
foreach ($tabAcheteurs as $acheteur) {
|
|
//$strOutput .= '<h1>no_commande: ' . $acheteur['no_commande'] . '</h1>';
|
|
$arrTotalsMembership = fxTotalPanierMembership($acheteur['eve_id'], $acheteur['eve_id_membership'], $acheteur['no_panier']);
|
|
//$strOutput .= '<pre>' . print_r($arrTotals, true) . '</pre>';
|
|
// insérer les totaux dans la table de jonction (NOTE: no_commande et no_panier onnt des INDEX UNIQUE donc, aucune chance de doublons)
|
|
$sqlInsert = "INSERT INTO rapport_finances_membership SET no_commande = '" . $objDatabase->fxEscape($acheteur['no_commande']) . "', no_panier = '" . $objDatabase->fxEscape($acheteur['no_panier']) . "', eve_id = " . intval($acheteur['eve_id']) . ", eve_id_membership = " . intval($acheteur['eve_id_membership']) . ", ach_total = " . floatval($arrTotalsMembership['total']) . ", ach_taxe1 = " . floatval($arrTotalsMembership['taxes'][1]['montant']) . ", ach_taxe2 = " . floatval($arrTotalsMembership['taxes'][2]['montant']) . ", ach_taxe3 = " . floatval($arrTotalsMembership['taxes'][3]['montant']) . ", rabais_total = " . floatval($arrTotalsMembership['rabais_total']);
|
|
$strOutput = $objDatabase->fxQuery($sqlInsert);
|
|
// mettre à jour les totaux de la facture originale
|
|
$arrTotalsOriginal = fxTotalPanier($acheteur['no_panier'], 'fr');
|
|
$sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET ach_total = " . floatval(floatval($arrTotalsOriginal['total']) - floatval($arrTotalsMembership['total'])) . ", ach_taxe1 = " . floatval(floatval($arrTotalsOriginal['taxes'][1]['montant']) - floatval($arrTotalsMembership['taxes'][1]['montant'])) . ", ach_taxe2 = " . floatval(floatval($arrTotalsOriginal['taxes'][2]['montant']) - floatval($arrTotalsMembership['taxes'][2]['montant'])) . ", ach_taxe3 = " . floatval(floatval($arrTotalsOriginal['taxes'][3]['montant']) - floatval($arrTotalsMembership['taxes'][3]['montant'])) . ", rabais_total = " . floatval(floatval($arrTotalsOriginal['rabais_total']) - floatval($arrTotalsMembership['rabais_total'])) . " WHERE no_panier = '" . $objDatabase->fxEscape($acheteur['no_panier']) . "'";
|
|
//$strOutput .= $objDatabase->fxQuery($sqlUpdate);
|
|
}
|
|
}
|
|
}
|
|
|
|
return $strOutput;
|
|
}
|
|
function fxTotalPanierMembership($intEvenement, $intEvenementMembership, $strNoPanier) {
|
|
global $objDatabase;
|
|
$fltTotalTaxes = $fltTotalTaxesFrais = $fltMontantTaxable = $fltSousTotal = $fltSousTotal2 = $fltTotal = 0;
|
|
|
|
// info événements
|
|
$sqlEvenements = "SELECT * FROM inscriptions_panier_evenements WHERE eve_id = " . intval($intEvenement);
|
|
$tabEvenements = $objDatabase->fxGetRow($sqlEvenements);
|
|
|
|
// info épreuves
|
|
$sqlEpreuves = "SELECT pec_id FROM inscriptions_panier_epreuves_commandees WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . " ORDER BY pec_id";
|
|
$tabEpreuves = $objDatabase->fxGetResults($sqlEpreuves);
|
|
|
|
// Calculer le sous-total
|
|
$sqlTotal = "
|
|
SELECT
|
|
(SELECT SUM(pec_prix) FROM inscriptions_panier_epreuves_commandees WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS prix_epreuves,
|
|
(SELECT SUM(e.rab_montant) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_rabais r WHERE r.pra_id = e.pra_id AND r.pra_depot = 0 AND e.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS rabais_epreuves,
|
|
(SELECT SUM(c.pec_prix - c.rab_montant) FROM inscriptions_panier_epreuves_commandees c, inscriptions_panier_epreuves e WHERE c.epr_id = e.epr_id AND e.epr_taxes_incluses = 0 AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS prix_epreuves_taxable,
|
|
(SELECT SUM(pro_prix) FROM inscriptions_panier_produits_new WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS prix_produits,
|
|
(SELECT SUM(p.rab_montant) FROM inscriptions_panier_produits_new p, inscriptions_panier_rabais r WHERE r.pra_id = p.pra_id AND r.pra_depot = 0 AND p.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS rabais_produits,
|
|
(SELECT SUM(pro_prix - rab_montant) FROM inscriptions_panier_produits_new WHERE pro_taxable = 1 AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND eve_id = " . intval($intEvenementMembership) . ") AS prix_produits_taxable,
|
|
(SELECT SUM(r.rab_montant) FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a WHERE r.pra_id = a.pra_id AND r.pra_depot = 0 AND a.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND r.rab_pourcent = 0 AND r.rab_epreuves = '' AND r.rab_produits = '') AS rabais_panier_montant,
|
|
(SELECT SUM(r.rab_pourcent) FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a WHERE r.pra_id = a.pra_id AND r.pra_depot = 0 AND a.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND r.rab_montant = 0 AND r.rab_epreuves = '' AND r.rab_produits = '') AS rabais_panier_pourcent
|
|
FROM DUAL
|
|
";
|
|
$tabTotal = $objDatabase->fxGetRow($sqlTotal);
|
|
|
|
$fltRegistrationTotal = $tabTotal['prix_epreuves'] + $tabTotal['prix_produits'];
|
|
|
|
// calculer les rabais
|
|
$fltRabaisMontant = $tabTotal['rabais_panier_montant'] + $tabTotal['rabais_epreuves'] + $tabTotal['rabais_produits'];
|
|
$intRabaisPourcent = $tabTotal['rabais_panier_pourcent'];
|
|
|
|
if ($intRabaisPourcent > 100)
|
|
$intRabaisPourcent = 100;
|
|
|
|
// calculer le rabais %
|
|
$fltRabaisPourcent = ($fltRegistrationTotal - $fltRabaisMontant) * ($intRabaisPourcent / 100);
|
|
|
|
// calculer le total après rabais pourcent
|
|
$fltRabaisTotal = $fltRabaisMontant + $fltRabaisPourcent;
|
|
$fltRegistrationTotal -= ($fltRabaisTotal);
|
|
|
|
if ($fltRegistrationTotal < 0)
|
|
$fltRegistrationTotal = 0;
|
|
|
|
$fltMontantTaxable = ($tabTotal['prix_epreuves_taxable'] + $tabTotal['prix_produits_taxable']) - ($fltRabaisPourcent + $tabTotal['rabais_panier_montant']);
|
|
|
|
if ($fltMontantTaxable < 0)
|
|
$fltMontantTaxable = 0;
|
|
|
|
// calculer le sous total (registration + option)
|
|
$fltSousTotal = $fltRegistrationTotal;
|
|
|
|
// calculer les taxes
|
|
$tabTaxes[1] = $tabTaxes[2] = $tabTaxes[3] = array('label_fr' => '', 'label_en' => '', 'montant' => 0, 'taux' => 0, 'numero' => '');
|
|
|
|
// récupérer les infos des taxes
|
|
if ($tabEvenements['tt_id'] > 1) {
|
|
$sqlTaux = "SELECT t.tau_nom_fr, t.tau_nom_en, t.tau_taux, t.tau_numero_client, t.tau_numero_ms1 FROM inscriptions_taux t, inscriptions_taux_types_taux ttt WHERE t.tau_id = ttt.tau_id AND ttt.tt_id = " . intval($tabEvenements['tt_id']) . " ORDER BY ttt.ttt_tri";
|
|
$tabTaux = $objDatabase->fxGetResults($sqlTaux);
|
|
|
|
if ($tabTaux != null) {
|
|
for ($intCtr = 1; $intCtr <= count($tabTaux); $intCtr++) {
|
|
$fltMontantTaxes = round($fltMontantTaxable * ($tabTaux[$intCtr]['tau_taux'] / 100), 2);
|
|
$tabTaxes[$intCtr] = array('label_fr' => $tabTaux[$intCtr]['tau_nom_fr'] . ' (' . $tabTaux[$intCtr]['tau_taux'] . '%)', 'label_en' => $tabTaux[$intCtr]['tau_nom_en'] . ' (' . $tabTaux[$intCtr]['tau_taux'] . '%)', 'montant' => $fltMontantTaxes, 'taux' => $tabTaux[$intCtr]['tau_taux'], 'numero' => $tabTaux[$intCtr]['tau_numero_client']);
|
|
$fltTotalTaxes += $fltMontantTaxes;
|
|
}
|
|
} else {
|
|
fxcreer_log("Il y a eu une erreur lors de la récupération des taxes:\n" . $sqlTaux);
|
|
}
|
|
}
|
|
// calculer le total après taxes
|
|
$fltSousTotal2 = $fltSousTotal + $fltTotalTaxes;
|
|
// calculer le total avec frais d'administration
|
|
$fltTotal = $fltSousTotal2;
|
|
|
|
// affiche le sous-total, les taxes, rabais et le total complet
|
|
$tabRetour['taxes'] = $tabTaxes;
|
|
$tabRetour['total_taxes'] = $fltTotalTaxes;
|
|
$tabRetour['total'] = abs($fltTotal);
|
|
$tabRetour['stotal'] = $fltSousTotal;
|
|
$tabRetour['stotal2'] = $fltSousTotal2;
|
|
$tabRetour['rabais_total'] = $fltRabaisTotal;
|
|
|
|
if ($tabEpreuves != null)
|
|
$tabRetour['pec_id'] = implode(',', array_map(function($tab) { return $tab['pec_id']; }, $tabEpreuves));
|
|
else
|
|
$tabRetour['pec_id'] = 0;
|
|
|
|
$tabRetour['eve_id'] = $tabEvenements['eve_id'];
|
|
$tabRetour['eve_id_membership'] = $intEvenementMembership;
|
|
|
|
return $tabRetour;
|
|
}
|
|
function fxGetTermes($intEvenement, $strNoPanier, $blnMembership, $strLangue) {
|
|
$strSuffixe = $strTermesText = $strTermesHTML = $strTermesModal = '';
|
|
$arrRetour = $arrTermesModalButtons = $arr_epreuves_id = array();
|
|
|
|
// faire un tableau avec tout les epr_id (sl)
|
|
$epreuves = fxListPanier($strNoPanier);
|
|
|
|
foreach ($epreuves[3] as $key => $value) {
|
|
$arr_epreuves_id[$key]= $value['epr_id'] ;
|
|
}
|
|
|
|
$tabEvenement = fxGetEvenements(fxGetEvenementsUrl($intEvenement), $strLangue);
|
|
|
|
if ($blnMembership) {
|
|
$strSuffixe = '_mem';
|
|
$tabEvenement = fxGetEvenements(fxGetEvenementsUrl($tabEvenement['general']['eve_id_membership']), $strLangue);
|
|
}
|
|
|
|
if ($tabEvenement['general']['eve_waiver_' . $strLangue] != '') {
|
|
$strTermesText .= '<p><strong>' . afficheTexte('terme_waiver', 0, 1, 1) . ' :</strong></p>';
|
|
$strTermesText .= $tabEvenement['general']['eve_waiver_' . $strLangue] . '<br>';
|
|
$strTermesHTML = '
|
|
<div class="card-text">
|
|
' . afficheTexte('terme_jaccepte', 0, 1, 1) . '
|
|
<strong><a href="#div_waiver' . $strSuffixe . '" id="link_waiver' . $strSuffixe . '" data-toggle="modal">' . afficheTexte('terme_waiver', 0, 1, 1) .'</a>.</strong>
|
|
<div class="form-check d-inline-block ml-2">
|
|
<input class="form-check-input position-static chk_termes" type="checkbox" id="chk_waiver' . $strSuffixe . '" name="chk_waiver' . $strSuffixe . '" value="1" aria-label="..." readonly>
|
|
</div>
|
|
</div>
|
|
';
|
|
$strTermesModal .= '
|
|
<div class="modal fade" id="div_waiver' . $strSuffixe . '" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="div_waiver_label' . $strSuffixe . '" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="div_waiver_label' . $strSuffixe . '">' . afficheTexte('terme_waiver_titre', 0, 1, 1) . '</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="' . afficheTexte('btn_terme_close', 0, 1, 1) . '">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
' . $tabEvenement['general']['eve_waiver_' . $strLangue] . '
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary rounded-0" data-dismiss="modal">' . afficheTexte('btn_terme_close', 0, 1, 1) . '</button>
|
|
<button id="btn_accept_waiver' . $strSuffixe . '" type="button" class="btn btn-primary rounded-0">' . afficheTexte('btn_terme_jaccepte', 0, 1, 1) . '</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
$arrTermesModalButtons[] = 'btn_accept_waiver' . $strSuffixe;
|
|
}
|
|
|
|
if ($tabEvenement['general']['eve_policy_' . $strLangue] != '') {
|
|
$strTermesText .= '<p><strong>' . afficheTexte('terme_politique_achat', 0, 1, 1) . ' :</strong></p>';
|
|
$strTermesText .= $tabEvenement['general']['eve_policy_' . $strLangue] . '<br>';
|
|
$strTermesHTML .= '
|
|
<div class="card-text">
|
|
' . afficheTexte('terme_jaccepte', 0, 1, 1) . '
|
|
<strong><a href="#div_policy' . $strSuffixe . '" id="link_policy' . $strSuffixe . '" data-toggle="modal">' . afficheTexte('terme_politique_achat', 0, 1, 1) . '</a>.</strong>
|
|
<div class="form-check d-inline-block ml-2">
|
|
<input class="form-check-input position-static chk_termes" type="checkbox" id="chk_policy' . $strSuffixe . '" name="chk_policy' . $strSuffixe . '" value="1" aria-label="..." readonly>
|
|
</div>
|
|
</div>
|
|
';
|
|
$strTermesModal .= '
|
|
<div class="modal fade" id="div_policy' . $strSuffixe . '" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="div_policy_label' . $strSuffixe . '" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="div_policy_label' . $strSuffixe . '">' . afficheTexte('terme_policy_titre', 0, 1, 1) . '</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="' . afficheTexte('btn_terme_close', 0, 1, 1) . '">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
' . $tabEvenement['general']['eve_policy_' . $strLangue] . '
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary rounded-0" data-dismiss="modal">' . afficheTexte('btn_terme_close', 0, 1, 1) . '</button>
|
|
<button id="btn_accept_policy' . $strSuffixe . '" type="button" class="btn btn-primary rounded-0">' . afficheTexte('btn_terme_jaccepte', 0, 1, 1) . '</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
$arrTermesModalButtons[] = 'btn_accept_policy' . $strSuffixe;
|
|
}
|
|
|
|
if ($tabEvenement['general']['eve_policy2_' . $strLangue] != '') {
|
|
$strTermesText .= '<p><strong>' . afficheTexte('terme_location_politique_achat', 0, 1, 1) . ' :</strong></p>';
|
|
$strTermesText .= $tabEvenement['general']['eve_policy2_' . $strLangue] . '<br>';
|
|
$strTermesHTML .= '
|
|
<div class="card-text">
|
|
' . afficheTexte('terme_jaccepte', 0, 1, 1) . '
|
|
<strong><a href="#div_location_policy' . $strSuffixe . '" id="link_location_policy' . $strSuffixe . '" data-toggle="modal">' . afficheTexte('terme_location_politique_achat', 0, 1, 1) . '</a>.</strong>
|
|
<div class="form-check d-inline-block ml-2">
|
|
<input class="form-check-input position-static chk_termes" type="checkbox" id="chk_location_policy' . $strSuffixe . '" name="chk_location_policy' . $strSuffixe . '" value="1" aria-label="..." readonly>
|
|
</div>
|
|
</div>
|
|
';
|
|
$strTermesModal .= '
|
|
<div class="modal fade" id="div_location_policy' . $strSuffixe . '" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="div_location_policy_label' . $strSuffixe . '" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="div_location_policy_label' . $strSuffixe . '">' . afficheTexte('terme_location_policy_titre', 0, 1, 1) . '</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="' . afficheTexte('btn_terme_close', 0, 1, 1) . '">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
' . $tabEvenement['general']['eve_policy2_' . $strLangue] . '
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary rounded-0" data-dismiss="modal">' . afficheTexte('btn_terme_close', 0, 1, 1) . '</button>
|
|
<button id="btn_accept_location_policy' . $strSuffixe . '" type="button" class="btn btn-primary rounded-0">' . afficheTexte('btn_terme_jaccepte', 0, 1, 1) . '</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
$arrTermesModalButtons[] = 'btn_accept_location_policy' . $strSuffixe;
|
|
}
|
|
|
|
// valide les waiver de 0 a 6 (sl)
|
|
for ($x = 0; $x <= 6; $x++) {
|
|
$mem_waive="eve_waiver".$x;
|
|
$array_list = explode(',',$tabEvenement['general'][$mem_waive.'_list_epreuves' ]);
|
|
|
|
$result = array_intersect($array_list, $arr_epreuves_id);
|
|
|
|
if (count($result) > 0) {
|
|
$strTermesText .= '<p><strong>' . $tabEvenement['general'][$mem_waive.'_titre_' . $strLangue] . ' :</strong></p>';
|
|
$strTermesText .= $tabEvenement['general'][$mem_waive . '_' . $strLangue] . '<br>';
|
|
$strTermesHTML .= '
|
|
<div class="card-text">
|
|
' . afficheTexte('terme_jaccepte', 0, 1, 1) . '
|
|
<strong><a href="#div_' . $mem_waive . $strSuffixe . '" id="link_' . $mem_waive . $strSuffixe . '" data-toggle="modal">' . $tabEvenement['general'][$mem_waive.'_titre_' . $strLangue] . '</a>.</strong>
|
|
<div class="form-check d-inline-block ml-2">
|
|
<input class="form-check-input position-static chk_termes" type="checkbox" id="chk_' . $mem_waive . $strSuffixe . '" name="chk_' . $mem_waive . $strSuffixe . '" value="1" aria-label="..." readonly>
|
|
</div>
|
|
</div>
|
|
';
|
|
$strTermesModal .= '
|
|
<div class="modal fade" id="div_'.$mem_waive.'' . $strSuffixe . '" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="div_' . $mem_waive . '_label' . $strSuffixe . '" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="div_'.$mem_waive.'_label' . $strSuffixe . '">' .$tabEvenement['general'][$mem_waive.'_titre_' . $strLangue]. '</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="' . afficheTexte('btn_terme_close', 0, 1, 1) . '">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
' . $tabEvenement['general'][$mem_waive.'_' . $strLangue] . '
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary rounded-0" data-dismiss="modal">' . afficheTexte('btn_terme_close', 0, 1, 1) . '</button>
|
|
<button id="btn_accept_' . $mem_waive . $strSuffixe . '" type="button" class="btn btn-primary rounded-0">' . afficheTexte('btn_terme_jaccepte', 0, 1, 1) . '</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
$arrTermesModalButtons[] = 'btn_accept_' . $mem_waive . $strSuffixe;
|
|
}
|
|
}
|
|
|
|
$arrRetour['html'] = $strTermesHTML;
|
|
$arrRetour['modal'] = $strTermesModal;
|
|
$arrRetour['text'] = $strTermesText;
|
|
$arrRetour['buttons'] = $arrTermesModalButtons;
|
|
|
|
return $arrRetour;
|
|
}
|
|
function fxShowBlocPaiement($tabEvenement, $fltMontant, $strLangue) {
|
|
global $vDomaine, $vblnEnvironementDev;
|
|
$strCCNumber = ($vblnEnvironementDev) ? ' value="4528038032834793"' : '';
|
|
$strCVV = ($vblnEnvironementDev) ? ' value="123"' : '';
|
|
$blnIsPromoteur = $blnAdmin = false;
|
|
$strOutput = '';
|
|
|
|
if (isset($tabEvenement) && intval($tabEvenement['general']['eve_gratuit']) != 1) { // si l'événement n'est pas gratuite, afficher le bloc de paiement
|
|
$strOutput .= '
|
|
<div id="paiement" class="card box_participant mb-3">
|
|
<div class="card-header">
|
|
<h2 class="box_paiement">' . afficheTexte('mode_paiement', 0) . '</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-2 col-lg-3">
|
|
|
|
</div>
|
|
<div class="col-12 col-md-8 col-lg-6">
|
|
<div class="form-group text-center">
|
|
';
|
|
|
|
if (floatval($fltMontant) > 0) {
|
|
if (isset($_SESSION['com_info']) && $_SESSION['com_info'] != '') {
|
|
$blnIsPromoteur = fxIsPromoteur($_SESSION['com_info']['com_id'], $tabEvenement['general']['eve_id']);
|
|
}
|
|
|
|
// si en mode admin, récupérer les mode de paiement réservés aux admin
|
|
if (isset($_SESSION['usa_id'])) {
|
|
$blnAdmin = true;
|
|
}
|
|
|
|
$tabPaiements = fxGetPaiements($blnAdmin, $blnIsPromoteur, $strLangue);
|
|
|
|
if ($tabPaiements != false) { // afficher le formulaire de la carte de crédit
|
|
for ($intCtr = 1; $intCtr <= count($tabPaiements); $intCtr++) {
|
|
if ($tabPaiements[$intCtr]['pai_id'] == 2 || $tabPaiements[$intCtr]['pai_id'] == 6) {
|
|
$strDetailsPaiement = $strChecked = '';
|
|
|
|
if ($tabPaiements[$intCtr]['pai_id'] == 2) {
|
|
$strChecked = ' checked';
|
|
}
|
|
|
|
if ($tabPaiements[$intCtr]['pai_id'] == 6) {
|
|
//$strDetailsPaiement = ' <em>' . afficheTexte('paiement_cheque', 0) . '</em>';
|
|
}
|
|
|
|
$strOutput .= '
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" id="chk_pai_' . $tabPaiements[$intCtr]['pai_id'] . '" name="chk_paiement" value="' . $tabPaiements[$intCtr]['pai_id'] . '"' . $strChecked . '>
|
|
<label class="form-check-label" for="chk_pai_' . $tabPaiements[$intCtr]['pai_id'] . '">
|
|
' . $tabPaiements[$intCtr]['pai_nom_' . $strLangue] . '
|
|
</label>
|
|
</div>
|
|
';
|
|
}
|
|
}
|
|
} else {
|
|
$strOutput .= '
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" id="chk_pai_1" name="chk_paiement" value="1" checked>
|
|
<label class="form-check-label" for="chk_pai_1">
|
|
' . afficheTexte('paypal', 0) . '
|
|
</label>
|
|
</div>
|
|
';
|
|
}
|
|
} else {
|
|
$strOutput .= '
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio" id="chk_pai_1" name="chk_paiement" value="1" checked>
|
|
<label class="form-check-label" for="chk_pai_1">
|
|
' . afficheTexte('gratuit', 0) . '
|
|
</label>
|
|
</div>
|
|
';
|
|
}
|
|
|
|
if (floatval($fltMontant) > 0) {
|
|
$strMonth = ($strLangue == 'fr') ? '-- Mois --' : '-- Month --';
|
|
$strYear = ($strLangue == 'fr') ? '-- Année --' :'-- Year --';
|
|
|
|
$strOutput .= '
|
|
</div>
|
|
<div id="creditcard">
|
|
<div class="form-message"></div>
|
|
<div class="img_cartes text-center">
|
|
<img id="card_mc" src="' . $vDomaine . '/images/mastercard.gif" width="55" height="34" alt="MasterCard">
|
|
<img id="card_visa" src="' . $vDomaine . '/images/visa.gif" width="59" height="34" alt="Visa">
|
|
</div>
|
|
<br>
|
|
<input type="hidden" id="card_type" name="card_type" value="">
|
|
<div class="form-group row justify-content-center">
|
|
<label for="ccnumber" class="control-label col-12">' . afficheTexte('checkout_ccnumber', 0) . ':</label>
|
|
<div class="col-11">
|
|
<input class="form-control" type="text" id="ccnumber" name="ccnumber" size="20" maxlength="16" autocomplete="off" placeholder="1234567890123456"' . $strCCNumber . '>
|
|
</div>
|
|
<small class="col text-muted">*</small>
|
|
</div>
|
|
<div class="form-group row justify-content-center">
|
|
<label class="control-label col-12">' . afficheTexte('checkout_ccexp', 0) . ':</label>
|
|
<div class="col-5">
|
|
<select class="form-control" id="ccmonth" name="ccmonth">
|
|
<label class="sr-only" for="ccmonth">' . afficheTexte('month', 0, 1, 1) . '</label>
|
|
<option value="" selected="selected">' . $strMonth . '</option>
|
|
';
|
|
|
|
for ($intCtr = 1; $intCtr <= 12; $intCtr++) {
|
|
$strSelected = ($vblnEnvironementDev && $intCtr == 3) ? ' selected' : '';
|
|
$strOutput .= '<option value="' . fxAddLeadingZero($intCtr) . '"' . $strSelected . '>' . fxMois('2013-' . $intCtr . '-01', $strLangue) . ' (' . $intCtr . ')' . '</option>';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</select>
|
|
</div>
|
|
<small class="col text-muted">*</small>
|
|
<div class="col-5">
|
|
<label class="sr-only" for="ccyear">' . afficheTexte('year', 0, 1, 1) . '</label>
|
|
<select class="form-control" id="ccyear" name="ccyear">
|
|
<option value="" selected="selected">' . $strYear . '</option>
|
|
';
|
|
|
|
for ($intCtr = date('Y', strtotime(fxGetDate())); $intCtr <= date('Y', strtotime(fxGetDate()))+ 10; $intCtr++) {
|
|
$strSelected = ($vblnEnvironementDev && $intCtr == 2025) ? ' selected' : '';
|
|
$strOutput .= '<option value="' . $intCtr . '"' . $strSelected . '>' . $intCtr . '</option>';
|
|
}
|
|
|
|
$strOutput .= '
|
|
</select>
|
|
</div>
|
|
<small class="col text-muted">*</small>
|
|
</div>
|
|
<div class="form-group row justify-content-center">
|
|
<label class="control-label col-12" for="cvv">' . afficheTexte('checkout_cvv', 0) . ':</label>
|
|
<div class="col-11">
|
|
<input class="form-control" type="text" id="cvv" name="cvv" size="3" maxlength="3" autocomplete="off" placeholder="123"' . $strCVV . '>
|
|
</div>
|
|
<small class="col text-muted">*</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2 col-lg-3">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
} else {
|
|
$strOutput .= '
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
';
|
|
}
|
|
} else { // si événement gratuit
|
|
$strOutput .= '
|
|
<input type="hidden" name="chk_paiement" value="1">
|
|
';
|
|
}
|
|
|
|
return $strOutput;
|
|
}
|
|
function fxShowTermesAcceptes($strNoPanier, $strLangue) {
|
|
$strRetour = '';
|
|
$tabPanier = fxListPanier($strNoPanier);
|
|
$tabAcheteur = $tabPanier[0];
|
|
|
|
$strRetour .= '
|
|
<div style="padding: 10px;">
|
|
<div style="color: #666666; font-size: 0.75rem;">
|
|
' . ($tabAcheteur['ach_termes_' . $strLangue]) . '
|
|
</div>
|
|
</div>
|
|
';
|
|
|
|
return $strRetour;} |