prestation/Controleur/ControleurTbmodifiernaturepiece.php
2025-12-01 18:54:33 +00:00

42 lines
1.4 KiB
PHP

<?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);
$this->genererVue(array('naturepiece' => $naturepiece));
}
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");
}
}