correctif pagination, disabled et maj remboursement

This commit is contained in:
2024-01-29 14:12:57 +01:00
4 changed files with 75 additions and 3 deletions

View File

@@ -70,12 +70,13 @@ class Class_gestionFiche
public function get_Page(int $nPage, string $idUtilisateur): array
{
$decalage = ($nPage - 1) * $this::$NB_LIGNES_PAGINATION;
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2)
as "rMontantValide", "eLibelle"
FROM remboursement
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
WHERE "rVisiteur"= :userId
ORDER BY "rDateModif" DESC LIMIT :nbLignes offset :decalage;';
ORDER BY "rMois" DESC LIMIT :nbLignes offset :decalage;';
$result = $this->pdo->prepare($req);
$result->bindParam('nbLignes', $this::$NB_LIGNES_PAGINATION);
$result->bindParam('decalage', $decalage);

View File

@@ -26,7 +26,27 @@ class Class_user
$result->bindParam('login', $login);
$result->bindParam('pwd', $password);
$result->execute();
$result = $result->fetch();
return $result->fetch();
if ($result['pLibelle'] == 'comptable') {
$this->updateBdd();
}
return $result;
}
public function updateBdd(): void
{
$curMonth = date('Ym');
$prevMonth = DateTime::createFromFormat('Ym', $curMonth);
$prevMonth->modify('first day of last month');
$prevMonth = $prevMonth->format('Ym');
$req = 'SELECT updateEtat(:currentMonth, :previousMonth)';
$result = $this->pdo->prepare($req);
$result->bindParam('currentMonth', $curMonth);
$result->bindParam('previousMonth', $prevMonth);
$result->execute();
}
}