示例#1
0
 function Page_Main()
 {
     $qs = new cQueryString();
     if ($qs->Count > 0) {
         $Sql = $qs->getValue("s");
         $Sql = TEAdecrypt($Sql, EW_RANDOM_KEY);
         if ($Sql != "") {
             // Get the filter values (for "IN")
             $Value = ew_AdjustSql($qs->getConvertedValue("f"));
             if ($Value != "") {
                 $arValue = explode(",", $Value);
                 $FldType = $qs->getValue("lft");
                 // Filter field data type
                 if (is_numeric($FldType)) {
                     $FldType = intval($FldType);
                 }
                 $cnt = count($arValue);
                 for ($i = 0; $i < $cnt; $i++) {
                     $arValue[$i] = ew_QuotedValue($arValue[$i], $FldType);
                 }
                 $Sql = str_replace("{filter_value}", implode(",", $arValue), $Sql);
             }
             // get the query value (for "LIKE" or "=")
             $Value = ew_AdjustSql($qs->getConvertedValue("q"));
             if ($Value != "") {
                 $Sql = str_replace("{query_value}", $Value, $Sql);
             }
             $this->GetLookupValues($Sql);
         }
     } else {
         die("Missing querystring.");
     }
 }
示例#2
0
 function Page_Main()
 {
     $post = ew_StripSlashes($_POST);
     if (count($post) == 0) {
         die("Missing post data.");
     }
     //$sql = $qs->getValue("s");
     $sql = $post["s"];
     $sql = TEAdecrypt($sql, EW_RANDOM_KEY);
     if ($sql == "") {
         die("Missing SQL.");
     }
     if (strpos($sql, "{filter}") > 0) {
         $filters = "";
         for ($i = 0; $i < 5; $i++) {
             // Get the filter values (for "IN")
             $filter = TEAdecrypt($post["f" . $i], EW_RANDOM_KEY);
             if ($filter != "") {
                 $value = $post["v" . $i];
                 if ($value == "") {
                     if ($i > 0) {
                         // Empty parent field
                         //continue; // Allow
                         ew_AddFilter($filters, "1=0");
                     }
                     // Disallow
                     continue;
                 }
                 $arValue = explode(",", $value);
                 $fldtype = intval($post["t" . $i]);
                 for ($j = 0, $cnt = count($arValue); $j < $cnt; $j++) {
                     $arValue[$j] = ew_QuotedValue($arValue[$j], ew_FieldDataType($fldtype));
                 }
                 $filter = str_replace("{filter_value}", implode(",", $arValue), $filter);
                 ew_AddFilter($filters, $filter);
             }
         }
         $sql = str_replace("{filter}", $filters != "" ? $filters : "1=1", $sql);
     }
     // Get the query value (for "LIKE" or "=")
     $value = ew_AdjustSql(@$post["q"]);
     if ($value != "") {
         $sql = preg_replace('/LIKE \'(%)?\\{query_value\\}%\'/', ew_Like('\'$1{query_value}%\''), $sql);
         $sql = str_replace("{query_value}", $value, $sql);
     }
     // Check custom function
     $fn = @$post["fn"];
     if ($fn != "" && function_exists($fn)) {
         // Custom function(&$sql)
         $sql = $fn($sql);
     }
     $this->GetLookupValues($sql);
 }
 function RenderRow()
 {
     global $conn, $Security, $Customers;
     // Call Row_Rendering event
     $Customers->Row_Rendering();
     // Common render codes for all row types
     // CustomerID
     $Customers->CustomerID->CellCssStyle = "";
     $Customers->CustomerID->CellCssClass = "";
     // Email
     $Customers->zEmail->CellCssStyle = "";
     $Customers->zEmail->CellCssClass = "";
     // FirstName
     $Customers->FirstName->CellCssStyle = "";
     $Customers->FirstName->CellCssClass = "";
     // LastName
     $Customers->LastName->CellCssStyle = "";
     $Customers->LastName->CellCssClass = "";
     // ContactPhone
     $Customers->ContactPhone->CellCssStyle = "";
     $Customers->ContactPhone->CellCssClass = "";
     // Customer_Type
     $Customers->Customer_Type->CellCssStyle = "";
     $Customers->Customer_Type->CellCssClass = "";
     // First_Order_Date
     $Customers->First_Order_Date->CellCssStyle = "";
     $Customers->First_Order_Date->CellCssClass = "";
     // Last_Order_Date
     $Customers->Last_Order_Date->CellCssStyle = "";
     $Customers->Last_Order_Date->CellCssClass = "";
     // Total_Orders
     $Customers->Total_Orders->CellCssStyle = "";
     $Customers->Total_Orders->CellCssClass = "";
     // Delivery_Window
     $Customers->Delivery_Window->CellCssStyle = "";
     $Customers->Delivery_Window->CellCssClass = "";
     // WeeklyMeals
     $Customers->WeeklyMeals->CellCssStyle = "";
     $Customers->WeeklyMeals->CellCssClass = "";
     // WeeklyReg
     $Customers->WeeklyReg->CellCssStyle = "";
     $Customers->WeeklyReg->CellCssClass = "";
     // WeeklyVeg
     $Customers->WeeklyVeg->CellCssStyle = "";
     $Customers->WeeklyVeg->CellCssClass = "";
     // kitchen_note
     $Customers->kitchen_note->CellCssStyle = "";
     $Customers->kitchen_note->CellCssClass = "";
     if ($Customers->RowType == EW_ROWTYPE_VIEW) {
         // View row
         // CustomerID
         $Customers->CustomerID->ViewValue = $Customers->CustomerID->CurrentValue;
         $Customers->CustomerID->CssStyle = "";
         $Customers->CustomerID->CssClass = "";
         $Customers->CustomerID->ViewCustomAttributes = "";
         // Email
         $Customers->zEmail->ViewValue = $Customers->zEmail->CurrentValue;
         $Customers->zEmail->CssStyle = "";
         $Customers->zEmail->CssClass = "";
         $Customers->zEmail->ViewCustomAttributes = "";
         // Password
         $Customers->Password->ViewValue = "********";
         $Customers->Password->CssStyle = "";
         $Customers->Password->CssClass = "";
         $Customers->Password->ViewCustomAttributes = "";
         // FirstName
         $Customers->FirstName->ViewValue = $Customers->FirstName->CurrentValue;
         $Customers->FirstName->CssStyle = "";
         $Customers->FirstName->CssClass = "";
         $Customers->FirstName->ViewCustomAttributes = "";
         // LastName
         $Customers->LastName->ViewValue = $Customers->LastName->CurrentValue;
         $Customers->LastName->CssStyle = "";
         $Customers->LastName->CssClass = "";
         $Customers->LastName->ViewCustomAttributes = "";
         // ContactPhone
         $Customers->ContactPhone->ViewValue = $Customers->ContactPhone->CurrentValue;
         $Customers->ContactPhone->CssStyle = "";
         $Customers->ContactPhone->CssClass = "";
         $Customers->ContactPhone->ViewCustomAttributes = "";
         // Allergies
         $Customers->Allergies->ViewValue = $Customers->Allergies->CurrentValue;
         if (!is_null($Customers->Allergies->ViewValue)) {
             $Customers->Allergies->ViewValue = str_replace("\n", "<br>", $Customers->Allergies->ViewValue);
         }
         $Customers->Allergies->CssStyle = "";
         $Customers->Allergies->CssClass = "";
         $Customers->Allergies->ViewCustomAttributes = "";
         // DeliveryAddress1
         $Customers->DeliveryAddress1->ViewValue = $Customers->DeliveryAddress1->CurrentValue;
         $Customers->DeliveryAddress1->CssStyle = "";
         $Customers->DeliveryAddress1->CssClass = "";
         $Customers->DeliveryAddress1->ViewCustomAttributes = "";
         // DeliveryAddress2
         $Customers->DeliveryAddress2->ViewValue = $Customers->DeliveryAddress2->CurrentValue;
         $Customers->DeliveryAddress2->CssStyle = "";
         $Customers->DeliveryAddress2->CssClass = "";
         $Customers->DeliveryAddress2->ViewCustomAttributes = "";
         // DeliveryCity
         $Customers->DeliveryCity->ViewValue = $Customers->DeliveryCity->CurrentValue;
         $Customers->DeliveryCity->CssStyle = "";
         $Customers->DeliveryCity->CssClass = "";
         $Customers->DeliveryCity->ViewCustomAttributes = "";
         // DeliveryState
         $Customers->DeliveryState->ViewValue = $Customers->DeliveryState->CurrentValue;
         $Customers->DeliveryState->CssStyle = "";
         $Customers->DeliveryState->CssClass = "";
         $Customers->DeliveryState->ViewCustomAttributes = "";
         // DeliveryZip
         $Customers->DeliveryZip->ViewValue = $Customers->DeliveryZip->CurrentValue;
         $Customers->DeliveryZip->CssStyle = "";
         $Customers->DeliveryZip->CssClass = "";
         $Customers->DeliveryZip->ViewCustomAttributes = "";
         // DeliveryComments
         $Customers->DeliveryComments->ViewValue = $Customers->DeliveryComments->CurrentValue;
         $Customers->DeliveryComments->CssStyle = "";
         $Customers->DeliveryComments->CssClass = "";
         $Customers->DeliveryComments->ViewCustomAttributes = "";
         // BillingFirstName
         $Customers->BillingFirstName->ViewValue = $Customers->BillingFirstName->CurrentValue;
         $Customers->BillingFirstName->CssStyle = "";
         $Customers->BillingFirstName->CssClass = "";
         $Customers->BillingFirstName->ViewCustomAttributes = "";
         // BillingLastName
         $Customers->BillingLastName->ViewValue = $Customers->BillingLastName->CurrentValue;
         $Customers->BillingLastName->CssStyle = "";
         $Customers->BillingLastName->CssClass = "";
         $Customers->BillingLastName->ViewCustomAttributes = "";
         // BillingAddress1
         $Customers->BillingAddress1->ViewValue = $Customers->BillingAddress1->CurrentValue;
         $Customers->BillingAddress1->CssStyle = "";
         $Customers->BillingAddress1->CssClass = "";
         $Customers->BillingAddress1->ViewCustomAttributes = "";
         // BillingAddress2
         $Customers->BillingAddress2->ViewValue = $Customers->BillingAddress2->CurrentValue;
         $Customers->BillingAddress2->CssStyle = "";
         $Customers->BillingAddress2->CssClass = "";
         $Customers->BillingAddress2->ViewCustomAttributes = "";
         // BillingCity
         $Customers->BillingCity->ViewValue = $Customers->BillingCity->CurrentValue;
         $Customers->BillingCity->CssStyle = "";
         $Customers->BillingCity->CssClass = "";
         $Customers->BillingCity->ViewCustomAttributes = "";
         // BillingState
         $Customers->BillingState->ViewValue = $Customers->BillingState->CurrentValue;
         $Customers->BillingState->CssStyle = "";
         $Customers->BillingState->CssClass = "";
         $Customers->BillingState->ViewCustomAttributes = "";
         // BillingZip
         $Customers->BillingZip->ViewValue = $Customers->BillingZip->CurrentValue;
         $Customers->BillingZip->CssStyle = "";
         $Customers->BillingZip->CssClass = "";
         $Customers->BillingZip->ViewCustomAttributes = "";
         // BillingPhone
         $Customers->BillingPhone->ViewValue = $Customers->BillingPhone->CurrentValue;
         $Customers->BillingPhone->CssStyle = "";
         $Customers->BillingPhone->CssClass = "";
         $Customers->BillingPhone->ViewCustomAttributes = "";
         // BillingCardType
         $Customers->BillingCardType->ViewValue = $Customers->BillingCardType->CurrentValue;
         $Customers->BillingCardType->CssStyle = "";
         $Customers->BillingCardType->CssClass = "";
         $Customers->BillingCardType->ViewCustomAttributes = "";
         // BillingCardNumber
         $Customers->BillingCardNumber->ViewValue = $Customers->BillingCardNumber->CurrentValue;
         $Customers->BillingCardNumber->CssStyle = "";
         $Customers->BillingCardNumber->CssClass = "";
         $Customers->BillingCardNumber->ViewCustomAttributes = "";
         // CIMCustID
         $Customers->CIMCustID->ViewValue = $Customers->CIMCustID->CurrentValue;
         $Customers->CIMCustID->CssStyle = "";
         $Customers->CIMCustID->CssClass = "";
         $Customers->CIMCustID->ViewCustomAttributes = "";
         // CIMPymtProfID
         $Customers->CIMPymtProfID->ViewValue = $Customers->CIMPymtProfID->CurrentValue;
         $Customers->CIMPymtProfID->CssStyle = "";
         $Customers->CIMPymtProfID->CssClass = "";
         $Customers->CIMPymtProfID->ViewCustomAttributes = "";
         // Customer_Type
         $Customers->Customer_Type->ViewValue = $Customers->Customer_Type->CurrentValue;
         $Customers->Customer_Type->CssStyle = "";
         $Customers->Customer_Type->CssClass = "";
         $Customers->Customer_Type->ViewCustomAttributes = "";
         // First_Order_Date
         $Customers->First_Order_Date->ViewValue = $Customers->First_Order_Date->CurrentValue;
         $Customers->First_Order_Date->ViewValue = ew_FormatDateTime($Customers->First_Order_Date->ViewValue, 6);
         $Customers->First_Order_Date->CssStyle = "";
         $Customers->First_Order_Date->CssClass = "";
         $Customers->First_Order_Date->ViewCustomAttributes = "";
         // Last_Order_Date
         $Customers->Last_Order_Date->ViewValue = $Customers->Last_Order_Date->CurrentValue;
         $Customers->Last_Order_Date->ViewValue = ew_FormatDateTime($Customers->Last_Order_Date->ViewValue, 6);
         $Customers->Last_Order_Date->CssStyle = "";
         $Customers->Last_Order_Date->CssClass = "";
         $Customers->Last_Order_Date->ViewCustomAttributes = "";
         // Total_Orders
         $Customers->Total_Orders->ViewValue = $Customers->Total_Orders->CurrentValue;
         $Customers->Total_Orders->CssStyle = "";
         $Customers->Total_Orders->CssClass = "";
         $Customers->Total_Orders->ViewCustomAttributes = "";
         // Delivery_Window
         if (strval($Customers->Delivery_Window->CurrentValue) != "") {
             switch ($Customers->Delivery_Window->CurrentValue) {
                 case "1-4":
                     $Customers->Delivery_Window->ViewValue = "1-4";
                     break;
                 case "5-8":
                     $Customers->Delivery_Window->ViewValue = "5-8";
                     break;
                 default:
                     $Customers->Delivery_Window->ViewValue = $Customers->Delivery_Window->CurrentValue;
             }
         } else {
             $Customers->Delivery_Window->ViewValue = NULL;
         }
         $Customers->Delivery_Window->CssStyle = "";
         $Customers->Delivery_Window->CssClass = "";
         $Customers->Delivery_Window->ViewCustomAttributes = "";
         // WeeklyMeals
         $Customers->WeeklyMeals->ViewValue = $Customers->WeeklyMeals->CurrentValue;
         $Customers->WeeklyMeals->CssStyle = "";
         $Customers->WeeklyMeals->CssClass = "";
         $Customers->WeeklyMeals->ViewCustomAttributes = "";
         // WeeklyReg
         $Customers->WeeklyReg->ViewValue = $Customers->WeeklyReg->CurrentValue;
         $Customers->WeeklyReg->CssStyle = "";
         $Customers->WeeklyReg->CssClass = "";
         $Customers->WeeklyReg->ViewCustomAttributes = "";
         // WeeklyVeg
         $Customers->WeeklyVeg->ViewValue = $Customers->WeeklyVeg->CurrentValue;
         $Customers->WeeklyVeg->CssStyle = "";
         $Customers->WeeklyVeg->CssClass = "";
         $Customers->WeeklyVeg->ViewCustomAttributes = "";
         // Want
         if (strval($Customers->Want->CurrentValue) != "") {
             $arwrk = explode(",", $Customers->Want->CurrentValue);
             $sSqlWrk = "SELECT `ItemName` FROM `Items` WHERE ";
             $sWhereWrk = "";
             foreach ($arwrk as $wrk) {
                 if ($sWhereWrk != "") {
                     $sWhereWrk .= " OR ";
                 }
                 $sWhereWrk .= "`ItemID` = " . ew_AdjustSql(trim($wrk)) . "";
             }
             if ($sWhereWrk != "") {
                 $sSqlWrk .= "(" . $sWhereWrk . ")";
             }
             $sSqlWrk .= " ORDER BY `ItemName` Asc";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup value(s) found
                 $Customers->Want->ViewValue = "";
                 $ari = 0;
                 while (!$rswrk->EOF) {
                     $Customers->Want->ViewValue .= $rswrk->fields('ItemName');
                     $rswrk->MoveNext();
                     if (!$rswrk->EOF) {
                         $Customers->Want->ViewValue .= ew_ViewOptionSeparator($ari);
                     }
                     // Separate Options
                     $ari++;
                 }
                 $rswrk->Close();
             } else {
                 $Customers->Want->ViewValue = $Customers->Want->CurrentValue;
             }
         } else {
             $Customers->Want->ViewValue = NULL;
         }
         $Customers->Want->CssStyle = "";
         $Customers->Want->CssClass = "";
         $Customers->Want->ViewCustomAttributes = "";
         // DontWant
         if (strval($Customers->DontWant->CurrentValue) != "") {
             $arwrk = explode(",", $Customers->DontWant->CurrentValue);
             $sSqlWrk = "SELECT `ItemName` FROM `Items` WHERE ";
             $sWhereWrk = "";
             foreach ($arwrk as $wrk) {
                 if ($sWhereWrk != "") {
                     $sWhereWrk .= " OR ";
                 }
                 $sWhereWrk .= "`ItemID` = " . ew_AdjustSql(trim($wrk)) . "";
             }
             if ($sWhereWrk != "") {
                 $sSqlWrk .= "(" . $sWhereWrk . ")";
             }
             $sSqlWrk .= " ORDER BY `ItemName` Asc";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup value(s) found
                 $Customers->DontWant->ViewValue = "";
                 $ari = 0;
                 while (!$rswrk->EOF) {
                     $Customers->DontWant->ViewValue .= $rswrk->fields('ItemName');
                     $rswrk->MoveNext();
                     if (!$rswrk->EOF) {
                         $Customers->DontWant->ViewValue .= ew_ViewOptionSeparator($ari);
                     }
                     // Separate Options
                     $ari++;
                 }
                 $rswrk->Close();
             } else {
                 $Customers->DontWant->ViewValue = $Customers->DontWant->CurrentValue;
             }
         } else {
             $Customers->DontWant->ViewValue = NULL;
         }
         $Customers->DontWant->CssStyle = "";
         $Customers->DontWant->CssClass = "";
         $Customers->DontWant->ViewCustomAttributes = "";
         // Comments
         $Customers->Comments->ViewValue = $Customers->Comments->CurrentValue;
         if (!is_null($Customers->Comments->ViewValue)) {
             $Customers->Comments->ViewValue = str_replace("\n", "<br>", $Customers->Comments->ViewValue);
         }
         $Customers->Comments->CssStyle = "";
         $Customers->Comments->CssClass = "";
         $Customers->Comments->ViewCustomAttributes = "";
         // kitchen_note
         $Customers->kitchen_note->ViewValue = $Customers->kitchen_note->CurrentValue;
         $Customers->kitchen_note->CssStyle = "";
         $Customers->kitchen_note->CssClass = "";
         $Customers->kitchen_note->ViewCustomAttributes = "";
         // CustomerID
         $Customers->CustomerID->HrefValue = "";
         // Email
         $Customers->zEmail->HrefValue = "";
         // FirstName
         $Customers->FirstName->HrefValue = "";
         // LastName
         $Customers->LastName->HrefValue = "";
         // ContactPhone
         $Customers->ContactPhone->HrefValue = "";
         // Customer_Type
         $Customers->Customer_Type->HrefValue = "";
         // First_Order_Date
         $Customers->First_Order_Date->HrefValue = "";
         // Last_Order_Date
         $Customers->Last_Order_Date->HrefValue = "";
         // Total_Orders
         $Customers->Total_Orders->HrefValue = "";
         // Delivery_Window
         $Customers->Delivery_Window->HrefValue = "";
         // WeeklyMeals
         $Customers->WeeklyMeals->HrefValue = "";
         // WeeklyReg
         $Customers->WeeklyReg->HrefValue = "";
         // WeeklyVeg
         $Customers->WeeklyVeg->HrefValue = "";
         // kitchen_note
         $Customers->kitchen_note->HrefValue = "";
     }
     // Call Row Rendered event
     $Customers->Row_Rendered();
 }
