This commit is contained in:
KONE SOREL 2026-03-24 14:57:43 +00:00
parent ffd760b090
commit f8822986ad
3 changed files with 38 additions and 9 deletions

View File

@ -23,6 +23,17 @@ class ControleurGedadherent extends Controleur {
$nouveau_fichier = "rien";
$codeNaturePiece = $this->requete->getParametre("codeNaturePiece");
if($codeNaturePiece == "AUT"){
$libelleDocument = $this->requete->getParametreFormulaire("libelleAutre");
}else{
$libelleDocument = $this->ged->getLibelleTypeDocument($codeNaturePiece);
}
var_dump(array($codeNaturePiece, $libelleDocument));
die();
if(!empty($_POST))
{
define('TARGET', $_SESSION['cheminGed']); // Repertoire cible
@ -37,6 +48,8 @@ class ControleurGedadherent extends Controleur {
// Variables
$extension = '';
if( !is_dir(TARGET) )
{
if( !mkdir(TARGET, 0755) )
@ -70,6 +83,7 @@ class ControleurGedadherent extends Controleur {
// On renomme le fichier
$nomOrigine = $_FILES['fichier_upload']['name'];
$nouveau_fichier = dateJourSql()."_".uniqid().".".$extension;
// Si c'est OK, on teste l'upload
if(move_uploaded_file($_FILES['fichier_upload']['tmp_name'], TARGET.$nouveau_fichier))
@ -79,7 +93,7 @@ class ControleurGedadherent extends Controleur {
: 'Chargé avec succès';
// on va envoyer dans la base de données
$this->ged->enregistrergedadherent($nomOrigine, $nouveau_fichier, $taille);
$this->ged->enregistrergedadherent($nomOrigine, $nouveau_fichier, $taille, $codeNaturePiece, $libelleDocument);
$this->rediriger("Gedadherent");
}
else

View File

@ -73,22 +73,22 @@ class Ged extends Modele {
{
$idAdherent = $_SESSION['idAdherent_C'];
$sql = 'call sp_r_get_ged_adherent(?, ?, ?, ?)';
$sql = 'call sp_get_ged_adherent_rh(?, ?, ?, ?)';
$resultat = $this->executerRequete($sql, array($idAdherent, $d1, $d2, $nomOrigine));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function enregistrergedadherent($nomOrigine, $nouveau_fichier, $taille)
public function enregistrergedadherent($nomOrigine, $nouveau_fichier, $taille, $codeNaturePiece, $libelleDocument)
{
$idAdherent = $_SESSION['idAdherent_C'];
$user = $_SESSION['login'];
$cheminFichier = $_SESSION['dossierGed'].$nouveau_fichier;
$sql = 'call sp_r_ajouter_ged_adherent(?, ?, ?, ?, ?)';
$sql = 'call sp_ajouter_ged_adherent_rh(?, ?, ?, ?, ?)';
$this->executerRequete($sql, array($idAdherent, $nomOrigine, $cheminFichier, $taille, $user));
$this->executerRequete($sql, array($idAdherent, $nomOrigine, $cheminFichier, $taille, $user, $codeNaturePiece, $libelleDocument));
}
public function getgedpolice($d1, $d2, $nomOrigine)
@ -226,10 +226,25 @@ class Ged extends Modele {
$sql = 'call sp_a_get_ged_adherent_rd(?)';
$resultat = $this->executerRequete($sql, array($idDemandeRemboursement));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getLibelleTypeDocument($codeNaturePiece){
$codeSociete = $_SESSION['codeSociete'];
if(est_anglophone()){
$sql = 'SELECT fn_get_type_document_eng(?, ?) as libelleDocument';
} else{
$sql = 'SELECT fn_get_type_document(?, ?) as libelleDocument';
}
$resultat = $this->executerRequete($sql, array($codeNaturePiece, $codeSociete));
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
return $ligne['libelleDocument'];
}
}

View File

@ -91,8 +91,8 @@
<th class="text-center">Date</th>
<th class="text-center">Src</th>
<th><?= _("Souscripteur / Police") ?></th>
<th><?= _("Prestataire") ?></th>
<th><?= _("Bénéficiaire (Adhérent)") ?></th>
<th><?= _("Bénéficiaire (Adhérent)") ?></th>
<th><?= _("Type du Document") ?></th>
<th><?= _("Nom du Document") ?></th>
<th class="text-center no-export"><?= _("Action") ?></th>
</tr>