/** * Testuje limity dla zadanego uzytkownika dla uslugi dla klienta * * @param Base_Model_Table $model * @param integer $recipientId * @throws Logic_WebService_Exception * @return void */ public function check(Base_Model_Table $model, $recipientId) { $model = new MailCounter(); $clientParams = $this->_client->getParams(); $serviceParams = $this->_service->getParams(); $counterMonth = $model->getCounter('month', $recipientId, $clientParams->id, $serviceParams->id); if ($counterMonth && $serviceParams->limit_month) { $validatorMonth = new Logic_Validate_ExpiryMonth(); if ($serviceParams->limit_month <= $counterMonth->count_value && !$validatorMonth->isValid($counterMonth->count_at_first)) { throw new Logic_WebService_Exception('Osiagnieto limit miesieczny (' . $serviceParams->limit_month . ') na usluge ' . $serviceParams->service_name . ' dla klienta ' . $clientParams->client_name, 430); } } $counterDay = $model->getCounter('day', $recipientId, $clientParams->id, $serviceParams->id); if ($counterDay && $serviceParams->limit_day) { $validatorDay = new Logic_Validate_ExpiryDay(); if ($serviceParams->limit_day <= $counterDay->count_value && !$validatorDay->isValid($counterMonth->count_at_first)) { throw new Logic_WebService_Exception('Osiagnieto limit dzienny (' . $serviceParams->limit_day . ') na usluge ' . $serviceParams->service_name . ' dla klienta ' . $clientParams->client_name, 431); } } }
/** * Reset zadanego licznika * * @return void */ public function resetcounterAction() { $model = new MailCounter(); $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('counter_id')); $counter = $model->getCounterById($id); if ($counter->count_type == 'day') { $model->resetSubcounter($id); } $model->resetCounter($id); $this->_helper->redirector('details', 'mailrecipient', null, array('id' => $request->getParam('id'))); }