示例#1
0
 function ValidateForm()
 {
     global $Language, $gsFormError;
     // Initialize form error message
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if (!ew_CheckRange($this->mes->FormValue, 1, 12)) {
         ew_AddMessage($gsFormError, $this->mes->FldErrMsg());
     }
     if (!ew_CheckRange($this->anio->FormValue, 2012, 2100)) {
         ew_AddMessage($gsFormError, $this->anio->FldErrMsg());
     }
     if (!ew_CheckEuroDate($this->fecha->FormValue)) {
         ew_AddMessage($gsFormError, $this->fecha->FldErrMsg());
     }
     if (!ew_CheckNumber($this->monto->FormValue)) {
         ew_AddMessage($gsFormError, $this->monto->FldErrMsg());
     }
     // Validate detail grid
     $DetailTblVar = explode(",", $this->getCurrentDetailTable());
     if (in_array("detalle_deudas", $DetailTblVar) && $GLOBALS["detalle_deudas"]->DetailAdd) {
         if (!isset($GLOBALS["detalle_deudas_grid"])) {
             $GLOBALS["detalle_deudas_grid"] = new cdetalle_deudas_grid();
         }
         // get detail page object
         $GLOBALS["detalle_deudas_grid"]->ValidateGridForm();
     }
     if (in_array("pagos", $DetailTblVar) && $GLOBALS["pagos"]->DetailAdd) {
         if (!isset($GLOBALS["pagos_grid"])) {
             $GLOBALS["pagos_grid"] = new cpagos_grid();
         }
         // get detail page object
         $GLOBALS["pagos_grid"]->ValidateGridForm();
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         ew_AddMessage($gsFormError, $sFormCustomError);
     }
     return $ValidateForm;
 }
示例#2
0
 function ValidateForm()
 {
     global $Language, $gsFormError;
     // Initialize form error message
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if (!$this->NAME_IN_CARD->FldIsDetailKey && !is_null($this->NAME_IN_CARD->FormValue) && $this->NAME_IN_CARD->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->NAME_IN_CARD->FldCaption(), $this->NAME_IN_CARD->ReqErrMsg));
     }
     if (!$this->NUMBER->FldIsDetailKey && !is_null($this->NUMBER->FormValue) && $this->NUMBER->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->NUMBER->FldCaption(), $this->NUMBER->ReqErrMsg));
     }
     if (!ew_CheckCreditCard($this->NUMBER->FormValue)) {
         ew_AddMessage($gsFormError, $this->NUMBER->FldErrMsg());
     }
     if (!$this->CARD_TYPE_ID->FldIsDetailKey && !is_null($this->CARD_TYPE_ID->FormValue) && $this->CARD_TYPE_ID->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->CARD_TYPE_ID->FldCaption(), $this->CARD_TYPE_ID->ReqErrMsg));
     }
     if (!$this->BANK_ID->FldIsDetailKey && !is_null($this->BANK_ID->FormValue) && $this->BANK_ID->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->BANK_ID->FldCaption(), $this->BANK_ID->ReqErrMsg));
     }
     if (!$this->VALID_THRU_MONTH->FldIsDetailKey && !is_null($this->VALID_THRU_MONTH->FormValue) && $this->VALID_THRU_MONTH->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->VALID_THRU_MONTH->FldCaption(), $this->VALID_THRU_MONTH->ReqErrMsg));
     }
     if (!ew_CheckRange($this->VALID_THRU_MONTH->FormValue, 1, 12)) {
         ew_AddMessage($gsFormError, $this->VALID_THRU_MONTH->FldErrMsg());
     }
     if (!$this->VALID_THRU_YEAR->FldIsDetailKey && !is_null($this->VALID_THRU_YEAR->FormValue) && $this->VALID_THRU_YEAR->FormValue == "") {
         ew_AddMessage($gsFormError, str_replace("%s", $this->VALID_THRU_YEAR->FldCaption(), $this->VALID_THRU_YEAR->ReqErrMsg));
     }
     if (!ew_CheckRange($this->VALID_THRU_YEAR->FormValue, 15, 50)) {
         ew_AddMessage($gsFormError, $this->VALID_THRU_YEAR->FldErrMsg());
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         ew_AddMessage($gsFormError, $sFormCustomError);
     }
     return $ValidateForm;
 }