示例#4
0
 function BasicSearchSQL($Keyword)
 {
     $sKeyword = ew_AdjustSql($Keyword);
     $sWhere = "";
     $this->BuildBasicSearchSQL($sWhere, $this->descripcion, $Keyword);
     $this->BuildBasicSearchSQL($sWhere, $this->activa, $Keyword);
     return $sWhere;
 }
示例#5
0
 function Page_Main()
 {
     global $conn, $Language, $gsFormError;
     global $Breadcrumb;
     $Breadcrumb = new cBreadcrumb();
     $Breadcrumb->Add("forgotpwd", "<span id=\"ewPageCaption\">" . $Language->Phrase("RequestPwdPage") . "</span>", ew_CurrentUrl());
     $bPostBack = ew_IsHttpPost();
     $bValidEmail = FALSE;
     if ($bPostBack) {
         // Setup variables
         $this->Email = $_POST["email"];
         $bValidEmail = $this->ValidateForm($this->Email);
         if ($bValidEmail) {
             $this->Action = "activate";
             $this->ActivateCode = ew_Encrypt($this->Email);
         } else {
             $this->setFailureMessage($gsFormError);
         }
         // Handle email activation
     } elseif (@$_GET["action"] != "") {
         $this->Action = $_GET["action"];
         $this->Email = @$_GET["email"];
         $this->ActivateCode = @$_GET["code"];
         if ($this->Email != ew_Decrypt($this->ActivateCode) || strtolower($this->Action) != "confirm") {
             // Email activation
             if ($this->getFailureMessage() == "") {
                 $this->setFailureMessage($Language->Phrase("ActivateFailed"));
             }
             // Set activate failed message
             $this->Page_Terminate("login.php");
             // Go to login page
         }
     }
     if ($this->Action != "") {
         $bEmailSent = FALSE;
         // Set up filter (SQL WHERE clause) and get Return SQL
         // SQL constructor in usuario class, usuarioinfo.php
         $sFilter = str_replace("%e", ew_AdjustSql($this->Email), EW_USER_EMAIL_FILTER);
         $this->CurrentFilter = $sFilter;
         $sSql = $this->SQL();
         if ($RsUser = $conn->Execute($sSql)) {
             if (!$RsUser->EOF) {
                 $rsold = $RsUser->fields;
                 $bValidEmail = TRUE;
                 // Call User Recover Password event
                 $bValidEmail = $this->User_RecoverPassword($rsold);
                 if ($bValidEmail) {
                     $sUserName = $rsold['usuario'];
                     $sPassword = $rsold['contrasenia'];
                     if (EW_ENCRYPTED_PASSWORD) {
                         if (strtolower($this->Action) == "confirm") {
                             $sPassword = substr($sPassword, 0, 16);
                             // Use first 16 characters only
                             $rsnew = array('contrasenia' => $sPassword);
                             // Reset the password
                             $this->Update($rsnew);
                         }
                     } else {
                         $this->Action = "confirm";
                         // Send password directly if not MD5
                     }
                 }
             } else {
                 $bValidEmail = FALSE;
                 $this->setFailureMessage($Language->Phrase("InvalidEmail"));
             }
             if ($bValidEmail) {
                 $Email = new cEmail();
                 if (strtolower($this->Action) == "confirm") {
                     $Email->Load("phptxt/forgotpwd.txt");
                     $Email->ReplaceContent('<!--$Password-->', $sPassword);
                 } else {
                     $Email->Load("phptxt/resetpwd.txt");
                     $sActivateLink = ew_FullUrl() . "?action=confirm";
                     $sActivateLink .= "&email=" . $this->Email;
                     $sActivateLink .= "&code=" . $this->ActivateCode;
                     $Email->ReplaceContent('<!--$ActivateLink-->', $sActivateLink);
                 }
                 $Email->ReplaceSender(EW_SENDER_EMAIL);
                 // Replace Sender
                 $Email->ReplaceRecipient($this->Email);
                 // Replace Recipient
                 $Email->ReplaceContent('<!--$UserName-->', $sUserName);
                 $Email->Charset = EW_EMAIL_CHARSET;
                 $Args = array();
                 if (EW_ENCRYPTED_PASSWORD && strtolower($this->Action) == "confirm") {
                     $Args["rs"] =& $rsnew;
                 }
                 if ($this->Email_Sending($Email, $Args)) {
                     $bEmailSent = $Email->Send();
                 }
             }
             $RsUser->Close();
         }
         if ($bEmailSent) {
             if ($this->getSuccessMessage() == "") {
                 if (strtolower($this->Action) == "confirm") {
                     $this->setSuccessMessage($Language->Phrase("PwdEmailSent"));
                 } else {
                     $this->setSuccessMessage($Language->Phrase("ResetPwdEmailSent"));
                 }
             }
             // Set up success message
             $this->Page_Terminate("login.php");
             // Return to login page
         } elseif ($bValidEmail) {
             $this->setFailureMessage($Language->Phrase("FailedToSendMail"));
             // Set up error message
         }
     }
 }
