Example #1
0
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if (empty($data['phone_number']) && empty($data['sms_id']) && (empty($data['date_until']) || empty($data['date_from']))) {
         $this->addErrorMessage('"Data do" i "Data od" sa wymagane jeżeli nie podasz "SMS ID" lub Numeru telefonu');
         return false;
     }
     if (empty($data['sms_id']) && empty($data['phone_number'])) {
         try {
             $dateCheck = new Zend_Date($data['date_from']);
             if (!$dateCheck->isEarlier($data['date_until']) and 0 != strcmp($data['date_from'], $data['date_until'])) {
                 $isValid = false;
                 $this->addErrorMessage('"Data do" nie może być wcześniejsza niż "Data od"!');
             }
             $dateSub = new Zend_Date($data['date_until']);
             $config = Zend_Registry::get('config');
             if ($dateSub->sub($dateCheck)->toValue('DD') > $config['search']['mail']['filter']['interval']) {
                 $isValid = false;
                 $this->addErrorMessage('Maksymalny okres z jakiego można wyszukiwać dane to ' . $config['search']['sms']['filter']['interval'] . ' dni');
             }
         } catch (Exception $ex) {
             $this->addErrorMessage($ex->getMessage());
             $isValid = false;
         }
     }
     return $isValid;
 }
Example #2
0
 public function isValid($data)
 {
     $return = parent::isValid($data);
     if ($this->getElement('new_password')->getValue() != $this->getElement('retype_new_password')->getValue()) {
         $this->getElement('retype_new_password')->addError("Inconsistent with new password");
         $return = false;
     }
     return $return;
 }
Example #3
0
 public function isValid($data)
 {
     $this->isValidPartial($data);
     $passErrors = $this->getElement("ldapPassword")->getErrors();
     if (!empty($passErrors)) {
         $this->getElement("login")->clearValidators();
     }
     return parent::isValid($data);
 }
Example #4
0
 public function isValid($data)
 {
     $valid = parent::isValid($data);
     if (empty($data['phone']) && empty($data['email'])) {
         $this->addErrorMessage('Należy podać numer telefonu bądź adres email');
         $valid = false;
     }
     return $valid;
 }
Example #5
0
 public function isValid($data)
 {
     $valid = parent::isValid($data);
     if (!empty($data['send_start']) && !empty($data['send_end'])) {
         if (strtotime($data['send_start']) >= strtotime($data['send_end'])) {
             $this->getElement('send_end')->addError('Data do musi być późniejsza niż data od');
             $valid = false;
         }
     }
     return $valid;
 }
Example #6
0
 public function isValid($data)
 {
     $valid = parent::isValid($data);
     $date1 = new Zend_Date($data['valid_since']);
     $date2 = new Zend_Date($data['valid_until']);
     if ($date1->isLater($date2)) {
         $this->addError('Nieprawidłowy przedział dat.');
         $valid = false;
     }
     return $valid;
 }
Example #7
0
 /**
  * Ustawia wartosci filtrow
  *
  * Nie wymaga przeslania danych via POST
  *
  * @param Zend_Controller_Request_Http $request
  * @return Logic_Search_Abstract
  */
 public function setFilterDataFromRequest(Zend_Controller_Request_Http $request)
 {
     if (!is_object($this->_form)) {
         throw new Logic_Search_Exception('Nie ustanowiono obiektu formularza filtrow');
     }
     if ($this->_form->isValid($request->getParams())) {
         $this->saveFilterData($this->_form->getValues());
     }
     $this->_form->setDefaults($this->getFilterData());
     return $this;
 }
Example #8
0
 public function isValid($data)
 {
     if (in_array(Logic_Ws_ServiceSet_ServiceSet::SHIPPING_TYPE_HTTP, $data['shipping_type'])) {
         $this->getElement('delimiter')->setRequired(true);
         $this->getElement('file_type')->setRequired(true);
         if ($data['file_type'] != Logic_Ws_ServiceSet_ServiceSet::TYPE_ANY) {
             $this->getElement('message')->setRequired(true);
         }
     }
     return parent::isValid($data);
 }
Example #9
0
 public function isValid($data)
 {
     $maskModel = new WsServiceSmsMask();
     $isValid = parent::isValid($data);
     if ($isValid) {
         $validMasks = $maskModel->getMaskForServices($data['ws_service_id'], $data['id_mask']);
         if ($validMasks->count() !== count($data['ws_service_id'])) {
             $isValid = false;
             $this->setErrors(array("Wybrana usługa nie obsługuje wybranego nadpisu"));
         }
     }
     return $isValid;
 }