示例#3
0
 function ValidateForm()
 {
     global $gsFormError, $Ideas;
     // Initialize
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if ($Ideas->Text->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Text";
     }
     if ($Ideas->Sequence->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Sequence";
     }
     if (!ew_CheckRange($Ideas->Sequence->FormValue, 0, 65535)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 65535 - Sequence";
     }
     if ($Ideas->Active->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Active";
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= $sFormCustomError;
     }
     return $ValidateForm;
 }
示例#4
0
 function ValidateForm()
 {
     global $Language, $gsFormError;
     // Initialize form error message
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if (!ew_CheckRange($this->mes->FormValue, 1, 12)) {
         ew_AddMessage($gsFormError, $this->mes->FldErrMsg());
     }
     if (!ew_CheckRange($this->anio->FormValue, 2012, 2100)) {
         ew_AddMessage($gsFormError, $this->anio->FldErrMsg());
     }
     if (!ew_CheckEuroDate($this->fecha->FormValue)) {
         ew_AddMessage($gsFormError, $this->fecha->FldErrMsg());
     }
     if (!ew_CheckNumber($this->monto->FormValue)) {
         ew_AddMessage($gsFormError, $this->monto->FldErrMsg());
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         ew_AddMessage($gsFormError, $sFormCustomError);
     }
     return $ValidateForm;
 }