示例#6
0
 function EditRow()
 {
     global $conn, $Security, $AdminInfo;
     $sFilter = $AdminInfo->KeyFilter();
     if ($AdminInfo->Name->CurrentValue != "") {
         // Check field with unique index
         $sFilterChk = "(Name = '" . ew_AdjustSql($AdminInfo->Name->CurrentValue) . "')";
         $sFilterChk .= " AND NOT (" . $sFilter . ")";
         $AdminInfo->CurrentFilter = $sFilterChk;
         $sSqlChk = $AdminInfo->SQL();
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $rsChk = $conn->Execute($sSqlChk);
         $conn->raiseErrorFn = '';
         if ($rsChk === FALSE) {
             return FALSE;
         } elseif (!$rsChk->EOF) {
             $sIdxErrMsg = str_replace("%f", "Name", "Duplicate value '%v' for unique index '%f'");
             $sIdxErrMsg = str_replace("%v", $AdminInfo->Name->CurrentValue, $sIdxErrMsg);
             $this->setMessage($sIdxErrMsg);
             $rsChk->Close();
             return FALSE;
         }
         $rsChk->Close();
     }
     $AdminInfo->CurrentFilter = $sFilter;
     $sSql = $AdminInfo->SQL();
     $conn->raiseErrorFn = 'ew_ErrorFn';
     $rs = $conn->Execute($sSql);
     $conn->raiseErrorFn = '';
     if ($rs === FALSE) {
         return FALSE;
     }
     if ($rs->EOF) {
         $EditRow = FALSE;
         // Update Failed
     } else {
         // Save old values
         $rsold =& $rs->fields;
         $rsnew = array();
         // Field id
         // Field Name
         $AdminInfo->Name->SetDbValueDef($AdminInfo->Name->CurrentValue, "");
         $rsnew['Name'] =& $AdminInfo->Name->DbValue;
         // Field Password
         $AdminInfo->Password->SetDbValueDef($AdminInfo->Password->CurrentValue, "");
         $rsnew['Password'] =& $AdminInfo->Password->DbValue;
         // Call Row Updating event
         $bUpdateRow = $AdminInfo->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($AdminInfo->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($AdminInfo->CancelMessage != "") {
                 $this->setMessage($AdminInfo->CancelMessage);
                 $AdminInfo->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $AdminInfo->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function KeyFilter()
 {
     $sKeyFilter = $this->SqlKeyFilter();
     if (!is_numeric($this->subject_type_id->CurrentValue)) {
         $sKeyFilter = "0=1";
     }
     // Invalid key
     $sKeyFilter = str_replace("@subject_type_id@", ew_AdjustSql($this->subject_type_id->CurrentValue), $sKeyFilter);
     // Replace key value
     return $sKeyFilter;
 }
示例#8
0
 function Page_Main()
 {
     global $conn, $Language, $Security, $gsFormError;
     global $Breadcrumb;
     $Breadcrumb = new cBreadcrumb();
     $Breadcrumb->Add("changepwd", "ChangePwdPage", ew_CurrentUrl(), "", "", TRUE);
     $bPostBack = ew_IsHttpPost();
     $bValidate = TRUE;
     if ($bPostBack) {
         $this->OldPassword = ew_StripSlashes(@$_POST["opwd"]);
         $this->NewPassword = ew_StripSlashes(@$_POST["npwd"]);
         $this->ConfirmedPassword = ew_StripSlashes(@$_POST["cpwd"]);
         $bValidate = $this->ValidateForm($this->OldPassword, $this->NewPassword, $this->ConfirmedPassword);
         if (!$bValidate) {
             $this->setFailureMessage($gsFormError);
         }
     }
     $bPwdUpdated = FALSE;
     if ($bPostBack && $bValidate) {
         // Setup variables
         $sUsername = $Security->CurrentUserName();
         $sFilter = str_replace("%u", ew_AdjustSql($sUsername), EW_USER_NAME_FILTER);
         // Set up filter (Sql Where Clause) and get Return SQL
         // SQL constructor in usuarios class, usuariosinfo.php
         $this->CurrentFilter = $sFilter;
         $sSql = $this->SQL();
         if ($rs = $conn->Execute($sSql)) {
             if (!$rs->EOF) {
                 $rsold = $rs->fields;
                 if (ew_ComparePassword($rsold['contrasenia'], $this->OldPassword)) {
                     $bValidPwd = TRUE;
                     $bValidPwd = $this->User_ChangePassword($rsold, $sUsername, $this->OldPassword, $this->NewPassword);
                     if ($bValidPwd) {
                         $rsnew = array('contrasenia' => $this->NewPassword);
                         // Change Password
                         $sEmail = $rsold['email'];
                         $rs->Close();
                         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
                         $bValidPwd = $this->Update($rsnew);
                         $conn->raiseErrorFn = '';
                         if ($bValidPwd) {
                             $bPwdUpdated = TRUE;
                         }
                     } else {
                         $this->setFailureMessage($Language->Phrase("InvalidNewPassword"));
                         $rs->Close();
                     }
                 } else {
                     $this->setFailureMessage($Language->Phrase("InvalidPassword"));
                 }
             } else {
                 $rs->Close();
             }
         }
     }
     if ($bPwdUpdated) {
         if (@$sEmail != "") {
             // Load Email Content
             $Email = new cEmail();
             $Email->Load("phptxt/changepwd.txt");
             $Email->ReplaceSender(EW_SENDER_EMAIL);
             // Replace Sender
             $Email->ReplaceRecipient($sEmail);
             // Replace Recipient
             $Email->ReplaceContent('<!--$Password-->', $this->NewPassword);
             $Email->Charset = EW_EMAIL_CHARSET;
             $Args = array();
             $Args["rs"] =& $rsnew;
             $bEmailSent = FALSE;
             if ($this->Email_Sending($Email, $Args)) {
                 $bEmailSent = $Email->Send();
             }
             // Send email failed
             if (!$bEmailSent) {
                 $this->setFailureMessage($Email->SendErrDescription);
             }
         }
         if ($this->getSuccessMessage() == "") {
             $this->setSuccessMessage($Language->Phrase("PasswordChanged"));
         }
         // Set up success message
         $this->Page_Terminate("index.php");
         // Exit page and clean up
     }
 }
 function RenderListRow()
 {
     global $conn, $Security;
     // Call Row Rendering event
     $this->Row_Rendering();
     // DeliveryDate
     $this->DeliveryDate->ViewValue = $this->DeliveryDate->CurrentValue;
     $this->DeliveryDate->ViewValue = ew_FormatDateTime($this->DeliveryDate->ViewValue, 6);
     $this->DeliveryDate->CssStyle = "";
     $this->DeliveryDate->CssClass = "";
     $this->DeliveryDate->ViewCustomAttributes = "";
     // CustomerID
     if (strval($this->CustomerID->CurrentValue) != "") {
         $sSqlWrk = "SELECT `LastName`, `FirstName` FROM `Customers` WHERE `CustomerID` = " . ew_AdjustSql($this->CustomerID->CurrentValue) . "";
         $sSqlWrk .= " ORDER BY `LastName` Asc";
         $rswrk = $conn->Execute($sSqlWrk);
         if ($rswrk && !$rswrk->EOF) {
             // Lookup value(s) found
             $this->CustomerID->ViewValue = $rswrk->fields('LastName');
             $this->CustomerID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('FirstName');
             $rswrk->Close();
         } else {
             $this->CustomerID->ViewValue = $this->CustomerID->CurrentValue;
         }
     } else {
         $this->CustomerID->ViewValue = NULL;
     }
     $this->CustomerID->CssStyle = "";
     $this->CustomerID->CssClass = "";
     $this->CustomerID->ViewCustomAttributes = "";
     // WeeklyMeals
     $this->WeeklyMeals->ViewValue = $this->WeeklyMeals->CurrentValue;
     $this->WeeklyMeals->CssStyle = "";
     $this->WeeklyMeals->CssClass = "";
     $this->WeeklyMeals->ViewCustomAttributes = "";
     // WeeklyReg
     $this->WeeklyReg->ViewValue = $this->WeeklyReg->CurrentValue;
     $this->WeeklyReg->CssStyle = "";
     $this->WeeklyReg->CssClass = "";
     $this->WeeklyReg->ViewCustomAttributes = "";
     // WeeklyVeg
     $this->WeeklyVeg->ViewValue = $this->WeeklyVeg->CurrentValue;
     $this->WeeklyVeg->CssStyle = "";
     $this->WeeklyVeg->CssClass = "";
     $this->WeeklyVeg->ViewCustomAttributes = "";
     // TransactionNumber
     $this->TransactionNumber->ViewValue = $this->TransactionNumber->CurrentValue;
     $this->TransactionNumber->CssStyle = "";
     $this->TransactionNumber->CssClass = "";
     $this->TransactionNumber->ViewCustomAttributes = "";
     // Want
     if (strval($this->Want->CurrentValue) != "") {
         $arwrk = explode(",", $this->Want->CurrentValue);
         $sSqlWrk = "SELECT `ItemName` FROM `Items` WHERE ";
         $sWhereWrk = "";
         foreach ($arwrk as $wrk) {
             if ($sWhereWrk != "") {
                 $sWhereWrk .= " OR ";
             }
             $sWhereWrk .= "`ItemID` = " . ew_AdjustSql(trim($wrk)) . "";
         }
         if ($sWhereWrk != "") {
             $sSqlWrk .= "(" . $sWhereWrk . ")";
         }
         $sSqlWrk .= " ORDER BY `ItemName` Asc";
         $rswrk = $conn->Execute($sSqlWrk);
         if ($rswrk && !$rswrk->EOF) {
             // Lookup value(s) found
             $this->Want->ViewValue = "";
             $ari = 0;
             while (!$rswrk->EOF) {
                 $this->Want->ViewValue .= $rswrk->fields('ItemName');
                 $rswrk->MoveNext();
                 if (!$rswrk->EOF) {
                     $this->Want->ViewValue .= ew_ViewOptionSeparator($ari);
                 }
                 // Separate Options
                 $ari++;
             }
             $rswrk->Close();
         } else {
             $this->Want->ViewValue = $this->Want->CurrentValue;
         }
     } else {
         $this->Want->ViewValue = NULL;
     }
     $this->Want->CssStyle = "";
     $this->Want->CssClass = "";
     $this->Want->ViewCustomAttributes = "";
     // DontWant
     if (strval($this->DontWant->CurrentValue) != "") {
         $arwrk = explode(",", $this->DontWant->CurrentValue);
         $sSqlWrk = "SELECT `ItemName` FROM `Items` WHERE ";
         $sWhereWrk = "";
         foreach ($arwrk as $wrk) {
             if ($sWhereWrk != "") {
                 $sWhereWrk .= " OR ";
             }
             $sWhereWrk .= "`ItemID` = " . ew_AdjustSql(trim($wrk)) . "";
         }
         if ($sWhereWrk != "") {
             $sSqlWrk .= "(" . $sWhereWrk . ")";
         }
         $sSqlWrk .= " ORDER BY `ItemName` Asc";
         $rswrk = $conn->Execute($sSqlWrk);
         if ($rswrk && !$rswrk->EOF) {
             // Lookup value(s) found
             $this->DontWant->ViewValue = "";
             $ari = 0;
             while (!$rswrk->EOF) {
                 $this->DontWant->ViewValue .= $rswrk->fields('ItemName');
                 $rswrk->MoveNext();
                 if (!$rswrk->EOF) {
                     $this->DontWant->ViewValue .= ew_ViewOptionSeparator($ari);
                 }
                 // Separate Options
                 $ari++;
             }
             $rswrk->Close();
         } else {
             $this->DontWant->ViewValue = $this->DontWant->CurrentValue;
         }
     } else {
         $this->DontWant->ViewValue = NULL;
     }
     $this->DontWant->CssStyle = "";
     $this->DontWant->CssClass = "";
     $this->DontWant->ViewCustomAttributes = "";
     // Comments
     $this->Comments->ViewValue = $this->Comments->CurrentValue;
     $this->Comments->CssStyle = "";
     $this->Comments->CssClass = "";
     $this->Comments->ViewCustomAttributes = "";
     // DeliveryDate
     $this->DeliveryDate->HrefValue = "";
     // CustomerID
     $this->CustomerID->HrefValue = "";
     // WeeklyMeals
     $this->WeeklyMeals->HrefValue = "";
     // WeeklyReg
     $this->WeeklyReg->HrefValue = "";
     // WeeklyVeg
     $this->WeeklyVeg->HrefValue = "";
     // TransactionNumber
     $this->TransactionNumber->HrefValue = "";
     // Want
     $this->Want->HrefValue = "";
     // DontWant
     $this->DontWant->HrefValue = "";
     // Comments
     $this->Comments->HrefValue = "";
     // Call Row Rendered event
     $this->Row_Rendered();
 }
 function RenderRow()
 {
     global $conn, $Security, $Language, $t_promotions_vins;
     // Initialize URLs
     $this->ViewUrl = $t_promotions_vins->ViewUrl();
     $this->EditUrl = $t_promotions_vins->EditUrl();
     $this->InlineEditUrl = $t_promotions_vins->InlineEditUrl();
     $this->CopyUrl = $t_promotions_vins->CopyUrl();
     $this->InlineCopyUrl = $t_promotions_vins->InlineCopyUrl();
     $this->DeleteUrl = $t_promotions_vins->DeleteUrl();
     // Call Row_Rendering event
     $t_promotions_vins->Row_Rendering();
     // Common render codes for all row types
     // promotion
     // produit_vin
     if ($t_promotions_vins->RowType == EW_ROWTYPE_VIEW) {
         // View row
         // promotion
         if (strval($t_promotions_vins->promotion->CurrentValue) != "") {
             $sFilterWrk = "`id` = " . ew_AdjustSql($t_promotions_vins->promotion->CurrentValue) . "";
             $sSqlWrk = "SELECT `titre` FROM `t_promotions`";
             $sWhereWrk = "";
             if ($sFilterWrk != "") {
                 if ($sWhereWrk != "") {
                     $sWhereWrk .= " AND ";
                 }
                 $sWhereWrk .= "(" . $sFilterWrk . ")";
             }
             if ($sWhereWrk != "") {
                 $sSqlWrk .= " WHERE " . $sWhereWrk;
             }
             $sSqlWrk .= " ORDER BY `titre` Asc";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup values found
                 $t_promotions_vins->promotion->ViewValue = $rswrk->fields('titre');
                 $rswrk->Close();
             } else {
                 $t_promotions_vins->promotion->ViewValue = $t_promotions_vins->promotion->CurrentValue;
             }
         } else {
             $t_promotions_vins->promotion->ViewValue = NULL;
         }
         $t_promotions_vins->promotion->ViewCustomAttributes = "";
         // produit_vin
         $t_promotions_vins->produit_vin->ViewValue = $t_promotions_vins->produit_vin->CurrentValue;
         if (strval($t_promotions_vins->produit_vin->CurrentValue) != "") {
             $sFilterWrk = "`id_produit_vin` = " . ew_AdjustSql($t_promotions_vins->produit_vin->CurrentValue) . "";
             $sSqlWrk = "SELECT `label` FROM `v_all_produits_vins`";
             $sWhereWrk = "";
             if ($sFilterWrk != "") {
                 if ($sWhereWrk != "") {
                     $sWhereWrk .= " AND ";
                 }
                 $sWhereWrk .= "(" . $sFilterWrk . ")";
             }
             if ($sWhereWrk != "") {
                 $sSqlWrk .= " WHERE " . $sWhereWrk;
             }
             $sSqlWrk .= " ORDER BY `label` Asc";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup values found
                 $t_promotions_vins->produit_vin->ViewValue = $rswrk->fields('label');
                 $rswrk->Close();
             } else {
                 $t_promotions_vins->produit_vin->ViewValue = $t_promotions_vins->produit_vin->CurrentValue;
             }
         } else {
             $t_promotions_vins->produit_vin->ViewValue = NULL;
         }
         $t_promotions_vins->produit_vin->ViewCustomAttributes = "";
         // promotion
         $t_promotions_vins->promotion->LinkCustomAttributes = "";
         $t_promotions_vins->promotion->HrefValue = "";
         $t_promotions_vins->promotion->TooltipValue = "";
         // produit_vin
         $t_promotions_vins->produit_vin->LinkCustomAttributes = "";
         $t_promotions_vins->produit_vin->HrefValue = "";
         $t_promotions_vins->produit_vin->TooltipValue = "";
     }
     // Call Row Rendered event
     if ($t_promotions_vins->RowType != EW_ROWTYPE_AGGREGATEINIT) {
         $t_promotions_vins->Row_Rendered();
     }
 }
 function SetUpMasterDetail()
 {
     global $ItemIngredients;
     $bValidMaster = FALSE;
     // Get the keys for master table
     if (@$_GET[EW_TABLE_SHOW_MASTER] != "") {
         $sMasterTblVar = $_GET[EW_TABLE_SHOW_MASTER];
         if ($sMasterTblVar == "") {
             $bValidMaster = TRUE;
             $this->sDbMasterFilter = "";
             $this->sDbDetailFilter = "";
         }
         if ($sMasterTblVar == "Ingredients") {
             $bValidMaster = TRUE;
             $this->sDbMasterFilter = $ItemIngredients->SqlMasterFilter_Ingredients();
             $this->sDbDetailFilter = $ItemIngredients->SqlDetailFilter_Ingredients();
             if (@$_GET["IngredientID"] != "") {
                 $GLOBALS["Ingredients"]->IngredientID->setQueryStringValue($_GET["IngredientID"]);
                 $ItemIngredients->IngredientID->setQueryStringValue($GLOBALS["Ingredients"]->IngredientID->QueryStringValue);
                 $ItemIngredients->IngredientID->setSessionValue($ItemIngredients->IngredientID->QueryStringValue);
                 if (!is_numeric($GLOBALS["Ingredients"]->IngredientID->QueryStringValue)) {
                     $bValidMaster = FALSE;
                 }
                 $this->sDbMasterFilter = str_replace("@IngredientID@", ew_AdjustSql($GLOBALS["Ingredients"]->IngredientID->QueryStringValue), $this->sDbMasterFilter);
                 $this->sDbDetailFilter = str_replace("@IngredientID@", ew_AdjustSql($GLOBALS["Ingredients"]->IngredientID->QueryStringValue), $this->sDbDetailFilter);
             } else {
                 $bValidMaster = FALSE;
             }
         }
         if ($sMasterTblVar == "Items") {
             $bValidMaster = TRUE;
             $this->sDbMasterFilter = $ItemIngredients->SqlMasterFilter_Items();
             $this->sDbDetailFilter = $ItemIngredients->SqlDetailFilter_Items();
             if (@$_GET["ItemID"] != "") {
                 $GLOBALS["Items"]->ItemID->setQueryStringValue($_GET["ItemID"]);
                 $ItemIngredients->ItemID->setQueryStringValue($GLOBALS["Items"]->ItemID->QueryStringValue);
                 $ItemIngredients->ItemID->setSessionValue($ItemIngredients->ItemID->QueryStringValue);
                 if (!is_numeric($GLOBALS["Items"]->ItemID->QueryStringValue)) {
                     $bValidMaster = FALSE;
                 }
                 $this->sDbMasterFilter = str_replace("@ItemID@", ew_AdjustSql($GLOBALS["Items"]->ItemID->QueryStringValue), $this->sDbMasterFilter);
                 $this->sDbDetailFilter = str_replace("@ItemID@", ew_AdjustSql($GLOBALS["Items"]->ItemID->QueryStringValue), $this->sDbDetailFilter);
             } else {
                 $bValidMaster = FALSE;
             }
         }
     }
     if ($bValidMaster) {
         // Save current master table
         $ItemIngredients->setCurrentMasterTable($sMasterTblVar);
         // Reset start record counter (new master key)
         $this->lStartRec = 1;
         $ItemIngredients->setStartRecordNumber($this->lStartRec);
         $ItemIngredients->setMasterFilter($this->sDbMasterFilter);
         // Set up master filter
         $ItemIngredients->setDetailFilter($this->sDbDetailFilter);
         // Set up detail filter
         // Clear previous master session values
         if ($sMasterTblVar != "Ingredients") {
             if ($ItemIngredients->IngredientID->QueryStringValue == "") {
                 $ItemIngredients->IngredientID->setSessionValue("");
             }
         }
         if ($sMasterTblVar != "Items") {
             if ($ItemIngredients->ItemID->QueryStringValue == "") {
                 $ItemIngredients->ItemID->setSessionValue("");
             }
         }
     } else {
         $this->sDbMasterFilter = $ItemIngredients->getMasterFilter();
         //  Restore master filter
         $this->sDbDetailFilter = $ItemIngredients->getDetailFilter();
         // Restore detail filter
     }
 }
 }
 if ($Delivery_Report_1_report->sFilter != "") {
     $Delivery_Report_1_report->sFilter .= " AND ";
 }
 if (is_null(ew_UnFormatDateTime(ew_FormatDateTime($Delivery_Report_1->DeliveryDate->CurrentValue, 6), 6))) {
     $Delivery_Report_1_report->sFilter .= "(`DeliveryDate` IS NULL)";
 } else {
     $Delivery_Report_1_report->sFilter .= "(`DeliveryDate` = '" . ew_AdjustSql(ew_UnFormatDateTime(ew_FormatDateTime($Delivery_Report_1->DeliveryDate->CurrentValue, 6), 6)) . "')";
 }
 if ($Delivery_Report_1_report->sFilter != "") {
     $Delivery_Report_1_report->sFilter .= " AND ";
 }
 if (is_null($Delivery_Report_1->Delivery_Window->CurrentValue)) {
     $Delivery_Report_1_report->sFilter .= "(`Delivery_Window` IS NULL)";
 } else {
     $Delivery_Report_1_report->sFilter .= "(`Delivery_Window` = '" . ew_AdjustSql($Delivery_Report_1->Delivery_Window->CurrentValue) . "')";
 }
 if ($Delivery_Report_1_report->sDbDetailFilter != "") {
     if ($Delivery_Report_1_report->sFilter != "") {
         $Delivery_Report_1_report->sFilter .= " AND ";
     }
     $Delivery_Report_1_report->sFilter .= "(" . $Delivery_Report_1_report->sDbDetailFilter . ")";
 }
 // Set up detail SQL
 $Delivery_Report_1->CurrentFilter = $Delivery_Report_1_report->sFilter;
 $Delivery_Report_1_report->sSql = $Delivery_Report_1->DetailSQL();
 // Load detail records
 $rsdtl = $conn->Execute($Delivery_Report_1_report->sSql);
 $Delivery_Report_1_report->nDtlRecs = $rsdtl->RecordCount();
 // Initialize Aggregate
 if (!$rsdtl->EOF) {
示例#13
0
 function RenderListRow()
 {
     global $conn, $Security;
     // Call Row Rendering event
     $this->Row_Rendering();
     // Common render codes
     // id_profile
     $this->id_profile->CellCssStyle = "white-space: nowrap;";
     $this->id_profile->CellCssClass = "";
     $this->id_profile->CellAttrs = array();
     $this->id_profile->ViewAttrs = array();
     $this->id_profile->EditAttrs = array();
     // stat_date
     $this->stat_date->CellCssStyle = "";
     $this->stat_date->CellCssClass = "";
     $this->stat_date->CellAttrs = array();
     $this->stat_date->ViewAttrs = array();
     $this->stat_date->EditAttrs = array();
     // year
     $this->year->CellCssStyle = "";
     $this->year->CellCssClass = "";
     $this->year->CellAttrs = array();
     $this->year->ViewAttrs = array();
     $this->year->EditAttrs = array();
     // month
     $this->month->CellCssStyle = "";
     $this->month->CellCssClass = "";
     $this->month->CellAttrs = array();
     $this->month->ViewAttrs = array();
     $this->month->EditAttrs = array();
     // week
     $this->week->CellCssStyle = "";
     $this->week->CellCssClass = "";
     $this->week->CellAttrs = array();
     $this->week->ViewAttrs = array();
     $this->week->EditAttrs = array();
     // alexa_rank
     $this->alexa_rank->CellCssStyle = "";
     $this->alexa_rank->CellCssClass = "";
     $this->alexa_rank->CellAttrs = array();
     $this->alexa_rank->ViewAttrs = array();
     $this->alexa_rank->EditAttrs = array();
     // google_pagerank
     $this->google_pagerank->CellCssStyle = "";
     $this->google_pagerank->CellCssClass = "";
     $this->google_pagerank->CellAttrs = array();
     $this->google_pagerank->ViewAttrs = array();
     $this->google_pagerank->EditAttrs = array();
     // id_profile
     if (strval($this->id_profile->CurrentValue) != "") {
         $sFilterWrk = "`id` = " . ew_AdjustSql($this->id_profile->CurrentValue) . "";
         $sSqlWrk = "SELECT DISTINCT `name` FROM `tbl_profile`";
         $sWhereWrk = "";
         if ($sWhereWrk != "") {
             $sWhereWrk .= " AND ";
         }
         $sWhereWrk .= "(" . "is_active = '1'" . ")";
         if ($sFilterWrk != "") {
             if ($sWhereWrk != "") {
                 $sWhereWrk .= " AND ";
             }
             $sWhereWrk .= "(" . $sFilterWrk . ")";
         }
         if ($sWhereWrk != "") {
             $sSqlWrk .= " WHERE " . $sWhereWrk;
         }
         $sSqlWrk .= " ORDER BY `name` Asc";
         $rswrk = $conn->Execute($sSqlWrk);
         if ($rswrk && !$rswrk->EOF) {
             // Lookup values found
             $this->id_profile->ViewValue = $rswrk->fields('name');
             $rswrk->Close();
         } else {
             $this->id_profile->ViewValue = $this->id_profile->CurrentValue;
         }
     } else {
         $this->id_profile->ViewValue = NULL;
     }
     $this->id_profile->CssStyle = "";
     $this->id_profile->CssClass = "";
     $this->id_profile->ViewCustomAttributes = "";
     // stat_date
     $this->stat_date->ViewValue = $this->stat_date->CurrentValue;
     $this->stat_date->ViewValue = ew_FormatDateTime($this->stat_date->ViewValue, 5);
     $this->stat_date->CssStyle = "";
     $this->stat_date->CssClass = "";
     $this->stat_date->ViewCustomAttributes = "";
     // year
     $this->year->ViewValue = $this->year->CurrentValue;
     $this->year->CssStyle = "";
     $this->year->CssClass = "";
     $this->year->ViewCustomAttributes = "";
     // month
     $this->month->ViewValue = $this->month->CurrentValue;
     $this->month->CssStyle = "";
     $this->month->CssClass = "";
     $this->month->ViewCustomAttributes = "";
     // week
     $this->week->ViewValue = $this->week->CurrentValue;
     $this->week->CssStyle = "";
     $this->week->CssClass = "";
     $this->week->ViewCustomAttributes = "";
     // alexa_rank
     $this->alexa_rank->ViewValue = $this->alexa_rank->CurrentValue;
     $this->alexa_rank->CssStyle = "";
     $this->alexa_rank->CssClass = "";
     $this->alexa_rank->ViewCustomAttributes = "";
     // google_pagerank
     $this->google_pagerank->ViewValue = $this->google_pagerank->CurrentValue;
     $this->google_pagerank->CssStyle = "";
     $this->google_pagerank->CssClass = "";
     $this->google_pagerank->ViewCustomAttributes = "";
     // id_profile
     $this->id_profile->HrefValue = "";
     $this->id_profile->TooltipValue = "";
     // stat_date
     $this->stat_date->HrefValue = "";
     $this->stat_date->TooltipValue = "";
     // year
     $this->year->HrefValue = "";
     $this->year->TooltipValue = "";
     // month
     $this->month->HrefValue = "";
     $this->month->TooltipValue = "";
     // week
     $this->week->HrefValue = "";
     $this->week->TooltipValue = "";
     // alexa_rank
     $this->alexa_rank->HrefValue = "";
     $this->alexa_rank->TooltipValue = "";
     // google_pagerank
     $this->google_pagerank->HrefValue = "";
     $this->google_pagerank->TooltipValue = "";
     // Call Row Rendered event
     $this->Row_Rendered();
 }
示例#14
0
 function RenderRow()
 {
     global $conn, $Security, $Language, $tbl_ga_stat;
     // Initialize URLs
     // Call Row_Rendering event
     $tbl_ga_stat->Row_Rendering();
     // Common render codes for all row types
     // id_profile
     $tbl_ga_stat->id_profile->CellCssStyle = "white-space: nowrap;";
     $tbl_ga_stat->id_profile->CellCssClass = "";
     $tbl_ga_stat->id_profile->CellAttrs = array();
     $tbl_ga_stat->id_profile->ViewAttrs = array();
     $tbl_ga_stat->id_profile->EditAttrs = array();
     // stat_date
     $tbl_ga_stat->stat_date->CellCssStyle = "";
     $tbl_ga_stat->stat_date->CellCssClass = "";
     $tbl_ga_stat->stat_date->CellAttrs = array();
     $tbl_ga_stat->stat_date->ViewAttrs = array();
     $tbl_ga_stat->stat_date->EditAttrs = array();
     // year
     $tbl_ga_stat->year->CellCssStyle = "";
     $tbl_ga_stat->year->CellCssClass = "";
     $tbl_ga_stat->year->CellAttrs = array();
     $tbl_ga_stat->year->ViewAttrs = array();
     $tbl_ga_stat->year->EditAttrs = array();
     // month
     $tbl_ga_stat->month->CellCssStyle = "";
     $tbl_ga_stat->month->CellCssClass = "";
     $tbl_ga_stat->month->CellAttrs = array();
     $tbl_ga_stat->month->ViewAttrs = array();
     $tbl_ga_stat->month->EditAttrs = array();
     // week
     $tbl_ga_stat->week->CellCssStyle = "";
     $tbl_ga_stat->week->CellCssClass = "";
     $tbl_ga_stat->week->CellAttrs = array();
     $tbl_ga_stat->week->ViewAttrs = array();
     $tbl_ga_stat->week->EditAttrs = array();
     // day
     $tbl_ga_stat->day->CellCssStyle = "";
     $tbl_ga_stat->day->CellCssClass = "";
     $tbl_ga_stat->day->CellAttrs = array();
     $tbl_ga_stat->day->ViewAttrs = array();
     $tbl_ga_stat->day->EditAttrs = array();
     // hour
     $tbl_ga_stat->hour->CellCssStyle = "";
     $tbl_ga_stat->hour->CellCssClass = "";
     $tbl_ga_stat->hour->CellAttrs = array();
     $tbl_ga_stat->hour->ViewAttrs = array();
     $tbl_ga_stat->hour->EditAttrs = array();
     // pageview
     $tbl_ga_stat->pageview->CellCssStyle = "";
     $tbl_ga_stat->pageview->CellCssClass = "";
     $tbl_ga_stat->pageview->CellAttrs = array();
     $tbl_ga_stat->pageview->ViewAttrs = array();
     $tbl_ga_stat->pageview->EditAttrs = array();
     // visit
     $tbl_ga_stat->visit->CellCssStyle = "";
     $tbl_ga_stat->visit->CellCssClass = "";
     $tbl_ga_stat->visit->CellAttrs = array();
     $tbl_ga_stat->visit->ViewAttrs = array();
     $tbl_ga_stat->visit->EditAttrs = array();
     if ($tbl_ga_stat->RowType == EW_ROWTYPE_VIEW) {
         // View row
         // id_profile
         if (strval($tbl_ga_stat->id_profile->CurrentValue) != "") {
             $sFilterWrk = "`id` = " . ew_AdjustSql($tbl_ga_stat->id_profile->CurrentValue) . "";
             $sSqlWrk = "SELECT DISTINCT `name` FROM `tbl_profile`";
             $sWhereWrk = "";
             if ($sFilterWrk != "") {
                 if ($sWhereWrk != "") {
                     $sWhereWrk .= " AND ";
                 }
                 $sWhereWrk .= "(" . $sFilterWrk . ")";
             }
             if ($sWhereWrk != "") {
                 $sSqlWrk .= " WHERE " . $sWhereWrk;
             }
             $sSqlWrk .= " ORDER BY `name` Asc";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup values found
                 $tbl_ga_stat->id_profile->ViewValue = $rswrk->fields('name');
                 $rswrk->Close();
             } else {
                 $tbl_ga_stat->id_profile->ViewValue = $tbl_ga_stat->id_profile->CurrentValue;
             }
         } else {
             $tbl_ga_stat->id_profile->ViewValue = NULL;
         }
         $tbl_ga_stat->id_profile->CssStyle = "";
         $tbl_ga_stat->id_profile->CssClass = "";
         $tbl_ga_stat->id_profile->ViewCustomAttributes = "";
         // stat_date
         $tbl_ga_stat->stat_date->ViewValue = $tbl_ga_stat->stat_date->CurrentValue;
         $tbl_ga_stat->stat_date->ViewValue = ew_FormatDateTime($tbl_ga_stat->stat_date->ViewValue, 5);
         $tbl_ga_stat->stat_date->CssStyle = "";
         $tbl_ga_stat->stat_date->CssClass = "";
         $tbl_ga_stat->stat_date->ViewCustomAttributes = "";
         // year
         $tbl_ga_stat->year->ViewValue = $tbl_ga_stat->year->CurrentValue;
         $tbl_ga_stat->year->CssStyle = "";
         $tbl_ga_stat->year->CssClass = "";
         $tbl_ga_stat->year->ViewCustomAttributes = "";
         // month
         $tbl_ga_stat->month->ViewValue = $tbl_ga_stat->month->CurrentValue;
         $tbl_ga_stat->month->CssStyle = "";
         $tbl_ga_stat->month->CssClass = "";
         $tbl_ga_stat->month->ViewCustomAttributes = "";
         // week
         $tbl_ga_stat->week->ViewValue = $tbl_ga_stat->week->CurrentValue;
         $tbl_ga_stat->week->CssStyle = "";
         $tbl_ga_stat->week->CssClass = "";
         $tbl_ga_stat->week->ViewCustomAttributes = "";
         // day
         if (strval($tbl_ga_stat->day->CurrentValue) != "") {
             switch ($tbl_ga_stat->day->CurrentValue) {
                 case "1":
                     $tbl_ga_stat->day->ViewValue = "1";
                     break;
                 case "2":
                     $tbl_ga_stat->day->ViewValue = "2";
                     break;
                 case "3":
                     $tbl_ga_stat->day->ViewValue = "3";
                     break;
                 case "4":
                     $tbl_ga_stat->day->ViewValue = "4";
                     break;
                 case "5":
                     $tbl_ga_stat->day->ViewValue = "5";
                     break;
                 case "6":
                     $tbl_ga_stat->day->ViewValue = "6";
                     break;
                 case "7":
                     $tbl_ga_stat->day->ViewValue = "7";
                     break;
                 default:
                     $tbl_ga_stat->day->ViewValue = $tbl_ga_stat->day->CurrentValue;
             }
         } else {
             $tbl_ga_stat->day->ViewValue = NULL;
         }
         $tbl_ga_stat->day->CssStyle = "";
         $tbl_ga_stat->day->CssClass = "";
         $tbl_ga_stat->day->ViewCustomAttributes = "";
         // hour
         $tbl_ga_stat->hour->ViewValue = $tbl_ga_stat->hour->CurrentValue;
         $tbl_ga_stat->hour->ViewValue = ew_FormatDateTime($tbl_ga_stat->hour->ViewValue, 4);
         $tbl_ga_stat->hour->CssStyle = "";
         $tbl_ga_stat->hour->CssClass = "";
         $tbl_ga_stat->hour->ViewCustomAttributes = "";
         // pageview
         $tbl_ga_stat->pageview->ViewValue = $tbl_ga_stat->pageview->CurrentValue;
         $tbl_ga_stat->pageview->CssStyle = "";
         $tbl_ga_stat->pageview->CssClass = "";
         $tbl_ga_stat->pageview->ViewCustomAttributes = "";
         // visit
         $tbl_ga_stat->visit->ViewValue = $tbl_ga_stat->visit->CurrentValue;
         $tbl_ga_stat->visit->CssStyle = "";
         $tbl_ga_stat->visit->CssClass = "";
         $tbl_ga_stat->visit->ViewCustomAttributes = "";
         // id_profile
         $tbl_ga_stat->id_profile->HrefValue = "";
         $tbl_ga_stat->id_profile->TooltipValue = "";
         // stat_date
         $tbl_ga_stat->stat_date->HrefValue = "";
         $tbl_ga_stat->stat_date->TooltipValue = "";
         // year
         $tbl_ga_stat->year->HrefValue = "";
         $tbl_ga_stat->year->TooltipValue = "";
         // month
         $tbl_ga_stat->month->HrefValue = "";
         $tbl_ga_stat->month->TooltipValue = "";
         // week
         $tbl_ga_stat->week->HrefValue = "";
         $tbl_ga_stat->week->TooltipValue = "";
         // day
         $tbl_ga_stat->day->HrefValue = "";
         $tbl_ga_stat->day->TooltipValue = "";
         // hour
         $tbl_ga_stat->hour->HrefValue = "";
         $tbl_ga_stat->hour->TooltipValue = "";
         // pageview
         $tbl_ga_stat->pageview->HrefValue = "";
         $tbl_ga_stat->pageview->TooltipValue = "";
         // visit
         $tbl_ga_stat->visit->HrefValue = "";
         $tbl_ga_stat->visit->TooltipValue = "";
     }
     // Call Row Rendered event
     if ($tbl_ga_stat->RowType != EW_ROWTYPE_AGGREGATEINIT) {
         $tbl_ga_stat->Row_Rendered();
     }
 }
示例#15
0
 function EditRow()
 {
     global $conn;
     for ($i = 0; $i < $this->TableNameCount; $i++) {
         $Sql = "SELECT * FROM " . EW_USER_LEVEL_PRIV_TABLE . " WHERE " . EW_USER_LEVEL_PRIV_TABLE_NAME_FIELD . " = '" . ew_AdjustSql($this->TableList[$i][4] . $this->TableList[$i][0]) . "' AND " . EW_USER_LEVEL_PRIV_USER_LEVEL_ID_FIELD . " = " . $this->codigo->CurrentValue;
         $rs = $conn->Execute($Sql);
         if ($rs && !$rs->EOF) {
             $Sql = "UPDATE " . EW_USER_LEVEL_PRIV_TABLE . " SET " . EW_USER_LEVEL_PRIV_PRIV_FIELD . " = " . $this->Privileges[$i] . " WHERE " . EW_USER_LEVEL_PRIV_TABLE_NAME_FIELD . " = '" . ew_AdjustSql($this->TableList[$i][4] . $this->TableList[$i][0]) . "' AND " . EW_USER_LEVEL_PRIV_USER_LEVEL_ID_FIELD . " = " . $this->codigo->CurrentValue;
             $conn->Execute($Sql);
         } else {
             $Sql = "INSERT INTO " . EW_USER_LEVEL_PRIV_TABLE . " (" . EW_USER_LEVEL_PRIV_TABLE_NAME_FIELD . ", " . EW_USER_LEVEL_PRIV_USER_LEVEL_ID_FIELD . ", " . EW_USER_LEVEL_PRIV_PRIV_FIELD . ") VALUES ('" . ew_AdjustSql($this->TableList[$i][4] . $this->TableList[$i][0]) . "', " . $this->codigo->CurrentValue . ", " . $this->Privileges[$i] . ")";
             $conn->Execute($Sql);
         }
         if ($rs) {
             $rs->Close();
         }
     }
     return TRUE;
 }
 function KeyFilter()
 {
     $sKeyFilter = $this->SqlKeyFilter();
     if (!is_numeric($this->idempleado->CurrentValue)) {
         $sKeyFilter = "0=1";
     }
     // Invalid key
     $sKeyFilter = str_replace("@idempleado@", ew_AdjustSql($this->idempleado->CurrentValue), $sKeyFilter);
     // Replace key value
     return $sKeyFilter;
 }
 }
 if ($Kitchen_Report_22D2_report->sFilter != "") {
     $Kitchen_Report_22D2_report->sFilter .= " AND ";
 }
 if (is_null(ew_UnFormatDateTime(ew_FormatDateTime($Kitchen_Report_22D2->DeliveryDate->CurrentValue, 6), 6))) {
     $Kitchen_Report_22D2_report->sFilter .= "(`DeliveryDate` IS NULL)";
 } else {
     $Kitchen_Report_22D2_report->sFilter .= "(`DeliveryDate` = '" . ew_AdjustSql(ew_UnFormatDateTime(ew_FormatDateTime($Kitchen_Report_22D2->DeliveryDate->CurrentValue, 6), 6)) . "')";
 }
 if ($Kitchen_Report_22D2_report->sFilter != "") {
     $Kitchen_Report_22D2_report->sFilter .= " AND ";
 }
 if (is_null($Kitchen_Report_22D2->MenuName->CurrentValue)) {
     $Kitchen_Report_22D2_report->sFilter .= "(`MenuName` IS NULL)";
 } else {
     $Kitchen_Report_22D2_report->sFilter .= "(`MenuName` = '" . ew_AdjustSql($Kitchen_Report_22D2->MenuName->CurrentValue) . "')";
 }
 if ($Kitchen_Report_22D2_report->sDbDetailFilter != "") {
     if ($Kitchen_Report_22D2_report->sFilter != "") {
         $Kitchen_Report_22D2_report->sFilter .= " AND ";
     }
     $Kitchen_Report_22D2_report->sFilter .= "(" . $Kitchen_Report_22D2_report->sDbDetailFilter . ")";
 }
 // Set up detail SQL
 $Kitchen_Report_22D2->CurrentFilter = $Kitchen_Report_22D2_report->sFilter;
 $Kitchen_Report_22D2_report->sSql = $Kitchen_Report_22D2->DetailSQL();
 // Load detail records
 $rsdtl = $conn->Execute($Kitchen_Report_22D2_report->sSql);
 $Kitchen_Report_22D2_report->nDtlRecs = $rsdtl->RecordCount();
 // Initialize Aggregate
 if (!$rsdtl->EOF) {
示例#18
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check if valid key values for master user
     if ($Security->CurrentUserID() != "" && !$Security->IsAdmin()) {
         // Non system admin
         $sMasterFilter = $this->SqlMasterFilter_socios();
         if (strval($this->id_socio->CurrentValue) != "" && $this->getCurrentMasterTable() == "socios") {
             $sMasterFilter = str_replace("@socio_nro@", ew_AdjustSql($this->id_socio->CurrentValue), $sMasterFilter);
         } else {
             $sMasterFilter = "";
         }
         if ($sMasterFilter != "") {
             $rsmaster = $GLOBALS["socios"]->LoadRs($sMasterFilter);
             $this->MasterRecordExists = $rsmaster && !$rsmaster->EOF;
             if (!$this->MasterRecordExists) {
                 $sMasterUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedMasterUserID"));
                 $sMasterUserIdMsg = str_replace("%f", $sMasterFilter, $sMasterUserIdMsg);
                 $this->setFailureMessage($sMasterUserIdMsg);
                 return FALSE;
             } else {
                 $rsmaster->Close();
             }
         }
     }
     // Check referential integrity for master table 'socios'
     $bValidMasterRecord = TRUE;
     $sMasterFilter = $this->SqlMasterFilter_socios();
     if (strval($this->id_socio->CurrentValue) != "") {
         $sMasterFilter = str_replace("@socio_nro@", ew_AdjustSql($this->id_socio->CurrentValue), $sMasterFilter);
     } else {
         $bValidMasterRecord = FALSE;
     }
     if ($bValidMasterRecord) {
         $rsmaster = $GLOBALS["socios"]->LoadRs($sMasterFilter);
         $bValidMasterRecord = $rsmaster && !$rsmaster->EOF;
         $rsmaster->Close();
     }
     if (!$bValidMasterRecord) {
         $sRelatedRecordMsg = str_replace("%t", "socios", $Language->Phrase("RelatedRecordRequired"));
         $this->setFailureMessage($sRelatedRecordMsg);
         return FALSE;
     }
     // Begin transaction
     if ($this->getCurrentDetailTable() != "") {
         $conn->BeginTrans();
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // mes
     $this->mes->SetDbValueDef($rsnew, $this->mes->CurrentValue, NULL, FALSE);
     // anio
     $this->anio->SetDbValueDef($rsnew, $this->anio->CurrentValue, NULL, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha->CurrentValue, 7), NULL, FALSE);
     // monto
     $this->monto->SetDbValueDef($rsnew, $this->monto->CurrentValue, NULL, FALSE);
     // id_socio
     $this->id_socio->SetDbValueDef($rsnew, $this->id_socio->CurrentValue, NULL, FALSE);
     // id_usuario
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['id_usuario'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->id->setDbValue($conn->Insert_ID());
         $rsnew['id'] = $this->id->DbValue;
     }
     // Add detail records
     if ($AddRow) {
         $DetailTblVar = explode(",", $this->getCurrentDetailTable());
         if (in_array("detalle_deudas", $DetailTblVar) && $GLOBALS["detalle_deudas"]->DetailAdd) {
             $GLOBALS["detalle_deudas"]->id_deuda->setSessionValue($this->id->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["detalle_deudas_grid"])) {
                 $GLOBALS["detalle_deudas_grid"] = new cdetalle_deudas_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["detalle_deudas_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["detalle_deudas"]->id_deuda->setSessionValue("");
             }
             // Clear master key if insert failed
         }
         if (in_array("pagos", $DetailTblVar) && $GLOBALS["pagos"]->DetailAdd) {
             $GLOBALS["pagos"]->id_deuda->setSessionValue($this->id->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["pagos_grid"])) {
                 $GLOBALS["pagos_grid"] = new cpagos_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["pagos_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["pagos"]->id_deuda->setSessionValue("");
             }
             // Clear master key if insert failed
         }
     }
     // Commit/Rollback transaction
     if ($this->getCurrentDetailTable() != "") {
         if ($AddRow) {
             $conn->CommitTrans();
             // Commit transaction
         } else {
             $conn->RollbackTrans();
             // Rollback transaction
         }
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
         $this->WriteAuditTrailOnAdd($rsnew);
     }
     return $AddRow;
 }
