pdo = $pDO->getPdoGsb(); } /** * FONCTION QUI CONNECTE UN UTILISATEUR */ public function connectUser(string $login, string $password): array|bool { $req = 'SELECT "uId", "uNom", "uPrenom", "uAdresse", "uCp", "uVille", "uSecteur", "uLabo", "parametre"."pLibelle" FROM utilisateur INNER JOIN parametre ON "parametre"."pType" = \'statUti\' AND "utilisateur"."uStatut" = "parametre"."pIndice" WHERE "uLogin" = :login AND "uMdp" = :pwd ;'; $result = $this->pdo->prepare($req); $result->bindParam('login', $login); $result->bindParam('pwd', $password); $result->execute(); $result = $result->fetch(); if ($result['pLibelle'] == 'comptable') { $this->updateBdd(); } return $result; } /** * Update les lignes remboursement de la bdd a la connexion du comptable */ 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(); } }