public function processUpdate()
 {
     if (_PS_MODE_DEMO_) {
         $this->errors[] = Tools::displayError('This functionality has been disabled.');
         return;
     }
     if ((isset($_FILES['no_picture']) && !$_FILES['no_picture']['error'] || isset($_FILES['flag']) && !$_FILES['flag']['error']) && Validate::isLanguageIsoCode(Tools::getValue('iso_code'))) {
         if ($_FILES['no_picture']['error'] == UPLOAD_ERR_OK) {
             $this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
         }
         // class AdminTab deal with every $_FILES content, don't do that for no_picture
         unset($_FILES['no_picture']);
     }
     /** @var Language $object */
     $object = $this->loadObject();
     if (Tools::getValue('active') != (int) $object->active) {
         if (!$this->checkDisableStatus($object)) {
             return false;
         }
     }
     $this->checkEmployeeIdLang($object->id);
     return parent::processUpdate();
 }
 /**
  * @see AdminController::processUpdate();
  */
 public function processUpdate()
 {
     // loads object
     if (!($object = $this->loadObject(true))) {
         return;
     }
     /** @var Warehouse $object */
     $this->updateAddress();
     // handles carriers associations
     $ids_carriers_selected = Tools::getValue('ids_carriers_selected');
     if (Tools::isSubmit('ids_carriers_selected') && !empty($ids_carriers_selected)) {
         $object->setCarriers($ids_carriers_selected);
     } else {
         $object->setCarriers(Tools::getValue('ids_carriers_available'));
     }
     return parent::processUpdate();
 }
    public function processUpdate()
    {
        $country = $this->loadObject();
        if (Validate::isLoadedObject($country) && Tools::getValue('id_zone')) {
            $old_id_zone = $country->id_zone;
            $results = Db::getInstance()->executeS('SELECT `id_state` FROM `' . _DB_PREFIX_ . 'state` WHERE `id_country` = ' . (int) $country->id . ' AND `id_zone` = ' . (int) $old_id_zone);
            if ($results && count($results)) {
                $ids = array();
                foreach ($results as $res) {
                    $ids[] = (int) $res['id_state'];
                }
                if (count($ids)) {
                    $res = Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'state` 
							SET `id_zone` = ' . (int) Tools::getValue('id_zone') . ' 
							WHERE `id_state` IN (' . implode(',', $ids) . ')');
                }
            }
        }
        return parent::processUpdate();
    }
    public function processUpdate()
    {
        if (Validate::isLoadedObject($this->object)) {
            $customer_email = strval(Tools::getValue('email'));
            // check if e-mail already used
            if ($customer_email != $this->object->email) {
                $customer = new Customer();
                if (Validate::isEmail($customer_email)) {
                    $customer->getByEmail($customer_email);
                }
                if ($customer->id && $customer->id != (int) $this->object->id) {
                    $this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $customer_email;
                }
            }
            return parent::processUpdate();
        } else {
            $this->errors[] = Tools::displayError('An error occurred while loading the object.') . '
				<b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
        }
    }
 /**
  * Override processUpdate to change SaveAndStay button action
  * @see classes/AdminControllerCore::processUpdate()
  */
 public function processUpdate()
 {
     $object = parent::processUpdate();
     if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
         if ($this->display == 'add') {
             $this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
         } else {
             $this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&id_attribute_group=' . (int) Tools::getValue('id_attribute_group') . '&conf=3&update' . $this->table . '&token=' . $this->token;
         }
     }
     if (count($this->errors)) {
         $this->setTypeAttribute();
     }
     return $object;
 }
 public function processUpdate()
 {
     $id = Tools::getValue('block_identifier');
     $block = BelvgStaticBlocks::getBlockByIdentifier($id);
     if ($block === FALSE || $block->id == $_POST[$this->identifier]) {
         return parent::processUpdate();
     }
     $this->errors[] = Tools::displayError('Duplicate field "block_identifier".');
     $this->display = 'edit';
     return FALSE;
 }
 public function processUpdate()
 {
     $this->redirect_shop_url = false;
     $current_url = parse_url($_SERVER['REQUEST_URI']);
     if (trim(dirname(dirname($current_url['path'])), '/') == trim($this->object->getBaseURI(), '/')) {
         $this->redirect_shop_url = true;
     }
     /** @var ShopUrl $object */
     $object = $this->loadObject(true);
     if ($object->main && !Tools::getValue('main')) {
         $this->errors[] = $this->trans('You cannot change a main URL to a non-main URL. You have to set another URL as your Main URL for the selected shop.', array(), 'Admin.Notifications.Error');
     }
     if (($object->main || Tools::getValue('main')) && !Tools::getValue('active')) {
         $this->errors[] = $this->trans('You cannot disable the Main URL.', array(), 'Admin.Notifications.Error');
     }
     return parent::processUpdate();
 }
 /**
  * Override processUpdate to change SaveAndStay button action
  * @see classes/AdminControllerCore::processUpdate()
  */
 public function processUpdate()
 {
     $object = parent::processUpdate();
     if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay') && !count($this->errors)) {
         $this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=&conf=3&update' . $this->table . '&token=' . $this->token;
     }
     return $object;
 }
 /**
  * @see AdminController::processUpdate();
  */
 public function processUpdate()
 {
     // loads object
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $this->updateAddress();
     // handles carriers associations
     $obj->setCarriers(Tools::getValue('ids_carriers'), array());
     return parent::processUpdate();
 }
 public function processUpdate()
 {
     $this->redirect_shop_url = false;
     $current_url = parse_url($_SERVER['REQUEST_URI']);
     if (trim(dirname(dirname($current_url['path'])), '/') == trim($this->object->getBaseURI(), '/')) {
         $this->redirect_shop_url = true;
     }
     return parent::processUpdate();
 }
    public function processUpdate()
    {
        if (Validate::isLoadedObject($this->object)) {
            return parent::processUpdate();
        } else {
            $this->errors[] = Tools::displayError('An error occurred while loading the object.') . '
				<b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
        }
    }
    public function processUpdate()
    {
        $country = $this->loadObject();
        if (Validate::isLoadedObject($country) && Tools::getValue('id_zone')) {
            $old_id_zone = $country->id_zone;
            //we change zone for states attached to this country, only if they have the same id zone before change
            if (parent::processUpdate()) {
                $results = Db::getInstance()->executeS('SELECT `id_state` FROM `' . _DB_PREFIX_ . 'state` WHERE `id_country` = ' . (int) $country->id . ' AND `id_zone` = ' . (int) $old_id_zone);
                $ids = array();
                foreach ($results as $res) {
                    $ids[] = (int) $res['id_state'];
                }
                Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'state` 
					SET `id_zone` = ' . (int) Tools::getValue('id_zone') . ' 
					WHERE `id_state` IN (' . implode(',', $ids) . ')');
            }
        } else {
            parent::processUpdate();
        }
    }