function port($type = 0, $_pays = false, $_cpostal = "") { if ($_SESSION['navig']->commande->transport == "" && !$type) { return -1; } if ($_SESSION['navig']->adresse != 0) { $chadr = 1; } else { $chadr = 0; } $modules = new Modules(); if (!$type) { $modules->charger_id($_SESSION['navig']->commande->transport); } else { $modules->charger_id($type); } if ($modules->type != Modules::TRANSPORT || !$modules->actif) { return -1; } $p = new Pays(); if ($chadr) { $adr = new adresse(); $adr->charger($_SESSION['navig']->adresse); $p->charger($adr->pays); $cpostal = $adr->cpostal; } else { $p->charger($_SESSION['navig']->client->pays); $cpostal = $_SESSION['navig']->client->cpostal; } // Prise en compte des infos passée, si aucune des infos précédentes n'est pertinente. if (empty($p->id) && $_pays) { $p->charger($_pays); } if (empty($cpostal) && $_cpostal != "") { $cpostal = $_cpostal; } $zone = new Zone(); $zone->charger($p->zone); try { $port = ActionsModules::instance()->instancier($modules->nom); $port->nbart = $_SESSION['navig']->panier->nbart(); $port->poids = $_SESSION['navig']->panier->poids(); $port->total = $_SESSION['navig']->panier->total(); $port->zone = $p->zone; $port->pays = $p->id; $port->unitetr = $zone->unite; $port->cpostal = $cpostal; $frais = $port->calcule(); ActionsModules::instance()->appel_module("port", $frais); return $frais; } catch (exception $e) { return -1; } }
// Compatibilité 1.4 -> On utilise le modèle PDF si il existe if (file_exists(__DIR__ . '/modeles/facture.php')) { include_once __DIR__ . "/../../classes/Commande.class.php"; include_once __DIR__ . "/../../classes/Client.class.php"; include_once __DIR__ . "/../../classes/Venteprod.class.php"; include_once __DIR__ . "/../../classes/Produit.class.php"; include_once __DIR__ . "/../../classes/Adresse.class.php"; include_once __DIR__ . "/../../classes/Zone.class.php"; include_once __DIR__ . "/../../classes/Pays.class.php"; include_once __DIR__ . "/../../fonctions/divers.php"; $client = new Client(); $client->charger_id($commande->client); $pays = new Pays(); $pays->charger($client->pays); $zone = new Zone(); $zone->charger($pays->zone); include_once __DIR__ . "/modeles/facture.php"; $facture = new Facture(); $facture->creer($_GET['ref']); exit; } // Le moteur ne sortira pas le contenu de $res $sortie = false; // Le fond est le template de facture. $reptpl = __DIR__ . "/template/"; $fond = "facture.html"; $lang = $commande->lang; // Compatibilité avec le moteur. $_REQUEST['commande'] = $_GET['ref']; require_once __DIR__ . "/../../fonctions/moteur.php"; require_once __DIR__ . "/../../classes/Pdf.class.php";
function modifier_transports($idtransport) { $transzone = new Transzone(); $zone = new Zone(); $tr = new Modules(); if ($tr->charger_id($_GET['id'])) { $zone = new Zone(); ?> <div class="entete_liste_config" style="margin-top:15px;"> <div class="titre"><?php echo trad('MODIFICATION_TRANSPORT', 'admin') . ' ' . ActionsAdminModules::instance()->lire_titre_module($tr); ?> </div> </div> <ul class="ligne1"> <li style="width:250px;"> <select class="form_select" id="zone"> <?php $query = "select * from {$zone->table}"; $resul = $transzone->query($query); while ($resul && ($row = $transzone->fetch_object($resul))) { $test = new Transzone(); if (!$test->charger($idtransport, $row->id)) { ?> <option value="<?php echo $row->id; ?> "><?php echo $row->nom; ?> </option> <?php } } ?> </select> </li> <li><a href="javascript:ajouter($('#zone').val())"><?php echo trad('AJOUTER_ZONE', 'admin'); ?> </a></li> </ul> <?php $query = "select * from {$transzone->table} where transport=\"" . $idtransport . "\""; $resul = $transzone->query($query); $i = 0; while ($resul && ($row = $transzone->fetch_object($resul))) { $zone = new Zone(); $zone->charger($row->zone); $fond = "ligne_" . ($i++ % 2 ? "fonce" : "claire") . "_BlocDescription"; ?> <ul class="<?php echo $fond; ?> "> <li style="width:492px;"><?php echo $zone->nom; ?> </li> <li style="width:32px;"><a href="javascript:supprimer(<?php echo $row->id; ?> )"><?php echo trad('Supprimer', 'admin'); ?> </a></li> </ul> <?php } } }
function modifier_pays_zone($idzone) { $zone = new Zone(); $zone->charger($idzone); $pays = new Pays(); $query = "select * from {$pays->table} where zone=\"-1\""; $resul = $pays->query($query); ?> <div class="entete_liste_config" style="margin-top:15px;"> <div class="titre"><?php echo trad('MODIFICATION_ZONE', 'admin'); ?> </div> </div> <ul class="ligne1"> <li style="width:250px;"> <select class="form_select" id="pays"> <?php while ($resul && ($row = $pays->fetch_object($resul))) { $paysdesc = new Paysdesc(); if ($paysdesc->charger($row->id)) { ?> <option value="<?php echo $paysdesc->pays; ?> "><?php echo $paysdesc->titre; ?> </option> <?php } } ?> </select> </li> <li><a href="javascript:ajouter($('#pays').val())"><?php echo trad('AJOUTER_PAYS', 'admin'); ?> </a></li> </ul> <?php $pays = new Pays(); $query = "select * from {$pays->table} where zone=\"" . $idzone . "\""; $resul = $pays->query($query); while ($resul && ($row = $pays->fetch_object($resul))) { $paysdesc = new Paysdesc(); $paysdesc->charger($row->id); $fond = "ligne_" . ($i++ % 2 ? "fonce" : "claire") . "_BlocDescription"; ?> <ul class="<?php echo $fond; ?> "> <li style="width:492px;"><?php echo $paysdesc->titre; ?> </li> <li style="width:32px;"><a href="javascript:supprimer(<?php echo $row->id; ?> )"><?php echo trad('Supprimer', 'admin'); ?> </a></li> </ul> <?php } ?> <ul class="ligne1"> <li><?php echo trad('Forfait transport: ', 'admin'); ?> <input type="text" class="form_inputtext" id="forfait" onclick="this.value=''" value="<?php echo htmlspecialchars($zone->unite); ?> " /></li> <li><a href="javascript:forfait($('#forfait').val())"><?php echo trad('VALIDER', 'admin'); ?> </a></li> </ul> <?php }
function bouclePanier($texte, $args) { $deb = lireTag($args, "deb", "int"); $fin = lireTag($args, "fin", "int"); $dernier = lireTag($args, "dernier", "int"); $ref = lireTag($args, "ref", "string"); $parent = lireTag($args, "parent", "int+-"); if (!$deb) { $deb = 0; } if (!$fin) { $fin = $_SESSION['navig']->panier->nbart; } if ($dernier == 1) { $deb = $_SESSION['navig']->panier->nbart - 1; } $total = 0; $res = ""; if (!$_SESSION['navig']->panier->nbart) { return; } for ($i = $deb; $i < $fin; $i++) { $article =& $_SESSION['navig']->panier->tabarticle[$i]; if ($ref != "" && $article->produit->ref != $ref) { continue; } $ceParent = $article->parent; if ($ceParent === '') { $ceParent = -1; } if ($parent != "" && $ceParent != $parent) { continue; } $plus = $article->quantite + 1; $moins = $article->quantite - 1; if ($moins == 0) { $moins++; } $quantite = $article->quantite; $tva = $article->produit->tva; if (!$article->produit->promo) { $prix = $article->produit->prix - $article->produit->prix * $_SESSION['navig']->client->pourcentage / 100; } else { $prix = $article->produit->prix2 - $article->produit->prix2 * $_SESSION['navig']->client->pourcentage / 100; } $prixht = $prix / (1 + $tva / 100); $totalht = $prixht * $quantite; $total = $prix * $quantite; $port = port(); if ($port < 0) { $port = 0; } $totcmdport = $total + $port; $totsansport = $_SESSION['navig']->panier->total(); $pays = new Pays(); $pays->charger($_SESSION['navig']->client->pays); $zone = new Zone(); $zone->charger($pays->zone); $portht = $port * 100 / (100 + $tva); $totcmdportht = $totcmdport * 100 / (100 + $tva); $totsansportht = $totsansport * 100 / (100 + $tva); $declidisp = new Declidisp(); $declidispdesc = new Declidispdesc(); $declinaison = new Declinaison(); $declinaisondesc = new Declinaisondesc(); $dectexte = ""; $decval = ""; if ($_SESSION['navig']->adresse) { $adr = new Adresse(); $adr->charger($_SESSION['navig']->adresse); $idpays = $adr->pays; } else { $idpays = $_SESSION['navig']->client->pays; } $pays = new Pays(); $pays->charger($idpays); $val = ""; for ($compt = 0; $compt < count($article->perso); $compt++) { $tperso = $article->perso[$compt]; $declinaison->charger($tperso->declinaison); // recup valeur declidisp ou string if ($declinaison->isDeclidisp($tperso->declinaison)) { $declidisp->charger($tperso->valeur); $declidispdesc->charger_declidisp($declidisp->id); $val = $declidispdesc->titre . " "; } else { $val = $tperso->valeur . " "; } // recup declinaison associee $declinaisondesc->charger($tperso->declinaison); $dectexte .= $declinaisondesc->titre . " " . $val . " "; $decval .= $val . " "; } if ($pays->tva != "" && !$pays->tva) { $prix = $prixht; $total = $totalht; } $temp = str_replace("#REF", $article->produit->ref, $texte); $temp = str_replace("#TITRE", $article->produitdesc->titre, $temp); $temp = str_replace("#QUANTITE", "{$quantite}", $temp); $temp = str_replace("#PRODUIT", $article->produitdesc->produit, $temp); $temp = str_replace("#PRIXUHT", formatter_somme($prixht), $temp); $temp = str_replace("#PRIXHT", formatter_somme($prixht), $temp); $temp = str_replace("#TOTALHT", formatter_somme($totalht), $temp); $temp = str_replace("#PRIXU", formatter_somme($prix), $temp); $temp = str_replace("#PRIX", formatter_somme($prix), $temp); $temp = str_replace("#TVA", "{$tva}", $temp); $temp = str_replace("#TOTAL", formatter_somme($total), $temp); $temp = str_replace("#ID", $article->produit->id, $temp); $temp = str_replace("#ARTICLE", "{$i}", $temp); $temp = str_replace("#PLUSURL", urlfond("panier", "action=" . "modifier" . "&article=" . $i . "&quantite=" . $plus, true), $temp); $temp = str_replace("#MOINSURL", urlfond("panier", "action=" . "modifier" . "&article=" . $i . "&quantite=" . $moins, true), $temp); $temp = str_replace("#SUPPRURL", urlfond("panier", "action=" . "supprimer" . "&article=" . $i, true), $temp); $temp = str_replace("#PRODURL", $article->produitdesc->getUrl(), $temp); $temp = str_replace("#TOTSANSPORTHT", formatter_somme($totsansportht), $temp); $temp = str_replace("#PORTHT", formatter_somme($portht), $temp); $temp = str_replace("#TOTPORTHT", formatter_somme($totcmdportht), $temp); $temp = str_replace("#TOTSANSPORT", formatter_somme($totsansport), $temp); $temp = str_replace("#PORT", formatter_somme($port), $temp); $temp = str_replace("#TOTPORT", formatter_somme($totcmdport), $temp); $temp = str_replace("#DECTEXTE", "{$dectexte}", $temp); $temp = str_replace("#DECVAL", "{$decval}", $temp); $res .= $temp; } return $res; }
if (!est_autorise("acces_configuration")) { exit; } require_once "../fonctions/divers.php"; require_once "liste/zone.php"; if ($_POST['action'] == "ajouter" && $_POST['nomzone'] != "") { $zone = new Zone(); $zone->nom = $_POST['nomzone']; $id = $zone->add(); } else { if ($_GET['action'] == "supprimer" && $_GET['id'] != "") { $zone = new Zone(); $pays = new Pays(); $query = "update {$pays->table} set zone=\"-1\" where zone=\"" . $_GET['id'] . "\""; $resul = mysql_query($query, $pays->link); $zone->charger($_GET['id']); $zone->delete(); } } if ($_REQUEST['id'] != "") { $id = $_REQUEST['id']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php require_once "title.php"; require_once "js/zone.php"; ?> </head>
<?php require_once __DIR__ . "/../auth.php"; require_once __DIR__ . "/../../fonctions/divers.php"; $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); if ($request->isXmlHttpRequest() === false) { redirige("../accueil.php"); } if (!est_autorise("acces_configuration")) { exit; } header('Content-Type: text/html; charset=utf-8'); if ($request->query->get('action') == "forfait" && $request->query->get('valeur', "") != "") { $zone = new Zone(); $zone->charger($request->query->get('id')); $zone->unite = $request->query->get('valeur'); $zone->maj(); echo 1; } else { if ($request->query->get('action') == "ajouter" && $request->query->get('pays', "") != "") { $pays = new Pays(); $query = "update {$pays->table} set zone='" . $request->query->get('id') . "' where id=\"" . $request->query->get('pays') . "\""; $resul = $pays->query($query); echo 1; } else { if ($request->query->get('action') == "supprimer" && $request->query->get('pays', "") != "") { $pays = new Pays(); $query = "update {$pays->table} set zone='-1' where id=\"" . $request->query->get('pays') . "\""; $resul = $pays->query($query); echo 1; }