_db = Zend_Db::factory($configuration->databases->db->sdv1); } elseif(empty($config)){ $dbConfig = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini', 'databases'); $this->_db = Zend_Db::factory($dbConfig->db->sdv1); } $this->_db->setFetchMode(Zend_Db::FETCH_OBJ); } /** * Liste les commandes suivant la * @param unknown_type $timestamp * @param unknown_type $etat * @param unknown_type $mode */ public function getCommandes($timestamp, $etat, $mode) { $dateTDebut = mktime(0, 0, 0, date('m', $timestamp), 1, date('Y', $timestamp)); $dateDebut = date('Y-m',$dateTDebut); $sql = $this->select()->where('dateCommande LIKE ?', $dateDebut.'%'); if (!empty($mode)){ if ( $mode == 'G' ) { $sql->where('typeCommande IN (?) ', array('', $mode)); } else { $sql->where('typeCommande = ?', $mode); } } if (!empty($etat)){ $sql->where('statutCommande = ?', $etat); } $result = $this->getAdapter()->fetchAll($sql); return $result; } public function getCommandesById($id) { $sql = $this->select()->where('idCommande = ?', $id); $result = $this->getAdapter()->fetchAll($sql); return $result; } public function getCommandesBySiren($siren) { $sql = $this->select() ->where('siren = ?', $siren) ->order('dateCommande ASC'); $result = $this->getAdapter()->fetchAll($sql); return $result; } public function getCommandesByLogin($login, $timestamp) { $dateTDebut = mktime(0, 0, 0, date('m', $timestamp), 1, date('Y', $timestamp)); $dateDebut = date('Y-m',$dateTDebut); $sql = $this->select() ->where('login = ?', $login) ->order('dateCommande ASC') ->where('dateCommande LIKE ?', $dateDebut.'%'); $result = $this->getAdapter()->fetchAll($sql); return $result; } }