/** * set value of http_client_info_sent * * @param string|array|Tinebase_Record_RecordSet $_id * @param boolean $_status * @throws Voipmanager_Exception_Backend */ public function setHttpClientInfoSent($_id, $_status) { foreach ((array) $_id as $id) { $phoneId = Voipmanager_Model_Snom_Phone::convertSnomPhoneIdToInt($id); $where[] = $this->_db->quoteInto($this->_db->quoteIdentifier('id') . ' = ?', $phoneId); } try { $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($this->_db); // NOTE: cascading delete for lines and phone_settings // SECOND NOTE: using array for second argument won't work as delete function joins array items using "AND" #foreach($where AS $where_atom) #{ # $this->_db->delete($this->_tablePrefix . 'snom_phones', $where_atom); #} $phoneData = array('http_client_info_sent' => (bool) $_status); $this->_db->update($this->_tablePrefix . 'snom_phones', $phoneData, $where); Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId); } catch (Exception $e) { Tinebase_TransactionManager::getInstance()->rollBack(); throw new Voipmanager_Exception_Backend($e->getMessage()); } }
/** * delete lines(s) identified by phone id * * @param string|Voipmanager_Model_Snom_Phone $_id */ public function deletePhoneLines($_id) { $phoneId = Voipmanager_Model_Snom_Phone::convertSnomPhoneIdToInt($_id); $where[] = $this->_db->quoteInto($this->_db->quoteIdentifier('snomphone_id') . ' = ?', $phoneId); $this->_db->delete($this->_tablePrefix . $this->_tableName, $where); }