示例#19
0
 function LoadRowValues(&$rs)
 {
     global $conn;
     if (!$rs || $rs->EOF) {
         return;
     }
     // Call Row Selected event
     $row =& $rs->fields;
     $this->Row_Selected($row);
     $this->id->setDbValue($rs->fields('id'));
     $this->mes->setDbValue($rs->fields('mes'));
     $this->anio->setDbValue($rs->fields('anio'));
     $this->fecha->setDbValue($rs->fields('fecha'));
     $this->monto->setDbValue($rs->fields('monto'));
     $this->id_usuario->setDbValue($rs->fields('id_usuario'));
     $this->id_socio->setDbValue($rs->fields('id_socio'));
     if (!isset($GLOBALS["detalle_deudas_grid"])) {
         $GLOBALS["detalle_deudas_grid"] = new cdetalle_deudas_grid();
     }
     $sDetailFilter = $GLOBALS["detalle_deudas"]->SqlDetailFilter_deudas();
     $sDetailFilter = str_replace("@id_deuda@", ew_AdjustSql($this->id->DbValue), $sDetailFilter);
     $GLOBALS["detalle_deudas"]->setCurrentMasterTable("deudas");
     $sDetailFilter = $GLOBALS["detalle_deudas"]->ApplyUserIDFilters($sDetailFilter);
     $this->detalle_deudas_Count = $GLOBALS["detalle_deudas"]->LoadRecordCount($sDetailFilter);
     if (!isset($GLOBALS["pagos_grid"])) {
         $GLOBALS["pagos_grid"] = new cpagos_grid();
     }
     $sDetailFilter = $GLOBALS["pagos"]->SqlDetailFilter_deudas();
     $sDetailFilter = str_replace("@id_deuda@", ew_AdjustSql($this->id->DbValue), $sDetailFilter);
     $GLOBALS["pagos"]->setCurrentMasterTable("deudas");
     $sDetailFilter = $GLOBALS["pagos"]->ApplyUserIDFilters($sDetailFilter);
     $this->pagos_Count = $GLOBALS["pagos"]->LoadRecordCount($sDetailFilter);
 }
