/** * * @param Base_Form_Abstract $form * @param type $id * @throws Logic_Ws_Exception */ public function updateIP(Base_Form_Abstract $form, $id) { $values = $form->getValues(); $clients = $values['clients']; unset($values['clients']); $clientIpModel = new WsClientHasWsSaveip(); try { $oldRow = $this->findOne($id); $oldRow->setFromArray($values); $oldRow->save(); $clientIpModel->deleteClients($id); foreach ($clients as $val) { $clientIpModel->insertClientIP(array('ws_client_id' => $val, 'ws_saveip_id' => $id)); } } catch (Exception $e) { throw new Logic_Ws_Exception($e->getMessage()); } }
/** * @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()); } }
public function deleteclientAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); if (empty($id)) { $this->_helper->messenger->error('Nie podano parametru ID'); return null; } try { $model = new WsClientHasWsSaveip(); $model->delete($id); $this->_helper->messenger->success(); $this->_helper->redirector('index'); return; } catch (Logic_Ws_Exception $e) { $this->_helper->messenger->error($e->getMessage()); $this->_helper->redirector('index'); } }