prestation/Controleur/ControleurListeprospects.php
2025-12-05 10:42:46 +00:00

72 lines
2.1 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Client_d.php';
require_once 'Modele/Police_d.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurListeprospects extends Controleur {
private $menuvue;
private $client;
private $police;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue("Listeprospects");
$this->client = new Client_d();
$this->police = new Police_d();
$_SESSION['modeDevis'] = "1";
}
public function index($numeroclientsearch="", $nomsearch="", $prenomsearch="", $telsearch="", $numeroPolicesearch="")
{
$_SESSION['numeroOptionTarif'] = "1";
if (isset($_POST['numeroclientsearch']))
{
$numeroclientsearch=$_POST['numeroclientsearch'];
$numeroPolicesearch=$_POST['numeroPolicesearch'];
if ($numeroclientsearch>" ") {
$clients = $this->client->getClientsearch($numeroclientsearch);
}
elseif($numeroPolicesearch>"0")
{
$idPolice = $this->police->getClientsearchPol($numeroPolicesearch);
if ($idPolice<>"0")
{
$this->police->getContexteClientId($idPolice);
$this->police->getContexteAjaxPolice($idPolice);
$this->rediriger("Fichedevis");
}
else
{
$clients = $this->client->getClients($numeroPolicesearch, "", "");
}
}
else
{
$nomsearch=$_POST['nomsearch'];
$prenomsearch=$_POST['prenomsearch'];
$telsearch=$_POST['telsearch'];
$clients = $this->client->getClients($nomsearch, $prenomsearch, $telsearch);
}
}
else
{
$clients = $this->client->getClientVide();
}
if ($clients->rowCount() == 1)
{
$client = $clients->fetch();
$_SESSION['idClient_d_Ajax'] = $client['id'];
$this->rediriger("Ficheprospect");
}
else
{
$this->genererVue(array('clients' => $clients, 'numeroclientsearch' => $numeroclientsearch,
'nomsearch' => $nomsearch, 'prenomsearch' => $prenomsearch, 'telsearch' => $telsearch, 'numeroPolicesearch' => $numeroPolicesearch));
}
}
}