示例#20
0
 function BasicSearchSQL($Keyword)
 {
     $sKeyword = ew_AdjustSql($Keyword);
     $sWhere = "";
     $this->BuildBasicSearchSQL($sWhere, $this->mes, $Keyword);
     $this->BuildBasicSearchSQL($sWhere, $this->anio, $Keyword);
     return $sWhere;
 }
 function BasicSearchSQL($Keyword)
 {
     global $order;
     $sKeyword = ew_AdjustSql($Keyword);
     $sWhere = "";
     $this->BuildBasicSearchSQL($sWhere, $order->zemail, $Keyword);
     return $sWhere;
 }
示例#22
0
<?php 
        echo $Report1->dtime->ViewValue;
        ?>
</span>
</td></tr>
<?php 
    }
    // Get detail records
    $Report1_report->ReportFilter = $Report1_report->DefaultFilter;
    if ($Report1_report->ReportFilter != "") {
        $Report1_report->ReportFilter .= " AND ";
    }
    if (is_null($Report1->dtime->CurrentValue)) {
        $Report1_report->ReportFilter .= "(`dtime` IS NULL)";
    } else {
        $Report1_report->ReportFilter .= "(`dtime` = '" . ew_AdjustSql($Report1->dtime->CurrentValue) . "')";
    }
    if ($Report1_report->DbDetailFilter != "") {
        if ($Report1_report->ReportFilter != "") {
            $Report1_report->ReportFilter .= " AND ";
        }
        $Report1_report->ReportFilter .= "(" . $Report1_report->DbDetailFilter . ")";
    }
    if (!$Security->CanReport()) {
        if ($sFilter != "") {
            $sFilter .= " AND ";
        }
        $sFilter .= "(0=1)";
    }
    // Set up detail SQL
    $Report1->CurrentFilter = $Report1_report->ReportFilter;
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check referential integrity for master table 'servicio_medico'
     $bValidMasterRecord = TRUE;
     $sMasterFilter = $this->SqlMasterFilter_servicio_medico();
     if (strval($this->idservicio_medico->CurrentValue) != "") {
         $sMasterFilter = str_replace("@idservicio_medico@", ew_AdjustSql($this->idservicio_medico->CurrentValue), $sMasterFilter);
     } else {
         $bValidMasterRecord = FALSE;
     }
     if ($bValidMasterRecord) {
         $rsmaster = $GLOBALS["servicio_medico"]->LoadRs($sMasterFilter);
         $bValidMasterRecord = $rsmaster && !$rsmaster->EOF;
         $rsmaster->Close();
     }
     if (!$bValidMasterRecord) {
         $sRelatedRecordMsg = str_replace("%t", "servicio_medico", $Language->Phrase("RelatedRecordRequired"));
         $this->setFailureMessage($sRelatedRecordMsg);
         return FALSE;
     }
     // Begin transaction
     if ($this->getCurrentDetailTable() != "") {
         $conn->BeginTrans();
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // idcuenta
     $this->idcuenta->SetDbValueDef($rsnew, $this->idcuenta->CurrentValue, NULL, FALSE);
     // idservicio_medico
     $this->idservicio_medico->SetDbValueDef($rsnew, $this->idservicio_medico->CurrentValue, 0, strval($this->idservicio_medico->CurrentValue) == "");
     // costo
     $this->costo->SetDbValueDef($rsnew, $this->costo->CurrentValue, 0, strval($this->costo->CurrentValue) == "");
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->idservicio_medico_prestado->setDbValue($conn->Insert_ID());
         $rsnew['idservicio_medico_prestado'] = $this->idservicio_medico_prestado->DbValue;
     }
     // Add detail records
     if ($AddRow) {
         $DetailTblVar = explode(",", $this->getCurrentDetailTable());
         if (in_array("doctor_servicio_medico_prestado", $DetailTblVar) && $GLOBALS["doctor_servicio_medico_prestado"]->DetailAdd) {
             $GLOBALS["doctor_servicio_medico_prestado"]->idservicio_medico_prestado->setSessionValue($this->idservicio_medico_prestado->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["doctor_servicio_medico_prestado_grid"])) {
                 $GLOBALS["doctor_servicio_medico_prestado_grid"] = new cdoctor_servicio_medico_prestado_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["doctor_servicio_medico_prestado_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["doctor_servicio_medico_prestado"]->idservicio_medico_prestado->setSessionValue("");
             }
             // Clear master key if insert failed
         }
     }
     // Commit/Rollback transaction
     if ($this->getCurrentDetailTable() != "") {
         if ($AddRow) {
             $conn->CommitTrans();
             // Commit transaction
         } else {
             $conn->RollbackTrans();
             // Rollback transaction
         }
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check referential integrity for master table 'tramites'
     $bValidMasterRecord = TRUE;
     $sMasterFilter = $this->SqlMasterFilter_tramites();
     if (strval($this->id_tramite->CurrentValue) != "") {
         $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_tramite->CurrentValue), $sMasterFilter);
     } else {
         $bValidMasterRecord = FALSE;
     }
     if ($bValidMasterRecord) {
         $rsmaster = $GLOBALS["tramites"]->LoadRs($sMasterFilter);
         $bValidMasterRecord = $rsmaster && !$rsmaster->EOF;
         $rsmaster->Close();
     }
     if (!$bValidMasterRecord) {
         $sRelatedRecordMsg = str_replace("%t", "tramites", $Language->Phrase("RelatedRecordRequired"));
         $this->setFailureMessage($sRelatedRecordMsg);
         return FALSE;
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // id_tramite
     $this->id_tramite->SetDbValueDef($rsnew, $this->id_tramite->CurrentValue, 0, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_CurrentDate(), ew_CurrentDate());
     $rsnew['fecha'] =& $this->fecha->DbValue;
     // hora
     $this->hora->SetDbValueDef($rsnew, ew_CurrentTime(), ew_CurrentTime());
     $rsnew['hora'] =& $this->hora->DbValue;
     // titulo
     $this->titulo->SetDbValueDef($rsnew, $this->titulo->CurrentValue, NULL, FALSE);
     // archivo
     if (!$this->archivo->Upload->KeepFile) {
         $this->archivo->Upload->DbValue = "";
         // No need to delete old file
         if ($this->archivo->Upload->FileName == "") {
             $rsnew['archivo'] = NULL;
         } else {
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         }
     }
     if (!$this->archivo->Upload->KeepFile) {
         $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
         if (!ew_Empty($this->archivo->Upload->FileName)) {
             $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
             $FileCount = count($NewFiles);
             for ($i = 0; $i < $FileCount; $i++) {
                 $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                 if ($NewFiles[$i] != "") {
                     $file = $NewFiles[$i];
                     if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) {
                         if (!in_array($file, $OldFiles)) {
                             $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file);
                             // Get new file name
                             if ($file1 != $file) {
                                 // Rename temp file
                                 while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) {
                                     // Make sure did not clash with existing upload file
                                     $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE);
                                 }
                                 // Use indexed name
                                 rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1);
                                 $NewFiles[$i] = $file1;
                             }
                         }
                     }
                 }
             }
             $this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles);
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         } else {
             $NewFiles = array();
         }
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['id_tramite']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['fecha']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['hora']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check for duplicate key
     if ($bInsertRow && $this->ValidateKey) {
         $sFilter = $this->KeyFilter();
         $rsChk = $this->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, $Language->Phrase("DupKey"));
             $this->setFailureMessage($sKeyErrMsg);
             $rsChk->Close();
             $bInsertRow = FALSE;
         }
     }
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             if (!$this->archivo->Upload->KeepFile) {
                 $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
                 if (!ew_Empty($this->archivo->Upload->FileName)) {
                     $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
                     $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']);
                     $FileCount = count($NewFiles);
                     for ($i = 0; $i < $FileCount; $i++) {
                         $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                         if ($NewFiles[$i] != "") {
                             $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
                             if (file_exists($file)) {
                                 $this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i);
                                 // Just replace
                             }
                         }
                     }
                 } else {
                     $NewFiles = array();
                 }
                 $FileCount = count($OldFiles);
                 for ($i = 0; $i < $FileCount; $i++) {
                     if ($OldFiles[$i] != "" && !in_array($OldFiles[$i], $NewFiles)) {
                         @unlink(ew_UploadPathEx(TRUE, $this->archivo->OldUploadPath) . $OldFiles[$i]);
                     }
                 }
             }
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     // archivo
     ew_CleanUploadTempPath($this->archivo, $this->archivo->Upload->Index);
     return $AddRow;
 }
