3 Commits

Author SHA1 Message Date
fada0b7595 Merge remote-tracking branch 'gitea/dev' into dev 2026-06-04 08:45:45 -04:00
c534a7f846 patch cookie prod et excel pour federation nat 2026-06-04 08:45:30 -04:00
5a3ce23a4b test 2026-06-03 15:09:00 -04:00
7 changed files with 222 additions and 618 deletions

View File

@ -113,9 +113,9 @@ if (isset($tabEvenement) && $tabEvenement['general']['eve_commanditaires'] == "1
<div class="social">
<a href="http://www.facebook.com/pages/Ms1timing/387594717971765" target="_blank"><i class="fa fa-facebook-square"></i></a>
<a href="https://twitter.com/ms1timing" target="_blank"><i class="fa fa-twitter-square"></i></a>
<!--
<a href="/index.php?cookies" ><img style="border: none;" width="30" src="<?php echo $vDomaine; ?>/images/cookie.png" alt="cookies" /></a>
-->
</div>
</div>
</div>

View File

@ -1,86 +0,0 @@
<?php
// MSIN-3880 nouveau tableau
include_once("php/inc_fx_modifierinscriptions.php");
include_once("php/inc_fx_memberships.php");
include_once("php/inc_fx_promoteur.php");
require_once('superadm/php/inc_manager.php');
global $objDatabase, $vDomaine, $strLangue;
$intEveId = 0;
$blnDon = false;
if ($strLangue == 'fr') {
$strPage = '/compte';
} else {
$strPage = '/account';
}
if($strLangue == 'fr')
$strCode = 'compte/';
else
$strCode = 'account/';
$strBibCode = $strCode;
if (!empty($_GET['code'])) {
$code = $_GET['code'];
} else {
$code = 'bib_assignment';
}
if (isset($_GET['promoteur_eve_id'])) {
$intEveId = base64_decode(urldecode($_GET['promoteur_eve_id']));
$arrEvenement = fxGetEvenementsId($intEveId);
//$tabEvenement['general'] = $arrEvenement;
}
?>
<a class="btn btn-primary rounded-pill" id="link_back" href="<?php echo $vDomaine . $strPage . "/inc_tableau_promoteur?promoteur_eve_id=" . urlencode(base64_encode($intEveId)); ?>">
<i class="fa fa-chevron-left mr-2" aria-hidden="true"></i>
<?php afficheTexte('promoteur_back'); ?>
</a>
<br> <br>
<?php
// recalculer les catégorie
if (isset($_REQUEST['resetcategorie'])) {
fxregles_niveau_updateall($intEveId);
}
// Annuler/retablir une inscriptions dans le tableau du promoteur
if (isset($_POST['btn_cancel_event_promo'])) {
$int_pec_id = $_POST['pec_id_original'];
$int_epr_id = $_POST['epr_id'];
$tabEpreuve = fxGetEpreuve($int_epr_id);
fxAnnulerRetablirInscription($tabEpreuve, $int_pec_id);
}
if ($intEveId != 0) {
$arrEvenement = fxGetEvenementsId($intEveId);
$tabRapports = fxGetMenussuperadm(0, 0, 1, $intEveId);
//$tabEvenement['general'] = $arrEvenement;
?> <ul class="nav flex-column ms1-menu-compte">
<li class="nav-item">
<a class="nav-list" href="<?php echo $vDomaine . "/" . $strCode; ?>bib_assignment?a=show_bib_dupes&promoteur_eve_id=<?php echo urlencode(base64_encode($intEveId)); ?>"> <i class="fa fa-clone" aria-hidden="true"></i> <?php echo afficheTexte('tableau_dossards_doublons', 0) ;?>
</a>
</li> </ul>
V2
<?php
fxShowBibTool4($strBibCode, $intEveId, $strLangue);
?>
<a class="btn btn-primary rounded-pill" id="link_back" href="<?php echo $vDomaine . $strPage . "/inc_tableau_promoteur?promoteur_eve_id=" . urlencode(base64_encode($intEveId)); ?>">
<i class="fa fa-chevron-left mr-2" aria-hidden="true"></i>
<?php afficheTexte('promoteur_back'); ?>
</a>
<?php
} else {
if ($strLangue == 'fr')
echo "Une erreur quelconque est survenue.";
else
echo "A generic error occurred.";
}

View File

@ -1,526 +0,0 @@
<?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">&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) {
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;}

View File

