53 lines
2.2 KiB
PHP
Executable File
53 lines
2.2 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Tabpointvente.php';
|
|
require_once 'Modele/Tablocalite.php';
|
|
|
|
class ControleurAjaxtbajouterpointvente extends Controleur {
|
|
private $pv;
|
|
private $loc;
|
|
|
|
public function __construct() {
|
|
$this->pv = new Tabpointvente();
|
|
$this->loc = new Tablocalite();
|
|
}
|
|
|
|
public function index() {
|
|
$typepv = $this->pv->gettypepointvente();
|
|
$pays = $this->loc->getpayslocalite();
|
|
$ville = array();
|
|
$localite = array();
|
|
|
|
$this->genererVueAjax(array(
|
|
'typepointvente' => $typepv,
|
|
'pays' => $pays,
|
|
'ville' => $ville,
|
|
'localite' => $localite,
|
|
));
|
|
}
|
|
|
|
public function ajouter(){
|
|
$codePointVente = strtoupper($this->requete->getParametreFormulaire("codePointVente"));
|
|
|
|
if (!$this->pv->existeligne($codePointVente)){
|
|
$libelle = strtoupper($this->requete->getParametreFormulaire("libelle"));
|
|
$codeTypePointVente = strtoupper($this->requete->getParametreFormulaire("codeTypePointVente"));
|
|
$adresseGeo = $this->requete->getParametreFormulaire("adresseGeo");
|
|
$adressePost = $this->requete->getParametreFormulaire("adressePost");
|
|
$telephone = $this->requete->getParametreFormulaire("telephone");
|
|
$fax = $this->requete->getParametreFormulaire("fax");
|
|
$email = $this->requete->getParametreFormulaire("email");
|
|
$codePays = strtoupper($this->requete->getParametreFormulaire("codePays"));
|
|
$codeVille = strtoupper($this->requete->getParametreFormulaire("codeVille"));
|
|
$codeLocalite = strtoupper($this->requete->getParametreFormulaire("codeLocalite"));
|
|
|
|
$this->pv->ajouterpointvente($codePointVente,$libelle,$codeTypePointVente,$adresseGeo,
|
|
$adressePost,$telephone,$fax,$email,$codePays,$codeVille,$codeLocalite);
|
|
}else{
|
|
echo 'Erreur: Le code saisi existe déjà! Veuillez entrer un autre./Error : The code entered already exists! Please enter another.';
|
|
die();
|
|
}
|
|
}
|
|
}
|
|
|
|
|