示例#25
0
 function KeyFilter()
 {
     $sKeyFilter = $this->SqlKeyFilter();
     if (!is_numeric($this->CARD_TYPE_ID->CurrentValue)) {
         $sKeyFilter = "0=1";
     }
     // Invalid key
     $sKeyFilter = str_replace("@CARD_TYPE_ID@", ew_AdjustSql($this->CARD_TYPE_ID->CurrentValue, $this->DBID), $sKeyFilter);
     // Replace key value
     return $sKeyFilter;
 }
示例#26
0
 function BasicSearchSQL($Keyword)
 {
     $sKeyword = ew_AdjustSql($Keyword);
     $sWhere = "";
     $this->BuildBasicSearchSQL($sWhere, $this->news_title, $Keyword);
     $this->BuildBasicSearchSQL($sWhere, $this->news_description, $Keyword);
     return $sWhere;
 }
 function Page_Main()
 {
     global $PromoCodes;
     // Load Key Parameters
     $sKey = "";
     $bSingleDelete = TRUE;
     // Initialize as single delete
     $nKeySelected = 0;
     // Initialize selected key count
     $sFilter = "";
     if (@$_GET["PromoCodeID"] != "") {
         $PromoCodes->PromoCodeID->setQueryStringValue($_GET["PromoCodeID"]);
         if (!is_numeric($PromoCodes->PromoCodeID->QueryStringValue)) {
             $this->Page_Terminate("PromoCodeslist.php");
         }
         // Prevent SQL injection, exit
         $sKey .= $PromoCodes->PromoCodeID->QueryStringValue;
     } else {
         $bSingleDelete = FALSE;
     }
     if ($bSingleDelete) {
         $nKeySelected = 1;
         // Set up key selected count
         $this->arRecKeys[0] = $sKey;
     } else {
         if (isset($_POST["key_m"])) {
             // Key in form
             $nKeySelected = count($_POST["key_m"]);
             // Set up key selected count
             $this->arRecKeys = ew_StripSlashes($_POST["key_m"]);
         }
     }
     if ($nKeySelected <= 0) {
         $this->Page_Terminate("PromoCodeslist.php");
     }
     // No key specified, return to list
     // Build filter
     foreach ($this->arRecKeys as $sKey) {
         $sFilter .= "(";
         // Set up key field
         $sKeyFld = $sKey;
         if (!is_numeric($sKeyFld)) {
             $this->Page_Terminate("PromoCodeslist.php");
         }
         // Prevent SQL injection, return to list
         $sFilter .= "`PromoCodeID`=" . ew_AdjustSql($sKeyFld) . " AND ";
         if (substr($sFilter, -5) == " AND ") {
             $sFilter = substr($sFilter, 0, strlen($sFilter) - 5) . ") OR ";
         }
     }
     if (substr($sFilter, -4) == " OR ") {
         $sFilter = substr($sFilter, 0, strlen($sFilter) - 4);
     }
     // Set up filter (SQL WhHERE clause) and get return SQL
     // SQL constructor in SQL constructor in PromoCodes class, PromoCodesinfo.php
     $PromoCodes->CurrentFilter = $sFilter;
     // Get action
     if (@$_POST["a_delete"] != "") {
         $PromoCodes->CurrentAction = $_POST["a_delete"];
     } else {
         $PromoCodes->CurrentAction = "I";
         // Display record
     }
     switch ($PromoCodes->CurrentAction) {
         case "D":
             // Delete
             $PromoCodes->SendEmail = TRUE;
             // Send email on delete success
             if ($this->DeleteRows()) {
                 // delete rows
                 $this->setMessage("Delete succeeded");
                 // Set up success message
                 $this->Page_Terminate($PromoCodes->getReturnUrl());
                 // Return to caller
             }
     }
 }
