fxEscape($strNoPanier) . "')";
$arrDonation = $objDatabase->fxGetRow($sqlDonation);
if ($arrDonation != null && $arrDonation['eve_id_don'] > 0) { // si événement de donation, vérifier si le panier est concerné
$sqlEpreuvePanier = "SELECT * FROM inscriptions_epreuves WHERE epr_id IN(SELECT epr_id FROM inscriptions_panier_epreuves_commandees WHERE no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "') AND epr_id_don <> 0";
$arrEpreuvePanier = $objDatabase->fxGetResultsKey($sqlEpreuvePanier);
if ($arrEpreuvePanier != null) {
$sqlInfoPanier = "SELECT * FROM inscriptions_panier_epreuves_commandees e, inscriptions_panier_participants p WHERE e.pec_id = p.pec_id AND e.no_panier = '" . $objDatabase->fxEscape($strNoPanier) . "' AND e.epr_id IN(" . implode(',', array_keys($arrEpreuvePanier)) . ") ORDER BY e.pec_id, p.par_id";
$arrInfoPanier = $objDatabase->fxGetResults($sqlInfoPanier);
if ($arrInfoPanier != null) {
for ($intCtr = 1; $intCtr <= count($arrInfoPanier); $intCtr++) {
$strLink = '/' . fxUnescape($arrDonation['eve_label_url']) . '/';
if ($arrInfoPanier[$intCtr]['pec_equipe'] == 1) {
if (intval($arrDonation['eve_id']) != 646) { // patch pour défi 808 2021
$arrOutput['equipe'][$arrInfoPanier[$intCtr]['pec_id']] = array(
'link' => $strLink . md5($arrInfoPanier[$intCtr]['pec_id']),
'label' => afficheTexte('don_facture_team', 0, 0, 1) . ' ' . fxUnescape($arrInfoPanier[$intCtr]['pec_nom_equipe']),
'race' => $arrEpreuvePanier[$arrInfoPanier[$intCtr]['epr_id']]
);
}
}
$arrOutput['participant'][$arrInfoPanier[$intCtr]['par_id']] = array(
'link' => $strLink . md5($arrInfoPanier[$intCtr]['pec_id']) . '/' . md5($arrInfoPanier[$intCtr]['par_id']),
'label' => afficheTexte('don_facture_participant', 0, 0, 1) . ' ' . fxUnescape($arrInfoPanier[$intCtr]['par_nom']) . ', ' . fxUnescape($arrInfoPanier[$intCtr]['par_prenom']),
'race' => $arrEpreuvePanier[$arrInfoPanier[$intCtr]['epr_id']]
);
}
}
}
}
}
return $arrOutput;
}
/**
* doner le lien donnation (liste des personnes inscrites)
* @author Stéphan Leith, Jean-Sébastien Proulx
* @version 1.0
* @param integer $mem_pec_id
* @param integer $mem_par_id
* @param string $strLangue Langue d'affichage
* @return array
*/
function fxGetLinksDonationParticipant($mem_pec_id, $mem_par_id, $strLangue) { #MSIN-2002
global $tabEvenement;
$strParticipant = '';
if ($strLangue == 'fr') {
$strPage = 'don';
$strLabel = "Faire un don";
} else {
$strPage = 'donate';
$strLabel = "Donate";
}
if (intval($mem_par_id) > 0) {
$strParticipant = '/' . md5($mem_par_id);
}
$strLink = $strPage . '/' . fxUnescape($tabEvenement['general']['eve_label_url']) . '/';
$arrOutput = array(
'link' => $strLink . md5($mem_pec_id) . $strParticipant,
'label' => $strLabel
);
return $arrOutput;
}
/**
* Affiche les liens de donation
* @author Jean-Sébastien Proulx
* @version 1.0
* @param string $strType Type d'affichage: web ou mail
* @param array $arrLinksDonation Tableau des liens issue de fxGetLinksDonation()
* @param string $strLangue Langue d'affichage
* @return string
*/
function fxShowLinksDonation($strType, $arrLinksDonation, $strLangue, $strColor) {
global $vDomaine,$vtexte_page;
$strOutput = '';
$vPage='panier.php';
$vtexte_page = obtenirTextepage( $vPage, $strLangue, 2,1);
if ($strLangue == 'fr') {
$strPage = 'don';
$strLabel = "Faire un don";
} else {
$strPage = 'donate';
$strLabel = "Donate";
}
$strLink = $vDomaine . '/' . $strPage;
if ($arrLinksDonation != null) {
$strOutput .= '
| ' . afficheTexte('don_facture_header', 0, 0, 1) . ' |
|---|
|
' . afficheTexte('don_facture_texte', 0, 0, 1) . ' '; foreach ($arrLinksDonation as $arrLinks) { foreach ($arrLinks as $arrData) { switch ($strType) { case 'mail': $strOutput .= '' . $strLabel . ' ' . $arrData['label'] . ' '; break; case 'web': default: $strOutput .= '' . $strLabel . ' ' . $arrData['label'] . ' '; break; } } } $strOutput .= ' |
| ' . afficheTexte('objectif_dons_equipe', 0) . ' | ' . afficheTexte('objectif_dons_montant_actuel', 0) . ' | ' . afficheTexte('objectif_dons_montant_original', 0) . ' |
|---|---|---|
| ' . fxUnescape($recEpreuvesCommandees['pec_nom_equipe']) . ' | ' . fxShowPrix($recEpreuvesCommandees['epr_objectif_dons_original'], $strLangue) . ' |
| ' . afficheTexte('objectif_dons_participant', 0) . ' | ' . afficheTexte('objectif_dons_montant_actuel', 0) . ' | ' . afficheTexte('objectif_dons_montant_original', 0) . ' |
|---|---|---|
| ' . fxUnescape($arrEpreuvesParticipants[$intCtr3]['par_nom']) . ', ' . fxUnescape($arrEpreuvesParticipants[$intCtr3]['par_prenom']) . ' | ' . fxShowPrix($arrEpreuvesParticipants[$intCtr3]['epr_objectif_dons_original'], $strLangue) . ' |
Montant: ' . fxShowPrix($arrDon[1]['pd_montant'], $strLangue) . '
'; $strDetails .= 'Date: ' . fxShowDate($arrAcheteur['ach_maj'], $strLangue) . '
'; $strDetails .= 'Donateur: ' . $from_name . '
'; $strDetails .= 'Courriel: ' . $from_mail . '
'; $attachment_label = 'Accéder à la page de don'; $attachment_url = $vDomaine . '/don/' . $arrEvenement['eve_label_url'] . '/' . md5($arrDon[1]['pec_id']) . '/' . md5($arrDon[1]['par_id']); } else { $subject = 'You have received a new donation for ' . fxUnescape($arrEvenement['eve_nom_en']); $strDetails .= 'Amount: ' . fxShowPrix($arrDon[1]['pd_montant'], $strLangue) . '
'; $strDetails .= 'Date: ' . fxShowDate($arrAcheteur['ach_maj'], $strLangue) . '
'; $strDetails .= 'Donor: ' . $from_name . '
'; $strDetails .= 'Email: ' . $from_mail . '
'; $attachment_label = 'Access the donation page'; $attachment_url = $vDomaine . '/donate/' . $arrEvenement['eve_label_url'] . '/' . md5($arrDon[1]['pec_id']) . '/' . md5($arrDon[1]['par_id']); } } else { $strDetails = fxUnescape($arrEvenementDon['eve_courriel_don_equipe_' . $strLangue], 1); if ($strLangue == 'fr') { $subject = 'Votre équipe a reçu un nouveau don pour ' . fxUnescape($arrEvenement['eve_nom_fr']); $strDetails .= 'Équipe: ' . fxUnescape($arrReceveur['par_nom_equipe']) . '
'; $strDetails .= 'Montant: ' . fxShowPrix($arrDon[1]['pd_montant'], $strLangue) . '
'; $strDetails .= 'Date: ' . fxShowDate($arrAcheteur['ach_maj'], $strLangue) . '
'; $strDetails .= 'Donateur: ' . $from_name . '
'; $strDetails .= 'Courriel: ' . $from_mail . '
'; $attachment_label = 'Accéder à la page de don'; $attachment_url = $vDomaine . '/don/' . $arrEvenement['eve_label_url'] . '/' . md5($arrDon[1]['pec_id']); } else { $subject = 'Your team has received a new donation for ' . fxUnescape($arrEvenement['eve_nom_en']); $strDetails .= 'Team: ' . fxUnescape($arrReceveur['par_nom_equipe']) . '
'; $strDetails .= 'Amount: ' . fxShowPrix($arrDon[1]['pd_montant'], $strLangue) . '
'; $strDetails .= 'Date: ' . fxShowDate($arrAcheteur['ach_maj'], $strLangue) . '
'; $strDetails .= 'Donor: ' . $from_name . '
'; $strDetails .= 'Email: ' . $from_mail . '
'; $attachment_label = 'Access the donation page'; $attachment_url = $vDomaine . '/donate/' . $arrEvenement['eve_label_url'] . '/' . md5($arrDon[1]['pec_id']); } } // Confirmation commande NEW - BEGIN $body = fxGetMailFormat(true, true, true, false, $strLangue); $body = str_replace('%nom_evenement%', fxUnescape($arrEvenement['eve_nom_' . $strLangue]), $body); $body = str_replace('%logo_evenement%', $vDomaine . $vRepertoireFichiers . '/images/evenements/' . $arrEvenement['eve_logo_facture_' . $strLangue], $body); $body = str_replace('%web_evenement%', '' . $arrEvenement['eve_siteweb'] . '', $body); $body = str_replace('%contact_evenement%', '' . $arrEvenement['eve_contact'] . '', $body); $body = str_replace('%attachment_url%', $attachment_url, $body); $body = str_replace('%attachment_label%', $attachment_label, $body); $body = str_replace('%to_mail%', $to_mail, $body); $body = str_replace('%subject%', $subject, $body); $body = str_replace('%message%', $strDetails, $body); // Confirmation commande NEW - END fxSendMail($subject, $body, $to_mail, $to_name, $from_mail, $from_name, true, 1, 0); return true; } /** * Récupère les infos du receveur de don d'une épreuve donnée * @author Jean-Sébastien Proulx * @version 1.0 * @param integer $intEpreuveCommandee id de l'épreuve commandée * @param integer $intParticipant id du participant * @return null or array */ function fxGetReceveur($intEpreuveCommandee = 0, $intParticipant = 0) { global $objDatabase; $arrOutput = null; if ($intParticipant != 0) { $sqlReceveur = "SELECT par_nom, par_prenom, par_courriel, eve_id, pec_id FROM resultats_participants WHERE pec_id = " . intval($intEpreuveCommandee) . " AND par_id_original = " . intval($intParticipant); } else { $sqlReceveur = "SELECT par_nom, par_prenom, par_courriel, eve_id, pec_id, par_nom_equipe FROM resultats_participants WHERE rol_id = 1 AND pec_id = " . intval($intEpreuveCommandee); } $arrOutput = $objDatabase->fxGetRow($sqlReceveur); return $arrOutput; } function fxGetParticipantSolo($intEpreuveCommandee) { global $objDatabase; $intParticipant = ''; $sqlEpreuvesParticipants = "SELECT * FROM resultats_participants WHERE is_cancelled = 0 AND MD5(pec_id) = '" . $intEpreuveCommandee . "'"; $arrEpreuvesParticipants = $objDatabase->fxGetResults($sqlEpreuvesParticipants); if ($arrEpreuvesParticipants != null && count($arrEpreuvesParticipants) == 1) { $intParticipant = md5($arrEpreuvesParticipants[1]['par_id_original']); } return $intParticipant; }