public function incrementIndex($node, $sub_node = NULL) { $data = array('id' => $this->NEXT($node, $sub_node)); if ($data['id'] == 1) { $data['node'] = $node; if (!is_null($sub_node) && !empty($sub_node)) { $data['sub_node'] = $sub_node; } if ($this->insert($data)) { return $data['id']; } throw new ErrorException('Unable to insert value in index table', 0, 1); } else { $auth_session = Zend_Registry::get('auth_session'); $where = array(); $where[] = $this->getAdapter()->quoteInto('domain_id = ?', $auth_session->domain_id); $where[] = $this->getAdapter()->quoteInto('node = ?', $node); if (!is_null($sub_node) && !empty($sub_node)) { $where[] = $this->getAdapter()->quoteInto('sub_node = ?', $sub_node); } if (parent::update($data, $where)) { return $data['id']; } throw new ErrorException('Unable to update index table', 0, 1); } }
/** * Update */ public function update($data, $id) { $auth_session = Zend_Registry::get('auth_session'); $where = array(); $where[] = $this->getAdapter()->quoteInto('id = ?', $id); $where[] = $this->getAdapter()->quoteInto('domain_id = ?', $auth_session->domain_id); return parent::update($data, $where); }
/** * Replaces updateDefault * * @param mixed $data * @param mixed $id * @return int */ public function update($name, $value, $extension_name = "core") { $auth_session = Zend_Registry::get('auth_session'); $where = array(); $where[] = $this->getAdapter()->quoteInto('name = ?', $name); $SI_EXTENSIONS = new SimpleInvoices_Db_Table_Extensions(); $extension_id = $SI_EXTENSIONS->findByName($extension_name); if ($extension_id >= 0) { $where[] = $this->getAdapter()->quoteInto('extension_id = ?', $extension_id); } else { throw new Exception("Invalid extension name: " . str_replace(array('{', '}', '+'), array('{', '}', '+'), htmlentities($extension_name, ENT_QUOTES, 'UTF-8'))); exit(1); } return parent::update(array('value' => $value), $where); }
/** * Update a customer * * @param mixed $data * @param mixed $id * @return int */ public function update(array $data, $id) { $auth_session = Zend_Registry::get('auth_session'); $where = array(); $where[] = $this->getAdapter()->quoteInto('id = ?', $id); $where[] = $this->getAdapter()->quoteInto('domain_id = ?', $auth_session->domain_id); // IF Credit Card Number is present it must be cyphered if (array_key_exists('credit_card_number', $data)) { if (!empty($data['credit_card_number'])) { $config = Zend_Registry::get('config'); $enc = new encryption(); $key = $config->encryption->default->key; $data['credit_card_number'] = $enc->encrypt($key, $data['credit_card_number']); } } return parent::update($data, $where); }