示例#28
0
 function BasicSearchSQL($Keyword)
 {
     global $Allergies;
     $sKeyword = ew_AdjustSql($Keyword);
     $sql = "";
     $sql .= $Allergies->name->FldExpression . " LIKE '%" . $sKeyword . "%' OR ";
     $sql .= $Allergies->code->FldExpression . " LIKE '%" . $sKeyword . "%' OR ";
     if (substr($sql, -4) == " OR ") {
         $sql = substr($sql, 0, strlen($sql) - 4);
     }
     return $sql;
 }
 function RenderRow()
 {
     global $conn, $Security, $GiftCertificates;
     // Call Row_Rendering event
     $GiftCertificates->Row_Rendering();
     // Common render codes for all row types
     // CustomerID
     $GiftCertificates->CustomerID->CellCssStyle = "";
     $GiftCertificates->CustomerID->CellCssClass = "";
     // GiftEmail
     $GiftCertificates->GiftEmail->CellCssStyle = "";
     $GiftCertificates->GiftEmail->CellCssClass = "";
     // GiftPhone
     $GiftCertificates->GiftPhone->CellCssStyle = "";
     $GiftCertificates->GiftPhone->CellCssClass = "";
     // GiftFirstName
     $GiftCertificates->GiftFirstName->CellCssStyle = "";
     $GiftCertificates->GiftFirstName->CellCssClass = "";
     // GiftLastName
     $GiftCertificates->GiftLastName->CellCssStyle = "";
     $GiftCertificates->GiftLastName->CellCssClass = "";
     // GiftAmount
     $GiftCertificates->GiftAmount->CellCssStyle = "";
     $GiftCertificates->GiftAmount->CellCssClass = "";
     // GiftMessage
     $GiftCertificates->GiftMessage->CellCssStyle = "";
     $GiftCertificates->GiftMessage->CellCssClass = "";
     // GiftSendMethod
     $GiftCertificates->GiftSendMethod->CellCssStyle = "";
     $GiftCertificates->GiftSendMethod->CellCssClass = "";
     // GiftSendAddress1
     $GiftCertificates->GiftSendAddress1->CellCssStyle = "";
     $GiftCertificates->GiftSendAddress1->CellCssClass = "";
     // GiftSendAddress2
     $GiftCertificates->GiftSendAddress2->CellCssStyle = "";
     $GiftCertificates->GiftSendAddress2->CellCssClass = "";
     // GiftSendCity
     $GiftCertificates->GiftSendCity->CellCssStyle = "";
     $GiftCertificates->GiftSendCity->CellCssClass = "";
     // GiftSendState
     $GiftCertificates->GiftSendState->CellCssStyle = "";
     $GiftCertificates->GiftSendState->CellCssClass = "";
     // GiftSendZip
     $GiftCertificates->GiftSendZip->CellCssStyle = "";
     $GiftCertificates->GiftSendZip->CellCssClass = "";
     // GiftSendEmail
     $GiftCertificates->GiftSendEmail->CellCssStyle = "";
     $GiftCertificates->GiftSendEmail->CellCssClass = "";
     // PromoCodeID
     $GiftCertificates->PromoCodeID->CellCssStyle = "";
     $GiftCertificates->PromoCodeID->CellCssClass = "";
     if ($GiftCertificates->RowType == EW_ROWTYPE_VIEW) {
         // View row
         // GiftCertificateID
         $GiftCertificates->GiftCertificateID->ViewValue = $GiftCertificates->GiftCertificateID->CurrentValue;
         $GiftCertificates->GiftCertificateID->CssStyle = "";
         $GiftCertificates->GiftCertificateID->CssClass = "";
         $GiftCertificates->GiftCertificateID->ViewCustomAttributes = "";
         // CustomerID
         $GiftCertificates->CustomerID->ViewValue = $GiftCertificates->CustomerID->CurrentValue;
         if (strval($GiftCertificates->CustomerID->CurrentValue) != "") {
             $sSqlWrk = "SELECT `Email` FROM `Customers` WHERE `CustomerID` = " . ew_AdjustSql($GiftCertificates->CustomerID->CurrentValue) . "";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup value(s) found
                 $GiftCertificates->CustomerID->ViewValue = $rswrk->fields('Email');
                 $rswrk->Close();
             } else {
                 $GiftCertificates->CustomerID->ViewValue = $GiftCertificates->CustomerID->CurrentValue;
             }
         } else {
             $GiftCertificates->CustomerID->ViewValue = NULL;
         }
         $GiftCertificates->CustomerID->CssStyle = "";
         $GiftCertificates->CustomerID->CssClass = "";
         $GiftCertificates->CustomerID->ViewCustomAttributes = "";
         // GiftEmail
         $GiftCertificates->GiftEmail->ViewValue = $GiftCertificates->GiftEmail->CurrentValue;
         $GiftCertificates->GiftEmail->CssStyle = "";
         $GiftCertificates->GiftEmail->CssClass = "";
         $GiftCertificates->GiftEmail->ViewCustomAttributes = "";
         // GiftPhone
         $GiftCertificates->GiftPhone->ViewValue = $GiftCertificates->GiftPhone->CurrentValue;
         $GiftCertificates->GiftPhone->CssStyle = "";
         $GiftCertificates->GiftPhone->CssClass = "";
         $GiftCertificates->GiftPhone->ViewCustomAttributes = "";
         // GiftFirstName
         $GiftCertificates->GiftFirstName->ViewValue = $GiftCertificates->GiftFirstName->CurrentValue;
         $GiftCertificates->GiftFirstName->CssStyle = "";
         $GiftCertificates->GiftFirstName->CssClass = "";
         $GiftCertificates->GiftFirstName->ViewCustomAttributes = "";
         // GiftLastName
         $GiftCertificates->GiftLastName->ViewValue = $GiftCertificates->GiftLastName->CurrentValue;
         $GiftCertificates->GiftLastName->CssStyle = "";
         $GiftCertificates->GiftLastName->CssClass = "";
         $GiftCertificates->GiftLastName->ViewCustomAttributes = "";
         // GiftAmount
         $GiftCertificates->GiftAmount->ViewValue = $GiftCertificates->GiftAmount->CurrentValue;
         $GiftCertificates->GiftAmount->CssStyle = "";
         $GiftCertificates->GiftAmount->CssClass = "";
         $GiftCertificates->GiftAmount->ViewCustomAttributes = "";
         // GiftMessage
         $GiftCertificates->GiftMessage->ViewValue = $GiftCertificates->GiftMessage->CurrentValue;
         $GiftCertificates->GiftMessage->CssStyle = "";
         $GiftCertificates->GiftMessage->CssClass = "";
         $GiftCertificates->GiftMessage->ViewCustomAttributes = "";
         // GiftSendMethod
         if (strval($GiftCertificates->GiftSendMethod->CurrentValue) != "") {
             switch ($GiftCertificates->GiftSendMethod->CurrentValue) {
                 case "0":
                     $GiftCertificates->GiftSendMethod->ViewValue = "Email To Buyer";
                     break;
                 case "1":
                     $GiftCertificates->GiftSendMethod->ViewValue = "Email to Recipient";
                     break;
                 case "2":
                     $GiftCertificates->GiftSendMethod->ViewValue = "Mail plastic card to Buyer";
                     break;
                 case "3":
                     $GiftCertificates->GiftSendMethod->ViewValue = "Mail plastic card to Recipient";
                     break;
                 default:
                     $GiftCertificates->GiftSendMethod->ViewValue = $GiftCertificates->GiftSendMethod->CurrentValue;
             }
         } else {
             $GiftCertificates->GiftSendMethod->ViewValue = NULL;
         }
         $GiftCertificates->GiftSendMethod->CssStyle = "";
         $GiftCertificates->GiftSendMethod->CssClass = "";
         $GiftCertificates->GiftSendMethod->ViewCustomAttributes = "";
         // GiftSendAddress1
         $GiftCertificates->GiftSendAddress1->ViewValue = $GiftCertificates->GiftSendAddress1->CurrentValue;
         $GiftCertificates->GiftSendAddress1->CssStyle = "";
         $GiftCertificates->GiftSendAddress1->CssClass = "";
         $GiftCertificates->GiftSendAddress1->ViewCustomAttributes = "";
         // GiftSendAddress2
         $GiftCertificates->GiftSendAddress2->ViewValue = $GiftCertificates->GiftSendAddress2->CurrentValue;
         $GiftCertificates->GiftSendAddress2->CssStyle = "";
         $GiftCertificates->GiftSendAddress2->CssClass = "";
         $GiftCertificates->GiftSendAddress2->ViewCustomAttributes = "";
         // GiftSendCity
         $GiftCertificates->GiftSendCity->ViewValue = $GiftCertificates->GiftSendCity->CurrentValue;
         $GiftCertificates->GiftSendCity->CssStyle = "";
         $GiftCertificates->GiftSendCity->CssClass = "";
         $GiftCertificates->GiftSendCity->ViewCustomAttributes = "";
         // GiftSendState
         $GiftCertificates->GiftSendState->ViewValue = $GiftCertificates->GiftSendState->CurrentValue;
         $GiftCertificates->GiftSendState->CssStyle = "";
         $GiftCertificates->GiftSendState->CssClass = "";
         $GiftCertificates->GiftSendState->ViewCustomAttributes = "";
         // GiftSendZip
         $GiftCertificates->GiftSendZip->ViewValue = $GiftCertificates->GiftSendZip->CurrentValue;
         $GiftCertificates->GiftSendZip->CssStyle = "";
         $GiftCertificates->GiftSendZip->CssClass = "";
         $GiftCertificates->GiftSendZip->ViewCustomAttributes = "";
         // GiftSendEmail
         $GiftCertificates->GiftSendEmail->ViewValue = $GiftCertificates->GiftSendEmail->CurrentValue;
         $GiftCertificates->GiftSendEmail->CssStyle = "";
         $GiftCertificates->GiftSendEmail->CssClass = "";
         $GiftCertificates->GiftSendEmail->ViewCustomAttributes = "";
         // PromoCodeID
         $GiftCertificates->PromoCodeID->ViewValue = $GiftCertificates->PromoCodeID->CurrentValue;
         if (strval($GiftCertificates->PromoCodeID->CurrentValue) != "") {
             $sSqlWrk = "SELECT `PromoCodeName` FROM `PromoCodes` WHERE `PromoCodeID` = " . ew_AdjustSql($GiftCertificates->PromoCodeID->CurrentValue) . "";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup value(s) found
                 $GiftCertificates->PromoCodeID->ViewValue = $rswrk->fields('PromoCodeName');
                 $rswrk->Close();
             } else {
                 $GiftCertificates->PromoCodeID->ViewValue = $GiftCertificates->PromoCodeID->CurrentValue;
             }
         } else {
             $GiftCertificates->PromoCodeID->ViewValue = NULL;
         }
         $GiftCertificates->PromoCodeID->CssStyle = "";
         $GiftCertificates->PromoCodeID->CssClass = "";
         $GiftCertificates->PromoCodeID->ViewCustomAttributes = "";
         // CustomerID
         $GiftCertificates->CustomerID->HrefValue = "";
         // GiftEmail
         $GiftCertificates->GiftEmail->HrefValue = "";
         // GiftPhone
         $GiftCertificates->GiftPhone->HrefValue = "";
         // GiftFirstName
         $GiftCertificates->GiftFirstName->HrefValue = "";
         // GiftLastName
         $GiftCertificates->GiftLastName->HrefValue = "";
         // GiftAmount
         $GiftCertificates->GiftAmount->HrefValue = "";
         // GiftMessage
         $GiftCertificates->GiftMessage->HrefValue = "";
         // GiftSendMethod
         $GiftCertificates->GiftSendMethod->HrefValue = "";
         // GiftSendAddress1
         $GiftCertificates->GiftSendAddress1->HrefValue = "";
         // GiftSendAddress2
         $GiftCertificates->GiftSendAddress2->HrefValue = "";
         // GiftSendCity
         $GiftCertificates->GiftSendCity->HrefValue = "";
         // GiftSendState
         $GiftCertificates->GiftSendState->HrefValue = "";
         // GiftSendZip
         $GiftCertificates->GiftSendZip->HrefValue = "";
         // GiftSendEmail
         $GiftCertificates->GiftSendEmail->HrefValue = "";
         // PromoCodeID
         $GiftCertificates->PromoCodeID->HrefValue = "";
     } elseif ($GiftCertificates->RowType == EW_ROWTYPE_ADD) {
         // Add row
         // CustomerID
         $GiftCertificates->CustomerID->EditCustomAttributes = "";
         if ($GiftCertificates->CustomerID->getSessionValue() != "") {
             $GiftCertificates->CustomerID->CurrentValue = $GiftCertificates->CustomerID->getSessionValue();
             $GiftCertificates->CustomerID->ViewValue = $GiftCertificates->CustomerID->CurrentValue;
             if (strval($GiftCertificates->CustomerID->CurrentValue) != "") {
                 $sSqlWrk = "SELECT `Email` FROM `Customers` WHERE `CustomerID` = " . ew_AdjustSql($GiftCertificates->CustomerID->CurrentValue) . "";
                 $rswrk = $conn->Execute($sSqlWrk);
                 if ($rswrk && !$rswrk->EOF) {
                     // Lookup value(s) found
                     $GiftCertificates->CustomerID->ViewValue = $rswrk->fields('Email');
                     $rswrk->Close();
                 } else {
                     $GiftCertificates->CustomerID->ViewValue = $GiftCertificates->CustomerID->CurrentValue;
                 }
             } else {
                 $GiftCertificates->CustomerID->ViewValue = NULL;
             }
             $GiftCertificates->CustomerID->CssStyle = "";
             $GiftCertificates->CustomerID->CssClass = "";
             $GiftCertificates->CustomerID->ViewCustomAttributes = "";
         } else {
             $GiftCertificates->CustomerID->EditValue = ew_HtmlEncode($GiftCertificates->CustomerID->CurrentValue);
             if (strval($GiftCertificates->CustomerID->CurrentValue) != "") {
                 $sSqlWrk = "SELECT `Email` FROM `Customers` WHERE `CustomerID` = " . ew_AdjustSql($GiftCertificates->CustomerID->CurrentValue) . "";
                 $rswrk = $conn->Execute($sSqlWrk);
                 if ($rswrk && !$rswrk->EOF) {
                     // Lookup value(s) found
                     $GiftCertificates->CustomerID->EditValue = $rswrk->fields('Email');
                     $rswrk->Close();
                 } else {
                     $GiftCertificates->CustomerID->EditValue = $GiftCertificates->CustomerID->CurrentValue;
                 }
             } else {
                 $GiftCertificates->CustomerID->EditValue = NULL;
             }
         }
         // GiftEmail
         $GiftCertificates->GiftEmail->EditCustomAttributes = "";
         $GiftCertificates->GiftEmail->EditValue = ew_HtmlEncode($GiftCertificates->GiftEmail->CurrentValue);
         // GiftPhone
         $GiftCertificates->GiftPhone->EditCustomAttributes = "";
         $GiftCertificates->GiftPhone->EditValue = ew_HtmlEncode($GiftCertificates->GiftPhone->CurrentValue);
         // GiftFirstName
         $GiftCertificates->GiftFirstName->EditCustomAttributes = "";
         $GiftCertificates->GiftFirstName->EditValue = ew_HtmlEncode($GiftCertificates->GiftFirstName->CurrentValue);
         // GiftLastName
         $GiftCertificates->GiftLastName->EditCustomAttributes = "";
         $GiftCertificates->GiftLastName->EditValue = ew_HtmlEncode($GiftCertificates->GiftLastName->CurrentValue);
         // GiftAmount
         $GiftCertificates->GiftAmount->EditCustomAttributes = "";
         $GiftCertificates->GiftAmount->EditValue = ew_HtmlEncode($GiftCertificates->GiftAmount->CurrentValue);
         // GiftMessage
         $GiftCertificates->GiftMessage->EditCustomAttributes = "";
         $GiftCertificates->GiftMessage->EditValue = ew_HtmlEncode($GiftCertificates->GiftMessage->CurrentValue);
         // GiftSendMethod
         $GiftCertificates->GiftSendMethod->EditCustomAttributes = "";
         $arwrk = array();
         $arwrk[] = array("0", "Email To Buyer");
         $arwrk[] = array("1", "Email to Recipient");
         $arwrk[] = array("2", "Mail plastic card to Buyer");
         $arwrk[] = array("3", "Mail plastic card to Recipient");
         array_unshift($arwrk, array("", "Please Select"));
         $GiftCertificates->GiftSendMethod->EditValue = $arwrk;
         // GiftSendAddress1
         $GiftCertificates->GiftSendAddress1->EditCustomAttributes = "";
         $GiftCertificates->GiftSendAddress1->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendAddress1->CurrentValue);
         // GiftSendAddress2
         $GiftCertificates->GiftSendAddress2->EditCustomAttributes = "";
         $GiftCertificates->GiftSendAddress2->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendAddress2->CurrentValue);
         // GiftSendCity
         $GiftCertificates->GiftSendCity->EditCustomAttributes = "";
         $GiftCertificates->GiftSendCity->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendCity->CurrentValue);
         // GiftSendState
         $GiftCertificates->GiftSendState->EditCustomAttributes = "";
         $GiftCertificates->GiftSendState->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendState->CurrentValue);
         // GiftSendZip
         $GiftCertificates->GiftSendZip->EditCustomAttributes = "";
         $GiftCertificates->GiftSendZip->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendZip->CurrentValue);
         // GiftSendEmail
         $GiftCertificates->GiftSendEmail->EditCustomAttributes = "";
         $GiftCertificates->GiftSendEmail->EditValue = ew_HtmlEncode($GiftCertificates->GiftSendEmail->CurrentValue);
         // PromoCodeID
         $GiftCertificates->PromoCodeID->EditCustomAttributes = "";
         $GiftCertificates->PromoCodeID->EditValue = ew_HtmlEncode($GiftCertificates->PromoCodeID->CurrentValue);
         if (strval($GiftCertificates->PromoCodeID->CurrentValue) != "") {
             $sSqlWrk = "SELECT `PromoCodeName` FROM `PromoCodes` WHERE `PromoCodeID` = " . ew_AdjustSql($GiftCertificates->PromoCodeID->CurrentValue) . "";
             $rswrk = $conn->Execute($sSqlWrk);
             if ($rswrk && !$rswrk->EOF) {
                 // Lookup value(s) found
                 $GiftCertificates->PromoCodeID->EditValue = $rswrk->fields('PromoCodeName');
                 $rswrk->Close();
             } else {
                 $GiftCertificates->PromoCodeID->EditValue = $GiftCertificates->PromoCodeID->CurrentValue;
             }
         } else {
             $GiftCertificates->PromoCodeID->EditValue = NULL;
         }
     }
     // Call Row Rendered event
     $GiftCertificates->Row_Rendered();
 }
