function EditRow()
 {
     global $conn, $Security, $Orders;
     $sFilter = $Orders->KeyFilter();
     $Orders->CurrentFilter = $sFilter;
     $sSql = $Orders->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 OrderID
         // Field CustomerID
         $Orders->CustomerID->SetDbValueDef($Orders->CustomerID->CurrentValue, 0);
         $rsnew['CustomerID'] =& $Orders->CustomerID->DbValue;
         // Field TransactionNumber
         $Orders->TransactionNumber->SetDbValueDef($Orders->TransactionNumber->CurrentValue, NULL);
         $rsnew['TransactionNumber'] =& $Orders->TransactionNumber->DbValue;
         // Field DateOrdered
         $Orders->DateOrdered->SetDbValueDef(ew_UnFormatDateTime($Orders->DateOrdered->CurrentValue, 6), ew_CurrentDate());
         $rsnew['DateOrdered'] =& $Orders->DateOrdered->DbValue;
         // Field Total
         $Orders->Total->SetDbValueDef($Orders->Total->CurrentValue, 0);
         $rsnew['Total'] =& $Orders->Total->DbValue;
         // Field DeliveryDate
         $Orders->DeliveryDate->SetDbValueDef(ew_UnFormatDateTime($Orders->DeliveryDate->CurrentValue, 6), ew_CurrentDate());
         $rsnew['DeliveryDate'] =& $Orders->DeliveryDate->DbValue;
         // Field PromoCodeID
         $Orders->PromoCodeID->SetDbValueDef($Orders->PromoCodeID->CurrentValue, NULL);
         $rsnew['PromoCodeID'] =& $Orders->PromoCodeID->DbValue;
         // Field Sequence
         $Orders->Sequence->SetDbValueDef($Orders->Sequence->CurrentValue, NULL);
         $rsnew['Sequence'] =& $Orders->Sequence->DbValue;
         // Call Row Updating event
         $bUpdateRow = $Orders->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($Orders->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($Orders->CancelMessage != "") {
                 $this->setMessage($Orders->CancelMessage);
                 $Orders->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $Orders->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
Exemple #2
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // Password
     $this->Password->SetDbValueDef($rsnew, $this->Password->CurrentValue, "", FALSE);
     // Email
     $this->_Email->SetDbValueDef($rsnew, $this->_Email->CurrentValue, "", FALSE);
     // Created
     $this->Created->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->Created->CurrentValue, 5), ew_CurrentDate(), strval($this->Created->CurrentValue) == "");
     // Type
     $this->Type->SetDbValueDef($rsnew, $this->Type->CurrentValue, NULL, FALSE);
     // 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
 function EditRow()
 {
     global $conn, $Security, $PromoCodes;
     $sFilter = $PromoCodes->KeyFilter();
     $PromoCodes->CurrentFilter = $sFilter;
     $sSql = $PromoCodes->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 PromoCodeID
         // Field PromoCodeName
         $PromoCodes->PromoCodeName->SetDbValueDef($PromoCodes->PromoCodeName->CurrentValue, "");
         $rsnew['PromoCodeName'] =& $PromoCodes->PromoCodeName->DbValue;
         // Field PromoCodeType
         $PromoCodes->PromoCodeType->SetDbValueDef($PromoCodes->PromoCodeType->CurrentValue, "");
         $rsnew['PromoCodeType'] =& $PromoCodes->PromoCodeType->DbValue;
         // Field Amount
         $PromoCodes->Amount->SetDbValueDef($PromoCodes->Amount->CurrentValue, 0);
         $rsnew['Amount'] =& $PromoCodes->Amount->DbValue;
         // Field ValidFrom
         $PromoCodes->ValidFrom->SetDbValueDef(ew_UnFormatDateTime($PromoCodes->ValidFrom->CurrentValue, 6), ew_CurrentDate());
         $rsnew['ValidFrom'] =& $PromoCodes->ValidFrom->DbValue;
         // Field ValidTo
         $PromoCodes->ValidTo->SetDbValueDef(ew_UnFormatDateTime($PromoCodes->ValidTo->CurrentValue, 6), NULL);
         $rsnew['ValidTo'] =& $PromoCodes->ValidTo->DbValue;
         // Field Message
         $PromoCodes->Message->SetDbValueDef($PromoCodes->Message->CurrentValue, NULL);
         $rsnew['Message'] =& $PromoCodes->Message->DbValue;
         // Field One_Time_Only
         $PromoCodes->One_Time_Only->SetDbValueDef($PromoCodes->One_Time_Only->CurrentValue, "");
         $rsnew['One_Time_Only'] =& $PromoCodes->One_Time_Only->DbValue;
         // Field New_Customer_Only
         $PromoCodes->New_Customer_Only->SetDbValueDef($PromoCodes->New_Customer_Only->CurrentValue, "");
         $rsnew['New_Customer_Only'] =& $PromoCodes->New_Customer_Only->DbValue;
         // Field multiple_use
         $PromoCodes->multiple_use->SetDbValueDef($PromoCodes->multiple_use->CurrentValue, 0);
         $rsnew['multiple_use'] =& $PromoCodes->multiple_use->DbValue;
         // Call Row Updating event
         $bUpdateRow = $PromoCodes->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($PromoCodes->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($PromoCodes->CancelMessage != "") {
                 $this->setMessage($PromoCodes->CancelMessage);
                 $PromoCodes->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $PromoCodes->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function EditRow()
 {
     global $conn, $Security, $Notifications;
     $sFilter = $Notifications->KeyFilter();
     $Notifications->CurrentFilter = $sFilter;
     $sSql = $Notifications->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 ZipCode
         // Field Email
         // Field Location
         $Notifications->Location->SetDbValueDef($Notifications->Location->CurrentValue, NULL);
         $rsnew['Location'] =& $Notifications->Location->DbValue;
         // Field Timestamp
         $Notifications->Timestamp->SetDbValueDef(ew_UnFormatDateTime($Notifications->Timestamp->CurrentValue, 6), ew_CurrentDate());
         $rsnew['Timestamp'] =& $Notifications->Timestamp->DbValue;
         // Call Row Updating event
         $bUpdateRow = $Notifications->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($Notifications->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($Notifications->CancelMessage != "") {
                 $this->setMessage($Notifications->CancelMessage);
                 $Notifications->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $Notifications->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // m_id
     $this->m_id->SetDbValueDef($rsnew, $this->m_id->CurrentValue, NULL, FALSE);
     // package_id
     $this->package_id->SetDbValueDef($rsnew, $this->package_id->CurrentValue, NULL, FALSE);
     // customer_name
     $this->customer_name->SetDbValueDef($rsnew, $this->customer_name->CurrentValue, NULL, FALSE);
     // customer_cell
     $this->customer_cell->SetDbValueDef($rsnew, $this->customer_cell->CurrentValue, NULL, FALSE);
     // date
     $this->date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->date->CurrentValue, 7), ew_CurrentDate(), FALSE);
     // month
     $this->month->SetDbValueDef($rsnew, $this->month->CurrentValue, "", FALSE);
     // category
     $this->category->SetDbValueDef($rsnew, $this->category->CurrentValue, "", FALSE);
     // amount
     $this->amount->SetDbValueDef($rsnew, $this->amount->CurrentValue, 0, FALSE);
     // Details
     $this->Details->SetDbValueDef($rsnew, $this->Details->CurrentValue, "", FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->delivery_id->setDbValue($conn->Insert_ID());
             $rsnew['delivery_id'] = $this->delivery_id->DbValue;
         }
     } 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Exemple #6
0
function EditRow()
{
    global $conn, $Security, $logs;
    $sFilter = $logs->SqlKeyFilter();
    if (!is_numeric($logs->id->CurrentValue)) {
        return FALSE;
    }
    $sFilter = str_replace("@id@", ew_AdjustSql($logs->id->CurrentValue), $sFilter);
    // Replace key value
    $logs->CurrentFilter = $sFilter;
    $sSql = $logs->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 time
        $logs->time->SetDbValueDef(ew_UnFormatDateTime($logs->time->CurrentValue, 5), ew_CurrentDate());
        $rsnew['time'] =& $logs->time->DbValue;
        // Field client
        $logs->client->SetDbValueDef($logs->client->CurrentValue, NULL);
        $rsnew['client'] =& $logs->client->DbValue;
        // Field group
        $logs->group->SetDbValueDef($logs->group->CurrentValue, NULL);
        $rsnew['group'] =& $logs->group->DbValue;
        // Field type
        $logs->type->SetDbValueDef($logs->type->CurrentValue, NULL);
        $rsnew['type'] =& $logs->type->DbValue;
        // Field message
        $logs->message->SetDbValueDef($logs->message->CurrentValue, NULL);
        $rsnew['message'] =& $logs->message->DbValue;
        // Call Row Updating event
        $bUpdateRow = $logs->Row_Updating($rsold, $rsnew);
        if ($bUpdateRow) {
            $conn->raiseErrorFn = 'ew_ErrorFn';
            $EditRow = $conn->Execute($logs->UpdateSQL($rsnew));
            $conn->raiseErrorFn = '';
        } else {
            if ($logs->CancelMessage != "") {
                $_SESSION[EW_SESSION_MESSAGE] = $logs->CancelMessage;
                $logs->CancelMessage = "";
            } else {
                $_SESSION[EW_SESSION_MESSAGE] = "Update cancelled";
            }
            $EditRow = FALSE;
        }
    }
    // Call Row Updated event
    if ($EditRow) {
        $logs->Row_Updated($rsold, $rsnew);
    }
    $rs->Close();
    return $EditRow;
}
 function AddRow()
 {
     global $conn, $Security, $Notifications;
     // Check if key value entered
     if ($Notifications->ZipCode->CurrentValue == "") {
         $this->setMessage("Invalid key value");
         return FALSE;
     }
     // Check if key value entered
     if ($Notifications->zEmail->CurrentValue == "") {
         $this->setMessage("Invalid key value");
         return FALSE;
     }
     // Check for duplicate key
     $bCheckKey = TRUE;
     $sFilter = $Notifications->KeyFilter();
     if ($bCheckKey) {
         $rsChk = $Notifications->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, "Duplicate primary key: '%f'");
             $this->setMessage($sKeyErrMsg);
             $rsChk->Close();
             return FALSE;
         }
     }
     $rsnew = array();
     // Field ZipCode
     $Notifications->ZipCode->SetDbValueDef($Notifications->ZipCode->CurrentValue, 0);
     $rsnew['ZipCode'] =& $Notifications->ZipCode->DbValue;
     // Field Email
     $Notifications->zEmail->SetDbValueDef($Notifications->zEmail->CurrentValue, "");
     $rsnew['Email'] =& $Notifications->zEmail->DbValue;
     // Field Location
     $Notifications->Location->SetDbValueDef($Notifications->Location->CurrentValue, NULL);
     $rsnew['Location'] =& $Notifications->Location->DbValue;
     // Field Timestamp
     $Notifications->Timestamp->SetDbValueDef(ew_UnFormatDateTime($Notifications->Timestamp->CurrentValue, 6), ew_CurrentDate());
     $rsnew['Timestamp'] =& $Notifications->Timestamp->DbValue;
     // Call Row Inserting event
     $bInsertRow = $Notifications->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($Notifications->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($Notifications->CancelMessage != "") {
             $this->setMessage($Notifications->CancelMessage);
             $Notifications->CancelMessage = "";
         } else {
             $this->setMessage("Insert cancelled");
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $Notifications->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
 function EditRow()
 {
     global $conn, $Security, $password_reset_requests;
     $sFilter = $password_reset_requests->KeyFilter();
     $password_reset_requests->CurrentFilter = $sFilter;
     $sSql = $password_reset_requests->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 CustomerID
         $password_reset_requests->CustomerID->SetDbValueDef($password_reset_requests->CustomerID->CurrentValue, 0);
         $rsnew['CustomerID'] =& $password_reset_requests->CustomerID->DbValue;
         // Field token_id
         $password_reset_requests->token_id->SetDbValueDef($password_reset_requests->token_id->CurrentValue, "");
         $rsnew['token_id'] =& $password_reset_requests->token_id->DbValue;
         // Field expires
         $password_reset_requests->expires->SetDbValueDef(ew_UnFormatDateTime($password_reset_requests->expires->CurrentValue, 6), ew_CurrentDate());
         $rsnew['expires'] =& $password_reset_requests->expires->DbValue;
         // Call Row Updating event
         $bUpdateRow = $password_reset_requests->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($password_reset_requests->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($password_reset_requests->CancelMessage != "") {
                 $this->setMessage($password_reset_requests->CancelMessage);
                 $password_reset_requests->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $password_reset_requests->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function EditRow()
 {
     global $Security, $Language;
     $sFilter = $this->KeyFilter();
     $sFilter = $this->ApplyUserIDFilters($sFilter);
     $conn =& $this->Connection();
     $this->CurrentFilter = $sFilter;
     $sSql = $this->SQL();
     $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
     $rs = $conn->Execute($sSql);
     $conn->raiseErrorFn = '';
     if ($rs === FALSE) {
         return FALSE;
     }
     if ($rs->EOF) {
         $this->setFailureMessage($Language->Phrase("NoRecord"));
         // Set no record message
         $EditRow = FALSE;
         // Update Failed
     } else {
         // Save old values
         $rsold =& $rs->fields;
         $this->LoadDbValues($rsold);
         $rsnew = array();
         // PATH
         if ($this->PATH->Visible && !$this->PATH->ReadOnly && !$this->PATH->Upload->KeepFile) {
             $this->PATH->Upload->DbValue = $rsold['PATH'];
             // Get original value
             if ($this->PATH->Upload->FileName == "") {
                 $rsnew['PATH'] = NULL;
             } else {
                 $rsnew['PATH'] = $this->PATH->Upload->FileName;
             }
         }
         // PROCESS
         $this->PROCESS->SetDbValueDef($rsnew, $this->PROCESS->CurrentValue, 0, $this->PROCESS->ReadOnly);
         // BANK_ACCOUNT_ID
         $this->BANK_ACCOUNT_ID->SetDbValueDef($rsnew, $this->BANK_ACCOUNT_ID->CurrentValue, 0, $this->BANK_ACCOUNT_ID->ReadOnly);
         // UPLOAD_FILE_STATUS_ID
         $this->UPLOAD_FILE_STATUS_ID->SetDbValueDef($rsnew, $this->UPLOAD_FILE_STATUS_ID->CurrentValue, 0, $this->UPLOAD_FILE_STATUS_ID->ReadOnly);
         // DATETIME
         $this->DATETIME->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->DATETIME->CurrentValue, 7), ew_CurrentDate(), $this->DATETIME->ReadOnly);
         if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) {
             if (!ew_Empty($this->PATH->Upload->Value)) {
                 $rsnew['PATH'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->PATH->UploadPath), $rsnew['PATH']);
                 // Get new file name
             }
         }
         // Call Row Updating event
         $bUpdateRow = $this->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
             if (count($rsnew) > 0) {
                 $EditRow = $this->Update($rsnew, "", $rsold);
             } else {
                 $EditRow = TRUE;
             }
             // No field to update
             $conn->raiseErrorFn = '';
             if ($EditRow) {
                 if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) {
                     if (!ew_Empty($this->PATH->Upload->Value)) {
                         $this->PATH->Upload->SaveToFile($this->PATH->UploadPath, $rsnew['PATH'], TRUE);
                     }
                 }
             }
         } 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("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $this->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     // PATH
     ew_CleanUploadTempPath($this->PATH, $this->PATH->Upload->Index);
     return $EditRow;
 }
 function EditRow()
 {
     global $conn, $Security, $HolidayDate;
     $sFilter = $HolidayDate->KeyFilter();
     $HolidayDate->CurrentFilter = $sFilter;
     $sSql = $HolidayDate->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 HolidayDateID
         // Field HolidayOrderBy
         $HolidayDate->HolidayOrderBy->SetDbValueDef(ew_UnFormatDateTime($HolidayDate->HolidayOrderBy->CurrentValue, 6), ew_CurrentDate());
         $rsnew['HolidayOrderBy'] =& $HolidayDate->HolidayOrderBy->DbValue;
         // Field HolidayDeliverOn
         $HolidayDate->HolidayDeliverOn->SetDbValueDef(ew_UnFormatDateTime($HolidayDate->HolidayDeliverOn->CurrentValue, 6), ew_CurrentDate());
         $rsnew['HolidayDeliverOn'] =& $HolidayDate->HolidayDeliverOn->DbValue;
         // Field HolidayComment
         $HolidayDate->HolidayComment->SetDbValueDef($HolidayDate->HolidayComment->CurrentValue, NULL);
         $rsnew['HolidayComment'] =& $HolidayDate->HolidayComment->DbValue;
         // Call Row Updating event
         $bUpdateRow = $HolidayDate->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($HolidayDate->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($HolidayDate->CancelMessage != "") {
                 $this->setMessage($HolidayDate->CancelMessage);
                 $HolidayDate->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $HolidayDate->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // Titulo
     $this->Titulo->SetDbValueDef($rsnew, $this->Titulo->CurrentValue, NULL, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_CurrentDate(), NULL);
     $rsnew['fecha'] =& $this->fecha->DbValue;
     // 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;
         }
     }
     // estado
     $this->estado->SetDbValueDef($rsnew, $this->estado->CurrentValue, NULL, FALSE);
     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);
     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) {
         $this->codigo->setDbValue($conn->Insert_ID());
         $rsnew['codigo'] = $this->codigo->DbValue;
     }
     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;
 }
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // nis
     $this->nis->SetDbValueDef($rsnew, $this->nis->CurrentValue, "", FALSE);
     // nama
     $this->nama->SetDbValueDef($rsnew, $this->nama->CurrentValue, "", FALSE);
     // tempat_lahir
     $this->tempat_lahir->SetDbValueDef($rsnew, $this->tempat_lahir->CurrentValue, "", FALSE);
     // tanggal_lahir
     $this->tanggal_lahir->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->tanggal_lahir->CurrentValue, 5), ew_CurrentDate(), FALSE);
     // alamat
     $this->alamat->SetDbValueDef($rsnew, $this->alamat->CurrentValue, "", FALSE);
     // agama
     $this->agama->SetDbValueDef($rsnew, $this->agama->CurrentValue, "", FALSE);
     // no_hp
     $this->no_hp->SetDbValueDef($rsnew, $this->no_hp->CurrentValue, "", FALSE);
     // email
     $this->_email->SetDbValueDef($rsnew, $this->_email->CurrentValue, "", FALSE);
     // 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_siswa->setDbValue($conn->Insert_ID());
         $rsnew['id_siswa'] = $this->id_siswa->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
 function EditRow()
 {
     global $Security, $Language;
     $sFilter = $this->KeyFilter();
     $sFilter = $this->ApplyUserIDFilters($sFilter);
     $conn =& $this->Connection();
     $this->CurrentFilter = $sFilter;
     $sSql = $this->SQL();
     $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
     $rs = $conn->Execute($sSql);
     $conn->raiseErrorFn = '';
     if ($rs === FALSE) {
         return FALSE;
     }
     if ($rs->EOF) {
         $this->setFailureMessage($Language->Phrase("NoRecord"));
         // Set no record message
         $EditRow = FALSE;
         // Update Failed
     } else {
         // Save old values
         $rsold =& $rs->fields;
         $this->LoadDbValues($rsold);
         $rsnew = array();
         // m_id
         $this->m_id->SetDbValueDef($rsnew, $this->m_id->CurrentValue, NULL, $this->m_id->ReadOnly);
         // package_id
         $this->package_id->SetDbValueDef($rsnew, $this->package_id->CurrentValue, NULL, $this->package_id->ReadOnly);
         // customer_name
         $this->customer_name->SetDbValueDef($rsnew, $this->customer_name->CurrentValue, NULL, $this->customer_name->ReadOnly);
         // customer_cell
         $this->customer_cell->SetDbValueDef($rsnew, $this->customer_cell->CurrentValue, NULL, $this->customer_cell->ReadOnly);
         // date
         $this->date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->date->CurrentValue, 7), ew_CurrentDate(), $this->date->ReadOnly);
         // month
         $this->month->SetDbValueDef($rsnew, $this->month->CurrentValue, "", $this->month->ReadOnly);
         // category
         $this->category->SetDbValueDef($rsnew, $this->category->CurrentValue, "", $this->category->ReadOnly);
         // amount
         $this->amount->SetDbValueDef($rsnew, $this->amount->CurrentValue, 0, $this->amount->ReadOnly);
         // Details
         $this->Details->SetDbValueDef($rsnew, $this->Details->CurrentValue, "", $this->Details->ReadOnly);
         // Call Row Updating event
         $bUpdateRow = $this->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
             if (count($rsnew) > 0) {
                 $EditRow = $this->Update($rsnew, "", $rsold);
             } else {
                 $EditRow = TRUE;
             }
             // No field to update
             $conn->raiseErrorFn = '';
             if ($EditRow) {
             }
         } 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("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $this->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
Exemple #14
0
 function EditRow()
 {
     global $Security, $Language;
     $sFilter = $this->KeyFilter();
     $conn =& $this->Connection();
     $this->CurrentFilter = $sFilter;
     $sSql = $this->SQL();
     $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
     $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;
         $this->LoadDbValues($rsold);
         $rsnew = array();
         // news_date
         $this->news_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->news_date->CurrentValue, 5), ew_CurrentDate(), $this->news_date->ReadOnly);
         // news_title
         $this->news_title->SetDbValueDef($rsnew, $this->news_title->CurrentValue, "", $this->news_title->ReadOnly);
         // news_description
         $this->news_description->SetDbValueDef($rsnew, $this->news_description->CurrentValue, "", $this->news_description->ReadOnly);
         // Call Row Updating event
         $bUpdateRow = $this->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
             if (count($rsnew) > 0) {
                 $EditRow = $this->Update($rsnew, "", $rsold);
             } else {
                 $EditRow = TRUE;
             }
             // No field to update
             $conn->raiseErrorFn = '';
             if ($EditRow) {
             }
         } 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("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $this->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function EditRow()
 {
     global $conn, $Security, $Language;
     $sFilter = $this->KeyFilter();
     $this->CurrentFilter = $sFilter;
     $sSql = $this->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;
         $this->LoadDbValues($rsold);
         $rsnew = array();
         // nis
         $this->nis->SetDbValueDef($rsnew, $this->nis->CurrentValue, "", $this->nis->ReadOnly);
         // nama
         $this->nama->SetDbValueDef($rsnew, $this->nama->CurrentValue, "", $this->nama->ReadOnly);
         // tempat_lahir
         $this->tempat_lahir->SetDbValueDef($rsnew, $this->tempat_lahir->CurrentValue, "", $this->tempat_lahir->ReadOnly);
         // tanggal_lahir
         $this->tanggal_lahir->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->tanggal_lahir->CurrentValue, 5), ew_CurrentDate(), $this->tanggal_lahir->ReadOnly);
         // alamat
         $this->alamat->SetDbValueDef($rsnew, $this->alamat->CurrentValue, "", $this->alamat->ReadOnly);
         // agama
         $this->agama->SetDbValueDef($rsnew, $this->agama->CurrentValue, "", $this->agama->ReadOnly);
         // no_hp
         $this->no_hp->SetDbValueDef($rsnew, $this->no_hp->CurrentValue, "", $this->no_hp->ReadOnly);
         // email
         $this->_email->SetDbValueDef($rsnew, $this->_email->CurrentValue, "", $this->_email->ReadOnly);
         // Call Row Updating event
         $bUpdateRow = $this->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             if (count($rsnew) > 0) {
                 $EditRow = $this->Update($rsnew, "", $rsold);
             } else {
                 $EditRow = TRUE;
             }
             // No field to update
             $conn->raiseErrorFn = '';
             if ($EditRow) {
             }
         } 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("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $this->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function EditRow()
 {
     global $conn, $Security, $Contact;
     $sFilter = $Contact->KeyFilter();
     $Contact->CurrentFilter = $sFilter;
     $sSql = $Contact->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 ContactID
         // Field Email
         $Contact->zEmail->SetDbValueDef($Contact->zEmail->CurrentValue, "");
         $rsnew['Email'] =& $Contact->zEmail->DbValue;
         // Field Received
         $Contact->Received->SetDbValueDef(ew_UnFormatDateTime($Contact->Received->CurrentValue, 6), ew_CurrentDate());
         $rsnew['Received'] =& $Contact->Received->DbValue;
         // Field Message
         $Contact->Message->SetDbValueDef($Contact->Message->CurrentValue, "");
         $rsnew['Message'] =& $Contact->Message->DbValue;
         // Call Row Updating event
         $bUpdateRow = $Contact->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($Contact->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($Contact->CancelMessage != "") {
                 $this->setMessage($Contact->CancelMessage);
                 $Contact->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $Contact->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // CODE
     $this->CODE->SetDbValueDef($rsnew, $this->CODE->CurrentValue, 0, FALSE);
     // DESCRIPTION
     $this->DESCRIPTION->SetDbValueDef($rsnew, $this->DESCRIPTION->CurrentValue, "", FALSE);
     // DATE
     $this->DATE->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->DATE->CurrentValue, 7), ew_CurrentDate(), FALSE);
     // AMOUNT
     $this->AMOUNT->SetDbValueDef($rsnew, $this->AMOUNT->CurrentValue, 0, FALSE);
     // UPLOAD_FILE_ID
     $this->UPLOAD_FILE_ID->SetDbValueDef($rsnew, $this->UPLOAD_FILE_ID->CurrentValue, 0, FALSE);
     // UPLOAD_FILE_DETAIL_STATUS_ID
     $this->UPLOAD_FILE_DETAIL_STATUS_ID->SetDbValueDef($rsnew, $this->UPLOAD_FILE_DETAIL_STATUS_ID->CurrentValue, 0, FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->UPLOAD_FILE_DETAIL_ID->setDbValue($conn->Insert_ID());
             $rsnew['UPLOAD_FILE_DETAIL_ID'] = $this->UPLOAD_FILE_DETAIL_ID->DbValue;
         }
     } 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Exemple #18
0
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // news_date
     $this->news_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->news_date->CurrentValue, 5), ew_CurrentDate(), FALSE);
     // news_title
     $this->news_title->SetDbValueDef($rsnew, $this->news_title->CurrentValue, "", FALSE);
     // news_description
     $this->news_description->SetDbValueDef($rsnew, $this->news_description->CurrentValue, "", FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->news_id->setDbValue($conn->Insert_ID());
             $rsnew['news_id'] = $this->news_id->DbValue;
         }
     } 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
 function AddRow()
 {
     global $conn, $Language, $Security, $bookpost;
     $rsnew = array();
     // name
     $bookpost->name->SetDbValueDef($rsnew, $bookpost->name->CurrentValue, "", FALSE);
     // cata
     $bookpost->cata->SetDbValueDef($rsnew, $bookpost->cata->CurrentValue, "", FALSE);
     // author
     $bookpost->author->SetDbValueDef($rsnew, $bookpost->author->CurrentValue, NULL, FALSE);
     // publisher
     $bookpost->publisher->SetDbValueDef($rsnew, $bookpost->publisher->CurrentValue, NULL, FALSE);
     // info
     $bookpost->info->SetDbValueDef($rsnew, $bookpost->info->CurrentValue, "", FALSE);
     // code
     $bookpost->code->SetDbValueDef($rsnew, $bookpost->code->CurrentValue, NULL, FALSE);
     // pic
     $bookpost->pic->SetDbValueDef($rsnew, $bookpost->pic->CurrentValue, NULL, FALSE);
     // useremail
     $bookpost->useremail->SetDbValueDef($rsnew, $bookpost->useremail->CurrentValue, "", FALSE);
     // price
     $bookpost->price->SetDbValueDef($rsnew, $bookpost->price->CurrentValue, 0, FALSE);
     // datatime
     $bookpost->datatime->SetDbValueDef($rsnew, ew_CurrentDateTime(), ew_CurrentDate());
     $rsnew['datatime'] =& $bookpost->datatime->DbValue;
     // hidden
     $bookpost->hidden->SetDbValueDef($rsnew, $bookpost->hidden->CurrentValue, NULL, FALSE);
     // Call Row Inserting event
     $bInsertRow = $bookpost->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($bookpost->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($bookpost->CancelMessage != "") {
             $this->setMessage($bookpost->CancelMessage);
             $bookpost->CancelMessage = "";
         } else {
             $this->setMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         $bookpost->bookid->setDbValue($conn->Insert_ID());
         $rsnew['bookid'] = $bookpost->bookid->DbValue;
         // Call Row Inserted event
         $bookpost->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
Exemple #20
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
         $this->cat_file->OldUploadPath = "/catalogues/";
         $this->cat_file->UploadPath = $this->cat_file->OldUploadPath;
     }
     $rsnew = array();
     // cat_name
     $this->cat_name->SetDbValueDef($rsnew, $this->cat_name->CurrentValue, "", FALSE);
     // cat_file
     if (!$this->cat_file->Upload->KeepFile) {
         if ($this->cat_file->Upload->FileName == "") {
             $rsnew['cat_file'] = NULL;
         } else {
             $rsnew['cat_file'] = $this->cat_file->Upload->FileName;
         }
         $this->cat_file->ImageWidth = EW_THUMBNAIL_DEFAULT_WIDTH;
         // Resize width
         $this->cat_file->ImageHeight = EW_THUMBNAIL_DEFAULT_HEIGHT;
         // Resize height
     }
     // cat_date
     $this->cat_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->cat_date->CurrentValue, 5), ew_CurrentDate(), FALSE);
     if (!$this->cat_file->Upload->KeepFile) {
         $this->cat_file->UploadPath = "/catalogues/";
         if (!ew_Empty($this->cat_file->Upload->Value)) {
             $rsnew['cat_file'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->cat_file->UploadPath), $rsnew['cat_file']);
             // Get new file name
         }
     }
     // 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) {
             if (!$this->cat_file->Upload->KeepFile) {
                 if (!ew_Empty($this->cat_file->Upload->Value)) {
                     $this->cat_file->Upload->Resize($this->cat_file->ImageWidth, $this->cat_file->ImageHeight, EW_THUMBNAIL_DEFAULT_QUALITY);
                     $this->cat_file->Upload->SaveToFile($this->cat_file->UploadPath, $rsnew['cat_file'], TRUE);
                 }
             }
         }
     } 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->cat_id->setDbValue($conn->Insert_ID());
         $rsnew['cat_id'] = $this->cat_id->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     // cat_file
     ew_CleanUploadTempPath($this->cat_file, $this->cat_file->Upload->Index);
     return $AddRow;
 }