Example #10
0
 public function isValid($data)
 {
     $phoneCol = $data['phone_heders'];
     $emailCol = $data['email_heders'];
     if (!empty($phoneCol) && !empty($emailCol)) {
         $validator = new Logic_Validate_NotEqual($phoneCol);
         $validator->setMessage("Kolumna z adresami email musi być inna niż z numerami telefonów");
         $this->getElement('phone_heders')->setAttrib('options', array($phoneCol => $phoneCol));
         $this->getElement('email_heders')->setAttrib('options', array($emailCol => $emailCol))->addValidator($validator);
     }
     $isValid = parent::isValid($data);
     $certFileName = $this->_receiveFiles('addressbook_import_csv');
     return $isValid;
 }
Example #11
0
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if ($isValid) {
         $model = new WsTemplate();
         $hash = new Logic_Filter_StringToHash();
         $template = $model->getTemplateNewest($hash->filter($data['template_name']));
         if ($template !== null) {
             $isValid = FALSE;
             $this->template_name->addError("Szablon o takiej nazwie już istnieje");
         }
     }
     return $isValid;
 }
Example #12
0
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if (!empty($data['date_for']) && !empty($data['date_to'])) {
         $date = new Zend_Date();
         $date2 = clone $date;
         $date->setDate($data['date_for'], 'YYYY-MM-dd')->getTimestamp();
         $date2->setDate($data['date_to'], 'YYYY-MM-dd')->getTimestamp();
         if ($date->isLater($date2)) {
             $isValid = false;
             $this->getElement('date_to')->addError("Data do nie może być wcześniejsza niż data od");
         }
     }
     return $isValid;
 }
Example #13
0
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     $ipValidator = new Logic_Validate_Ip();
     $ips = explode(PHP_EOL, $data['ip']);
     foreach ($ips as $ip) {
         list($ip_address, $mask) = explode('/', $ip);
         $ipValidator->setRange($ip);
         if (false === $ipValidator->isValid(trim($ip_address))) {
             $this->getElement('ip')->addError("{$ip} nie jest poprawnym adresem IP");
             $isValid = false;
         }
     }
     return $isValid;
 }
Example #14
0
 /**
  * Walidacja poprawności parametrów
  * @param array $data
  */
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     $wsServiceSmsModel = new WsServiceSms();
     $wsServiceSmsRow = $wsServiceSmsModel->findOne($data['service_id']);
     foreach (array('crt', 'pem') as $type) {
         $this->getElement($type)->addFilter(new Zend_Filter_File_Rename(array('target' => $wsServiceSmsRow->service_login . ".{$type}")));
         $certFileName[$type] = $this->_receiveFiles($type);
     }
     try {
         Logic_Ws_Cert::isCertificateValid($certFileName['crt']);
     } catch (Exception $exc) {
         $this->getElement('crt')->addError($exc->getMessage());
         $isValid = false;
     }
     return $isValid;
 }
Example #15
0
 public function isValid($data)
 {
     $valid = parent::isValid($data);
     if ($data['timeblock_end'] !== '') {
         if (strtotime($data['timeblock_end']) <= strtotime($data['timeblock_start'])) {
             $this->getElement('timeblock_end')->addError('Data końca blokady musi być późniejsza niż data jej początku');
             $valid = false;
         }
     }
     if ($data['timeblock_start'] !== '') {
         if (strtotime($data['timeblock_start']) < strtotime(date('Y-m-d'))) {
             $this->getElement('timeblock_start')->addError('Data początku blokady nie może być przeszła');
             $valid = false;
         }
     }
     return $valid;
 }
Example #16
0
 public function isValid($data)
 {
     $valid = parent::isValid($data);
     if ($valid) {
         if (strtotime($data['timelock_start']) < strtotime(date('Y-m-d'))) {
             $valid = false;
             $this->getElement('timelock_start')->addError('Data nie może być w ustawiona wprzeszłości');
         }
         if (strtotime($data['timelock_end']) < strtotime(date('Y-m-d'))) {
             $valid = false;
             $this->getElement('timelock_end')->addError('Data nie może być w ustawiona wprzeszłości');
         }
         if (strtotime($data['timelock_end']) < strtotime($data['zablokowane_czasowo_start'])) {
             $valid = false;
             $this->getElement('timelock_end')->addError('Data końca blokady nie może być w ustawiona przed datą rozpoczęcia blokady');
         }
     }
     return $valid;
 }
Example #17
0
 public function isValid($data)
 {
     $serviceSetmodel = new WsServiceSet();
     $serviceSetInfo = $serviceSetmodel->getSet($data['ws_service_set_id']);
     if ($serviceSetInfo === null) {
         $this->setErrorMessages(array('Brak danych o wysyłce'));
     }
     $isValid = parent::isValid($data);
     if ($isValid) {
         $this->_receiveFiles('addressbook_import_csv');
         if ($serviceSetInfo->file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_VAR) {
             $tagsValidator = $this->tagsValidator($data, $serviceSetInfo);
             if (!empty($tagsValidator)) {
                 $isValid = false;
                 $this->setErrorMessages($tagsValidator);
             }
         }
     }
     return $isValid;
 }