示例#30
0
function EditRow()
{
    global $conn, $Security, $categories;
    $sFilter = $categories->SqlKeyFilter();
    if (!is_numeric($categories->id->CurrentValue)) {
        return FALSE;
    }
    $sFilter = str_replace("@id@", ew_AdjustSql($categories->id->CurrentValue), $sFilter);
    // Replace key value
    $categories->CurrentFilter = $sFilter;
    $sSql = $categories->SQL();
    $conn->raiseErrorFn = 'ew_ErrorFn';
    $rs = $conn->Execute($sSql);
    $conn->raiseErrorFn = '';
    if ($rs === FALSE) {
        return FALSE;
    }
    if ($rs->EOF) {
        $EditRow = FALSE;
        // Update Failed
    } else {
        // Save old values
        $rsold =& $rs->fields;
        $rsnew = array();
        // Field id
        // Field name
        $categories->name->SetDbValueDef($categories->name->CurrentValue, NULL);
        $rsnew['name'] =& $categories->name->DbValue;
        // Field keywords
        $categories->keywords->SetDbValueDef($categories->keywords->CurrentValue, NULL);
        $rsnew['keywords'] =& $categories->keywords->DbValue;
        // Call Row Updating event
        $bUpdateRow = $categories->Row_Updating($rsold, $rsnew);
        if ($bUpdateRow) {
            $conn->raiseErrorFn = 'ew_ErrorFn';
            $EditRow = $conn->Execute($categories->UpdateSQL($rsnew));
            $conn->raiseErrorFn = '';
        } else {
            if ($categories->CancelMessage != "") {
                $_SESSION[EW_SESSION_MESSAGE] = $categories->CancelMessage;
                $categories->CancelMessage = "";
            } else {
                $_SESSION[EW_SESSION_MESSAGE] = "Update cancelled";
            }
            $EditRow = FALSE;
        }
    }
    // Call Row Updated event
    if ($EditRow) {
        $categories->Row_Updated($rsold, $rsnew);
    }
    $rs->Close();
    return $EditRow;
}