function AddRow()
{
    global $conn, $Security, $archives;
    // Check for duplicate key
    $bCheckKey = TRUE;
    $sFilter = $archives->SqlKeyFilter();
    if (trim(strval($archives->id->CurrentValue)) == "") {
        $bCheckKey = FALSE;
    } else {
        $sFilter = str_replace("@id@", ew_AdjustSql($archives->id->CurrentValue), $sFilter);
        // Replace key value
    }
    if (!is_numeric($archives->id->CurrentValue)) {
        $bCheckKey = FALSE;
    }
    if ($bCheckKey) {
        $rsChk = $archives->LoadRs($sFilter);
        if ($rsChk && !$rsChk->EOF) {
            $_SESSION[EW_SESSION_MESSAGE] = "Duplicate value for primary key";
            $rsChk->Close();
            return FALSE;
        }
    }
    $rsnew = array();
    // Field url
    $archives->url->SetDbValueDef($archives->url->CurrentValue, "");
    $rsnew['url'] =& $archives->url->DbValue;
    // Field projectname
    $archives->projectname->SetDbValueDef($archives->projectname->CurrentValue, NULL);
    $rsnew['projectname'] =& $archives->projectname->DbValue;
    // Field title
    $archives->title->SetDbValueDef($archives->title->CurrentValue, "");
    $rsnew['title'] =& $archives->title->DbValue;
    // Field datetime
    $archives->datetime->SetDbValueDef(ew_UnFormatDateTime($archives->datetime->CurrentValue, 5), ew_CurrentDate());
    $rsnew['datetime'] =& $archives->datetime->DbValue;
    // Field content
    $archives->content->SetDbValueDef($archives->content->CurrentValue, NULL);
    $rsnew['content'] =& $archives->content->DbValue;
    // Call Row Inserting event
    $bInsertRow = $archives->Row_Inserting($rsnew);
    if ($bInsertRow) {
        $conn->raiseErrorFn = 'ew_ErrorFn';
        $AddRow = $conn->Execute($archives->InsertSQL($rsnew));
        $conn->raiseErrorFn = '';
    } else {
        if ($archives->CancelMessage != "") {
            $_SESSION[EW_SESSION_MESSAGE] = $archives->CancelMessage;
            $archives->CancelMessage = "";
        } else {
            $_SESSION[EW_SESSION_MESSAGE] = "Insert cancelled";
        }
        $AddRow = FALSE;
    }
    if ($AddRow) {
        $archives->id->setDbValue($conn->Insert_ID());
        $rsnew['id'] =& $archives->id->DbValue;
        // Call Row Inserted event
        $archives->Row_Inserted($rsnew);
    }
    return $AddRow;
}
Exemple #22
0
 function EditRow()
 {
     global $conn, $Security, $Language;
     $sFilter = $this->KeyFilter();
     $this->CurrentFilter = $sFilter;
     $sSql = $this->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;
         $this->LoadDbValues($rsold);
         $rsnew = array();
         // fecha_recepcion
         $this->fecha_recepcion->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_recepcion->CurrentValue, 7), ew_CurrentDate(), $this->fecha_recepcion->ReadOnly);
         // cliente
         $this->cliente->SetDbValueDef($rsnew, $this->cliente->CurrentValue, NULL, $this->cliente->ReadOnly);
         // id_tipo_cliente
         $this->id_tipo_cliente->SetDbValueDef($rsnew, $this->id_tipo_cliente->CurrentValue, NULL, $this->id_tipo_cliente->ReadOnly);
         // tel
         $this->tel->SetDbValueDef($rsnew, $this->tel->CurrentValue, NULL, $this->tel->ReadOnly);
         // cel
         $this->cel->SetDbValueDef($rsnew, $this->cel->CurrentValue, NULL, $this->cel->ReadOnly);
         // objetos
         $this->objetos->SetDbValueDef($rsnew, $this->objetos->CurrentValue, NULL, $this->objetos->ReadOnly);
         // detalle_a_realizar
         $this->detalle_a_realizar->SetDbValueDef($rsnew, $this->detalle_a_realizar->CurrentValue, NULL, $this->detalle_a_realizar->ReadOnly);
         // fecha_entrega
         $this->fecha_entrega->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_entrega->CurrentValue, 7), NULL, $this->fecha_entrega->ReadOnly);
         // observaciones
         $this->observaciones->SetDbValueDef($rsnew, $this->observaciones->CurrentValue, NULL, $this->observaciones->ReadOnly);
         // id_estado
         $this->id_estado->SetDbValueDef($rsnew, $this->id_estado->CurrentValue, 0, $this->id_estado->ReadOnly);
         // precio
         $this->precio->SetDbValueDef($rsnew, $this->precio->CurrentValue, NULL, $this->precio->ReadOnly);
         // entrega
         $this->entrega->SetDbValueDef($rsnew, $this->entrega->CurrentValue, NULL, $this->entrega->ReadOnly);
         // foto1
         if (!$this->foto1->ReadOnly && !$this->foto1->Upload->KeepFile) {
             $this->foto1->Upload->DbValue = $rs->fields('foto1');
             // Get original value
             if ($this->foto1->Upload->FileName == "") {
                 $rsnew['foto1'] = NULL;
             } else {
                 $rsnew['foto1'] = $this->foto1->Upload->FileName;
             }
         }
         // foto2
         if (!$this->foto2->ReadOnly && !$this->foto2->Upload->KeepFile) {
             $this->foto2->Upload->DbValue = $rs->fields('foto2');
             // Get original value
             if ($this->foto2->Upload->FileName == "") {
                 $rsnew['foto2'] = NULL;
             } else {
                 $rsnew['foto2'] = $this->foto2->Upload->FileName;
             }
         }
         if (!$this->foto1->Upload->KeepFile) {
             if (!ew_Empty($this->foto1->Upload->Value)) {
                 if ($this->foto1->Upload->FileName == $this->foto1->Upload->DbValue) {
                     // Overwrite if same file name
                     $this->foto1->Upload->DbValue = "";
                     // No need to delete any more
                 } else {
                     $rsnew['foto1'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->foto1->UploadPath), $rsnew['foto1']);
                     // Get new file name
                 }
             }
         }
         if (!$this->foto2->Upload->KeepFile) {
             if (!ew_Empty($this->foto2->Upload->Value)) {
                 if ($this->foto2->Upload->FileName == $this->foto2->Upload->DbValue) {
                     // Overwrite if same file name
                     $this->foto2->Upload->DbValue = "";
                     // No need to delete any more
                 } else {
                     $rsnew['foto2'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->foto2->UploadPath), $rsnew['foto2']);
                     // Get new file name
                 }
             }
         }
         // Call Row Updating event
         $bUpdateRow = $this->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             if (count($rsnew) > 0) {
                 $EditRow = $this->Update($rsnew, "", $rsold);
             } else {
                 $EditRow = TRUE;
             }
             // No field to update
             $conn->raiseErrorFn = '';
             if ($EditRow) {
                 if (!$this->foto1->Upload->KeepFile) {
                     if (!ew_Empty($this->foto1->Upload->Value)) {
                         $this->foto1->Upload->SaveToFile($this->foto1->UploadPath, $rsnew['foto1'], TRUE);
                     }
                     if ($this->foto1->Upload->DbValue != "") {
                         @unlink(ew_UploadPathEx(TRUE, $this->foto1->OldUploadPath) . $this->foto1->Upload->DbValue);
                     }
                 }
                 if (!$this->foto2->Upload->KeepFile) {
                     if (!ew_Empty($this->foto2->Upload->Value)) {
                         $this->foto2->Upload->SaveToFile($this->foto2->UploadPath, $rsnew['foto2'], TRUE);
                     }
                     if ($this->foto2->Upload->DbValue != "") {
                         @unlink(ew_UploadPathEx(TRUE, $this->foto2->OldUploadPath) . $this->foto2->Upload->DbValue);
                     }
                 }
             }
         } 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("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $this->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     // foto1
     ew_CleanUploadTempPath($this->foto1, $this->foto1->Upload->Index);
     // foto2
     ew_CleanUploadTempPath($this->foto2, $this->foto2->Upload->Index);
     return $EditRow;
 }
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // PATH
     if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) {
         $this->PATH->Upload->DbValue = "";
         // No need to delete old file
         if ($this->PATH->Upload->FileName == "") {
             $rsnew['PATH'] = NULL;
         } else {
             $rsnew['PATH'] = $this->PATH->Upload->FileName;
         }
     }
     // PROCESS
     $this->PROCESS->SetDbValueDef($rsnew, $this->PROCESS->CurrentValue, 0, FALSE);
     // BANK_ACCOUNT_ID
     $this->BANK_ACCOUNT_ID->SetDbValueDef($rsnew, $this->BANK_ACCOUNT_ID->CurrentValue, 0, FALSE);
     // UPLOAD_FILE_STATUS_ID
     $this->UPLOAD_FILE_STATUS_ID->SetDbValueDef($rsnew, $this->UPLOAD_FILE_STATUS_ID->CurrentValue, 0, FALSE);
     // DATETIME
     $this->DATETIME->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->DATETIME->CurrentValue, 7), ew_CurrentDate(), FALSE);
     if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) {
         if (!ew_Empty($this->PATH->Upload->Value)) {
             $rsnew['PATH'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->PATH->UploadPath), $rsnew['PATH']);
             // Get new file name
         }
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->UPLOAD_FILE_ID->setDbValue($conn->Insert_ID());
             $rsnew['UPLOAD_FILE_ID'] = $this->UPLOAD_FILE_ID->DbValue;
             if ($this->PATH->Visible && !$this->PATH->Upload->KeepFile) {
                 if (!ew_Empty($this->PATH->Upload->Value)) {
                     $this->PATH->Upload->SaveToFile($this->PATH->UploadPath, $rsnew['PATH'], TRUE);
                 }
             }
         }
     } 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     // PATH
     ew_CleanUploadTempPath($this->PATH, $this->PATH->Upload->Index);
     return $AddRow;
 }
 function AddRow()
 {
     global $conn, $Security, $Subscriptions;
     // Check if key value entered
     if ($Subscriptions->DeliveryDate->CurrentValue == "") {
         $this->setMessage("Invalid key value");
         return FALSE;
     }
     // Check if key value entered
     if ($Subscriptions->CustomerID->CurrentValue == "") {
         $this->setMessage("Invalid key value");
         return FALSE;
     }
     // Check for duplicate key
     $bCheckKey = TRUE;
     $sFilter = $Subscriptions->KeyFilter();
     if ($bCheckKey) {
         $rsChk = $Subscriptions->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, "Duplicate primary key: '%f'");
             $this->setMessage($sKeyErrMsg);
             $rsChk->Close();
             return FALSE;
         }
     }
     $rsnew = array();
     // Field DeliveryDate
     $Subscriptions->DeliveryDate->SetDbValueDef(ew_UnFormatDateTime($Subscriptions->DeliveryDate->CurrentValue, 6), ew_CurrentDate());
     $rsnew['DeliveryDate'] =& $Subscriptions->DeliveryDate->DbValue;
     // Field CustomerID
     $Subscriptions->CustomerID->SetDbValueDef($Subscriptions->CustomerID->CurrentValue, 0);
     $rsnew['CustomerID'] =& $Subscriptions->CustomerID->DbValue;
     // Field TransactionNumber
     $Subscriptions->TransactionNumber->SetDbValueDef($Subscriptions->TransactionNumber->CurrentValue, NULL);
     $rsnew['TransactionNumber'] =& $Subscriptions->TransactionNumber->DbValue;
     // Field PromoCodeID
     $Subscriptions->PromoCodeID->SetDbValueDef($Subscriptions->PromoCodeID->CurrentValue, NULL);
     $rsnew['PromoCodeID'] =& $Subscriptions->PromoCodeID->DbValue;
     // Field WeeklyMeals
     $Subscriptions->WeeklyMeals->SetDbValueDef($Subscriptions->WeeklyMeals->CurrentValue, 0);
     $rsnew['WeeklyMeals'] =& $Subscriptions->WeeklyMeals->DbValue;
     // Field WeeklyReg
     $Subscriptions->WeeklyReg->SetDbValueDef($Subscriptions->WeeklyReg->CurrentValue, 0);
     $rsnew['WeeklyReg'] =& $Subscriptions->WeeklyReg->DbValue;
     // Field WeeklyVeg
     $Subscriptions->WeeklyVeg->SetDbValueDef($Subscriptions->WeeklyVeg->CurrentValue, 0);
     $rsnew['WeeklyVeg'] =& $Subscriptions->WeeklyVeg->DbValue;
     // Call Row Inserting event
     $bInsertRow = $Subscriptions->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($Subscriptions->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($Subscriptions->CancelMessage != "") {
             $this->setMessage($Subscriptions->CancelMessage);
             $Subscriptions->CancelMessage = "";
         } else {
             $this->setMessage("Insert cancelled");
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         $Subscriptions->SubscriptionID->setDbValue($conn->Insert_ID());
         $rsnew['SubscriptionID'] =& $Subscriptions->SubscriptionID->DbValue;
         // Call Row Inserted event
         $Subscriptions->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
 function AddRow()
 {
     global $conn, $Language, $Security, $tbl_facebook_stat;
     // Check if key value entered
     if ($tbl_facebook_stat->id_profile->CurrentValue == "") {
         $this->setMessage($Language->Phrase("InvalidKeyValue"));
         return FALSE;
     }
     // Check if key value entered
     if ($tbl_facebook_stat->stat_date->CurrentValue == "") {
         $this->setMessage($Language->Phrase("InvalidKeyValue"));
         return FALSE;
     }
     // Check for duplicate key
     $bCheckKey = TRUE;
     $sFilter = $tbl_facebook_stat->KeyFilter();
     if ($bCheckKey) {
         $rsChk = $tbl_facebook_stat->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, $Language->Phrase("DupKey"));
             $this->setMessage($sKeyErrMsg);
             $rsChk->Close();
             return FALSE;
         }
     }
     $rsnew = array();
     // id_profile
     $tbl_facebook_stat->id_profile->SetDbValueDef($rsnew, $tbl_facebook_stat->id_profile->CurrentValue, 0, FALSE);
     // stat_date
     $tbl_facebook_stat->stat_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($tbl_facebook_stat->stat_date->CurrentValue, 5, FALSE), ew_CurrentDate());
     // year
     $tbl_facebook_stat->year->SetDbValueDef($rsnew, $tbl_facebook_stat->year->CurrentValue, 0, FALSE);
     // month
     $tbl_facebook_stat->month->SetDbValueDef($rsnew, $tbl_facebook_stat->month->CurrentValue, 0, FALSE);
     // week
     $tbl_facebook_stat->week->SetDbValueDef($rsnew, $tbl_facebook_stat->week->CurrentValue, 0, FALSE);
     // interactions
     $tbl_facebook_stat->interactions->SetDbValueDef($rsnew, $tbl_facebook_stat->interactions->CurrentValue, 0, TRUE);
     // comments
     $tbl_facebook_stat->comments->SetDbValueDef($rsnew, $tbl_facebook_stat->comments->CurrentValue, 0, TRUE);
     // wallposts
     $tbl_facebook_stat->wallposts->SetDbValueDef($rsnew, $tbl_facebook_stat->wallposts->CurrentValue, 0, TRUE);
     // fans
     $tbl_facebook_stat->fans->SetDbValueDef($rsnew, $tbl_facebook_stat->fans->CurrentValue, 0, TRUE);
     // likes
     $tbl_facebook_stat->likes->SetDbValueDef($rsnew, $tbl_facebook_stat->likes->CurrentValue, 0, TRUE);
     // unsubscribe
     $tbl_facebook_stat->unsubscribe->SetDbValueDef($rsnew, $tbl_facebook_stat->unsubscribe->CurrentValue, 0, FALSE);
     // Call Row Inserting event
     $bInsertRow = $tbl_facebook_stat->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($tbl_facebook_stat->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($tbl_facebook_stat->CancelMessage != "") {
             $this->setMessage($tbl_facebook_stat->CancelMessage);
             $tbl_facebook_stat->CancelMessage = "";
         } else {
             $this->setMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $tbl_facebook_stat->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // PASSANGER_ID
     $this->PASSANGER_ID->SetDbValueDef($rsnew, $this->PASSANGER_ID->CurrentValue, 0, FALSE);
     // FLIGHT_ID
     $this->FLIGHT_ID->SetDbValueDef($rsnew, $this->FLIGHT_ID->CurrentValue, 0, FALSE);
     // GATE
     $this->GATE->SetDbValueDef($rsnew, $this->GATE->CurrentValue, 0, FALSE);
     // SEAT
     $this->SEAT->SetDbValueDef($rsnew, $this->SEAT->CurrentValue, "", FALSE);
     // DATETIME
     $this->DATETIME->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->DATETIME->CurrentValue, 7), ew_CurrentDate(), FALSE);
     // RESERVATION_ID
     $this->RESERVATION_ID->SetDbValueDef($rsnew, $this->RESERVATION_ID->CurrentValue, 0, FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->BOARDING_ID->setDbValue($conn->Insert_ID());
             $rsnew['BOARDING_ID'] = $this->BOARDING_ID->DbValue;
         }
     } 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;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Exemple #27