Example #18
0
 public function isValid($data)
 {
     $isValid = parent::isValid($data);
     if ($isValid) {
         $date = new Zend_Date();
         $date2 = clone $date;
         $date->set($data['date_for'], 'YYYY-MM-dd');
         $date2->set($data['date_to'], 'YYYY-MM-dd');
         if ($date->getDate()->isLater($date2->getDate())) {
             $isValid = false;
             $this->getElement('date_to')->addError('Data do musi być późniejsza niż Data od');
         } else {
             $date->addDay(31);
             if ($date->getDate()->isEarlier($date2->getDate())) {
                 $isValid = false;
                 $this->getElement('date_to')->addError('Wygenerowanie raportu możliwe jest za dowolny okres obejmujący max 31 dni');
             }
         }
     }
     return $isValid;
 }
Example #19
0
 public function isValid($data)
 {
     $contactCol = $data['phone_heders'];
     $messageCol = $data['message_heders'];
     $file_type = (int) $data['file_type'];
     $serviceSetmodel = new WsServiceSet();
     $serviceSetInfo = $serviceSetmodel->getSet($data['ws_service_set_id']);
     if ($serviceSetInfo !== null) {
         if ($serviceSetInfo->file_type !== null && $serviceSetInfo->file_type != $file_type) {
             $this->addErrorMessage("Typ wysyłki rózni się od zdefiniowanego");
             return false;
         }
         if ($file_type != Logic_Ws_ServiceSet_ServiceSet::TYPE_CONST && $serviceSetInfo->delimeter != null && $serviceSetInfo->delimeter !== (int) $data['delimeter']) {
             $this->addErrorMessage("Separator pola rózni się od zdefiniowanego");
             return false;
         }
         if ($file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_CONST && $serviceSetInfo->ws_addressbook_id != null && $serviceSetInfo->ws_addressbook_id !== (int) $data['ws_addressbook_id']) {
             $this->addErrorMessage("Wybrana książka adresowa rózni się od zdefiniowanej");
             return false;
         }
     }
     $notEqualValidator = new Logic_Validate_NotEqual($data['phone_heders']);
     if (!empty($contactCol) || !empty($messageCol) && !empty($contactCol)) {
         $this->getElement('phone_heders')->setAttrib('options', array($contactCol => $contactCol));
         $this->getElement('message_heders')->setAttrib('options', array($messageCol => $messageCol));
     }
     switch ($file_type) {
         case Logic_Ws_ServiceSet_ServiceSet::TYPE_CONST:
             $this->ws_addressbook_id->setRequired(true);
             break;
         case Logic_Ws_ServiceSet_ServiceSet::TYPE_VAR:
             $this->addressbook_import_csv->setRequired(true);
             $this->delimeter->setRequired(true);
             $this->phone_heders->setRequired(true);
             break;
         case Logic_Ws_ServiceSet_ServiceSet::TYPE_ANY:
             $validator = new Logic_Validate_NotEqual($contactCol);
             $validator->setMessage("Kolumna z kontaktami musi być inna niż z wiadomością");
             $this->addressbook_import_csv->setRequired(true);
             $this->delimeter->setRequired(true);
             $this->phone_heders->setRequired(true);
             $this->message_heders->setRequired(true)->addValidator($validator);
             break;
     }
     $isValid = parent::isValid($data);
     if ($file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_VAR || $file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_ANY) {
         $this->_receiveFiles('addressbook_import_csv');
     }
     if ($isValid && $file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_VAR) {
         $tagsValidator = $this->tagsValidator($data);
         if (!empty($tagsValidator)) {
             $isValid = false;
             $this->setErrorMessages($tagsValidator);
         }
     }
     return $isValid;
 }
Example #20
0
 /**
  * Nadpisanie isValid(), pomijające przy walidacji wymagalność pól templateowych.
  */
 public function isValid($data)
 {
     $requiredTemplateFields = array();
     foreach ($this->_baseNames as $baseName) {
         $elem = $this->getElement($baseName . self::TEMPLATE_SUFFIX);
         if ($elem->isRequired()) {
             $requiredTemplateFields[] = $elem;
             $elem->setRequired(false);
         }
     }
     $isValid = parent::isValid($data);
     foreach ($requiredTemplateFields as $field) {
         $field->setRequired(true);
     }
     return $isValid;
 }