Пример #1
0
 /**
  * Maps array to the given {@link Pays}.
  * <p>
  * Expected properties are:
  * <ul>
  *   <li>id</li>
  *   <li>label</li>
  * </ul>
  * @param Pays $pays model
  * @param array $properties to map from.
  */
 public static function map(Pays $pays, array $properties)
 {
     if (array_key_exists('id', $properties)) {
         $pays->setId($properties['id']);
     }
     if (array_key_exists('nom', $properties)) {
         $pays->setLabel($properties['label']);
     }
 }
Пример #2
0
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;
    }
}
Пример #3
0
 function edition()
 {
     $id = intval(lireParam('pays', 'int'));
     $maj = $id > 0;
     $pays = new Pays();
     if ($maj) {
         $pays->charger($id);
     } else {
         $pays->lang = 0;
         $pays->defaut = 0;
     }
     $pays->tva = intval($_REQUEST['tva']) != 0 ? 1 : 0;
     $pays->zone = intval($_REQUEST['zone']);
     $pays->isocode = intval($_REQUEST['isocode']);
     $pays->isoalpha2 = $_REQUEST['isoalpha2'];
     $pays->isoalpha3 = $_REQUEST['isoalpha3'];
     if ($maj) {
         $pays->maj();
     } else {
         $id = $pays->add();
     }
     if ($id > 0) {
         foreach ($_REQUEST['langue'] as $langue) {
             $paysdesc = new Paysdesc();
             if ($maj) {
                 $paysdesc->charger($id, $langue);
             }
             $paysdesc->pays = $id;
             $paysdesc->lang = $langue;
             $paysdesc->titre = $_REQUEST['titre'][$langue];
             $paysdesc->chapo = $_REQUEST['chapo'][$langue];
             $paysdesc->description = $_REQUEST['description'][$langue];
             if ($maj) {
                 $paysdesc->maj();
             } else {
                 $paysdesc->add();
             }
         }
     }
 }
 public function addAction()
 {
     if ($this->request->isPost()) {
         $joueur = new Joueur();
         $joueur->nom = $this->request->getPost('nom');
         $joueur->prenom = $this->request->getPost('prenom');
         $joueur->codePays = $this->request->getPost('codePays');
         if ($joueur->save()) {
             $this->flash->success('Le joueur a bien été ajouté ;)');
             return $this->response->redirect('joueur/index');
         } else {
             $this->flash->error('Un erreur est survenue. Merci de réessayer plus tard :(');
         }
     }
     $this->view->setVars(['pays' => Pays::find()]);
 }
