Files
ms1inscription-v5/php/inc_fx_panier_js.php
stephan dd4a83043a 4436 Add payment session handling and mode checks in inc_fonctions.php and inc_fx_panier_js.php
This commit introduces new functions for managing payment session data, including `fxPaiementSessionComId`, `fxPaiementCanUseModesPromoteur`, and `fxPaiementCanUseModesAdmin`. These functions enhance the payment processing logic by determining the appropriate payment modes based on user roles (promoteur or admin). The existing payment display functions in `inc_fx_panier_js.php` are updated to utilize these new functions, improving the clarity and maintainability of the payment handling process. These changes aim to enhance user experience and ensure proper access control for payment options.
2026-07-07 16:09:11 -04:00

1046 lines
53 KiB
PHP
Raw 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
// mets les totaux dans un tableau (JSP)
// param : id de l'vévénement, no panier, langue
// créé : 2021-05-12
function fxUpdateFinancesMembershipall(){
global $objDatabase;
// tout
$sql = "SELECT eve_id FROM inscriptions_evenements WHERE eve_id_membership = '649' ORDER BY eve_date_limite LIMIT 0,1000";
// actif
$sql = "SELECT eve_id
FROM inscriptions_evenements
WHERE eve_id_membership = '649'
AND NOW() <= DATE_ADD(eve_date_limite, INTERVAL 1 DAY)
ORDER BY eve_date_limite
LIMIT 0,1000";
$arr = $objDatabase->fxGetResults($sql );
if (!empty($arr)) {
foreach ($arr as $row) {
if (isset($row['eve_id'])) {
fxUpdateFinancesMembership( $row['eve_id']);
}
}
}
}
function fxUpdateFinancesMembership($intEvenement, $pan = "")
{
global $objDatabase;
$strOutput = '';
// SQL
$sqlTypeEvenement = "
SELECT
te_id
FROM
inscriptions_evenements
WHERE
eve_id = " . intval($intEvenement) . "
";
$intTypeEvenement = $objDatabase->fxGetVar($sqlTypeEvenement);
// MSIN-4228
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 {
// avant MSIN-4298
$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
)
";
$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
)
AND NOT EXISTS (
SELECT 1
FROM rapport_finances_membership r
WHERE r.no_panier = a.no_panier
);
";
}
$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'], $pan);
// 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);
// echosl($sqlInsert);
// Valeurs sûres (si une taxe manque dans larray)
// echosl($acheteur['no_panier']);
// print_rsl($arrTotalsMembership);
$tax1 = isset($arrTotalsMembership['taxes'][1]['montant']) ? (float)$arrTotalsMembership['taxes'][1]['montant'] : 0.0;
$tax2 = isset($arrTotalsMembership['taxes'][2]['montant']) ? (float)$arrTotalsMembership['taxes'][2]['montant'] : 0.0;
$tax3 = isset($arrTotalsMembership['taxes'][3]['montant']) ? (float)$arrTotalsMembership['taxes'][3]['montant'] : 0.0;
$sqlUpsert = "
INSERT INTO rapport_finances_membership
SET
no_commande = '" . $objDatabase->fxEscape($acheteur['no_commande']) . "',
no_panier = '" . $objDatabase->fxEscape($acheteur['no_panier']) . "',
eve_id = " . (int)$acheteur['eve_id'] . ",
eve_id_membership = " . (int)$acheteur['eve_id_membership'] . ",
ach_total = " . (float)$arrTotalsMembership['total'] . ",
ach_taxe1 = " . $tax1 . ",
ach_taxe2 = " . $tax2 . ",
ach_taxe3 = " . $tax3 . ",
rabais_total = " . (float)$arrTotalsMembership['rabais_total'] . ",
updated_at = NOW()
ON DUPLICATE KEY UPDATE
eve_id = VALUES(eve_id),
eve_id_membership = VALUES(eve_id_membership),
ach_total = VALUES(ach_total),
ach_taxe1 = VALUES(ach_taxe1),
ach_taxe2 = VALUES(ach_taxe2),
ach_taxe3 = VALUES(ach_taxe3),
rabais_total = VALUES(rabais_total),
updated_at = NOW()
";
$strOutput = $objDatabase->fxQuery($sqlUpsert);
;
// 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 ;
}
function fxTotalPanierMembership($intEvenement, $intEvenementMembership, $strNoPanier, $pan = "")
{//echosl($intEvenement);
//echosl($intEvenementMembership);
if ($strNoPanier == $pan){
echosl($strNoPanier);
error_reporting(E_ALL);
ini_set("display_errors", 1);}
global $objDatabase;
$fltTotalTaxes = $fltTotalTaxesFrais = $fltMontantTaxable = $fltSousTotal = $fltSousTotal2 = $fltTotal = 0;
//echosl($intEvenementMembership);
// info événements
$sqlEvenements = "SELECT * FROM inscriptions_panier_evenements WHERE eve_id = " . intval($intEvenement);
$tabEvenements = $objDatabase->fxGetRow($sqlEvenements);
//echosl($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($intEvenement) . ") AS prix_epreuves,
(SELECT SUM(pec_prix) FROM inscriptions_panier_epreuves_commandees WHERE eve_id !='" . intval($intEvenement). "' and no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_epreuves_autre_eve,
(SELECT SUM(c.pec_prix - c.rab_montant)
FROM inscriptions_panier_epreuves_commandees c, inscriptions_panier_epreuves e
WHERE eve_id !='" . intval($intEvenement) . "'
AND c.epr_id = e.epr_id
AND e.epr_taxes_incluses = 0
AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_epreuves_taxable_autre_eve,
(SELECT SUM(pro_prix)
FROM inscriptions_panier_produits_new
WHERE eve_id !='" . intval($intEvenement). "'
AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_autre_eve,
(SELECT SUM(pro_prix)
FROM inscriptions_panier_produits_new
WHERE eve_id !='" . intval($intEvenement) . "'
AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_taxable_autre_eve,
(SELECT SUM(r.rab_montant)
FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a
WHERE (r.rab_description_fr LIKE '%tq%'
OR r.rab_produits LIKE '%1426%'
OR r.rab_produits LIKE '%1427%'
OR r.rab_produits LIKE '%1561%'
OR r.rab_produits LIKE '%1959%') and r.pra_id = a.pra_id
AND r.rab_taxes=1
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_taxable,
(SELECT SUM(e.rab_montant) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_rabais r WHERE (r.rab_description_fr LIKE '%tq%'
OR r.rab_produits LIKE '%1426%'
OR r.rab_produits LIKE '%1427%'
OR r.rab_produits LIKE '%1561%'
OR r.rab_produits LIKE '%1959%') and 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.rab_description_fr LIKE '%tq%'
OR r.rab_produits LIKE '%1426%'
OR r.rab_produits LIKE '%1427%'
OR r.rab_produits LIKE '%1561%'
OR r.rab_produits LIKE '%1959%') and 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) FROM inscriptions_panier_produits_new WHERE eve_id = " . intval($intEvenementMembership) . " and pro_taxable = 1 AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_taxable,
(SELECT SUM(r.rab_montant) FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a WHERE (r.rab_description_fr LIKE '%tq%'
OR r.rab_produits LIKE '%1426%'
OR r.rab_produits LIKE '%1427%'
OR r.rab_produits LIKE '%1561%'
OR r.rab_produits LIKE '%1959%') and r.pra_id = a.pra_id AND r.rab_taxes=0 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.rab_description_fr LIKE '%tq%'
OR r.rab_produits LIKE '%1426%'
OR r.rab_produits LIKE '%1427%'
OR r.rab_produits LIKE '%1561%'
OR r.rab_produits LIKE '%1959%') and 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);
if ($strNoPanier == $pan) {
echosl($sqlTotal);
print_rsl($tabTotal);
}
// $fltRegistrationTotal = $tabTotal['prix_epreuves'] + $tabTotal['prix_produits'];
$fltRegistrationTotal = $tabTotal['prix_epreuves_autre_eve'] + $tabTotal['prix_produits_taxable_autre_eve'];
// calculer les rabais
//$fltRabaisMontant = $tabTotal['rabais_panier_montant'] + $tabTotal['rabais_epreuves'] + $tabTotal['rabais_produits'];
//$intRabaisPourcent = $tabTotal['rabais_panier_pourcent'];
// calculer les rabais v2
$fltRabaisMontant = $tabTotal['rabais_panier_montant_taxable'] + $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);
$fltRabaisPourcenttx = ( $fltRabaisMontant - $tabTotal['prix_epreuves_taxable_autre_eve'] - $tabTotal['prix_produits_taxable_autre_eve']) * ($intRabaisPourcent / 100);
$fltRabaisPourcentpastx = ( $fltRabaisMontant ) * ($intRabaisPourcent / 100);
$fltRabaisPourcent = $fltRabaisPourcentpastx + $fltRabaisPourcenttx;
// 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']);
$fltMontantTaxable = ($tabTotal['prix_epreuves_taxable'] + $tabTotal['prix_produits_taxable'] ) - ($fltRabaisPourcent + $tabTotal['rabais_panier_montant_taxable']+$tabTotal['rabais_produits']);
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;
if ($strNoPanier == $pan) {
echo("fltRabaisTotal ");
echosl($fltRabaisTotal);
echo("fltMontantTaxable ");
echosl($fltMontantTaxable);
echo("fltRabaisPourcentpastx ");
echosl($fltRabaisPourcentpastx);
echo("fltRabaisPourcenttx ");
echosl($fltRabaisPourcenttx);
}
// 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;
if ($strNoPanier == $pan) {
print_rsl($tabRetour);
}
return $tabRetour;
}
// MSIN-4228 nouvelle function avant old
function fxTotalPanierMembershipavectq($intEvenement, $intEvenementMembership, $strNoPanier, $pan = "")
{//echosl($intEvenement);
//echosl($intEvenementMembership);
if ($strNoPanier == $pan){
echosl($strNoPanier);
error_reporting(E_ALL);
ini_set("display_errors", 1);}
global $objDatabase;
$fltTotalTaxes = $fltTotalTaxesFrais = $fltMontantTaxable = $fltSousTotal = $fltSousTotal2 = $fltTotal = 0;
//echosl($intEvenementMembership);
// info événements
$sqlEvenements = "SELECT * FROM inscriptions_panier_evenements WHERE eve_id = " . intval($intEvenement);
$tabEvenements = $objDatabase->fxGetRow($sqlEvenements);
//echosl($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($intEvenement) . ") AS prix_epreuves,
(SELECT SUM(pec_prix) FROM inscriptions_panier_epreuves_commandees WHERE eve_id !='" . intval($intEvenement). "' and no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_epreuves_autre_eve,
(SELECT SUM(c.pec_prix - c.rab_montant)
FROM inscriptions_panier_epreuves_commandees c, inscriptions_panier_epreuves e
WHERE eve_id !='" . intval($intEvenement) . "'
AND c.epr_id = e.epr_id
AND e.epr_taxes_incluses = 0
AND c.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_epreuves_taxable_autre_eve,
(SELECT SUM(pro_prix)
FROM inscriptions_panier_produits_new
WHERE eve_id !='" . intval($intEvenement). "'
AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_autre_eve,
(SELECT SUM(pro_prix)
FROM inscriptions_panier_produits_new
WHERE eve_id !='" . intval($intEvenement) . "'
AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_taxable_autre_eve,
(SELECT SUM(r.rab_montant)
FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a
WHERE r.rab_description_fr LIKE '%tq%' and r.pra_id = a.pra_id
AND r.rab_taxes=1
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_taxable,
(SELECT SUM(e.rab_montant) FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_rabais r WHERE r.rab_description_fr LIKE '%tq%' and 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.rab_description_fr LIKE '%tq%' and 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) FROM inscriptions_panier_produits_new WHERE eve_id = " . intval($intEvenementMembership) . " and pro_taxable = 1 AND no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AS prix_produits_taxable,
(SELECT SUM(r.rab_montant) FROM inscriptions_panier_rabais r, inscriptions_panier_rabais_acheteurs a WHERE r.rab_description_fr LIKE '%tq%' and r.pra_id = a.pra_id AND r.rab_taxes=0 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.rab_description_fr LIKE '%tq%' and 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);
if ($strNoPanier == $pan) {
echosl($sqlTotal);
print_rsl($tabTotal);
}
// $fltRegistrationTotal = $tabTotal['prix_epreuves'] + $tabTotal['prix_produits'];
$fltRegistrationTotal = $tabTotal['prix_epreuves_autre_eve'] + $tabTotal['prix_produits_taxable_autre_eve'];
// calculer les rabais
//$fltRabaisMontant = $tabTotal['rabais_panier_montant'] + $tabTotal['rabais_epreuves'] + $tabTotal['rabais_produits'];
//$intRabaisPourcent = $tabTotal['rabais_panier_pourcent'];
// calculer les rabais v2
$fltRabaisMontant = $tabTotal['rabais_panier_montant_taxable'] + $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);
$fltRabaisPourcenttx = ( $fltRabaisMontant - $tabTotal['prix_epreuves_taxable_autre_eve'] - $tabTotal['prix_produits_taxable_autre_eve']) * ($intRabaisPourcent / 100);
$fltRabaisPourcentpastx = ( $fltRabaisMontant ) * ($intRabaisPourcent / 100);
$fltRabaisPourcent = $fltRabaisPourcentpastx + $fltRabaisPourcenttx;
// 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']);
$fltMontantTaxable = ($tabTotal['prix_epreuves_taxable'] + $tabTotal['prix_produits_taxable'] ) - ($fltRabaisPourcent + $tabTotal['rabais_panier_montant_taxable']+$tabTotal['rabais_produits']);
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;
if ($strNoPanier == $pan) {
echo("fltRabaisTotal ");
echosl($fltRabaisTotal);
echo("fltMontantTaxable ");
echosl($fltMontantTaxable);
echo("fltRabaisPourcentpastx ");
echosl($fltRabaisPourcentpastx);
echo("fltRabaisPourcenttx ");
echosl($fltRabaisPourcenttx);
}
// 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;
if ($strNoPanier == $pan) {
print_rsl($tabRetour);
}
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">&times;</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">&times;</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">&times;</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">&times;</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) {
$intComId = fxPaiementSessionComId();
if ($intComId > 0) {
$blnIsPromoteur = fxPaiementCanUseModesPromoteur($intComId, $tabEvenement['general']['eve_id']);
}
$blnAdmin = fxPaiementCanUseModesAdmin();
$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 fxShowBlocPaiementpaypaladvance($tabEvenement, $fltMontant, $strLangue)
{
global $vPaypal_devise,$vDomaine, $vblnEnvironementDev,$currency,$vPaypaladv_SANDBOX;
$strCCNumber = ($vPaypaladv_SANDBOX) ? '4032038429294006' : '';
$strCVV = ($vPaypaladv_SANDBOX) ? '272' : '';
$strCCDate = ($vPaypaladv_SANDBOX) ? '09/2027' : '';
$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
// afficher si sanxbox
$sandbox="";
if ($vPaypaladv_SANDBOX==true){
$sandbox='<h2>' . afficheTexte(' cartes de crédit de test', 0) . '</h2>';
$sandbox.='<br> no carte: ' .$strCCNumber.' / date: '.$strCCDate.' / cvv: '.$strCVV;
}
$strOutput .= '
<div id="paiement" class="card box_participant mb-3">
<div class="card-header">
<h2 class="box_paiement">' . afficheTexte('mode_paiement', 0) . '</h2>
' .$sandbox. '
</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) {
$intComId = fxPaiementSessionComId();
if ($intComId > 0) {
$blnIsPromoteur = fxPaiementCanUseModesPromoteur($intComId, $tabEvenement['general']['eve_id']);
}
$blnAdmin = fxPaiementCanUseModesAdmin();
$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="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>
<div class="container">
<div class="panel">
<div class="panel-body">
<div class="overlay hidden"><div class="overlay-content"><img src="'.$vDomaine.'/paypal_advanced/css/loading.gif" alt="Processing..."/></div></div>
<div class="panel-heading">
</div>
<!-- Display status message -->
<div id="paymentResponse" class="hidden"></div>
<!-- Set up a container element for the button -->
<div id="checkout-form">
<div id="card-name-field-container"></div>
<div id="card-number-field-container"></div>
<div id="card-expiry-field-container"></div>
<div id="card-cvv-field-container"></div>
</div>
</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;
}