function substitparrain($texte)
{
    global $id_parrain;
    $client = new Client();
    $client->charger_id($id_parrain);
    $texte = str_replace("#PARRAIN_EMAIL", "{$client->email}", $texte);
    return $texte;
}
    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>

<body>
<?php 
ActionsAdminModules::instance()->inclure_module_admin("client_visualiser");
Example #3
0
// ou qu'un admin identifié n'est pas autorisé
if (!(isset($_SESSION['navig']) && $_SESSION['navig']->connecte && $_SESSION['navig']->client->id == $commande->client && $commande->facture != "" || isset($_SESSION["util"]) && est_autorise("acces_commandes"))) {
    exit;
}
// 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;
Example #4
0
function lister_commandes($critere, $order, $debut, $nbres, $search = '')
{
    $commande = new Commande();
    $i = 0;
    $query = "select * from {$commande->table} where 1 {$search} order by {$critere} {$order} limit {$debut},{$nbres}";
    $resul = $commande->query($query);
    while ($resul && ($row = $commande->fetch_object($resul, 'Commande'))) {
        $client = new Client();
        $client->charger_id($row->client);
        $statutdesc = new Statutdesc();
        $statutdesc->charger($row->statut);
        $devise = new Devise();
        $devise->charger($row->devise);
        $total = formatter_somme($row->total(true, true));
        $date = strftime("%d/%m/%y %H:%M:%S", strtotime($row->date));
        $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce") . "_rub";
        ?>

<ul class="<?php 
        echo $fond;
        ?>
">
	<li style="width:142px;"><?php 
        echo $row->ref;
        ?>
</li>
	<li style="width:104px;"><?php 
        echo $date;
        ?>
</li>
	<li style="width:200px;"><?php 
        echo $client->entreprise;
        ?>
</li>
	<li style="width:200px;"><a href="client_visualiser.php?ref=<?php 
        echo $client->ref;
        ?>
"><?php 
        echo $client->nom . " " . $client->prenom;
        ?>
</a></li>
	<li style="width:59px;"><?php 
        echo $total;
        ?>
 <?php 
        echo $devise->symbole;
        ?>
</li>
	<li style="width:70px;"><?php 
        echo $statutdesc->titre;
        ?>
</li>
	<li style="width:40px;"><a href="commande_details.php?ref=<?php 
        echo $row->ref;
        ?>
">éditer</a></li>
	<?php 
        if ($row->statut != Commande::ANNULE) {
            ?>
		<li style="width:35px; text-align:center;"><a href="#" onclick="supprimer('<?php 
            echo $row->id;
            ?>
'); return false;"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
	<?php 
        }
        ?>
</ul>
		<?php 
    }
}
 public function getSearchList($searchTerm, $clientFoundList)
 {
     $searchTerm = $this->escape_string(trim($searchTerm));
     $return = array();
     if ($searchTerm === '' && count($clientFoundList) == 0) {
         return $return;
     }
     $qOrders = "SELECT * FROM " . self::TABLE . "\n            WHERE ref like '%{$searchTerm}%'\n                OR facture like '%{$searchTerm}%'\n                OR transaction like '%{$searchTerm}%'\n                " . (count($clientFoundList) > 0 ? " OR client IN (" . implode(',', $clientFoundList) . ")" : '') . "\n                " . (strtotime($searchTerm) ? " OR date LIKE '" . date('Y-m-d', strtotime($searchTerm)) . "%'" : '') . "\n            LIMIT 100";
     $rOrders = $this->query($qOrders);
     while ($rOrders && ($theOrder = $this->fetch_object($rOrders, 'Commande'))) {
         $thisOrderArray = array();
         $client = new Client();
         $client->charger_id($theOrder->client);
         $statutdesc = new Statutdesc();
         $statutdesc->charger($theOrder->statut);
         $devise = new Devise();
         $devise->charger($theOrder->devise);
         $total = formatter_somme($theOrder->total(true, true));
         $date = strftime("%d/%m/%y %H:%M:%S", strtotime($theOrder->date));
         $thisOrderArray['ref'] = $theOrder->ref;
         $thisOrderArray['transaction'] = $theOrder->transaction;
         $thisOrderArray['facture'] = $theOrder->facture;
         $thisOrderArray['date'] = $date;
         $thisOrderArray['client'] = array("entreprise" => $client->entreprise, "ref" => $client->ref, "nom" => $client->nom, "prenom" => $client->prenom);
         $thisOrderArray['total'] = $total;
         $thisOrderArray['devise'] = $devise->symbole;
         $thisOrderArray['titre'] = $statutdesc->titre;
         $thisOrderArray['statut'] = $theOrder->statut;
         $thisOrderArray['id'] = $theOrder->id;
         $return[] = $thisOrderArray;
     }
     return $return;
 }
 function traitement_formulaire_client(&$res)
 {
     require_once __DIR__ . "/Raison.class.php";
     // L'existence de l'email
     if ($_SESSION['navig']->formcli->email != "") {
         $client = new Client();
         if ($client->existe($_SESSION['navig']->formcli->email)) {
             $res = preg_replace("/\\#EXISTE\\[([^]]*)\\]/", "\\1", $res);
         }
     }
     $res = preg_replace("/\\#EXISTE\\[[^]]*\\]/", "", $res);
     // Les infos stockées en session
     $mapping = array('RAISONID' => 'raison', 'PRENOM' => 'prenom', 'NOM' => 'nom', 'ENTREPRISE' => 'entreprise', 'SIRET' => 'siret', 'INTRACOM' => 'intracom', 'ADRESSE1' => 'adresse1', 'ADRESSE2' => 'adresse2', 'ADRESSE3' => 'adresse3', 'CPOSTAL' => 'cpostal', 'VILLE' => 'ville', 'PAYS' => 'pays', 'EMAIL' => 'email', 'MOTDEPASSE' => 'motdepasse', 'TELFIXE' => 'telfixe', 'TELPORT' => 'telport');
     $res = $this->controle_formulaire($_SESSION['navig']->formcli, $mapping, $res);
     // Le parrain
     $tmpparrain = new Client();
     $tmpparrain->charger_id($_SESSION['navig']->formcli->parrain);
     $res = str_replace("#PARRAIN", $tmpparrain->email, $res);
     // Les RAISONn et CHECKn
     $raisons = CacheBase::getCache()->query("select id from " . Raison::TABLE);
     if ($raisons) {
         foreach ($raisons as $raison) {
             $sel = $_SESSION['navig']->formcli->raison == $raison->id;
             $res = str_replace("#RAISON{$raison->id}", $sel ? 'selected="selected"' : '', $res);
             $res = str_replace("#CHECK{$raison->id}", $sel ? 'checked="checked"' : '', $res);
         }
     }
     // Compatibilité < 1.5.2
     if ($_SESSION['navig']->formcli->raison == "") {
         $res = str_replace("#RAISON0", $_SESSION['navig']->formcli->raison == "" ? 'selected="selected"' : '', $res);
     }
     return $res;
 }