示例#5
0
function ew_CheckDay($checkYear, $checkMonth, $checkDay)
{
    $maxDay = 31;
    if ($checkMonth == 4 || $checkMonth == 6 || $checkMonth == 9 || $checkMonth == 11) {
        $maxDay = 30;
    } elseif ($checkMonth == 2) {
        if ($checkYear % 4 > 0) {
            $maxDay = 28;
        } elseif ($checkYear % 100 == 0 && $checkYear % 400 > 0) {
            $maxDay = 28;
        } else {
            $maxDay = 29;
        }
    }
    return ew_CheckRange($checkDay, 1, $maxDay);
}
示例#6
0
 function ValidateForm()
 {
     global $gsFormError, $Customers;
     // Initialize
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if (!ew_CheckEmail($Customers->zEmail->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect email - Email";
     }
     if ($Customers->Password->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Password";
     }
     if ($Customers->FirstName->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - First Name";
     }
     if ($Customers->LastName->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Last Name";
     }
     if (!ew_CheckPhone($Customers->ContactPhone->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect phone number - Contact Phone";
     }
     if (!ew_CheckZip($Customers->DeliveryZip->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect ZIP code - Delivery Zip";
     }
     if (!ew_CheckZip($Customers->BillingZip->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect ZIP code - Billing Zip";
     }
     if (!ew_CheckPhone($Customers->BillingPhone->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect phone number - Billing Phone";
     }
     if (!ew_CheckInteger($Customers->BillingCardNumber->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Billing Card Number";
     }
     if (!ew_CheckInteger($Customers->CIMCustID->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Authorize.net Customer Profile ID";
     }
     if (!ew_CheckInteger($Customers->CIMPymtProfID->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Authorize.net Payment Profile ID";
     }
     if (!ew_CheckUSDate($Customers->First_Order_Date->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect date, format = mm/dd/yyyy - First Order Date";
     }
     if (!ew_CheckEuroDate($Customers->Last_Order_Date->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect date, format = dd/mm/yyyy - Last Order Date";
     }
     if ($Customers->Total_Orders->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Total Orders";
     }
     if (!ew_CheckInteger($Customers->Total_Orders->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Total Orders";
     }
     if ($Customers->WeeklyMeals->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Subscription Weekly Meals";
     }
     if (!ew_CheckRange($Customers->WeeklyMeals->FormValue, 0, 255)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 255 - Subscription Weekly Meals";
     }
     if ($Customers->WeeklyReg->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Subscription Regular Meals";
     }
     if (!ew_CheckRange($Customers->WeeklyReg->FormValue, 0, 255)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 255 - Subscription Regular Meals";
     }
     if ($Customers->WeeklyVeg->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Subscription vegetarian Meals";
     }
     if (!ew_CheckRange($Customers->WeeklyVeg->FormValue, 0, 255)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 255 - Subscription vegetarian Meals";
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= $sFormCustomError;
     }
     return $ValidateForm;
 }
示例#7
0
 function ValidateForm()
 {
     global $gsFormError, $Menus;
     // Initialize
     $gsFormError = "";
     if ($Menus->MenuName->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Menu Name";
     }
     if ($Menus->Sequence->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Sequence";
     }
     if (!ew_CheckRange($Menus->Sequence->FormValue, 0, 65535)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 65535 - Sequence";
     }
     if ($Menus->Active->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Active";
     }
     if (!ew_CheckInteger($Menus->packing_slip_sequence->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - packing slip sequence";
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= $sFormCustomError;
     }
     return $ValidateForm;
 }
示例#8
0
 function ValidateSearch()
 {
     global $gsSearchError;
     // Initialize
     $gsSearchError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return TRUE;
     }
     if (!ew_CheckRange($this->mes->AdvancedSearch->SearchValue, 1, 12)) {
         ew_AddMessage($gsSearchError, $this->mes->FldErrMsg());
     }
     if (!ew_CheckRange($this->anio->AdvancedSearch->SearchValue, 2012, 2100)) {
         ew_AddMessage($gsSearchError, $this->anio->FldErrMsg());
     }
     if (!ew_CheckEuroDate($this->fecha->AdvancedSearch->SearchValue)) {
         ew_AddMessage($gsSearchError, $this->fecha->FldErrMsg());
     }
     if (!ew_CheckNumber($this->monto->AdvancedSearch->SearchValue)) {
         ew_AddMessage($gsSearchError, $this->monto->FldErrMsg());
     }
     // Return validate result
     $ValidateSearch = $gsSearchError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         ew_AddMessage($gsSearchError, $sFormCustomError);
     }
     return $ValidateSearch;
 }
示例#9
0
 function ValidateForm()
 {
     global $gsFormError, $Items;
     // Initialize
     $gsFormError = "";
     if (!ew_CheckFileType($Items->Image->Upload->FileName)) {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "File type is not allowed.";
     }
     if ($Items->Image->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0) {
         if ($Items->Image->Upload->FileSize > EW_MAX_FILE_SIZE) {
             $gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, "Max. file size (%s bytes) exceeded.");
         }
     }
     if (!ew_CheckFileType($Items->PDF->Upload->FileName)) {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "File type is not allowed.";
     }
     if ($Items->PDF->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0) {
         if ($Items->PDF->Upload->FileSize > EW_MAX_FILE_SIZE) {
             $gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, "Max. file size (%s bytes) exceeded.");
         }
     }
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if ($Items->MenuID->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Menu";
     }
     if ($Items->ItemName->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Item Name";
     }
     if ($Items->Description->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Description";
     }
     if (!ew_CheckNumber($Items->Price->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect floating point number - Price";
     }
     if ($Items->Vegetarian->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Vegetarian";
     }
     if (!ew_CheckNumber($Items->Vegetarian_Price->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect floating point number - Vegetarian Price";
     }
     if ($Items->Sequence->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Sequence";
     }
     if (!ew_CheckRange($Items->Sequence->FormValue, 0, 65535)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 65535 - Sequence";
     }
     if ($Items->Active->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Active";
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= $sFormCustomError;
     }
     return $ValidateForm;
 }
示例#10
0
 function ValidateForm()
 {
     global $gsFormError, $OrderDetails;
     // Initialize
     $gsFormError = "";
     // Check if validation required
     if (!EW_SERVER_VALIDATE) {
         return $gsFormError == "";
     }
     if (!ew_CheckInteger($OrderDetails->OrderID->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Order ID";
     }
     if ($OrderDetails->CustomerID->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Customer";
     }
     if ($OrderDetails->ItemID->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Item Name";
     }
     if ($OrderDetails->Count->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Regular Servings";
     }
     if (!ew_CheckRange($OrderDetails->Count->FormValue, 0, 65535)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Number must be between 0 and 65535 - Regular Servings";
     }
     if ($OrderDetails->VegCount->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Vegetarian Servings";
     }
     if (!ew_CheckInteger($OrderDetails->VegCount->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect integer - Vegetarian Servings";
     }
     if ($OrderDetails->Amount->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Amount";
     }
     if (!ew_CheckNumber($OrderDetails->Amount->FormValue)) {
         if ($gsFormError != "") {
             $gsFormError .= "<br>";
         }
         $gsFormError .= "Incorrect floating point number - Amount";
     }
     if ($OrderDetails->Chefs_Tasting->FormValue == "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= "Please enter required field - Chefs Tasting";
     }
     // Return validate result
     $ValidateForm = $gsFormError == "";
     // Call Form_CustomValidate event
     $sFormCustomError = "";
     $ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
     if ($sFormCustomError != "") {
         $gsFormError .= $gsFormError != "" ? "<br>" : "";
         $gsFormError .= $sFormCustomError;
     }
     return $ValidateForm;
 }