Пример #5
0
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 
}
Пример #6
0
function boucleTransport($texte, $args)
{
    // récupération des arguments
    $id = lireTag($args, "id", "int_list");
    $nom = lireTag($args, "nom", "string");
    $exclusion = lireTag($args, "exclusion", "string_list");
    $idpays = intval(lireTag($args, "pays", "int"));
    $cpostal = intval(lireTag($args, "cpostal", "string"));
    $montantmini = intval(lireTag($args, "montantmini", "float"));
    $search = "";
    $res = "";
    if ($id != "") {
        $search .= "and id in ({$id})";
    }
    if ($nom != "") {
        $search .= "and nom=\"{$nom}\"";
    }
    if ($exclusion != "") {
        $liste = "";
        $tabexcl = explode(",", $exclusion);
        for ($i = 0; $i < count($tabexcl); $i++) {
            $liste .= "'" . $tabexcl[$i] . "'" . ",";
        }
        $liste = rtrim($liste, ",");
        $search .= " and nom not in ({$liste})";
    }
    $modules = new Modules();
    $query = "select * from {$modules->table} where type='2' and actif='1' {$search} order by classement";
    $resul = CacheBase::getCache()->query($query);
    if (empty($resul)) {
        return "";
    }
    $pays = new Pays();
    if ($idpays > 0) {
        $pays->charger($idpays);
    } else {
        if ($_SESSION['navig']->adresse != "" && $_SESSION['navig']->adresse != 0) {
            $adr = new Adresse();
            $adr->charger($_SESSION['navig']->adresse);
            $pays->charger($adr->pays);
        } else {
            $pays->charger($_SESSION['navig']->client->pays);
        }
    }
    $transzone = new Transzone();
    $compt = 0;
    foreach ($resul as $row) {
        if (!$transzone->charger($row->id, $pays->zone)) {
            continue;
        }
        $compt++;
        $modules = new Modules();
        $modules->charger_id($row->id);
        try {
            $instance = ActionsModules::instance()->instancier($modules->nom);
            $port = round(port($row->id, $pays->id, $cpostal), 2);
            $titre = $instance->getTitre();
            $chapo = $instance->getChapo();
            $description = $instance->getDescription();
        } catch (Exception $ex) {
            $titre = $chapo = $description = '';
        }
        if ($port < $montantmini) {
            continue;
        }
        // Chercher le logo
        $exts = array('png', 'gif', 'jpeg', 'jpg');
        $logo = false;
        foreach ($exts as $ext) {
            $tmp = ActionsModules::instance()->lire_chemin_base() . "/{$row->nom}/logo.{$ext}";
            if (file_exists($tmp)) {
                $logo = ActionsModules::instance()->lire_url_base() . "/{$row->nom}/logo.{$ext}";
                break;
            }
        }
        $temp = str_replace("#NOM", $row->nom, $texte);
        $temp = str_replace("#TITRE", "{$titre}", $temp);
        $temp = str_replace("#CHAPO", "{$chapo}", $temp);
        $temp = str_replace("#DESCRIPTION", "{$description}", $temp);
        $temp = str_replace("#URLCMD", urlfond("commande", "action=transport&amp;id=" . $row->id, true), $temp);
        $temp = str_replace("#ID", "{$row->id}", $temp);
        $temp = str_replace("#LOGO", $logo, $temp);
        $temp = str_replace("#PORT", formatter_somme($port), $temp);
        $temp = str_replace("#COMPT", "{$compt}", $temp);
        $res .= $temp;
    }
    return $res;
}
Пример #7
0
 ></label>
                    </td>
                </tr>
                <tr>
                    <td><?php 
echo trad('Zone_transport', 'admin');
?>
</td>
                    <td>
                        <select name="zone">
                            <option value="0"><?php 
echo trad('Aucune', 'admin');
?>
</option>
                            <?php 
