getCommandesKbisBySiren($siren); } /** * Liste les commandes Kbis par numéro de commande * @param string $num G * @return array */ public function listCommandesKbisByNum($num) { $commandes = new Application_Model_CommandesKbis(); $id = substr($num, 1); return $commandes->getCommandesKbisById($id); } /** * Liste les commandes Kbis * @param string $date * @param int $etat * @param string $mode * @return array */ public function listCommandesKbis($date, $etat, $mode) { $commandes = new Application_Model_CommandesKbis(); return $commandes->getCommandes($date, $etat, $mode); } public function listCommandesGreffeByNum($num) { $commandes = new Application_Model_Commandes(); $id = substr($num, 1); return $commandes->getCommandesById($id); } public function listCommandesGreffeBySiren($siren) { $commandes = new Application_Model_Commandes(); return $commandes->getCommandesBySiren($siren); } public function listCommandesGreffeByLogin($login, $timestamp) { $commandes = new Application_Model_Commandes(); return $commandes->getCommandesByLogin($login, $timestamp); } public function listCommandesGreffe($date, $etat, $mode) { if ($mode=='-') $mode = ''; $commandes = new Application_Model_Commandes(); return $commandes->getCommandes($date, $etat, $mode); } public function listAllStatus() { $commandeStatut = new Application_Model_CommandesStatut(); return $commandeStatut->getStatut()->toArray(); } /** * * Enter description here ... */ public function listStatus($mode) { $commandeStatut = new Application_Model_CommandesStatut(); return $commandeStatut->getStatutByTypeCommande($mode)->toArray(); } /** * Change l'état d'une commande * @param integer $id * @param integer $etat * @param string $type */ public function changeEtatGreffe($id, $etat, $type = 'C') { $commandeStatut = new Application_Model_CommandesStatut(); $sql = $commandeStatut->select() ->from('commandes_statut') ->columns('id') ->where('typeCommande = ?', $type) ->order('ordre DESC') ->limit(1); $rows = $commandeStatut->fetchAll($sql); $trigger = NULL; if ($rows->count()>0){ $trigger = $rows[0]->id; } $commande = new Application_Model_Commandes(); $data = array( 'statutCommande' => $etat ); if ($etat == $trigger){ $data['dateReception'] = date('Y-m-d H:i:s'); } return $commande->update($data, 'idCommande = '.$id); } /** * Change l'état d'une commande * @param integer $id * @param integer $etat * @param string $type */ public function changeEtatKbis($id, $etat, $type = 'C') { $commandeStatut = new Application_Model_CommandesStatut(); $sql = $commandeStatut->select() ->from('commandes_statut') ->columns('id') ->where('typeCommande = ?', $type) ->order('ordre DESC') ->limit(1); $rows = $commandeStatut->fetchAll($sql); $trigger = NULL; if ($rows->count()>0){ $trigger = $rows[0]->id; } $commande = new Application_Model_CommandesKbis(); $data = array( 'statutCommande' => $etat ); if ($etat == $trigger){ $data['dateReception'] = date('Y-m-d H:i:s'); } return $commande->update($data, 'id = '.$id); } }