Example #1
0
 public function check()
 {
     $date = new JDate($this->date_from);
     $this->date_from = $date->toSql();
     $date1 = new JDate($this->date_to);
     $this->date_to = $date1->toSql();
     return parent::check();
 }
 public function check()
 {
     $status = parent::check();
     //to throw error when optionvalue id is empty
     /* if(!$this->optionvalue_id){
     			$this->setError(JText::_('J2STORE_PRODUCT_OPTION_VALUE_MISSING'));
     			$status = false;
     		} */
     return $status;
 }
Example #3
0
 public function check()
 {
     if (!isset($this->product_source) || empty($this->product_source)) {
         $this->setError(JText::_('J2STORE_PRODUCT_SOURCE_NOT_FOUND'));
         return false;
     }
     if (!isset($this->product_source_id) || empty($this->product_source_id)) {
         $this->setError(JText::_('J2STORE_PRODUCT_SOURCE_ID_NOT_FOUND'));
         return false;
     }
     return parent::check();
 }
Example #4
0
 public function check()
 {
     $result = true;
     if (!$this->title) {
         $this->setError(JText::_('COM_AKEEBASUBS_APICOUPONS_ERR_TITLE'));
         $result = false;
     }
     if (!$this->key) {
         $this->key = md5(microtime());
     }
     if (!$this->password) {
         $this->password = md5(microtime());
     }
     // Make sure assigned subscriptions really do exist and normalize the list
     if (!empty($this->subscriptions)) {
         if (is_array($this->subscriptions)) {
             $subs = $this->subscriptions;
         } else {
             $subs = explode(',', $this->subscriptions);
         }
         if (empty($subs)) {
             $this->subscriptions = '';
         } else {
             $subscriptions = array();
             foreach ($subs as $id) {
                 $subObject = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($id)->getItem();
                 $id = null;
                 if (is_object($subObject)) {
                     if ($subObject->akeebasubs_level_id > 0) {
                         $id = $subObject->akeebasubs_level_id;
                     }
                 }
                 if (!is_null($id)) {
                     $subscriptions[] = $id;
                 }
             }
             $this->subscriptions = implode(',', $subscriptions);
         }
     }
     // Check the type
     if (!in_array($this->type, array('value', 'percent'))) {
         $this->type = 'value';
     }
     // Check value
     if ($this->value < 0) {
         $this->setError(JText::_('COM_AKEEBASUBS_COUPON_ERR_VALUE'));
         $result = false;
     } elseif ($this->value > 100 && $this->type == 'percent') {
         $this->value = 100;
     }
     return parent::check() && $result;
 }
Example #5
0
 /**
  * Overrides the automated table checks to handle the 'hash' column for faster searching
  *
  * @return boolean
  */
 public function check()
 {
     // Create a slug if there is a title and an empty slug
     if ($this->hasField('title') && $this->hasField('slug') && empty($this->slug)) {
         $this->slug = F0FStringUtils::toSlug($this->title);
     }
     // Create the SHA-1 hash of the slug for faster searching (make sure the hash column is CHAR(64) to take
     // advantage of MySQL's optimised searching for fixed size CHAR columns)
     if ($this->hasField('hash') && $this->hasField('slug')) {
         $this->hash = sha1($this->slug);
     }
     // Reset cached values
     $this->resetTreeCache();
     return parent::check();
 }
Example #6
0
 public function check()
 {
     $result = parent::check();
     if (empty($this->slug)) {
         $this->setError(JText::_('COM_AKEEBASUBS_ERR_SLUG_EMPTY'));
         $result = false;
     } else {
         $pattern = '/^[a-z_][a-z0-9_\\-]*$/';
         if (!preg_match($pattern, $this->slug)) {
             $this->setError(JText::_('COM_AKEEBASUBS_ERR_SLUG_INVALID'));
             $result = false;
         }
     }
     return $result;
 }
Example #7
0
 public function check()
 {
     $result = true;
     if (!$this->country_name) {
         $this->setError(JText::_('COM_J2STORE_COUNTRY_MISSING'));
         $result = false;
     }
     if (!$this->country_isocode_2) {
         $this->setError(JText::_('COM_J2STORE_COUNTRY_ISOCODE2_MISSING'));
         $result = false;
     }
     if (!$this->country_isocode_3) {
         $this->setError(JText::_('COM_J2STORE_COUNTRY_ISOCODE3_MISSING'));
         $result = false;
     }
     return parent::check() && $result;
 }
Example #8
0
 public function check()
 {
     $result = true;
     //check variant id exists
     if (empty($this->product_id)) {
         $this->setError(JText::_('COM_J2STORE_VARIANT_ID_MISSING'));
         $result = false;
     }
     if (empty($this->product_file_display_name)) {
         $this->setError(JText::_('J2STORE_PRODUCT_FILE_DISPLAY_NAME_IS_EMPTY'));
         $result = false;
     }
     //check product file path is not empty
     if (empty($this->product_file_save_name)) {
         $this->setError(JText::_('J2STORE_PRODUCT_FILE_PATH_IS_EMPTY'));
         $result = false;
     }
     //to check given file path is valid
     if ($this->checkAttachmentPathExists()) {
         $this->setError(JText::_('J2STORE_PRODUCT_FILE_PATH_IS_EMPTY'));
         $result = false;
     }
     return parent::check() && $result;
 }