$pays = new Pays();
foreach ($pays->query_liste("SELECT * FROM " . Zone::TABLE . " ORDER BY nom") as $zone) {
    ?>
                            <option value="<?php 
    echo $zone->id;
    ?>
" <?php 
    if ($errorCode > 0 && $request->request->get("zone") == $zone->id) {
        ?>
selected="selected"<?php 
    }
    ?>
><?php 
    echo $zone->nom;
    ?>
</option>
Пример #8
0
?>
</td>
    							<td><input name="ville" type="text" class="form" value="<?php 
echo htmlspecialchars($client->ville);
?>
" size="40" /></td>
    						</tr>

    						<tr class="fonce">
    							<td class="designation"><?php 
echo trad('Pays', 'admin');
?>
</td>
    							<td><select name="pays" class="form_client">
    								<?php 
$pays = new Pays();
$query = "select * from {$pays->table}";
$resul = $pays->query($query);
while ($resul && ($row = $pays->fetch_object($resul, 'Pays'))) {
    $paysdesc = new Paysdesc();
    if ($paysdesc->charger($row->id)) {
        if ($row->id == $client->pays || $pays->defaut) {
            $selected = "selected=\"selected\"";
        } else {
            $selected = "";
        }
        ?>
    										<option value="<?php 
        echo $row->id;
        ?>
" <?php 
Пример #9
0
 function total($tva = 1, $remise = 0)
 {
     $total = 0;
     $taxe = 0;
     $pays = new Pays();
     if ($_SESSION['navig']->adresse != "" && $_SESSION['navig']->adresse != 0) {
         $adr = new Adresse();
         $adr->charger($_SESSION['navig']->adresse);
         $pays->charger($adr->pays);
     } else {
         $pays->charger($_SESSION['navig']->client->pays);
     }
     foreach ($this->tabarticle as $art) {
         $prix = $art->produit->promo ? $art->produit->prix2 : $art->produit->prix;
         $taxe += ($prix - $prix / (1 + $art->produit->tva / 100)) * $art->quantite;
         $total += $prix * $art->quantite;
     }
     if ($tva && $pays->tva != "" && !$pays->tva) {
         $total -= $taxe;
     } else {
         if ($tva == 0) {
             $total -= $taxe;
         }
     }
     $total -= $remise;
     ActionsModules::instance()->appel_module("totalPanier", $total);
     return round($total, 2);
 }
Пример #10
0
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;
        }
    }
}
Пример #11
0
function paiement($type_paiement)
{
    if (!$_SESSION['navig']->client->id || $_SESSION['navig']->panier->nbart < 1) {
        redirige(urlfond());
    }
    $total = 0;
    $nbart = 0;
    $poids = 0;
    $unitetr = 0;
    ActionsModules::instance()->appel_module("avantcommande");
    $modules = new Modules();
    $modules->charger_id($type_paiement);
    if (!$modules->actif) {
        return 0;
    }
    try {
        $modpaiement = ActionsModules::instance()->instancier($modules->nom);
        $commande = new Commande();
        $commande->transport = $_SESSION['navig']->commande->transport;
        $commande->client = $_SESSION['navig']->client->id;
        $commande->remise = 0;
        $devise = ActionsDevises::instance()->get_devise_courante();
        $commande->devise = $devise->id;
        $commande->taux = $devise->taux;
        $client = new Client();
        $client->charger_id($_SESSION['navig']->client->id);
        $adr = new Venteadr();
        $adr->raison = $client->raison;
        $adr->entreprise = $client->entreprise;
        $adr->nom = $client->nom;
        $adr->prenom = $client->prenom;
        $adr->adresse1 = $client->adresse1;
        $adr->adresse2 = $client->adresse2;
        $adr->adresse3 = $client->adresse3;
        $adr->cpostal = $client->cpostal;
        $adr->ville = $client->ville;
        $adr->tel = $client->telfixe . "  " . $client->telport;
        $adr->pays = $client->pays;
        $adrcli = $adr->add();
        $commande->adrfact = $adrcli;
        $adr = new Venteadr();
        $livraison = new Adresse();
        if ($livraison->charger($_SESSION['navig']->adresse)) {
            $adr->raison = $livraison->raison;
            $adr->entreprise = $livraison->entreprise;
            $adr->nom = $livraison->nom;
            $adr->prenom = $livraison->prenom;
            $adr->adresse1 = $livraison->adresse1;
            $adr->adresse2 = $livraison->adresse2;
            $adr->adresse3 = $livraison->adresse3;
            $adr->cpostal = $livraison->cpostal;
            $adr->ville = $livraison->ville;
            $adr->tel = $livraison->tel;
            $adr->pays = $livraison->pays;
        } else {
            $adr->raison = $client->raison;
            $adr->entreprise = $client->entreprise;
            $adr->nom = $client->nom;
            $adr->prenom = $client->prenom;
            $adr->adresse1 = $client->adresse1;
            $adr->adresse2 = $client->adresse2;
            $adr->adresse3 = $client->adresse3;
            $adr->cpostal = $client->cpostal;
            $adr->ville = $client->ville;
            $adr->tel = $client->telfixe . "  " . $client->telport;
            $adr->pays = $client->pays;
        }
        $adrlivr = $adr->add();
        $commande->adrlivr = $adrlivr;
        $commande->facture = 0;
        $commande->statut = Commande::NONPAYE;
        $commande->paiement = $type_paiement;
        $commande->lang = ActionsLang::instance()->get_id_langue_courante();
        $commande->id = $commande->add();
        $pays = new Pays();
        $pays->charger($adr->pays);
        $correspondanceParent = array(null);
        foreach ($_SESSION['navig']->panier->tabarticle as $pos => &$article) {
            $venteprod = new Venteprod();
            $dectexte = "\n";
            $produit = new Produit();
            $stock = new Stock();
            foreach ($article->perso as $perso) {
                $declinaison = new Declinaison();
                $declinaisondesc = new Declinaisondesc();
                if (is_numeric($perso->valeur) && $modpaiement->defalqcmd) {
                    // diminution des stocks de déclinaison si on est sur un module de paiement qui défalque de suite
                    $stock->charger($perso->valeur, $article->produit->id);
                    $stock->valeur -= $article->quantite;
                    $stock->maj();
                }
                $declinaison->charger($perso->declinaison);
                $declinaisondesc->charger($declinaison->id);
                // recup valeur declidisp ou string
                if ($declinaison->isDeclidisp($perso->declinaison)) {
                    $declidisp = new Declidisp();
                    $declidispdesc = new Declidispdesc();
                    $declidisp->charger($perso->valeur);
                    $declidispdesc->charger_declidisp($declidisp->id);
                    $dectexte .= "- " . $declinaisondesc->titre . " : " . $declidispdesc->titre . "\n";
                } else {
                    $dectexte .= "- " . $declinaisondesc->titre . " : " . $perso->valeur . "\n";
                }
            }
            // diminution des stocks classiques si on est sur un module de paiement qui défalque de suite
            $produit = new Produit($article->produit->ref);
            if ($modpaiement->defalqcmd) {
                $produit->stock -= $article->quantite;
                $produit->maj();
            }
            /* Gestion TVA */
            $prix = $article->produit->prix;
            $prix2 = $article->produit->prix2;
            $tva = $article->produit->tva;
            if ($pays->tva != "" && (!$pays->tva || $pays->tva && $_SESSION['navig']->client->intracom != "" && !$pays->boutique)) {
                $prix = round($prix / (1 + $tva / 100), 2);
                $prix2 = round($prix2 / (1 + $tva / 100), 2);
                $tva = 0;
            }
            $venteprod->quantite = $article->quantite;
            if (!$article->produit->promo) {
                $venteprod->prixu = $prix;
            } else {
                $venteprod->prixu = $prix2;
            }
            $venteprod->ref = $article->produit->ref;
            $venteprod->titre = $article->produitdesc->titre . " " . $dectexte;
            $venteprod->chapo = $article->produitdesc->chapo;
            $venteprod->description = $article->produitdesc->description;
            $venteprod->tva = $tva;
            $venteprod->commande = $commande->id;
            $venteprod->id = $venteprod->add();
            $correspondanceParent[] = $venteprod->id;
            // ajout dans ventedeclisp des declidisp associées au venteprod
            foreach ($article->perso as $perso) {
                $declinaison = new Declinaison();
                $declinaison->charger($perso->declinaison);
                // si declidisp (pas un champs libre)
                if ($declinaison->isDeclidisp($perso->declinaison)) {
                    $vdec = new Ventedeclidisp();
                    $vdec->venteprod = $venteprod->id;
                    $vdec->declidisp = $perso->valeur;
                    $vdec->add();
                }
            }
            ActionsModules::instance()->appel_module("apresVenteprod", $venteprod, $pos);
            $total += $venteprod->prixu * $venteprod->quantite;
            $nbart++;
            $poids += $article->produit->poids;
        }
        foreach ($correspondanceParent as $id_panier => $id_venteprod) {
            if ($_SESSION['navig']->panier->tabarticle[$id_panier]->parent >= 0) {
                $venteprod->charger($id_venteprod);
                $venteprod->parent = $correspondanceParent[$_SESSION['navig']->panier->tabarticle[$id_panier]->parent];
                $venteprod->maj();
            }
        }
        $pays = new Pays($_SESSION['navig']->client->pays);
        if ($_SESSION['navig']->client->pourcentage > 0) {
            $commande->remise = $total * $_SESSION['navig']->client->pourcentage / 100;
        }
        $total -= $commande->remise;
        if ($_SESSION['navig']->promo->id != "") {
            $commande->remise += calc_remise($total);
            $_SESSION['navig']->promo->utilise = 1;
            if (!empty($commande->remise)) {
                $commande->remise = round($commande->remise, 2);
            }
            $commande->maj();
            $temppromo = new Promo();
            $temppromo->charger_id($_SESSION['navig']->promo->id);
            $temppromo->utilise++;
            $temppromo->maj();
            $promoutil = new Promoutil();
            $promoutil->commande = $commande->id;
            $promoutil->promo = $temppromo->id;
            $promoutil->code = $temppromo->code;
            $promoutil->type = $temppromo->type;
            $promoutil->valeur = $temppromo->valeur;
            $promoutil->add();
        }
        if ($commande->remise > $total) {
            $commande->remise = $total;
        }
        $commande->port = port();
        if (intval($commande->port) <= 0) {
            $commande->port = 0;
        }
        $_SESSION['navig']->promo = new Promo();
        $_SESSION['navig']->commande = $commande;
        $commande->transaction = genid($commande->id, 6);
        $commande->maj();
        $total = $_SESSION['navig']->panier->total(1, $_SESSION['navig']->commande->remise) + $_SESSION['navig']->commande->port;
        if ($total < $_SESSION['navig']->commande->port) {
            $total = $_SESSION['navig']->commande->port;
        }
        $_SESSION['navig']->commande->total = $total;
        ActionsModules::instance()->appel_module("aprescommande", $commande);
        // Appeler la méthode mail du plugin de paiement...
        $modpaiement->mail($commande);
        // ... et la méthode paiement
        $modpaiement->paiement($commande);
    } catch (Exception $e) {
        // FIXME: Echec de commande -> cas à traiter ?
    }
}
Пример #12
0
<?php

