Пример #1
0
 protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_combination = 0)
 {
     if (!Validate::isUnsignedId($id_shop) || !Validate::isUnsignedId($id_currency) || !Validate::isUnsignedId($id_country) || !Validate::isUnsignedId($id_group) || !Validate::isUnsignedId($id_customer)) {
         $this->errors[] = Tools::displayError('Wrong IDs');
     } elseif (!isset($price) && !isset($reduction) || isset($price) && !Validate::isNegativePrice($price) || isset($reduction) && !Validate::isPrice($reduction)) {
         $this->errors[] = Tools::displayError('Invalid price/discount amount');
     } elseif (!Validate::isUnsignedInt($from_quantity)) {
         $this->errors[] = Tools::displayError('Invalid quantity');
     } elseif ($reduction && !Validate::isReductionType($reduction_type)) {
         $this->errors[] = Tools::displayError('Please select a discount type (amount or percentage).');
     } elseif ($from && $to && (!Validate::isDateFormat($from) || !Validate::isDateFormat($to))) {
         $this->errors[] = Tools::displayError('The from/to date is invalid.');
     } elseif (SpecificPrice::exists((int) $this->object->id, $id_combination, $id_shop, $id_group, $id_country, $id_currency, $id_customer, $from_quantity, $from, $to, false)) {
         $this->errors[] = Tools::displayError('A specific price already exists for these parameters.');
     } else {
         return true;
     }
     return false;
 }
 protected function _validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_combination = 0)
 {
     $ozgyosby = "to";
     ${"GLOBALS"}["btpodjichm"] = "id_currency";
     ${"GLOBALS"}["bhtycruw"] = "reduction";
     ${"GLOBALS"}["bekhutld"] = "id_customer";
     $rqydxo = "id_customer";
     ${"GLOBALS"}["qqlijffwnzf"] = "id_group";
     ${"GLOBALS"}["vfloimyumc"] = "reduction";
     $rfliqft = "price";
     ${"GLOBALS"}["eylkdzfand"] = "reduction";
     ${"GLOBALS"}["loatbfmujs"] = "from_quantity";
     $oizxlllbrlh = "from";
     ${"GLOBALS"}["vtpluvfuk"] = "from";
     ${"GLOBALS"}["hfjldank"] = "to";
     ${"GLOBALS"}["caxowajj"] = "id_shop";
     ${"GLOBALS"}["tdxizfbhk"] = "to";
     if (!Validate::isUnsignedId(${${"GLOBALS"}["mfhudxleebxl"]}) || !Validate::isUnsignedId(${${"GLOBALS"}["agsaea"]}) || !Validate::isUnsignedId(${${"GLOBALS"}["fhldbhsbjpj"]}) || !Validate::isUnsignedId(${${"GLOBALS"}["lvijxfxbvoub"]}) || !Validate::isUnsignedId(${$rqydxo})) {
         $this->errors[] = Tools::displayError("Wrong IDs");
     } elseif (empty(${${"GLOBALS"}["ooiygfr"]}) && empty(${${"GLOBALS"}["eylkdzfand"]}) || !empty(${${"GLOBALS"}["ooiygfr"]}) && !Validate::isPrice(${$rfliqft}) || !empty(${${"GLOBALS"}["bhtycruw"]}) && !Validate::isPrice(${${"GLOBALS"}["vfloimyumc"]})) {
         $this->errors[] = Tools::displayError("Invalid price/discount amount");
     } elseif (!Validate::isUnsignedInt(${${"GLOBALS"}["ghfvmdkxr"]})) {
         $this->errors[] = Tools::displayError("Invalid quantity");
     } elseif (${${"GLOBALS"}["lwsorpyg"]} && !Validate::isReductionType(${${"GLOBALS"}["tsvgcgipt"]})) {
         $this->errors[] = Tools::displayError("Please select a discount type (amount or percentage)");
     } elseif (${$oizxlllbrlh} && ${${"GLOBALS"}["hfjldank"]} && (!Validate::isDateFormat(${${"GLOBALS"}["vtpluvfuk"]}) || !Validate::isDateFormat(${$ozgyosby}))) {
         $this->errors[] = Tools::displayError("Wrong from/to date");
     } elseif (SpecificPrice::exists((int) $this->object->id, ${${"GLOBALS"}["yfcctxblhl"]}, ${${"GLOBALS"}["caxowajj"]}, ${${"GLOBALS"}["qqlijffwnzf"]}, ${${"GLOBALS"}["fhldbhsbjpj"]}, ${${"GLOBALS"}["btpodjichm"]}, ${${"GLOBALS"}["bekhutld"]}, ${${"GLOBALS"}["loatbfmujs"]}, ${${"GLOBALS"}["mutdbub"]}, ${${"GLOBALS"}["tdxizfbhk"]})) {
         $this->errors[] = Tools::displayError("A specific price already exists for these parameters");
     } else {
         return true;
     }
     return false;
 }