This commit refines the refund context handling by removing the unnecessary boolean parameter for Super Admin in the `fxRefundComputeContext` function, simplifying the logic. It ensures that refunds are consistently linked to the correct event context across various functions, enhancing authorization checks and calculations. The version code is incremented to 4.72.719 to reflect these changes.
755 lines
41 KiB
PHP
755 lines
41 KiB
PHP
|
|
<?php
|
|
require_once('php/inc_start_time.php');
|
|
|
|
$strLangue = 'fr';
|
|
$strPage = 'commandes.php';
|
|
|
|
if (isset($_GET['p']))
|
|
$p = $_GET['p'];
|
|
else
|
|
$p = 'list';
|
|
|
|
$strAction = $p;
|
|
|
|
if (isset($_POST['frm_action'])) {
|
|
switch ($_POST['frm_action']) {
|
|
case 'mod-commande';
|
|
require_once('php/inc_functions.php');
|
|
|
|
require_once('php/inc_fx_messages.php');
|
|
require_once('../php/inc_fx_modifierinscriptions.php');
|
|
include_once('php/inc_fx_commandes.php');
|
|
|
|
fxModCommande($_POST['ach_id']);
|
|
break;
|
|
case 'maj-commande';
|
|
include_once('../php/inc_fonctions.php');
|
|
include_once('../php/inc_fx_panier.php');
|
|
|
|
global $objDatabase;
|
|
|
|
// forcer le 'receipt_text'
|
|
$sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET pai_id = 5, receipt_text = 'APPROUVEE - MERCI', ach_error_log = 'Manuel via admin par " . $_SESSION['usa_info']['com_prenom'] . "' WHERE no_panier = '" . $_POST['no_panier'] . "'";
|
|
$qryUpdate = $objDatabase->fxQuery($sqlUpdate);
|
|
|
|
fxMajCommande($_POST['no_panier'], $_POST['lang']);
|
|
|
|
header('Location: ' . fxGetReferer());
|
|
exit;
|
|
break;
|
|
}
|
|
}
|
|
|
|
require_once('php/inc_functions.php');
|
|
|
|
require_once('php/inc_fx_messages.php');
|
|
include_once('php/inc_fx_commandes.php');
|
|
|
|
require_once('../php/inc_fx_memberships.php');
|
|
require_once('../php/inc_fx_code_qr.php');
|
|
require_once('../php/inc_fx_panier.php');
|
|
|
|
$vtexte_page = obtenirTextepage($strPage, $strLangue, 2);
|
|
// activer les erreurs
|
|
|
|
|
|
global $db;
|
|
|
|
if (!empty($_GET['pg']))
|
|
$page = $_GET['pg'];
|
|
else
|
|
$page = 1;
|
|
|
|
$nb = 100;
|
|
$start = $page * $nb - $nb;
|
|
|
|
include('inc_header.php');
|
|
|
|
|
|
?>
|
|
<div class="container-fluid" id="main">
|
|
<div class="row">
|
|
<div class="col-md-9 col-lg-10 order-first order-md-last">
|
|
<?php
|
|
$recCommandes = array();
|
|
|
|
switch ($p) {
|
|
case 'add':
|
|
case 'mod':
|
|
if ($p == 'mod') {
|
|
$sqlCommandes = "SELECT *, IF(a.com_id <> 0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s WHERE s.sta_id = a.sta_id AND a.ach_id = " . intval($_GET['ach_id']);
|
|
$recCommandes = $db->fxGetRow($sqlCommandes);
|
|
|
|
if ($recCommandes == null) {
|
|
header('Location: commandes.php');
|
|
exit;
|
|
}
|
|
}
|
|
|
|
$sqlStatuts = "SELECT sta_id, sta_nom_fr FROM inscriptions_panier_statuts WHERE sta_actif = 1 AND sta_id >= 1 ORDER BY sta_nom_fr";
|
|
$recStatuts = $db->fxGetResults($sqlStatuts);
|
|
|
|
$sqlProvinces = "SELECT pro_id, pro_nom_fr FROM inscriptions_provinces ORDER BY pro_nom_fr";
|
|
$recProvinces = $db->fxGetResults($sqlProvinces);
|
|
|
|
$sqlPays = "SELECT pay_id, pay_nom_fr FROM inscriptions_pays ORDER BY pay_nom_fr";
|
|
$recPays = $db->fxGetResults($sqlPays);
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
$().ready(function() {
|
|
$("#frm_commande").validate({
|
|
rules: {
|
|
com_prenom: "required",
|
|
com_nom: "required",
|
|
com_courriel: {
|
|
required: true,
|
|
email: true
|
|
},
|
|
com_adresse: "required",
|
|
com_ville: "required",
|
|
com_codepostal: "required",
|
|
com_telephone1: "required"
|
|
},
|
|
messages: {
|
|
com_prenom: "Veuillez entrer un prénom",
|
|
com_nom: "Veuillez entrer un nom de famille",
|
|
com_courriel: {
|
|
required: "Veuillez entrer un courriel",
|
|
email: "Le courriel doit être une adresse valide"
|
|
},
|
|
com_adresse: "Veuillez entrer une adresse",
|
|
com_ville: "Veuillez entrer une ville",
|
|
com_codepostal: "Veuillez entrer un code postal",
|
|
com_telephone1: "Veuillez entrer un numéro de téléphone"
|
|
}
|
|
});
|
|
|
|
$('#ach_date_statut_cal').datetimepicker({
|
|
format: 'YYYY-MM-DD',
|
|
locale: '<?php echo $strLangue; ?>-ca'
|
|
});
|
|
|
|
$('#btn_cancel_top, #btn_cancel_bot').click(function() {
|
|
document.location.href = 'commandes.php';
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<h1><?php if ($p == 'add') { ?>Ajouter<?php } else { ?>Modifier<?php } ?> une commande</h1>
|
|
<?php
|
|
|
|
|
|
if (isset($_SESSION['msg']) && $_SESSION['msg'] != 0)
|
|
echo fxMessage($_SESSION['msg'], $strLangue);
|
|
|
|
if ($recCommandes['sta_id'] == 3 && $recCommandes['no_commande'] == '') {
|
|
?>
|
|
<form action="commandes.php?p=mod&ach_id=<?php echo $_GET['ach_id']; ?>" method="post" name="statuts">
|
|
<input type="hidden" name="frm_action" value="maj-commande">
|
|
<input type="hidden" name="no_panier" value="<?php echo $recCommandes['no_panier']; ?>">
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="lang">Langue du courriel : </label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select id="lang" name="lang" class="form-control rounded-0">
|
|
<option value="en">Anglais</option>
|
|
<option value="fr" selected="selected">Français</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-sm-offset-3 col-sm-9 col-lg-7">
|
|
<button class="btn btn-danger rounded-0" type="submit" name="btn_statut">Marquer cette commande comme acceptée</button>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-sm-offset-3 col-sm-9 col-lg-7">
|
|
Ceci ajoutera un numéro de commande et enverra le détails de la commande au client par courriel.
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<?php
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
<form action="commandes.php?p=mod&ach_id=<?php echo $_GET['ach_id']; ?>" class="form-horizontal" method="post" id="frm_commande" name="frm_commande">
|
|
<div class="buttons">
|
|
<?php
|
|
if ($strAction == 'mod') {
|
|
?>
|
|
<button type="submit" class="btn btn-success rounded-0" id="btn_save_bot" name="btn_save_bot"><i class="fa fa-floppy-o" aria-hidden="true"></i> Enregistrer</button>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<button type="submit" class="btn btn-success rounded-0" id="btn_add_bot" name="btn_add_bot"><i class="fa fa-floppy-o" aria-hidden="true"></i> Ajouter</button>
|
|
<?php
|
|
}
|
|
?>
|
|
<a class="btn btn-danger rounded-0" href="commandes.php"><i class="fa fa-times" aria-hidden="true"></i> Annuler</a>
|
|
</div>
|
|
<div class="clearer"><span></span></div>
|
|
<br />
|
|
<?php
|
|
if ($p == 'mod') {
|
|
?>
|
|
<input type="hidden" name="ach_id" value="<?php echo $_GET['ach_id']; ?>">
|
|
<?php
|
|
}
|
|
?>
|
|
<fieldset>
|
|
<input type="hidden" name="frm_action" value="mod-commande">
|
|
<legend>Détails de la commande</legend>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_prenom">Prénom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_prenom" name="com_prenom" value="<?php echo fxUnescape($recCommandes["com_prenom"]); ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_nom">Nom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_nom" name="com_nom" value="<?php echo fxUnescape($recCommandes["com_nom"]); ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_courriel">Courriel :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_courriel" name="com_courriel" value="<?php echo fxUnescape($recCommandes["com_courriel"]); ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_telephone1">Téléphone :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_telephone1" name="com_telephone1" value="<?php echo fxUnescape($recCommandes["com_telephone1"]); ?>" size="20" maxlength="20" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_telephone2">Cellulaire :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_telephone2" name="com_telephone2" value="<?php echo fxUnescape($recCommandes["com_telephone2"]); ?>" size="20" maxlength="20" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_adresse">Adresse :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_adresse" name="com_adresse" value="<?php echo fxUnescape($recCommandes["com_adresse"]); ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_ville">Ville :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_ville" name="com_ville" value="<?php echo fxUnescape($recCommandes["com_ville"]); ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="pro_id">Province :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select id="pro_id" name="pro_id" class="form-control rounded-0">
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recProvinces); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo $recProvinces[$intCtr]['pro_id']; ?>" <?php if ($recProvinces[$intCtr]['pro_id'] == $recCommandes['pro_id']) { ?>selected<?php } ?>><?php echo $recProvinces[$intCtr]['pro_nom_fr']; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="pay_id">Pays :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select id="pay_id" name="pay_id" class="form-control rounded-0">
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recPays); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo $recPays[$intCtr]['pay_id']; ?>" <?php if ($recPays[$intCtr]['pay_id'] == $recCommandes['pay_id']) { ?>selected<?php } ?>><?php echo $recPays[$intCtr]['pay_nom_fr']; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="com_codepostal">Code postal :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="com_codepostal" name="com_codepostal" value="<?php echo fxUnescape($recCommandes["com_codepostal"]); ?>" size="20" maxlength="10" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="sta_id">Statut de la commande :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="hidden" name="sta_id_old" value="<?php echo $recCommandes['sta_id']; ?>">
|
|
<?php
|
|
if ($recCommandes['sta_id'] < 0) {
|
|
?>
|
|
<input type="hidden" name="sta_id" value="<?php echo $recCommandes['sta_id']; ?>">
|
|
<?php
|
|
echo $recCommandes['sta_nom_fr'];
|
|
} else {
|
|
?>
|
|
<select id="sta_id" name="sta_id" class="form-control rounded-0">
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recStatuts); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo $recStatuts[$intCtr]['sta_id']; ?>" <?php if ($recStatuts[$intCtr]['sta_id'] == $recCommandes['sta_id']) { ?>selected<?php } ?>><?php echo $recStatuts[$intCtr]['sta_nom_fr']; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3">Statut changé le...</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<p><?php if ($recCommandes['ach_date_statut'] != '') { echo fxShowDate($recCommandes['ach_date_statut'], 'fr') . ' @ ' . fxShowTime($recCommandes['ach_date_statut']); } else { ?>Jamais<?php } ?></p>
|
|
<br>
|
|
<?php
|
|
/*if ($recCommandes['ach_date_statut'] != '') {
|
|
?>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-12" for="ach_date_statut">Modifier cette date :</label>
|
|
<div class="col-12">
|
|
<div class="input-group" id='ach_date_statut_cal' data-target-input="nearest">
|
|
<input type="hidden" name="ach_date_statut_old" value="<?php echo date('Y-m-d', strtotime($recCommandes['ach_date_statut'])); ?>">
|
|
<input class="form-control rounded-0" type="text" id="ach_date_statut" name="ach_date_statut" maxlength="10" value="<?php echo date('Y-m-d', strtotime($recCommandes['ach_date_statut'])); ?>">
|
|
<div class="input-group-append rounded-0" data-target="#ach_date_statut_cal" data-toggle="datetimepicker">
|
|
<span class="input-group-text rounded-0">
|
|
<i class="fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}*/
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3">Adresse ip:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<p><?php echo $recCommandes['ach_ip']; ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3">Log:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<p><span></span></p>
|
|
<br>
|
|
<div>
|
|
<pre>
|
|
<?php echo $recCommandes['ach_error_log']; ?>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3">Compte client utilisé:</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<p>
|
|
<?php
|
|
if (intval($recCommandes['com_id']) > 0) {
|
|
?>
|
|
<a href="index.php?t=Mg%3D%3D&a=mod&id=<?php echo fxUnescape($recCommandes['com_id']); ?>">
|
|
<?php echo fxUnescape($recCommandes['usager']); ?>
|
|
</a>
|
|
<?php
|
|
}
|
|
?>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</form>
|
|
<p> </p>
|
|
|
|
<h3><img src="images_blue/ico_commandes_big.png" alt="">Détails de la commande</h3>
|
|
<?php
|
|
|
|
echo fxShowPanier($recCommandes['no_panier'], 0, 'web', 1, 'fr');
|
|
|
|
|
|
?>
|
|
|
|
<p> </p>
|
|
<h3><img src="images_blue/ico_commandes_big.png" alt="">PAYPAL</h3>
|
|
|
|
<?php
|
|
|
|
// ************************************************ rembourcement
|
|
|
|
/****************************************************
|
|
* Page: remboursement.php
|
|
* Rôle : affiche le formulaire de remboursement + prépare
|
|
* les variables serveur nécessaires au front (AJAX).
|
|
****************************************************/
|
|
|
|
// Démarrer la session
|
|
if (session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
|
|
require_once $_SERVER["DOCUMENT_ROOT"] . "/superadm/php/inc_fx_paypal.php";
|
|
// Jeton anti double clic / re-soumission
|
|
$refundToken = fxRefundEnsureToken();
|
|
|
|
// Récupération des infos commande (présentes dans ton contexte)
|
|
$CAPTURE_ID = $recCommandes["TransactionID"] ?? null;
|
|
|
|
if (!isset($CAPTURE_ID) || !is_string($CAPTURE_ID) || $CAPTURE_ID === '') {
|
|
//echo '<div style="background:#feecec;border:1px solid #f2b8b5;padding:10px;border-radius:8px;">
|
|
// ⚠️ CAPTURE_ID non fourni côté serveur.
|
|
// </div>';
|
|
return;
|
|
}
|
|
|
|
// Contexte de remboursement mutualisé (calculs + détails PayPal)
|
|
$refundCtx = fxRefundComputeContext($recCommandes, intval($recCommandes['eve_id'] ?? 0));
|
|
$paypaldetails = $refundCtx['paypaldetails'];
|
|
|
|
// Auteur du remboursement (Super Admin connecté) : alimente l'encart "Ajouté par".
|
|
// Côté promoteur, l'appelant fournira plutôt $_SESSION["com_info"].
|
|
$refundAuteur = trim(($_SESSION["usa_info"]["com_prenom"] ?? '') . ' ' . ($_SESSION["usa_info"]["com_nom"] ?? ''));
|
|
|
|
// Formulaire de remboursement (rendu mutualisé : voir inc_fx_paypal.php).
|
|
// L'ancien bloc de debug echosl() (n° commande, ajouté par, max...) est désormais
|
|
// intégré proprement dans l'encart d'infos du formulaire mutualisé.
|
|
echo fxRenderRefundForm($recCommandes, $refundToken, $refundCtx, $vDomaine, $refundAuteur);
|
|
?>
|
|
|
|
|
|
|
|
|
|
<h3><img src="images_blue/ico_commandes_big.png" alt="">Détails PAYPAL</h3>
|
|
|
|
<?php
|
|
|
|
|
|
// $sortie=paypaldetails($recCommandes["TransactionID"]);
|
|
|
|
|
|
echo(renderPayPalCaptureHtml($paypaldetails));
|
|
|
|
|
|
|
|
|
|
break;
|
|
case 'list';
|
|
default:
|
|
// afficher pagination
|
|
$tabQuery = $_GET;
|
|
unset($tabQuery['pg']);
|
|
$strQueryPager = http_build_query($tabQuery, '', '&');
|
|
$limit = " LIMIT $start, $nb";
|
|
$where = '';
|
|
$group = 0;
|
|
|
|
if (!empty($_GET['w'])) {
|
|
$where .= " AND a.sta_id = " . intval($_GET['w']);
|
|
}
|
|
if (!empty($_GET['eve_id'])) {
|
|
$where .= " AND a.eve_id = " . intval($_GET['eve_id']);
|
|
}
|
|
if (isset($_GET['btn_search'])) {
|
|
$group = 1;
|
|
}
|
|
if (!empty($_GET['TrasactionID'])) {
|
|
$where .= " AND a.trx_id LIKE '%" . $db->fxEscape($_GET['TrasactionID']) . "%'";
|
|
}
|
|
if (!empty($_GET['txt_commande'])) {
|
|
$where .= " AND a.no_commande LIKE '%" . $db->fxEscape($_GET['txt_commande']) . "%'";
|
|
$group = 0;
|
|
}
|
|
if (!empty($_GET['txt_no_panier'])) {
|
|
$where .= " AND a.no_panier LIKE '%" . $db->fxEscape($_GET['txt_no_panier']) . "%'";
|
|
$group = 0;
|
|
}
|
|
|
|
if (!empty($_GET['txt_prenom'])) {
|
|
$where .= " AND a.com_prenom LIKE '%" . $db->fxEscape($_GET['txt_prenom']) . "%'";
|
|
}
|
|
if (!empty($_GET['txt_nom'])) {
|
|
$where .= " AND a.com_nom LIKE '%" . $db->fxEscape($_GET['txt_nom']) . "%'";
|
|
}
|
|
if (!empty($_GET['txt_courriel'])) {
|
|
$where .= " AND a.com_courriel LIKE '%" . $db->fxEscape($_GET['txt_courriel']) . "%'";
|
|
}
|
|
if (!empty($_GET['TransactionID'])) {
|
|
$where .= " AND a.TransactionID LIKE '%" . $db->fxEscape($_GET['TransactionID']) . "%'";
|
|
}
|
|
|
|
if ($group == 1){
|
|
//$group = " GROUP BY a.no_commande";
|
|
$group = '';}
|
|
else{
|
|
$group = '';}
|
|
|
|
$sqlCommandes = "SELECT SQL_CALC_FOUND_ROWS (SELECT e.eve_nom_fr FROM inscriptions_evenements e WHERE e.eve_id = a.eve_id) AS evenement,a.ach_id, a.no_commande, a.TransactionID, a.com_prenom, a.com_nom, a.com_courriel, a.no_panier, a.ach_maj, s.sta_id, s.sta_nom_fr, a.ach_total, a.pai_id, a.ach_lang, a.com_id, IF(a.com_id <> 0, (SELECT c.com_login FROM inscriptions_comptes c WHERE a.com_id = c.com_id), '') AS usager,a.paypal_source,a.paypal_card_brand,a.paypal_card_last_digits FROM inscriptions_panier_acheteurs a, inscriptions_panier_statuts s WHERE s.sta_id = a.sta_id $where $group ORDER BY a.ach_maj DESC, a.no_commande DESC";
|
|
$sqlCommandes .= $limit;
|
|
|
|
|
|
$recCommandes = $db->fxGetResults($sqlCommandes);
|
|
|
|
|
|
$nbTotal = $db->fxGetVar("SELECT FOUND_ROWS()");
|
|
//$nbTotal = 10000;
|
|
|
|
$sqlStatuts = "SELECT sta_id, sta_nom_fr FROM inscriptions_panier_statuts WHERE sta_actif = 1 ORDER BY sta_nom_fr";
|
|
$recStatuts = $db->fxGetResults($sqlStatuts);
|
|
|
|
$sqlEvenements = "SELECT eve_id, eve_nom_fr FROM inscriptions_evenements WHERE DATE_SUB(CURDATE(),INTERVAL 3 MONTH) <= eve_date_fin ORDER BY eve_nom_fr";
|
|
$recEvenements = $db->fxGetResults($sqlEvenements);
|
|
?>
|
|
<h1>Liste des commandes</h1>
|
|
<?php
|
|
/*if (isset($_SESSION['msg']) && $_SESSION['msg'] != 0)
|
|
echo fxMessage($_SESSION['msg'], $strLangue);*/
|
|
?>
|
|
<ul class="nav nav-pills">
|
|
<?php
|
|
unset($tabQuery['w']);
|
|
$strQuery = http_build_query($tabQuery, '', '&');
|
|
for ($intCtr = 1; $intCtr <= count($recStatuts); $intCtr++) {
|
|
?>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link<?php if (isset($_GET['w']) && $recStatuts[$intCtr]['sta_id'] == $_GET['w']) { ?> active<?php } ?>" href="commandes.php?<?php echo $strQuery; ?>&w=<?php echo $recStatuts[$intCtr]['sta_id']; ?>"><?php echo $recStatuts[$intCtr]['sta_nom_fr']; ?></a>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link<?php if (empty($_GET['w'])) { ?> active<?php } ?>" href="commandes.php?<?php echo $strQuery; ?>">Toutes les commandes</a>
|
|
</li>
|
|
</ul>
|
|
<br>
|
|
<div id="recherche">
|
|
<form action="commandes.php?<?php echo $strQuery; ?>" class="form-horizontal" method="get" id="frm_search" name="frm_search">
|
|
<fieldset>
|
|
<legend>Rechercher une commande</legend>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="TransactionID">TransactionID (PayPal) :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="TransactionID" name="TransactionID" value="<?php if (isset($_GET['TransactionID'])) { echo $_GET['TransactionID']; } ?>" size="10" maxlength="20" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="form-label col-sm-3" for="txt_commande">No commande :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="txt_commande" name="txt_commande" value="<?php if (isset($_GET['txt_commande'])) { echo $_GET['txt_commande']; } ?>" size="10" maxlength="20" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="form-label col-sm-3" for="txt_no_panier">No panier :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="txt_no_panier" name="txt_no_panier" value="<?php if (isset($_GET['txt_no_panier'])) { echo $_GET['txt_no_panier']; } ?>" size="10" maxlength="20" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="txt_prenom">Prénom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="txt_prenom" name="txt_prenom" value="<?php if (isset($_GET['txt_prenom'])) { echo $_GET['txt_prenom']; } ?>" size="30" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">*
|
|
<label class="col-form-label col-sm-3" for="txt_nom">Nom :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input type="text" id="txt_nom" name="txt_nom" value="<?php if (isset($_GET['txt_nom'])) { echo $_GET['txt_nom']; } ?>" size="30" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="txt_courriel">Courriel :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<input tye="text" id="txt_courriel" name="txt_courriel" value="<?php if (isset($_GET['txt_courriel'])) { echo $_GET['txt_courriel']; } ?>" size="40" maxlength="50" class="form-control rounded-0">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-3" for="eve_id">Événement :</label>
|
|
<div class="col-sm-9 col-lg-7">
|
|
<select id="eve_id" name="eve_id" class="form-control rounded-0">
|
|
<option value=""<?php if ((isset($_GET['btn_search']) && $_GET['eve_id'] == '') || !isset($_GET['btn_search'])) { ?> selected="selected"<?php } ?>>Tous les événements</option>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($recEvenements); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo fxUnescape($recEvenements[$intCtr]['eve_id']); ?>"<?php if (isset($_GET['btn_search']) && isset($_GET['eve_id']) && $_GET['eve_id'] === $recEvenements[$intCtr]['eve_id']) { ?> selected="selected"<?php } ?>><?php echo fxUnescape($recEvenements[$intCtr]['eve_nom_fr']); ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-sm-9 col-lg-7 offset-sm-3">
|
|
<button class="btn btn-primary rounded-0" type="submit" id="btn_search" name="btn_search"><i class="fa fa-search" aria-hidden="true"></i> Rechercher</button>
|
|
<?php
|
|
if (isset($_GET['btn_psearch']) || isset($_GET['w'])) {
|
|
?>
|
|
<a class="btn btn-danger rounded-0" href="commandes.php?p=list"><i class="fa fa-times" aria-hidden="true"></i> <?php if ($strLangue == 'fr') { ?>Effacer rechercher<?php } else { ?>Remove search<?php } ?></a>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<?php
|
|
if (count((array)$recCommandes) > 0) {
|
|
?>
|
|
<thead>
|
|
<tr>
|
|
<th style="text-align: center;">#</th>
|
|
<th style="text-align: left;">No commande</th>
|
|
<th style="text-align: left;">No panier</th>
|
|
<th style="text-align: left;">Nom, Prénom</th>
|
|
<th style="text-align: left;">Statut</th>
|
|
<th style="text-align: left;">TransactionID</th>
|
|
<th style="text-align: left;">Date de création</th>
|
|
<th style="text-align: left;">courriel</th>
|
|
<th style="text-align: right;">total</th>
|
|
<th> </th>
|
|
<th style="text-align: left;">usager</th>
|
|
<th style="text-align: left;">paiement</th>
|
|
<th> </th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count((array)$recCommandes); $intCtr++) {
|
|
?>
|
|
<tr <?php if ($intCtr % 2) { ?>class="ligne_paire"<?php } ?>>
|
|
<td style="text-align: center;"><?php echo $intCtr + $start; ?></td>
|
|
<td style="text-align: left;"><a href="commandes.php?p=mod&ach_id=<?php echo $recCommandes[$intCtr]['ach_id']; ?>"><?php echo $recCommandes[$intCtr]['no_commande']; ?></a></td>
|
|
<td style="text-align: left;"><a href="commandes.php?p=mod&ach_id=<?php echo $recCommandes[$intCtr]['ach_id']; ?>"><?php echo $recCommandes[$intCtr]['no_panier']; ?></a></td>
|
|
<td style="text-align: left;"><?php echo fxUnescape($recCommandes[$intCtr]['com_nom']) . ', ' . fxUnescape($recCommandes[$intCtr]['com_prenom']); ?></td>
|
|
<td style="text-align: center;">
|
|
<div id="statut_<?php echo fxUnescape($recCommandes[$intCtr]['ach_id']); ?>">
|
|
<div>
|
|
<?php echo fxUnescape($recCommandes[$intCtr]['sta_nom_fr']); ?>
|
|
</div>
|
|
<?php
|
|
if (intval($recCommandes[$intCtr]['sta_id']) == 3) {
|
|
?>
|
|
<button class="btn btn-danger rounded-0 btn_update_statut" data-ach_id="<?php echo fxUnescape($recCommandes[$intCtr]['ach_id']); ?>" type="button"><i class="fa fa-times-circle mr-2" aria-hidden="true" data-toggle="tooltip" title="Annuler/Rembourser"></i>A/R</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</td>
|
|
<td style="text-align: left;"><?php echo fxUnescape($recCommandes[$intCtr]['TransactionID']); ?></td>
|
|
<td style="text-align: left;"><?php echo fxShowDate($recCommandes[$intCtr]['ach_maj'], 'fr') . ' @ ' . fxShowTime($recCommandes[$intCtr]['ach_maj']); ?></td>
|
|
<td style="text-align: left;"><?php echo fxUnescape($recCommandes[$intCtr]['com_courriel']); ?></td>
|
|
<td style="text-align: right;">
|
|
<?php
|
|
if ($recCommandes[$intCtr]['pai_id'] < 6) {
|
|
echo fxShowPrix($recCommandes[$intCtr]['ach_total'], 'fr', 1);
|
|
} else {
|
|
echo fxShowPrix(0, 'fr', 1);
|
|
}
|
|
?>
|
|
</td>
|
|
<td style="text-align: left;"><?php echo fxUnescape($recCommandes[$intCtr]['evenement']); ?></td>
|
|
<td style="text-align: left;">
|
|
<?php
|
|
if (intval($recCommandes[$intCtr]['com_id']) > 0) {
|
|
?>
|
|
<a href="index.php?t=Mg%3D%3D&a=mod&id=<?php echo fxUnescape($recCommandes[$intCtr]['com_id']); ?>">
|
|
<?php echo fxUnescape($recCommandes[$intCtr]['usager']); ?>
|
|
</a>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<td style="text-align: center;"><?php echo $recCommandes[$intCtr]['paypal_source']." ".$recCommandes[$intCtr]['paypal_card_brand']." ".$recCommandes[$intCtr]['paypal_card_last_digits'];?>
|
|
</td>
|
|
<td style="text-align: center;"><?php if ($recCommandes[$intCtr]['sta_id'] > 1) { ?><a href="../facture.php?no_panier=<?php echo $recCommandes[$intCtr]['no_panier']; ?>" target="_blank">facture</a><?php } else { ?> <?php } ?></td>
|
|
<td style="text-align: center;">
|
|
<?php
|
|
if ($recCommandes[$intCtr]['sta_id'] == 3) {
|
|
?>
|
|
<a class="btn btn-secondary link_confirmation" href="#" data-no_panier="<?php echo $recCommandes[$intCtr]['no_panier']; ?>" data-no_commande="<?php echo $recCommandes[$intCtr]['no_commande']; ?>" data-lng="<?php echo $recCommandes[$intCtr]['ach_lang']; ?>">renvoyer confirmation</a>
|
|
<?php
|
|
} else {
|
|
?>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
<?php /* <tr>
|
|
<th colspan="5"><?php if ($page != 1) { ?><a href="?page=<?php echo $page - 1; ?>">« précédent</a><?php } ?></th>
|
|
<th> </th>
|
|
<th colspan="6" style="text-align: right;"><a href="?page=<?php echo $page + 1; ?>">suivant »</a></th>
|
|
</tr>
|
|
<?php */
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<td style="text-align: center;">
|
|
<p> </p>
|
|
<strong>Il n'y a aucune commande pour le moment.</strong>
|
|
<p> </p>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
<p> </p>
|
|
<?php
|
|
if (count((array)$recCommandes) > 0) {
|
|
echo fxShowPaging('commandes.php?' . $strQueryPager, $nbTotal, $nb, $page);
|
|
}
|
|
}
|
|
?>
|
|
<p> </p>
|
|
</div>
|
|
<?php require_once('inc_droite.php'); ?>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$('body').on("click", ".link_confirmation", function() {
|
|
var $no_panier = $(this).data('no_panier');
|
|
var $no_commande = $(this).data('no_commande');
|
|
var $lng = $(this).data('lng');
|
|
|
|
bootbox.dialog({
|
|
message: "Êtes-vous certain de vouloir envoyer la confirmation de la commande " + $no_commande +"?",
|
|
title: "Question",
|
|
buttons: {
|
|
success: {
|
|
label: "Oui",
|
|
className: "btn-success",
|
|
callback: function() {
|
|
$.post('<?php echo $vDomaine; ?>/ajax_confirmation.php', 'no_panier=' + $no_panier + '&lng=' + $lng, function ($result) {
|
|
alert($result.state);
|
|
}, 'json');
|
|
}
|
|
},
|
|
danger: {
|
|
label: "Non",
|
|
className: "btn-danger"
|
|
}
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
</script>
|
|
<?php require_once('inc_footer.php');
|