require_once __DIR__ . '/auth.php';
if (!est_autorise("acces_configuration")) {
    exit;
}
$request = Symfony\Component\HttpFoundation\Request::createFromGlobals();
$pays = new Pays($request->query->get("id"));
?>
<form method="post" action="pays.php">
    <input type="hidden" name="action" value="editCountry">
    <input type="hidden" name="id" value="<?php 
echo $pays->id;
?>
"
    <p>
        <button class="btn btn-large btn-block btn-primary" type="submit"><?php 
echo trad('VALIDER_LES_MODIFICATIONS', 'admin');
?>
</button>
    </p> 
<table class="table table-striped">
    <tbody>
        <tr>
            <td><?php 
echo trad('ISO-3166', 'admin');
?>
</td>
            <td><input type="text" name="isocode" value="<?php 
echo htmlspecialchars($pays->isocode);
?>
Пример #13
0
 public function actionResult()
 {
     $rc = Yii::app()->robokassa;
     // Коллбэк для события "оплата произведена"
     $rc->onSuccess = function ($event) {
         // Запишем в модель оплаты что оплата прошла
         $payForm = Yii::app()->robokassa->params['order'];
         $payForm->status = 'succes';
         $payForm->save();
         // получим пользователя из модели оплаты
         $player = Player::model()->findByPk($payForm->id_player);
         // Прибавим в статистике пользователя параметр инвестиции
         $statistic = Statistic::model()->findByAttributes(array('id_player' => $player->id));
         $statistic->invest_summ += $payForm->summ;
         $statistic->save();
         // Добавим пользователю сумму на счет оплаты !!!*1000!!!
         $player->setSummBuyPlus($payForm->summ);
         // Увеличим лемит вывода
         $current_summ_limit = $payForm->summ * 0.4;
         $player->setSummLimitPlus($current_summ_limit);
         // Получить реферала, если есть(?)
         $referal = Referals::model()->findByAttributes(array('id_referal' => $player->id));
         if ($referal != null) {
             // Получить пригласившего
             $parent_referal = Player::model()->findByAttributes(array('id' => $referal->id_player));
             // Получить статистику пригласившего и записать в базу
             $statistic_referal = Statistic::model()->findByAttributes(array('id_player' => $parent_referal->id));
             // Если еще не оплачивал, отметить что оплатил, добавить реферала в сумму рефералов прегласившего
             if ($referal->is_active == 0) {
                 $referal->is_active = 1;
                 $statistic_referal->referals += 1;
             }
             $summ_pay = $payForm->summ;
             $parent_referal->setReferalBonuses($summ_pay, $statistic_referal);
         }
     };
     // Коллбэк для события "отказ от оплаты"
     $rc->onFail = function ($event) {
         $InvId = Yii::app()->request->getParam('InvId');
         $payForm = Pays::model()->findByAttributes(array('id' => $InvId));
         if ($payForm != null) {
             $payForm->status = 'fail';
             $payForm->save();
         }
     };
     // Обработка ответа робокассы
     $rc->result();
 }