Example #7
0
function modifiercompte($raison, $entreprise, $siret, $intracom, $prenom, $nom, $adresse1, $adresse2, $adresse3, $cpostal, $ville, $pays, $telfixe, $telport, $email1, $email2, $motdepasse1, $motdepasse2, $obligetel = 0, $urlok = "", $urlerr = "")
{
    $client = new Client();
    $client->charger_id($_SESSION['navig']->client->id);
    if ($motdepasse1 == "") {
        $client->id = $_SESSION['navig']->client->id;
        $client->raison = strip_tags($raison);
        $client->siret = strip_tags($siret);
        $client->intracom = strip_tags($intracom);
        $client->entreprise = strip_tags($entreprise);
        $client->nom = strip_tags($nom);
        $client->prenom = strip_tags($prenom);
        $client->telfixe = strip_tags($telfixe);
        $client->telport = strip_tags($telport);
        $errEmail = 0;
        if ($email1 != $client->email) {
            $test = new Client();
            if ($test->existe($email1)) {
                $errEmail = 1;
            }
        }
        if ($email1 == $email2 && $email1 != "" && filter_var($email1, FILTER_VALIDATE_EMAIL)) {
            $client->email = strip_tags($email1);
        } else {
            $client->email = "";
        }
        $client->adresse1 = strip_tags($adresse1);
        $client->adresse2 = strip_tags($adresse2);
        $client->adresse3 = strip_tags($adresse3);
        $client->cpostal = strip_tags($cpostal);
        $client->ville = strip_tags($ville);
        $client->pays = strip_tags($pays);
        $client->motdepasse = $_SESSION['navig']->client->motdepasse;
        $_SESSION['navig']->formcli = $client;
        $obligeok = 1;
        switch ($obligetel) {
            case 0:
                $obligeok = 1;
                break;
            case 1:
                if ($client->telfixe == "") {
                    $obligeok = 0;
                }
                break;
            case 2:
                if ($client->telport == "") {
                    $obligeok = 0;
                }
                break;
            case 3:
                if ($client->telfixe == "" && $client->telport == "") {
                    $obligeok = 0;
                }
                break;
            case 4:
                if ($client->telfixe == "" || $client->telport == "") {
                    $obligeok = 0;
                }
                break;
            default:
                $obligeok = 1;
        }
        ActionsModules::instance()->appel_module("avantmodifcompte");
        if ($client->raison != "" && $client->prenom != "" && $client->nom != "" && $client->email != "" && $client->email && $client->adresse1 != "" && $client->cpostal != "" && $client->ville != "" && $client->pays != "" && $obligeok && !$errEmail) {
            $client->maj();
            $_SESSION['navig']->client = $client;
            ActionsModules::instance()->appel_module("apresmodifcompte", $client);
            redirige_action($urlok, $_SESSION['navig']->urlpageret);
        } else {
            redirige_action($urlerr, urlfond("compte_modifiererr", "errform=1"));
        }
    } else {
        modifiermotdepasse($motdepasse1, $motdepasse2, $urlok, $urlerr);
    }
}
Example #8
0
     $search .= "where client and  ";
 }
 $commande = new Commande();
 $i = 0;
 $jour = substr($motcle, 0, 2);
 $mois = substr($motcle, 3, 2);
 $annee = substr($motcle, 6);
 $ladate = "{$annee}-{$mois}-{$jour}";
 $ladate = str_replace("??", "%", $ladate);
 $search .= " ref like '%{$motcle}%' or date like '{$ladate}'";
 $query = "select * from {$commande->table} {$search}";
 $resul = mysql_query($query, $commande->link);
 $venteprod = new Venteprod();
 while ($row = mysql_fetch_object($resul)) {
     $client = new Client();
     $client->charger_id($row->client);
     $statutdesc = new Statutdesc();
     $statutdesc->charger($row->statut);
     $query2 = "SELECT sum(prixu*quantite) as total FROM {$venteprod->table} where commande='{$row->id}'";
     $resul2 = mysql_query($query2, $venteprod->link);
     $total = round(mysql_result($resul2, 0, "total"), 2);
     $port = $row->port;
     $total -= $row->remise;
     $total += $port;
     if ($total < 0) {
         $total = 0;
     }
     $jour = substr($row->date, 8, 2);
     $mois = substr($row->date, 5, 2);
     $annee = substr($row->date, 0, 4);
     $heure = substr($row->date, 11, 2);