production/Controleur/ControleurTbmodifiernaturepiece.php
2025-12-02 11:29:44 +00:00

46 lines
1.5 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Naturepiece.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurTbmodifiernaturepiece extends Controleur {
private $menuvue;
private $naturepiece;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuTbajout('naturepiece');
$this->naturepiece = new naturepiece();
}
public function index() {
$id = $this->requete->getParametre("id");
$naturepiece = $this->naturepiece->getnaturepiece($id);
$chemin = $this->menuvue->getChemin('Dossiercons');
$this->genererVue(array('naturepiece' => $naturepiece, 'chemin' => $chemin));
}
public function reafficher() {
$this->genererVue();
}
public function modifier() {
$id = $this->requete->getParametre("idnaturepiece");
$oldcodeNaturePiece = $this->requete->getParametre("oldcodeNaturePiece");
$codeNaturePiece = $this->requete->getParametre("codeNaturePiece");
$libelle = $this->requete->getParametre("libelle");
// Début contrôle doublon
$doublon = false;
$doublon = (($codeNaturePiece!=$oldcodeNaturePiece) && ($this->naturepiece->existeligne($codeNaturePiece)));
if (!$doublon) {
$codeNaturePiece = strtoupper($codeNaturePiece);
$libelle = ucfirst($libelle);
$this->naturepiece->modifier($id, $codeNaturePiece, $libelle);
}
$this->rediriger("Tblistenaturepiece");
}
}