0
 function AddRow()
 {
     global $conn, $Security, $Orders;
     $rsnew = array();
     // Field CustomerID
     $Orders->CustomerID->SetDbValueDef($Orders->CustomerID->CurrentValue, 0);
     $rsnew['CustomerID'] =& $Orders->CustomerID->DbValue;
     // Field TransactionNumber
     $Orders->TransactionNumber->SetDbValueDef($Orders->TransactionNumber->CurrentValue, NULL);
     $rsnew['TransactionNumber'] =& $Orders->TransactionNumber->DbValue;
     // Field DateOrdered
     $Orders->DateOrdered->SetDbValueDef(ew_UnFormatDateTime($Orders->DateOrdered->CurrentValue, 6), ew_CurrentDate());
     $rsnew['DateOrdered'] =& $Orders->DateOrdered->DbValue;
     // Field Total
     $Orders->Total->SetDbValueDef($Orders->Total->CurrentValue, 0);
     $rsnew['Total'] =& $Orders->Total->DbValue;
     // Field DeliveryDate
     $Orders->DeliveryDate->SetDbValueDef(ew_UnFormatDateTime($Orders->DeliveryDate->CurrentValue, 6), ew_CurrentDate());
     $rsnew['DeliveryDate'] =& $Orders->DeliveryDate->DbValue;
     // Field PromoCodeID
     $Orders->PromoCodeID->SetDbValueDef($Orders->PromoCodeID->CurrentValue, NULL);
     $rsnew['PromoCodeID'] =& $Orders->PromoCodeID->DbValue;
     // Field Timestamp
     $Orders->Timestamp->SetDbValueDef(ew_UnFormatDateTime($Orders->Timestamp->CurrentValue, 6), ew_CurrentDate());
     $rsnew['Timestamp'] =& $Orders->Timestamp->DbValue;
     // Field Sequence
     $Orders->Sequence->SetDbValueDef($Orders->Sequence->CurrentValue, NULL);
     $rsnew['Sequence'] =& $Orders->Sequence->DbValue;
     // Call Row Inserting event
     $bInsertRow = $Orders->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($Orders->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($Orders->CancelMessage != "") {
             $this->setMessage($Orders->CancelMessage);
             $Orders->CancelMessage = "";
         } else {
             $this->setMessage("Insert cancelled");
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         $Orders->OrderID->setDbValue($conn->Insert_ID());
         $rsnew['OrderID'] =& $Orders->OrderID->DbValue;
         // Call Row Inserted event
         $Orders->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
 function AddRow()
 {
     global $conn, $Language, $Security, $order;
     $rsnew = array();
     // bookid
     $order->bookid->SetDbValueDef($rsnew, $order->bookid->CurrentValue, 0, FALSE);
     // orderstatus
     $order->orderstatus->SetDbValueDef($rsnew, $order->orderstatus->CurrentValue, 0, FALSE);
     // email
     $order->zemail->SetDbValueDef($rsnew, $order->zemail->CurrentValue, "", FALSE);
     // datatime
     $order->datatime->SetDbValueDef($rsnew, ew_CurrentDateTime(), ew_CurrentDate());
     $rsnew['datatime'] =& $order->datatime->DbValue;
     // Call Row Inserting event
     $bInsertRow = $order->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($order->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($order->CancelMessage != "") {
             $this->setMessage($order->CancelMessage);
             $order->CancelMessage = "";
         } else {
             $this->setMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         $order->orderid->setDbValue($conn->Insert_ID());
         $rsnew['orderid'] = $order->orderid->DbValue;
         // Call Row Inserted event
         $order->Row_Inserted($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;
 }
 function EditRow()
 {
     global $conn, $Security, $Language, $order;
     $sFilter = $order->KeyFilter();
     $order->CurrentFilter = $sFilter;
     $sSql = $order->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();
         // bookid
         $order->bookid->SetDbValueDef($rsnew, $order->bookid->CurrentValue, 0, FALSE);
         // orderstatus
         $order->orderstatus->SetDbValueDef($rsnew, $order->orderstatus->CurrentValue, 0, FALSE);
         // email
         $order->zemail->SetDbValueDef($rsnew, $order->zemail->CurrentValue, "", FALSE);
         // datatime
         $order->datatime->SetDbValueDef($rsnew, ew_CurrentDateTime(), ew_CurrentDate());
         $rsnew['datatime'] =& $order->datatime->DbValue;
         // Call Row Updating event
         $bUpdateRow = $order->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($order->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($order->CancelMessage != "") {
                 $this->setMessage($order->CancelMessage);
                 $order->CancelMessage = "";
             } else {
                 $this->setMessage($Language->Phrase("UpdateCancelled"));
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $order->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     return $EditRow;
 }