@ -4,6 +4,7 @@ require_once('inc_fx_options.php'); // inclure les fonctions des options
require_once('inc_fx_participants.php'); // inclure les fonctions des participants
require_once('inc_fx_code_qr.php');
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/inc_fx_panier_js.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/inc_fx_promoteur.php';
// Retourner le numéro du panier ou en générer un (JSP)
// param : langue
@ -3041,6 +3042,16 @@ function fxMajCommande($strNoPanier, $strLangue = 'fr', $blnResend = false)
$sqlInsert = "INSERT INTO resultats_participants(eve_id, epr_id, par_prenom, par_nom, par_naissance, par_age, par_sexe, par_adresse, par_adresse2, par_ville, pro_id, par_codepostal, pay_id, par_telephone1, par_telephone1_ext, par_telephone2, par_courriel, par_capitaine, com_id, par_nom_equipe, no_panier, par_note, par_maj, no_commande, par_id_original, par_no_equipe, par_equipe, pec_id, rol_id, no_invitation, epr_objectif_dons, epr_objectif_dons_original, par_categorie_1_long_fr, par_categorie_1_long_en,par_categorie_1_court_fr, par_categorie_1_court_en, par_categorie_2_long_fr, par_categorie_2_long_en, par_categorie_2_court_fr, par_categorie_2_court_en, par_categorie_3_long_fr, par_categorie_3_long_en, par_categorie_3_court_fr, par_categorie_3_court_en, epr_objectif_distance, epr_objectif_distance_original, epr_objectif_temps, epr_objectif_temps_original, par_contact_urgence_nom, par_contact_urgence_telephone) SELECT eve_id, epr_id, par_prenom, par_nom, par_naissance, par_age, par_sexe, par_adresse, par_adresse2, par_ville, pro_id, par_codepostal, pay_id, par_telephone1, par_telephone1_ext, par_telephone2, par_courriel, par_capitaine, com_id, par_nom_equipe, no_panier, par_note, '" . fxGetDateTime() . "', '" . $no_commande . "', par_id, par_no_equipe, par_equipe, pec_id, rol_id, no_invitation, epr_objectif_dons, epr_objectif_dons, par_categorie_1_long_fr, par_categorie_1_long_en,par_categorie_1_court_fr, par_categorie_1_court_en, par_categorie_2_long_fr, par_categorie_2_long_en, par_categorie_2_court_fr, par_categorie_2_court_en, par_categorie_3_long_fr, par_categorie_3_long_en, par_categorie_3_court_fr, par_categorie_3_court_en, epr_objectif_distance, epr_objectif_distance, epr_objectif_temps, epr_objectif_temps, par_contact_urgence_nom, par_contact_urgence_telephone FROM inscriptions_panier_participants WHERE par_id = " . intval($tabParticipants[$tabEpreuves[$intCtr]['pec_id']][$intCtr2]['par_id']);
$qryInsert = $objDatabase->fxQuery($sqlInsert);
// MSIN-4379 — Étape 7 : assignation auto du dossard après création du participant (achat).
if ($qryInsert !== false) {
$intNewParId = (int)$objDatabase->fxGetLastId();
$intEprIdAutoBib = (int)$tabParticipants[$tabEpreuves[$intCtr]['pec_id']][$intCtr2]['epr_id'];
if ($intNewParId > 0 && $intEprIdAutoBib > 0) {
fxAssignAutoBibForParticipant($intEprIdAutoBib, $intNewParId);
}
}
// insérer les questions
if (isset($tabQuestions[$tabParticipants[$tabEpreuves[$intCtr]['pec_id']][$intCtr2]['par_id']])) {
$list_file = [];

View File

@ -3050,6 +3050,211 @@ function fxSaveBibAutoConfig($epr_id, $ranges, $active = true) {
return ['success' => true, 'auto_active' => true];
}
/**
* MSIN-4379 — Étape 6
* Liste des epr_bib_id marqués epr_bib_auto = 1 pour une épreuve.
*/
function fxGetAutoBibRangeIds($epr_id) {
global $objDatabase;
$epr_id = intval($epr_id);
if ($epr_id <= 0 || !fxIsBibAutoActive($epr_id)) {
return [];
}
$sql = "
SELECT epr_bib_id
FROM inscriptions_epreuves_bib
WHERE epr_id = $epr_id
AND epr_bib_auto = 1
ORDER BY epr_bib_start
";
$rows = $objDatabase->fxGetResults($sql);
$ids = [];
if (is_array($rows)) {
foreach ($rows as $r) {
$id = (int)($r['epr_bib_id'] ?? 0);
if ($id > 0) {
$ids[] = $id;
}
}
}
return $ids;
}
/**
* MSIN-4379 — Étape 6
* Charge un participant resultats pour l'assignation auto (même jointures que le batch).
*/
function fxLoadParticipantForAutoBib($epr_id, $par_id) {
global $objDatabase;
$epr_id = intval($epr_id);
$par_id = intval($par_id);
if ($epr_id <= 0 || $par_id <= 0) {
return null;
}
$sql = "
SELECT
p.*,
p.pec_id,
c.pec_id_original,
c.pec_nom_equipe,
c.no_equipe
FROM resultats_participants p
LEFT JOIN resultats_epreuves_commandees c
ON c.pec_id_original = p.pec_id
AND c.epr_id = p.epr_id
WHERE p.epr_id = $epr_id
AND p.par_id = $par_id
AND p.is_cancelled = 0
LIMIT 1
";
return $objDatabase->fxGetRow($sql);
}
/**
* MSIN-4379 — Étape 6
* Assigne un dossard à un participant à l'achat (pools epr_bib_auto = 1).
* Réutilise fxFindNextBatchBib / fxApplyBatchParticipantBib et la logique équipe du batch.
*/
function fxAssignAutoBibForParticipant($epr_id, $par_id) {
global $objDatabase;
$epr_id = intval($epr_id);
$par_id = intval($par_id);
if ($epr_id <= 0 || $par_id <= 0) {
return ['success' => false, 'message' => 'paramètres invalides'];
}
if (!fxIsBibAutoActive($epr_id)) {
return ['success' => false, 'skipped' => true, 'message' => 'auto inactif'];
}
$tabRanges = fxGetRangesForBatchAssign($epr_id, fxGetAutoBibRangeIds($epr_id));
if (empty($tabRanges)) {
return ['success' => false, 'message' => 'aucune plage auto'];
}
$p = fxLoadParticipantForAutoBib($epr_id, $par_id);
if (!$p) {
return ['success' => false, 'message' => 'participant introuvable'];
}
if (in_array((int)$p['rol_id'], [3, 4], true)) {
return ['success' => false, 'skipped' => true, 'message' => 'rôle exclu'];
}
$currentBib = trim((string)($p['no_bib'] ?? ''));
if ($currentBib !== '' && $currentBib !== '0') {
return [
'success' => true,
'skipped' => true,
'no_bib' => (int)$currentBib,
];
}
$sqlEpreuve = "
SELECT epr_equipe, epr_bib_team_mode
FROM inscriptions_epreuves
WHERE epr_id = $epr_id
LIMIT 1
";
$tabEpreuve = $objDatabase->fxGetRow($sqlEpreuve);
$isTeamEvent = $tabEpreuve && (int)$tabEpreuve['epr_equipe'] === 1;
$teamMode = (int)($tabEpreuve['epr_bib_team_mode'] ?? 1);
if ($teamMode <= 0) {
$teamMode = 1;
}
$teamKey = fxGetBatchTeamKey($p);
$foundBib = null;
$teamNumber = 0;
$usedBib = [];
if ($isTeamEvent && $teamMode === 3 && $teamKey > 0) {
$sqlTeamBib = "
SELECT no_bib
FROM resultats_participants
WHERE epr_id = $epr_id
AND pec_id = $teamKey
AND is_cancelled = 0
AND no_bib IS NOT NULL
AND no_bib <> ''
AND no_bib <> 0
AND par_id <> $par_id
LIMIT 1
";
$existingBib = (int)$objDatabase->fxGetVar($sqlTeamBib);
if ($existingBib > 0) {
$foundBib = $existingBib;
$teamNumber = $existingBib;
}
}
if ($foundBib === null) {
$findTeamMode = $isTeamEvent ? $teamMode : 1;
$foundBib = fxFindNextBatchBib($epr_id, $tabRanges, 'execute', $usedBib, $findTeamMode);
}
if ($foundBib === null) {
if (function_exists('fxcreer_log')) {
fxcreer_log('MSIN-4379: aucun dossard libre (epr_id=' . $epr_id . ', par_id=' . $par_id . ')');
}
return ['success' => false, 'message' => 'aucun dossard disponible'];
}
fxApplyBatchParticipantBib($epr_id, $par_id, $foundBib);
if ($isTeamEvent && $teamKey > 0) {
$updatedTeams = [];
if ($teamMode === 3) {
fxApplyBatchTeamNumber($epr_id, $teamKey, $foundBib, $updatedTeams);
} else {
$sqlEquipe = "
SELECT no_equipe
FROM resultats_epreuves_commandees
WHERE pec_id_original = $teamKey
AND epr_id = $epr_id
LIMIT 1
";
$teamNumber = (int)$objDatabase->fxGetVar($sqlEquipe);
if ($teamNumber <= 0) {
$sqlMaxTeam = "
SELECT MAX(CAST(no_equipe AS UNSIGNED))
FROM resultats_epreuves_commandees
WHERE epr_id = $epr_id
";
$teamNumber = (int)$objDatabase->fxGetVar($sqlMaxTeam) + 1;
}
fxApplyBatchTeamNumber($epr_id, $teamKey, $teamNumber, $updatedTeams);
}
}
return [
'success' => true,
'no_bib' => (int)$foundBib,
];
}
function fxInfosBibEpreuve($epr_id){
global $objDatabase;

View File

@ -7,7 +7,7 @@
* Constantes *
*
**************/
define('_VERSION_CODE', '4.72.60');
define('_VERSION_CODE', '4.72.61');
define('_DATE_CODE', '2026-06-02');
//MSIN-4290
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');

View File

@ -600,9 +600,9 @@ function fxrapportexcell_array($headers,$data,$memexcfichier,$memexctitre) {
}
function fxupload_excel_fnq($mem_fichier) {
/** Include PHPExcel */
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
$objReader = new PHPExcel_Reader_Excel2007();
$objReader->setReadDataOnly(false);