function substitadresse($texte) { global $adresse; $tadresse = new Adresse(); if ($tadresse->charger(intval($adresse))) { $raisondesc = new Raisondesc(); $raisondesc->charger($tadresse->raison); $paysdesc = new Paysdesc(); $paysdesc->charger($tadresse->pays); $texte = str_replace("#ADRESSE_RAISONID", $tadresse->raison, $texte); $texte = str_replace("#ADRESSE_IDPAYS", $tadresse->pays, $texte); $texte = str_replace("#ADRESSE_ID", $tadresse->id, $texte); $texte = str_replace("#ADRESSE_LIBELLE", $tadresse->libelle, $texte); $texte = str_replace("#ADRESSE_RAISON", $raisondesc->long, $texte); $texte = str_replace("#ADRESSE_ENTREPRISE", $tadresse->entreprise, $texte); $texte = str_replace("#ADRESSE_NOM", $tadresse->nom, $texte); $texte = str_replace("#ADRESSE_PRENOM", $tadresse->prenom, $texte); $texte = str_replace("#ADRESSE_ADRESSE1", $tadresse->adresse1, $texte); $texte = str_replace("#ADRESSE_ADRESSE2", $tadresse->adresse2, $texte); $texte = str_replace("#ADRESSE_ADRESSE3", $tadresse->adresse3, $texte); $texte = str_replace("#ADRESSE_CPOSTAL", $tadresse->cpostal, $texte); $texte = str_replace("#ADRESSE_VILLE", $tadresse->ville, $texte); $texte = str_replace("#ADRESSE_PAYS", $paysdesc->titre, $texte); $texte = str_replace("#ADRESSE_TEL", $tadresse->tel, $texte); } $texte = str_replace("#ADRESSE_ACTIVE", "" . $_SESSION['navig']->adresse . "", $texte); return $texte; }
function substitclient($texte) { // Les #CLIENT_RAISONnF $raisons = CacheBase::getCache()->query("select id from raison"); if ($raisons) { foreach ($raisons as $raison) { $sel = $_SESSION['navig']->client->raison == $raison->id ? 'selected="selected"' : ''; $texte = str_replace("#CLIENT_RAISON" . $raison->id . "F", $sel, $texte); } } $paysdesc = new Paysdesc(); $paysdesc->charger($_SESSION['navig']->client->pays); $raisondesc = new Raisondesc(); $raisondesc->charger($_SESSION['navig']->client->raison); $texte = str_replace("#CLIENT_IDPAYS", $_SESSION['navig']->client->pays, $texte); $texte = str_replace("#CLIENT_ID", intval($_SESSION['navig']->client->id), $texte); $texte = str_replace("#CLIENT_REF", $_SESSION['navig']->client->ref, $texte); $texte = str_replace("#CLIENT_RAISONID", $_SESSION['navig']->client->raison, $texte); $texte = str_replace("#CLIENT_RAISON", $raisondesc->long, $texte); $texte = str_replace("#CLIENT_ENTREPRISE", $_SESSION['navig']->client->entreprise, $texte); $texte = str_replace("#CLIENT_SIRET", $_SESSION['navig']->client->siret, $texte); $texte = str_replace("#CLIENT_INTRACOM", $_SESSION['navig']->client->intracom, $texte); $texte = str_replace("#CLIENT_NOM", $_SESSION['navig']->client->nom, $texte); $texte = str_replace("#CLIENT_PRENOM", $_SESSION['navig']->client->prenom, $texte); $texte = str_replace("#CLIENT_ADRESSE1", $_SESSION['navig']->client->adresse1, $texte); $texte = str_replace("#CLIENT_ADRESSE2", $_SESSION['navig']->client->adresse2, $texte); $texte = str_replace("#CLIENT_ADRESSE3", $_SESSION['navig']->client->adresse3, $texte); $texte = str_replace("#CLIENT_CPOSTAL", $_SESSION['navig']->client->cpostal, $texte); $texte = str_replace("#CLIENT_VILLE", $_SESSION['navig']->client->ville, $texte); $texte = str_replace("#CLIENT_PAYS", $paysdesc->titre, $texte); $texte = str_replace("#CLIENT_EMAIL", $_SESSION['navig']->client->email, $texte); $texte = str_replace("#CLIENT_TELFIXE", $_SESSION['navig']->client->telfixe, $texte); $texte = str_replace("#CLIENT_TELPORT", $_SESSION['navig']->client->telport, $texte); $texte = str_replace("#CLIENT_TYPE", $_SESSION['navig']->client->type, $texte); return $texte; }
} $errorCode = 0; try { ActionsAdminClient::getInstance()->action($request); } catch (TheliaAdminException $e) { $errorCode = $e->getCode(); switch ($errorCode) { case TheliaAdminException::CLIENT_ADD_ADRESS: $addError = 1; break; case TheliaAdminException::CLIENT_ADRESS_EDIT_ERROR: $editAddressError[$request->get("id")] = 1; break; } } $raisondesc = new Raisondesc($client->raison); if ($client->parrain) { $parrain = new Client(); $parrain->charger_id($client->parrain); } $paysdesc = new Paysdesc(); $paysdesc->charger($client->pays); ?> <!DOCTYPE html> <html lang="fr"> <head> <?php require_once "title.php"; ?> </head>
function boucleAdresse($texte, $args) { $adresse = new Adresse(); // récupération des arguments $adresse_id = lireTag($args, "id", "int"); if ($adresse_id == '') { $adresse_id = lireTag($args, "adresse", "int"); } $client_id = lireTag($args, "client", "int"); $defaut = lireTag($args, "defaut", "int"); $exclusion = lireTag($args, "exclusion", "int_list"); $search = ""; $res = ""; // preparation de la requete if ($adresse_id != "") { $search .= " and id=\"{$adresse_id}\""; } if ($client_id != "") { $search .= " and client=\"{$client_id}\""; } if ($exclusion != "") { $search .= " and id not in ({$exclusion})"; } // éviter de lister l'ensemble des adresses de la base if ($adresse_id == "" && $client_id == "") { return ""; } if ($defaut == "1" && $adresse_id != "0") { return ""; } else { if ($defaut == "0" && $adresse_id == "0") { return ""; } } if ($adresse_id != "0") { $query = "select * from {$adresse->table} where 1 {$search}"; $resul = CacheBase::getCache()->query($query); if (empty($resul)) { return ""; } foreach ($resul as $row) { // Les #RAISONnF $raisons = CacheBase::getCache()->query("select id from " . Raison::TABLE); if ($raisons) { foreach ($raisons as $raison) { $sel = $row->raison == $raison->id ? 'selected="selected"' : ''; $texte = str_replace("#RAISON" . $raison->id . "F", $sel, $texte); } } $raisondesc = new Raisondesc(); $raisondesc->charger($row->raison); $temp = str_replace("#ID", "{$row->id}", $texte); $temp = str_replace("#PRENOM", "{$row->prenom}", $temp); $temp = str_replace("#NOM", "{$row->nom}", $temp); $temp = str_replace("#ENTREPRISE", "{$row->entreprise}", $temp); $temp = str_replace("#RAISONID", $row->raison, $temp); $temp = str_replace("#RAISON", $raisondesc->long, $temp); $temp = str_replace("#LIBELLE", "{$row->libelle}", $temp); $temp = str_replace("#ADRESSE1", "{$row->adresse1}", $temp); $temp = str_replace("#ADRESSE2", "{$row->adresse2}", $temp); $temp = str_replace("#ADRESSE3", "{$row->adresse3}", $temp); $temp = str_replace("#CPOSTAL", "{$row->cpostal}", $temp); $temp = str_replace("#PAYS", "{$row->pays}", $temp); $temp = str_replace("#VILLE", "{$row->ville}", $temp); $temp = str_replace("#TEL", "{$row->tel}", $temp); $temp = str_replace("#TELFIXE", "{$row->tel}", $temp); $temp = str_replace("#TELPORT", "{$row->tel}", $temp); $temp = str_replace("#SUPPRURL", urlfond("livraison_adresse", "action=supprimerlivraison&id={$row->id}", true), $temp); $temp = str_replace("#URL", urlfond("commande", "action=modadresse&adresse={$row->id}", true), $temp); $res .= $temp; } } else { // Les #RAISONnF $raisons = CacheBase::getCache()->query("select id from " . Raison::TABLE); if ($raisons) { foreach ($raisons as $raison) { $sel = $_SESSION['navig']->client->raison == $raison->id ? 'selected="selected"' : ''; $texte = str_replace("#RAISON" . $raison->id . "F", $sel, $texte); } } $raisondesc = new Raisondesc($_SESSION['navig']->client->raison); $temp = $texte; $temp = str_replace("#ID", $_SESSION['navig']->client->id, $temp); $temp = str_replace("#LIBELLE", "", $temp); $temp = str_replace("#RAISONID", $_SESSION['navig']->client->raison, $temp); $temp = str_replace("#RAISON", $raisondesc->long, $temp); $temp = str_replace("#NOM", $_SESSION['navig']->client->nom, $temp); $temp = str_replace("#PRENOM", $_SESSION['navig']->client->prenom, $temp); $temp = str_replace("#ENTREPRISE", $_SESSION['navig']->client->entreprise, $temp); $temp = str_replace("#ADRESSE1", $_SESSION['navig']->client->adresse1, $temp); $temp = str_replace("#ADRESSE2", $_SESSION['navig']->client->adresse2, $temp); $temp = str_replace("#ADRESSE3", $_SESSION['navig']->client->adresse3, $temp); $temp = str_replace("#CPOSTAL", $_SESSION['navig']->client->cpostal, $temp); $temp = str_replace("#VILLE", $_SESSION['navig']->client->ville, $temp); $temp = str_replace("#PAYS", $_SESSION['navig']->client->pays, $temp); $temp = str_replace("#EMAIL", $_SESSION['navig']->client->email, $temp); $temp = str_replace("#TELFIXE", $_SESSION['navig']->client->telfixe, $temp); $temp = str_replace("#TELPORT", $_SESSION['navig']->client->telport, $temp); if (empty($_SESSION['navig']->client->telport)) { $temp = str_replace("#TEL", $_SESSION['navig']->client->telfixe, $temp); } else { $temp = str_replace("#TEL", $_SESSION['navig']->client->telport, $temp); } $res .= $temp; } return $res; }
public function substitmail($corps, $commande) { ActionsModules::instance()->appel_module("preSubstitmail", $corps, $commande); $nomsite = Variable::lire("nomsite"); $jour = substr($commande->date, 8, 2); $mois = substr($commande->date, 5, 2); $annee = substr($commande->date, 0, 4); $heure = substr($commande->date, 11, 2); $minute = substr($commande->date, 14, 2); $seconde = substr($commande->date, 17, 2); $client = new Client($commande->client); $paiement = new Modules($commande->paiement); $paiementdesc = new Modulesdesc($paiement->nom, $commande->lang); $transport = new Modules($commande->transport); $transportdesc = new Modulesdesc($transport->nom, $commande->lang); $total = $commande->total(); $totcmdport = $commande->port + $total; $adresse = new Venteadr($commande->adrlivr); $raisondesc = new Raisondesc(); $raisondesc->charger($adresse->raison, $commande->lang); $nom = $adresse->nom; $prenom = $adresse->prenom; $entreprise = $adresse->entreprise; $adresse1 = $adresse->adresse1; $adresse2 = $adresse->adresse2; $adresse3 = $adresse->adresse3; $cpostal = $adresse->cpostal; $ville = $adresse->ville; $pays = new Paysdesc($adresse->pays, $commande->lang); $corps = str_replace("__COMMANDE_REF__", $commande->ref, $corps); $corps = str_replace("__COMMANDE_DATE__", $jour . "/" . $mois . "/" . $annee, $corps); $corps = str_replace("__COMMANDE_HEURE__", $heure . ":" . $minute, $corps); $corps = str_replace("__COMMANDE_TRANSACTION__", $commande->transaction, $corps); $corps = str_replace("__COMMANDE_PAIEMENT__", $paiementdesc->titre, $corps); $corps = str_replace("__COMMANDE_TOTALPORT__", $totcmdport - $commande->remise, $corps); $corps = str_replace("__COMMANDE_TOTAL__", $total, $corps); $corps = str_replace("__COMMANDE_PORT__", $commande->port, $corps); $corps = str_replace("__COMMANDE_REMISE__", $commande->remise, $corps); $corps = str_replace("__COMMANDE_TRANSPORT__", $transportdesc->titre, $corps); $corps = str_replace("__COMMANDE_TRANSPORTCHAPO__", $transportdesc->chapo, $corps); $corps = str_replace("__COMMANDE_LIVRRAISON__", $raisondesc->court, $corps); $corps = str_replace("__COMMANDE_LIVRNOM__", $nom, $corps); $corps = str_replace("__COMMANDE_LIVRPRENOM__", $prenom, $corps); $corps = str_replace("__COMMANDE_LIVRENTREPRISE__", $entreprise, $corps); $corps = str_replace("__COMMANDE_LIVRADRESSE1__", $adresse1, $corps); $corps = str_replace("__COMMANDE_LIVRADRESSE2__", $adresse2, $corps); $corps = str_replace("__COMMANDE_LIVRADRESSE3__", $adresse3, $corps); $corps = str_replace("__COMMANDE_LIVRCPOSTAL__", $cpostal, $corps); $corps = str_replace("__COMMANDE_LIVRVILLE__", $ville, $corps); $corps = str_replace("__COMMANDE_LIVRPAYS__", $pays->titre, $corps); $corps = str_replace("__COMMANDE_LIVRTEL__", $adresse->tel, $corps); $corps = str_replace("__NOMSITE__", $nomsite, $corps); $corps = str_replace("__URLSITE__", urlfond(), $corps); $adresse = new Venteadr($commande->adrfact); $raisondesc = new Raisondesc(); $raisondesc->charger($adresse->raison); $pays = new Paysdesc(); $pays->charger($adresse->pays); $corps = str_replace("__CLIENT_REF__", $client->ref, $corps); $corps = str_replace("__CLIENT_RAISON__", $raisondesc->court, $corps); $corps = str_replace("__CLIENT_ENTREPRISE__", $client->entreprise, $corps); $corps = str_replace("__CLIENT_SIRET__", $client->siret, $corps); $corps = str_replace("__CLIENT_FACTNOM__", $adresse->nom, $corps); $corps = str_replace("__CLIENT_FACTPRENOM__", $adresse->prenom, $corps); $corps = str_replace("__CLIENT_ADRESSE1__", $adresse->adresse1, $corps); $corps = str_replace("__CLIENT_ADRESSE2__", $adresse->adresse2, $corps); $corps = str_replace("__CLIENT_ADRESSE3__", $adresse->adresse3, $corps); $corps = str_replace("__CLIENT_CPOSTAL__", $adresse->cpostal, $corps); $corps = str_replace("__CLIENT_VILLE__", $adresse->ville, $corps); $corps = str_replace("__CLIENT_PAYS__", $pays->titre, $corps); $corps = str_replace("__CLIENT_EMAIL__", $client->email, $corps); $corps = str_replace("__CLIENT_TELFIXE__", $client->telfixe, $corps); $corps = str_replace("__CLIENT_TELPORT__", $client->telport, $corps); $pattern = '{<VENTEPROD>((?:(?:(?!<VENTEPROD[^>]*>|</VENTEPROD>).)++|<VENTEPROD[^>]*>(?1)</VENTEPROD>)*)</VENTEPROD>}si'; if (preg_match($pattern, $corps, $cut)) { $corps = str_replace("<VENTEPROD>", "", $corps); $corps = str_replace("</VENTEPROD>", "", $corps); $res = ""; $venteprod = new Venteprod(); $query = "select * from {$venteprod->table} where commande=\"" . $commande->id . "\""; $resul = $venteprod->query($query); while ($resul && ($row = $venteprod->fetch_object($resul))) { $temp = str_replace("__VENTEPROD_TITRE__", $row->titre, $cut[1]); $temp = str_replace("__VENTEPROD_REF__", $row->ref, $temp); $temp = str_replace("__VENTEPROD_CHAPO__", $row->chapo, $temp); $temp = str_replace("__VENTEPROD_QUANTITE__", $row->quantite, $temp); $temp = str_replace("__VENTEPROD_PRIXU__", $row->prixu, $temp); $temp = str_replace("__VENTEPROD_TOTAL__", $row->prixu * $row->quantite, $temp); ActionsModules::instance()->appel_module("substitutionsventeprodmailcommande", $temp, $row); $res .= $temp; } $corps = str_replace($cut[1], $res, $corps); } // Substitutions mail "devise" $devise = new Devise($commande->devise); ActionsDevises::instance()->subsititutions_mail($devise, $corps); ActionsModules::instance()->appel_module("substitutionsmailcommande", $corps, $commande); return $corps; }