/** * @param integer $id * @param Base_Form_Abstract $form * @throws Logic_Ws_Exception * @return void */ public function updateClient($id, Base_Form_Abstract $form) { $values = $form->getValues(); $ipAddress = $values['ip_address']; unset($values['ip_address']); if (empty($values['code'])) { unset($values['code']); } $clientIpModel = new WsClientHasWsSaveip(); try { if (intval($values['shipping_type']) === Logic_Ws_ServiceSet_ServiceSet::SHIPPING_TYPE_API && !empty($values['code'])) { $values['code'] = sha1($values['code']); } $oldRow = $this->findOne($id); $oldRow->setFromArray($values); $oldRow->save(); $clientIpModel->deleteIP($id); foreach ($ipAddress as $val) { if (intval($val) > 0) { $clientIpModel->insertClientIP(array('ws_client_id' => $id, 'ws_saveip_id' => $val)); } } } catch (Exception $e) { throw new Logic_Ws_Exception($e->getMessage()); } }