Пример #14
0
function substitpanier($texte)
{
    $total = 0;
    $totalht = 0;
    $totaleco = 0;
    $totaltaxe = 0;
    $allItemCount = $nb_article = 0;
    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);
    $total = $_SESSION['navig']->panier->total();
    $totalht = $_SESSION['navig']->panier->total(0);
    $totaleco = $_SESSION['navig']->panier->totalecotaxe();
    $tva = $total - $totalht;
    $nb_article = $_SESSION['navig']->panier->nbart;
    foreach ($_SESSION['navig']->panier->tabarticle as $anItem) {
        $allItemCount += $anItem->quantite;
    }
    unset($anItem);
    $port = port();
    if ($port < 0) {
        $port = 0;
    }
    $totcmdport = $total + $port;
    $remise = $remise_client = $remise_promo = 0;
    if ($_SESSION['navig']->client->pourcentage > 0) {
        $remise_client = $total * $_SESSION['navig']->client->pourcentage / 100;
    }
    $remise_promo += calc_remise($total);
    $remise = $remise_promo + $remise_client;
    $totcmdport -= $remise;
    $totremise = $total - $remise;
    if ($totcmdport < $port) {
        $totcmdport = $port;
    }
    $totcmdportht = $totalht + $port;
    $totalht = formatter_somme($totalht);
    $total = formatter_somme($total);
    $totaleco = formatter_somme($totaleco);
    $totaltaxe = formatter_somme($totaltaxe);
    $port = formatter_somme($port);
    $totcmdport = formatter_somme($totcmdport);
    $remise = formatter_somme($remise);
    $totremise = formatter_somme($totremise);
    $totcmdportht = formatter_somme($totcmdportht);
    $tva = formatter_somme($tva, 2, ".", "");
    $remise_client = formatter_somme($remise_client);
    $remise_promo = formatter_somme($remise_promo);
    $totpoids = $_SESSION['navig']->panier->poids();
    $texte = str_replace("#PANIER_TOTALHT", "{$totalht}", $texte);
    $texte = str_replace("#PANIER_TOTALECO", "{$totaleco}", $texte);
    $texte = str_replace("#PANIER_TOTALTVA", "{$tva}", $texte);
    // total TVA du panier = #PANIER_TVA
    $texte = str_replace("#PANIER_TOTAL", "{$total}", $texte);
    $texte = str_replace("#PANIER_PORT", "{$port}", $texte);
    $texte = str_replace("#PANIER_TOTPORTHT", "{$totcmdportht}", $texte);
    $texte = str_replace("#PANIER_TOTPORT", "{$totcmdport}", $texte);
    $texte = str_replace("#PANIER_TOTREMISE", "{$totremise}", $texte);
    $texte = str_replace("#PANIER_REMISE_CLIENT", "{$remise_client}", $texte);
    $texte = str_replace("#PANIER_REMISE_PROMO", "{$remise_promo}", $texte);
    $texte = str_replace("#PANIER_REMISE", "{$remise}", $texte);
    $texte = str_replace("#PANIER_NBART_TOTAL", $allItemCount, $texte);
    $texte = str_replace("#PANIER_NBART", "" . $nb_article . "", $texte);
    $texte = str_replace("#PANIER_POIDS", "{$totpoids}", $texte);
    $texte = str_replace("#PANIER_TVA", "{$tva}", $texte);
    // total TVA du panier
    return $texte;
}
Пример #15
0
 private function getParams(Pays $pays)
 {
     $params = array(':id' => $pays->getId(), ':label' => $pays->getPaysLabel());
     return $params;
 }
Пример #16
0
            $pays = new Pays();
            $id = intval(lireParam('pays', 'int'));
            $pays->query("update {$pays->table} set `boutique`=0");
            $pays->query("update {$pays->table} set `boutique`=1 where id={$id}");
            exit;
        }
    }
}
/* Afficher la forme de modif/creation de pays */
$langues = array();
$langue = new Lang();
$result = $langue->query("select * from " . $langue->table . " order by id");
while ($result && ($row = $langue->fetch_object($result))) {
    $langues[] = $row;
}
$pays = new Pays();
$paysdesc = new Paysdesc();
$id = intval(lireParam('pays', 'int'));
$pays->id = $id;
if ($id > 0) {
    $pays->charger($id);
}
?>
<div class="entete_config" style="width: auto; float: none;">
			<div class="titre"><?php 
echo trad('EDITION', 'admin');
?>
</div>
			<div class="fonction_valider"><a href="#" onclick="$('#pays_edit_form').submit(); return false;"><?php 
echo trad('VALIDER_LES_MODIFICATIONS', 'admin');
?>
Пример #17
0
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;
// Compatibilité avec le moteur.
Пример #18
0
 public function add($titre, $isocode, $isoalpha2, $isoalpha3, $tva, $zone)
 {
     $titre = trim($titre);
     if (empty($titre)) {
         throw new TheliaAdminException("Title can not be empty", TheliaAdminException::COUNTRY_TITLE_EMPTY);
     }
     $this->isocode = $isocode;
     $this->isoalpha2 = $isoalpha2;
     $this->isoalpha3 = $isoalpha3;
     $this->tva = $tva;
     $this->zone = $zone;
     $this->id = parent::add();
     $paysdesc = new Paysdesc();
     $paysdesc->pays = $this->id;
     $paysdesc->lang = ActionsAdminLang::instance()->get_id_langue_courante();
     $paysdesc->titre = $titre;
     $paysdesc->add();
     redirige("pays.php");
 }
Пример #19
0
 /**
  * 锁定支付密码
  * 
  */
 function lockPayStatus()
 {
     $user_id = 1;
     //测试user_id
     $pay = new Pays();
     $lockPayStatus = $pay->lockPayStatus($user_id);
     print_r($lockPayStatus);
 }
Пример #20
0
 public function actionGetHistoryBays()
 {
     $player = Player::model()->findByAttributes(array('email' => Yii::app()->user->id));
     $criteria = new CDbCriteria();
     $criteria->addCondition('id_player = :id_player');
     $criteria->params = array(':id_player' => $player->id);
     $count = Pays::model()->count($criteria);
     $pages = new CPagination($count);
     // элементов на страницу
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $pays = Pays::model()->findAll($criteria);
     $this->render('historyPays', array('pays' => $pays));
 }