| Current Path : /var/www/cesa.co.za/echasl23/ |
| Current File : /var/www/cesa.co.za/echasl23/Applicationsedit.php |
<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "Applicationsinfo.php" ?>
<?php include "adminusersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Create page object
$Applications_edit = new cApplications_edit();
$Page =& $Applications_edit;
// Page init
$Applications_edit->Page_Init();
// Page main
$Applications_edit->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var Applications_edit = new ew_Page("Applications_edit");
// page properties
Applications_edit.PageID = "edit"; // page ID
Applications_edit.FormID = "fApplicationsedit"; // form ID
var EW_PAGE_ID = Applications_edit.PageID; // for backward compatibility
// extend page with ValidateForm function
Applications_edit.ValidateForm = function(fobj) {
ew_PostAutoSuggest(fobj);
if (!this.ValidateRequired)
return true; // ignore validation
if (fobj.a_confirm && fobj.a_confirm.value == "F")
return true;
var i, elm, aelm, infix;
var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
for (i=0; i<rowcnt; i++) {
infix = (fobj.key_count) ? String(i+1) : "";
elm = fobj.elements["x" + infix + "_FoundingDate"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Applications->FoundingDate->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_AppForm"];
if (elm && !ew_CheckFileType(elm.value))
return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
elm = fobj.elements["x" + infix + "_CIPCReg"];
if (elm && !ew_CheckFileType(elm.value))
return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
elm = fobj.elements["x" + infix + "_MPRes"];
if (elm && !ew_CheckFileType(elm.value))
return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
elm = fobj.elements["x" + infix + "_PIInsurance"];
if (elm && !ew_CheckFileType(elm.value))
return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
elm = fobj.elements["x" + infix + "_Letterhead"];
if (elm && !ew_CheckFileType(elm.value))
return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
elm = fobj.elements["x" + infix + "_DateApproved"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Applications->DateApproved->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with Form_CustomValidate function
Applications_edit.Form_CustomValidate =
function(fobj) { // DO NOT CHANGE THIS LINE!
// Your custom validation code here, return false if invalid.
return true;
}
<?php if (EW_CLIENT_VALIDATE) { ?>
Applications_edit.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
Applications_edit.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-cold-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js");
//-->
</script>
<p><span class="phpmaker"><?php echo $Language->Phrase("Edit") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $Applications->TableCaption() ?><br><br>
<a href="<?php echo $Applications->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$Applications_edit->ShowMessage();
?>
<form name="fApplicationsedit" id="fApplicationsedit" action="<?php echo ew_CurrentPage() ?>" method="post" enctype="multipart/form-data" onsubmit="return Applications_edit.ValidateForm(this);">
<p>
<input type="hidden" name="a_table" id="a_table" value="Applications">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($Applications->ApplicationID->Visible) { // ApplicationID ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->ApplicationID->FldCaption() ?></td>
<td<?php echo $Applications->ApplicationID->CellAttributes() ?>><span id="el_ApplicationID">
<div<?php echo $Applications->ApplicationID->ViewAttributes() ?>><?php echo $Applications->ApplicationID->EditValue ?></div><input type="hidden" name="x_ApplicationID" id="x_ApplicationID" value="<?php echo ew_HtmlEncode($Applications->ApplicationID->CurrentValue) ?>">
</span><?php echo $Applications->ApplicationID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->FirmName->Visible) { // FirmName ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->FirmName->FldCaption() ?></td>
<td<?php echo $Applications->FirmName->CellAttributes() ?>><span id="el_FirmName">
<input type="text" name="x_FirmName" id="x_FirmName" title="<?php echo $Applications->FirmName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $Applications->FirmName->EditValue ?>"<?php echo $Applications->FirmName->EditAttributes() ?>>
</span><?php echo $Applications->FirmName->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->PhysicalAddress->Visible) { // PhysicalAddress ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->PhysicalAddress->FldCaption() ?></td>
<td<?php echo $Applications->PhysicalAddress->CellAttributes() ?>><span id="el_PhysicalAddress">
<textarea name="x_PhysicalAddress" id="x_PhysicalAddress" title="<?php echo $Applications->PhysicalAddress->FldTitle() ?>" cols="35" rows="4"<?php echo $Applications->PhysicalAddress->EditAttributes() ?>><?php echo $Applications->PhysicalAddress->EditValue ?></textarea>
</span><?php echo $Applications->PhysicalAddress->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->FoundingDate->Visible) { // FoundingDate ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->FoundingDate->FldCaption() ?></td>
<td<?php echo $Applications->FoundingDate->CellAttributes() ?>><span id="el_FoundingDate">
<input type="text" name="x_FoundingDate" id="x_FoundingDate" title="<?php echo $Applications->FoundingDate->FldTitle() ?>" value="<?php echo $Applications->FoundingDate->EditValue ?>"<?php echo $Applications->FoundingDate->EditAttributes() ?>>
</span><?php echo $Applications->FoundingDate->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->VATNumber->Visible) { // VATNumber ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->VATNumber->FldCaption() ?></td>
<td<?php echo $Applications->VATNumber->CellAttributes() ?>><span id="el_VATNumber">
<input type="text" name="x_VATNumber" id="x_VATNumber" title="<?php echo $Applications->VATNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $Applications->VATNumber->EditValue ?>"<?php echo $Applications->VATNumber->EditAttributes() ?>>
</span><?php echo $Applications->VATNumber->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->AppForm->Visible) { // AppForm ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->AppForm->FldCaption() ?></td>
<td<?php echo $Applications->AppForm->CellAttributes() ?>><span id="el_AppForm">
<div id="old_x_AppForm">
<?php if ($Applications->AppForm->HrefValue <> "" || $Applications->AppForm->TooltipValue <> "") { ?>
<?php if (!empty($Applications->AppForm->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->AppForm->HrefValue ?>"><?php echo $Applications->AppForm->EditValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->AppForm->Upload->DbValue)) { ?>
<?php echo $Applications->AppForm->EditValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AppForm">
<?php if (!empty($Applications->AppForm->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AppForm" id="a_AppForm" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>
<label><input type="radio" name="a_AppForm" id="a_AppForm" value="2"><?php echo $Language->Phrase("Remove") ?></label>
<label><input type="radio" name="a_AppForm" id="a_AppForm" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $Applications->AppForm->EditAttrs["onchange"] = "this.form.a_AppForm[2].checked=true;" . @$Applications->AppForm->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AppForm" id="a_AppForm" value="3">
<?php } ?>
<input type="file" name="x_AppForm" id="x_AppForm" title="<?php echo $Applications->AppForm->FldTitle() ?>" size="30"<?php echo $Applications->AppForm->EditAttributes() ?>>
</div>
</span><?php echo $Applications->AppForm->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->CIPCReg->Visible) { // CIPCReg ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->CIPCReg->FldCaption() ?></td>
<td<?php echo $Applications->CIPCReg->CellAttributes() ?>><span id="el_CIPCReg">
<div id="old_x_CIPCReg">
<?php if ($Applications->CIPCReg->HrefValue <> "" || $Applications->CIPCReg->TooltipValue <> "") { ?>
<?php if (!empty($Applications->CIPCReg->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->CIPCReg->HrefValue ?>"><?php echo $Applications->CIPCReg->EditValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->CIPCReg->Upload->DbValue)) { ?>
<?php echo $Applications->CIPCReg->EditValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</div>
<div id="new_x_CIPCReg">
<?php if (!empty($Applications->CIPCReg->Upload->DbValue)) { ?>
<label><input type="radio" name="a_CIPCReg" id="a_CIPCReg" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>
<label><input type="radio" name="a_CIPCReg" id="a_CIPCReg" value="2"><?php echo $Language->Phrase("Remove") ?></label>
<label><input type="radio" name="a_CIPCReg" id="a_CIPCReg" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $Applications->CIPCReg->EditAttrs["onchange"] = "this.form.a_CIPCReg[2].checked=true;" . @$Applications->CIPCReg->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_CIPCReg" id="a_CIPCReg" value="3">
<?php } ?>
<input type="file" name="x_CIPCReg" id="x_CIPCReg" title="<?php echo $Applications->CIPCReg->FldTitle() ?>" size="30"<?php echo $Applications->CIPCReg->EditAttributes() ?>>
</div>
</span><?php echo $Applications->CIPCReg->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->MPRes->Visible) { // MPRes ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->MPRes->FldCaption() ?></td>
<td<?php echo $Applications->MPRes->CellAttributes() ?>><span id="el_MPRes">
<div id="old_x_MPRes">
<?php if ($Applications->MPRes->HrefValue <> "" || $Applications->MPRes->TooltipValue <> "") { ?>
<?php if (!empty($Applications->MPRes->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->MPRes->HrefValue ?>"><?php echo $Applications->MPRes->EditValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->MPRes->Upload->DbValue)) { ?>
<?php echo $Applications->MPRes->EditValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</div>
<div id="new_x_MPRes">
<?php if (!empty($Applications->MPRes->Upload->DbValue)) { ?>
<label><input type="radio" name="a_MPRes" id="a_MPRes" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>
<label><input type="radio" name="a_MPRes" id="a_MPRes" value="2"><?php echo $Language->Phrase("Remove") ?></label>
<label><input type="radio" name="a_MPRes" id="a_MPRes" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $Applications->MPRes->EditAttrs["onchange"] = "this.form.a_MPRes[2].checked=true;" . @$Applications->MPRes->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_MPRes" id="a_MPRes" value="3">
<?php } ?>
<input type="file" name="x_MPRes" id="x_MPRes" title="<?php echo $Applications->MPRes->FldTitle() ?>" size="30"<?php echo $Applications->MPRes->EditAttributes() ?>>
</div>
</span><?php echo $Applications->MPRes->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->PIInsurance->Visible) { // PIInsurance ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->PIInsurance->FldCaption() ?></td>
<td<?php echo $Applications->PIInsurance->CellAttributes() ?>><span id="el_PIInsurance">
<div id="old_x_PIInsurance">
<?php if ($Applications->PIInsurance->HrefValue <> "" || $Applications->PIInsurance->TooltipValue <> "") { ?>
<?php if (!empty($Applications->PIInsurance->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->PIInsurance->HrefValue ?>"><?php echo $Applications->PIInsurance->EditValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->PIInsurance->Upload->DbValue)) { ?>
<?php echo $Applications->PIInsurance->EditValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</div>
<div id="new_x_PIInsurance">
<?php if (!empty($Applications->PIInsurance->Upload->DbValue)) { ?>
<label><input type="radio" name="a_PIInsurance" id="a_PIInsurance" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>
<label><input type="radio" name="a_PIInsurance" id="a_PIInsurance" value="2"><?php echo $Language->Phrase("Remove") ?></label>
<label><input type="radio" name="a_PIInsurance" id="a_PIInsurance" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $Applications->PIInsurance->EditAttrs["onchange"] = "this.form.a_PIInsurance[2].checked=true;" . @$Applications->PIInsurance->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_PIInsurance" id="a_PIInsurance" value="3">
<?php } ?>
<input type="file" name="x_PIInsurance" id="x_PIInsurance" title="<?php echo $Applications->PIInsurance->FldTitle() ?>" size="30"<?php echo $Applications->PIInsurance->EditAttributes() ?>>
</div>
</span><?php echo $Applications->PIInsurance->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->Letterhead->Visible) { // Letterhead ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Letterhead->FldCaption() ?></td>
<td<?php echo $Applications->Letterhead->CellAttributes() ?>><span id="el_Letterhead">
<div id="old_x_Letterhead">
<?php if ($Applications->Letterhead->HrefValue <> "" || $Applications->Letterhead->TooltipValue <> "") { ?>
<?php if (!empty($Applications->Letterhead->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->Letterhead->HrefValue ?>"><?php echo $Applications->Letterhead->EditValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->Letterhead->Upload->DbValue)) { ?>
<?php echo $Applications->Letterhead->EditValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</div>
<div id="new_x_Letterhead">
<?php if (!empty($Applications->Letterhead->Upload->DbValue)) { ?>
<label><input type="radio" name="a_Letterhead" id="a_Letterhead" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>
<label><input type="radio" name="a_Letterhead" id="a_Letterhead" value="2"><?php echo $Language->Phrase("Remove") ?></label>
<label><input type="radio" name="a_Letterhead" id="a_Letterhead" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $Applications->Letterhead->EditAttrs["onchange"] = "this.form.a_Letterhead[2].checked=true;" . @$Applications->Letterhead->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_Letterhead" id="a_Letterhead" value="3">
<?php } ?>
<input type="file" name="x_Letterhead" id="x_Letterhead" title="<?php echo $Applications->Letterhead->FldTitle() ?>" size="30"<?php echo $Applications->Letterhead->EditAttributes() ?>>
</div>
</span><?php echo $Applications->Letterhead->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->DateCreated->Visible) { // DateCreated ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->DateCreated->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $Applications->DateCreated->CellAttributes() ?>><span id="el_DateCreated">
<div<?php echo $Applications->DateCreated->ViewAttributes() ?>><?php echo $Applications->DateCreated->EditValue ?></div><input type="hidden" name="x_DateCreated" id="x_DateCreated" value="<?php echo ew_HtmlEncode($Applications->DateCreated->CurrentValue) ?>">
</span><?php echo $Applications->DateCreated->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->Status->Visible) { // Status ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Status->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $Applications->Status->CellAttributes() ?>><span id="el_Status">
<div id="tp_x_Status" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_Status" id="x_Status" title="<?php echo $Applications->Status->FldTitle() ?>" value="{value}"<?php echo $Applications->Status->EditAttributes() ?>></label></div>
<div id="dsl_x_Status" repeatcolumn="5">
<?php
$arwrk = $Applications->Status->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Applications->Status->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_Status" id="x_Status" title="<?php echo $Applications->Status->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $Applications->Status->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $Applications->Status->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->DateApproved->Visible) { // DateApproved ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->DateApproved->FldCaption() ?></td>
<td<?php echo $Applications->DateApproved->CellAttributes() ?>><span id="el_DateApproved">
<input type="text" name="x_DateApproved" id="x_DateApproved" title="<?php echo $Applications->DateApproved->FldTitle() ?>" value="<?php echo $Applications->DateApproved->EditValue ?>"<?php echo $Applications->DateApproved->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x_DateApproved" name="cal_x_DateApproved" alt="<?php echo $Language->Phrase("PickDate") ?>" title="<?php echo $Language->Phrase("PickDate") ?>" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup({
inputField: "x_DateApproved", // input field id
ifFormat: "%Y/%m/%d", // date format
button: "cal_x_DateApproved" // button id
});
</script>
</span><?php echo $Applications->DateApproved->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($Applications->Comments->Visible) { // Comments ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Comments->FldCaption() ?></td>
<td<?php echo $Applications->Comments->CellAttributes() ?>><span id="el_Comments">
<textarea name="x_Comments" id="x_Comments" title="<?php echo $Applications->Comments->FldTitle() ?>" cols="35" rows="4"<?php echo $Applications->Comments->EditAttributes() ?>><?php echo $Applications->Comments->EditValue ?></textarea>
</span><?php echo $Applications->Comments->CustomMsg ?></td>
</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("EditBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$Applications_edit->Page_Terminate();
?>
<?php
//
// Page class
//
class cApplications_edit {
// Page ID
var $PageID = 'edit';
// Table name
var $TableName = 'Applications';
// Page object name
var $PageObjName = 'Applications_edit';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $Applications;
if ($Applications->UseTokenInUrl) $PageUrl .= "t=" . $Applications->TableVar . "&"; // Add page token
return $PageUrl;
}
// Page URLs
var $AddUrl;
var $EditUrl;
var $CopyUrl;
var $DeleteUrl;
var $ViewUrl;
var $ListUrl;
// Export URLs
var $ExportPrintUrl;
var $ExportHtmlUrl;
var $ExportExcelUrl;
var $ExportWordUrl;
var $ExportXmlUrl;
var $ExportCsvUrl;
// Update URLs
var $InlineAddUrl;
var $InlineCopyUrl;
var $InlineEditUrl;
var $GridAddUrl;
var $GridEditUrl;
var $MultiDeleteUrl;
var $MultiUpdateUrl;
// Message
function getMessage() {
return @$_SESSION[EW_SESSION_MESSAGE];
}
function setMessage($v) {
if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
} else {
$_SESSION[EW_SESSION_MESSAGE] = $v;
}
}
// Show message
function ShowMessage() {
$sMessage = $this->getMessage();
$this->Message_Showing($sMessage);
if ($sMessage <> "") { // Message in Session, display
echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
}
}
// Validate page request
function IsPageRequest() {
global $objForm, $Applications;
if ($Applications->UseTokenInUrl) {
if ($objForm)
return ($Applications->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($Applications->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (Applications)
$GLOBALS["Applications"] = new cApplications();
// Table object (adminusers)
$GLOBALS['adminusers'] = new cadminusers();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'edit', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'Applications', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $Applications;
// Security
$Security = new cAdvancedSecurity();
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->TableName);
$Security->TablePermission_Loaded();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
if (!$Security->CanEdit()) {
$Security->SaveLastUrl();
$this->Page_Terminate("Applicationslist.php");
}
$Security->UserID_Loading();
if ($Security->IsLoggedIn()) $Security->LoadUserID();
$Security->UserID_Loaded();
// Create form object
$objForm = new cFormObj();
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
var $sDbMasterFilter;
var $sDbDetailFilter;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsFormError, $Applications;
// Load key from QueryString
if (@$_GET["ApplicationID"] <> "")
$Applications->ApplicationID->setQueryStringValue($_GET["ApplicationID"]);
if (@$_POST["a_edit"] <> "") {
$Applications->CurrentAction = $_POST["a_edit"]; // Get action code
$this->GetUploadFiles(); // Get upload files
$this->LoadFormValues(); // Get form values
// Validate form
if (!$this->ValidateForm()) {
$Applications->CurrentAction = ""; // Form error, reset action
$this->setMessage($gsFormError);
$Applications->EventCancelled = TRUE; // Event cancelled
$this->RestoreFormValues();
}
} else {
$Applications->CurrentAction = "I"; // Default action is display
}
// Check if valid key
if ($Applications->ApplicationID->CurrentValue == "")
$this->Page_Terminate("Applicationslist.php"); // Invalid key, return to list
switch ($Applications->CurrentAction) {
case "I": // Get a record to display
if (!$this->LoadRow()) { // Load record based on key
$this->setMessage($Language->Phrase("NoRecord")); // No record found
$this->Page_Terminate("Applicationslist.php"); // No matching record, return to list
}
break;
Case "U": // Update
$Applications->SendEmail = TRUE; // Send email on update success
if ($this->EditRow()) { // Update record based on key
$this->setMessage($Language->Phrase("UpdateSuccess")); // Update success
$sReturnUrl = $Applications->getReturnUrl();
if (ew_GetPageName($sReturnUrl) == "Applicationsview.php")
$sReturnUrl = $Applications->ViewUrl(); // View paging, return to View page directly
$this->Page_Terminate($sReturnUrl); // Return to caller
} else {
$Applications->EventCancelled = TRUE; // Event cancelled
$this->RestoreFormValues(); // Restore form values if update failed
}
}
// Render the record
$Applications->RowType = EW_ROWTYPE_EDIT; // Render as Edit
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $Applications;
// Get upload data
if ($Applications->AppForm->Upload->UploadFile()) {
// No action required
} else {
echo $Applications->AppForm->Upload->Message;
$this->Page_Terminate();
exit();
}
if ($Applications->CIPCReg->Upload->UploadFile()) {
// No action required
} else {
echo $Applications->CIPCReg->Upload->Message;
$this->Page_Terminate();
exit();
}
if ($Applications->MPRes->Upload->UploadFile()) {
// No action required
} else {
echo $Applications->MPRes->Upload->Message;
$this->Page_Terminate();
exit();
}
if ($Applications->PIInsurance->Upload->UploadFile()) {
// No action required
} else {
echo $Applications->PIInsurance->Upload->Message;
$this->Page_Terminate();
exit();
}
if ($Applications->Letterhead->Upload->UploadFile()) {
// No action required
} else {
echo $Applications->Letterhead->Upload->Message;
$this->Page_Terminate();
exit();
}
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $Applications;
$Applications->ApplicationID->setFormValue($objForm->GetValue("x_ApplicationID"));
$Applications->FirmName->setFormValue($objForm->GetValue("x_FirmName"));
$Applications->PhysicalAddress->setFormValue($objForm->GetValue("x_PhysicalAddress"));
$Applications->FoundingDate->setFormValue($objForm->GetValue("x_FoundingDate"));
$Applications->FoundingDate->CurrentValue = ew_UnFormatDateTime($Applications->FoundingDate->CurrentValue, 5);
$Applications->VATNumber->setFormValue($objForm->GetValue("x_VATNumber"));
$Applications->DateCreated->setFormValue($objForm->GetValue("x_DateCreated"));
$Applications->DateCreated->CurrentValue = ew_UnFormatDateTime($Applications->DateCreated->CurrentValue, 5);
$Applications->Status->setFormValue($objForm->GetValue("x_Status"));
$Applications->DateApproved->setFormValue($objForm->GetValue("x_DateApproved"));
$Applications->DateApproved->CurrentValue = ew_UnFormatDateTime($Applications->DateApproved->CurrentValue, 5);
$Applications->Comments->setFormValue($objForm->GetValue("x_Comments"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $Applications;
$this->LoadRow();
$Applications->ApplicationID->CurrentValue = $Applications->ApplicationID->FormValue;
$Applications->FirmName->CurrentValue = $Applications->FirmName->FormValue;
$Applications->PhysicalAddress->CurrentValue = $Applications->PhysicalAddress->FormValue;
$Applications->FoundingDate->CurrentValue = $Applications->FoundingDate->FormValue;
$Applications->FoundingDate->CurrentValue = ew_UnFormatDateTime($Applications->FoundingDate->CurrentValue, 5);
$Applications->VATNumber->CurrentValue = $Applications->VATNumber->FormValue;
$Applications->DateCreated->CurrentValue = $Applications->DateCreated->FormValue;
$Applications->DateCreated->CurrentValue = ew_UnFormatDateTime($Applications->DateCreated->CurrentValue, 5);
$Applications->Status->CurrentValue = $Applications->Status->FormValue;
$Applications->DateApproved->CurrentValue = $Applications->DateApproved->FormValue;
$Applications->DateApproved->CurrentValue = ew_UnFormatDateTime($Applications->DateApproved->CurrentValue, 5);
$Applications->Comments->CurrentValue = $Applications->Comments->FormValue;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $Applications;
$sFilter = $Applications->KeyFilter();
// Call Row Selecting event
$Applications->Row_Selecting($sFilter);
// Load SQL based on filter
$Applications->CurrentFilter = $sFilter;
$sSql = $Applications->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$Applications->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $Applications;
$Applications->ApplicationID->setDbValue($rs->fields('ApplicationID'));
$Applications->FirmName->setDbValue($rs->fields('FirmName'));
$Applications->PhysicalAddress->setDbValue($rs->fields('PhysicalAddress'));
$Applications->FoundingDate->setDbValue($rs->fields('FoundingDate'));
$Applications->VATNumber->setDbValue($rs->fields('VATNumber'));
$Applications->AppForm->Upload->DbValue = $rs->fields('AppForm');
$Applications->CIPCReg->Upload->DbValue = $rs->fields('CIPCReg');
$Applications->MPRes->Upload->DbValue = $rs->fields('MPRes');
$Applications->PIInsurance->Upload->DbValue = $rs->fields('PIInsurance');
$Applications->Letterhead->Upload->DbValue = $rs->fields('Letterhead');
$Applications->DateCreated->setDbValue($rs->fields('DateCreated'));
$Applications->Status->setDbValue($rs->fields('Status'));
$Applications->DateApproved->setDbValue($rs->fields('DateApproved'));
$Applications->Comments->setDbValue($rs->fields('Comments'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $Applications;
// Initialize URLs
// Call Row_Rendering event
$Applications->Row_Rendering();
// Common render codes for all row types
// ApplicationID
$Applications->ApplicationID->CellCssStyle = ""; $Applications->ApplicationID->CellCssClass = "";
$Applications->ApplicationID->CellAttrs = array(); $Applications->ApplicationID->ViewAttrs = array(); $Applications->ApplicationID->EditAttrs = array();
// FirmName
$Applications->FirmName->CellCssStyle = ""; $Applications->FirmName->CellCssClass = "";
$Applications->FirmName->CellAttrs = array(); $Applications->FirmName->ViewAttrs = array(); $Applications->FirmName->EditAttrs = array();
// PhysicalAddress
$Applications->PhysicalAddress->CellCssStyle = ""; $Applications->PhysicalAddress->CellCssClass = "";
$Applications->PhysicalAddress->CellAttrs = array(); $Applications->PhysicalAddress->ViewAttrs = array(); $Applications->PhysicalAddress->EditAttrs = array();
// FoundingDate
$Applications->FoundingDate->CellCssStyle = ""; $Applications->FoundingDate->CellCssClass = "";
$Applications->FoundingDate->CellAttrs = array(); $Applications->FoundingDate->ViewAttrs = array(); $Applications->FoundingDate->EditAttrs = array();
// VATNumber
$Applications->VATNumber->CellCssStyle = ""; $Applications->VATNumber->CellCssClass = "";
$Applications->VATNumber->CellAttrs = array(); $Applications->VATNumber->ViewAttrs = array(); $Applications->VATNumber->EditAttrs = array();
// AppForm
$Applications->AppForm->CellCssStyle = ""; $Applications->AppForm->CellCssClass = "";
$Applications->AppForm->CellAttrs = array(); $Applications->AppForm->ViewAttrs = array(); $Applications->AppForm->EditAttrs = array();
// CIPCReg
$Applications->CIPCReg->CellCssStyle = ""; $Applications->CIPCReg->CellCssClass = "";
$Applications->CIPCReg->CellAttrs = array(); $Applications->CIPCReg->ViewAttrs = array(); $Applications->CIPCReg->EditAttrs = array();
// MPRes
$Applications->MPRes->CellCssStyle = ""; $Applications->MPRes->CellCssClass = "";
$Applications->MPRes->CellAttrs = array(); $Applications->MPRes->ViewAttrs = array(); $Applications->MPRes->EditAttrs = array();
// PIInsurance
$Applications->PIInsurance->CellCssStyle = ""; $Applications->PIInsurance->CellCssClass = "";
$Applications->PIInsurance->CellAttrs = array(); $Applications->PIInsurance->ViewAttrs = array(); $Applications->PIInsurance->EditAttrs = array();
// Letterhead
$Applications->Letterhead->CellCssStyle = ""; $Applications->Letterhead->CellCssClass = "";
$Applications->Letterhead->CellAttrs = array(); $Applications->Letterhead->ViewAttrs = array(); $Applications->Letterhead->EditAttrs = array();
// DateCreated
$Applications->DateCreated->CellCssStyle = ""; $Applications->DateCreated->CellCssClass = "";
$Applications->DateCreated->CellAttrs = array(); $Applications->DateCreated->ViewAttrs = array(); $Applications->DateCreated->EditAttrs = array();
// Status
$Applications->Status->CellCssStyle = ""; $Applications->Status->CellCssClass = "";
$Applications->Status->CellAttrs = array(); $Applications->Status->ViewAttrs = array(); $Applications->Status->EditAttrs = array();
// DateApproved
$Applications->DateApproved->CellCssStyle = ""; $Applications->DateApproved->CellCssClass = "";
$Applications->DateApproved->CellAttrs = array(); $Applications->DateApproved->ViewAttrs = array(); $Applications->DateApproved->EditAttrs = array();
// Comments
$Applications->Comments->CellCssStyle = ""; $Applications->Comments->CellCssClass = "";
$Applications->Comments->CellAttrs = array(); $Applications->Comments->ViewAttrs = array(); $Applications->Comments->EditAttrs = array();
if ($Applications->RowType == EW_ROWTYPE_VIEW) { // View row
// ApplicationID
$Applications->ApplicationID->ViewValue = $Applications->ApplicationID->CurrentValue;
$Applications->ApplicationID->CssStyle = "";
$Applications->ApplicationID->CssClass = "";
$Applications->ApplicationID->ViewCustomAttributes = "";
// FirmName
$Applications->FirmName->ViewValue = $Applications->FirmName->CurrentValue;
$Applications->FirmName->CssStyle = "";
$Applications->FirmName->CssClass = "";
$Applications->FirmName->ViewCustomAttributes = "";
// PhysicalAddress
$Applications->PhysicalAddress->ViewValue = $Applications->PhysicalAddress->CurrentValue;
$Applications->PhysicalAddress->CssStyle = "";
$Applications->PhysicalAddress->CssClass = "";
$Applications->PhysicalAddress->ViewCustomAttributes = "";
// FoundingDate
$Applications->FoundingDate->ViewValue = $Applications->FoundingDate->CurrentValue;
$Applications->FoundingDate->ViewValue = ew_FormatDateTime($Applications->FoundingDate->ViewValue, 5);
$Applications->FoundingDate->CssStyle = "";
$Applications->FoundingDate->CssClass = "";
$Applications->FoundingDate->ViewCustomAttributes = "";
// VATNumber
$Applications->VATNumber->ViewValue = $Applications->VATNumber->CurrentValue;
$Applications->VATNumber->CssStyle = "";
$Applications->VATNumber->CssClass = "";
$Applications->VATNumber->ViewCustomAttributes = "";
// AppForm
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->ViewValue = $Applications->AppForm->Upload->DbValue;
} else {
$Applications->AppForm->ViewValue = "";
}
$Applications->AppForm->CssStyle = "";
$Applications->AppForm->CssClass = "";
$Applications->AppForm->ViewCustomAttributes = "";
// CIPCReg
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->ViewValue = $Applications->CIPCReg->Upload->DbValue;
} else {
$Applications->CIPCReg->ViewValue = "";
}
$Applications->CIPCReg->CssStyle = "";
$Applications->CIPCReg->CssClass = "";
$Applications->CIPCReg->ViewCustomAttributes = "";
// MPRes
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->ViewValue = $Applications->MPRes->Upload->DbValue;
} else {
$Applications->MPRes->ViewValue = "";
}
$Applications->MPRes->CssStyle = "";
$Applications->MPRes->CssClass = "";
$Applications->MPRes->ViewCustomAttributes = "";
// PIInsurance
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->ViewValue = $Applications->PIInsurance->Upload->DbValue;
} else {
$Applications->PIInsurance->ViewValue = "";
}
$Applications->PIInsurance->CssStyle = "";
$Applications->PIInsurance->CssClass = "";
$Applications->PIInsurance->ViewCustomAttributes = "";
// Letterhead
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->ViewValue = $Applications->Letterhead->Upload->DbValue;
} else {
$Applications->Letterhead->ViewValue = "";
}
$Applications->Letterhead->CssStyle = "";
$Applications->Letterhead->CssClass = "";
$Applications->Letterhead->ViewCustomAttributes = "";
// DateCreated
$Applications->DateCreated->ViewValue = $Applications->DateCreated->CurrentValue;
$Applications->DateCreated->ViewValue = ew_FormatDateTime($Applications->DateCreated->ViewValue, 5);
$Applications->DateCreated->CssStyle = "";
$Applications->DateCreated->CssClass = "";
$Applications->DateCreated->ViewCustomAttributes = "";
// Status
if (strval($Applications->Status->CurrentValue) <> "") {
switch ($Applications->Status->CurrentValue) {
case "P":
$Applications->Status->ViewValue = "Pending";
break;
case "A":
$Applications->Status->ViewValue = "Approved";
break;
case "R":
$Applications->Status->ViewValue = "Rejected";
break;
default:
$Applications->Status->ViewValue = $Applications->Status->CurrentValue;
}
} else {
$Applications->Status->ViewValue = NULL;
}
$Applications->Status->CssStyle = "";
$Applications->Status->CssClass = "";
$Applications->Status->ViewCustomAttributes = "";
// DateApproved
$Applications->DateApproved->ViewValue = $Applications->DateApproved->CurrentValue;
$Applications->DateApproved->ViewValue = ew_FormatDateTime($Applications->DateApproved->ViewValue, 5);
$Applications->DateApproved->CssStyle = "";
$Applications->DateApproved->CssClass = "";
$Applications->DateApproved->ViewCustomAttributes = "";
// Comments
$Applications->Comments->ViewValue = $Applications->Comments->CurrentValue;
$Applications->Comments->CssStyle = "";
$Applications->Comments->CssClass = "";
$Applications->Comments->ViewCustomAttributes = "";
// ApplicationID
$Applications->ApplicationID->HrefValue = "";
$Applications->ApplicationID->TooltipValue = "";
// FirmName
$Applications->FirmName->HrefValue = "";
$Applications->FirmName->TooltipValue = "";
// PhysicalAddress
$Applications->PhysicalAddress->HrefValue = "";
$Applications->PhysicalAddress->TooltipValue = "";
// FoundingDate
$Applications->FoundingDate->HrefValue = "";
$Applications->FoundingDate->TooltipValue = "";
// VATNumber
$Applications->VATNumber->HrefValue = "";
$Applications->VATNumber->TooltipValue = "";
// AppForm
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->HrefValue = ew_UploadPathEx(FALSE, $Applications->AppForm->UploadPath) . ((!empty($Applications->AppForm->ViewValue)) ? $Applications->AppForm->ViewValue : $Applications->AppForm->CurrentValue);
if ($Applications->Export <> "") $Applications->AppForm->HrefValue = ew_ConvertFullUrl($Applications->AppForm->HrefValue);
} else {
$Applications->AppForm->HrefValue = "";
}
$Applications->AppForm->TooltipValue = "";
// CIPCReg
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->HrefValue = ew_UploadPathEx(FALSE, $Applications->CIPCReg->UploadPath) . ((!empty($Applications->CIPCReg->ViewValue)) ? $Applications->CIPCReg->ViewValue : $Applications->CIPCReg->CurrentValue);
if ($Applications->Export <> "") $Applications->CIPCReg->HrefValue = ew_ConvertFullUrl($Applications->CIPCReg->HrefValue);
} else {
$Applications->CIPCReg->HrefValue = "";
}
$Applications->CIPCReg->TooltipValue = "";
// MPRes
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->HrefValue = ew_UploadPathEx(FALSE, $Applications->MPRes->UploadPath) . ((!empty($Applications->MPRes->ViewValue)) ? $Applications->MPRes->ViewValue : $Applications->MPRes->CurrentValue);
if ($Applications->Export <> "") $Applications->MPRes->HrefValue = ew_ConvertFullUrl($Applications->MPRes->HrefValue);
} else {
$Applications->MPRes->HrefValue = "";
}
$Applications->MPRes->TooltipValue = "";
// PIInsurance
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->HrefValue = ew_UploadPathEx(FALSE, $Applications->PIInsurance->UploadPath) . ((!empty($Applications->PIInsurance->ViewValue)) ? $Applications->PIInsurance->ViewValue : $Applications->PIInsurance->CurrentValue);
if ($Applications->Export <> "") $Applications->PIInsurance->HrefValue = ew_ConvertFullUrl($Applications->PIInsurance->HrefValue);
} else {
$Applications->PIInsurance->HrefValue = "";
}
$Applications->PIInsurance->TooltipValue = "";
// Letterhead
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->HrefValue = ew_UploadPathEx(FALSE, $Applications->Letterhead->UploadPath) . ((!empty($Applications->Letterhead->ViewValue)) ? $Applications->Letterhead->ViewValue : $Applications->Letterhead->CurrentValue);
if ($Applications->Export <> "") $Applications->Letterhead->HrefValue = ew_ConvertFullUrl($Applications->Letterhead->HrefValue);
} else {
$Applications->Letterhead->HrefValue = "";
}
$Applications->Letterhead->TooltipValue = "";
// DateCreated
$Applications->DateCreated->HrefValue = "";
$Applications->DateCreated->TooltipValue = "";
// Status
$Applications->Status->HrefValue = "";
$Applications->Status->TooltipValue = "";
// DateApproved
$Applications->DateApproved->HrefValue = "";
$Applications->DateApproved->TooltipValue = "";
// Comments
$Applications->Comments->HrefValue = "";
$Applications->Comments->TooltipValue = "";
} elseif ($Applications->RowType == EW_ROWTYPE_EDIT) { // Edit row
// ApplicationID
$Applications->ApplicationID->EditCustomAttributes = "";
$Applications->ApplicationID->EditValue = $Applications->ApplicationID->CurrentValue;
$Applications->ApplicationID->CssStyle = "";
$Applications->ApplicationID->CssClass = "";
$Applications->ApplicationID->ViewCustomAttributes = "";
// FirmName
$Applications->FirmName->EditCustomAttributes = "";
$Applications->FirmName->EditValue = ew_HtmlEncode($Applications->FirmName->CurrentValue);
// PhysicalAddress
$Applications->PhysicalAddress->EditCustomAttributes = "";
$Applications->PhysicalAddress->EditValue = ew_HtmlEncode($Applications->PhysicalAddress->CurrentValue);
// FoundingDate
$Applications->FoundingDate->EditCustomAttributes = "";
$Applications->FoundingDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($Applications->FoundingDate->CurrentValue, 5));
// VATNumber
$Applications->VATNumber->EditCustomAttributes = "";
$Applications->VATNumber->EditValue = ew_HtmlEncode($Applications->VATNumber->CurrentValue);
// AppForm
$Applications->AppForm->EditCustomAttributes = "";
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->EditValue = $Applications->AppForm->Upload->DbValue;
} else {
$Applications->AppForm->EditValue = "";
}
// CIPCReg
$Applications->CIPCReg->EditCustomAttributes = "";
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->EditValue = $Applications->CIPCReg->Upload->DbValue;
} else {
$Applications->CIPCReg->EditValue = "";
}
// MPRes
$Applications->MPRes->EditCustomAttributes = "";
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->EditValue = $Applications->MPRes->Upload->DbValue;
} else {
$Applications->MPRes->EditValue = "";
}
// PIInsurance
$Applications->PIInsurance->EditCustomAttributes = "";
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->EditValue = $Applications->PIInsurance->Upload->DbValue;
} else {
$Applications->PIInsurance->EditValue = "";
}
// Letterhead
$Applications->Letterhead->EditCustomAttributes = "";
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->EditValue = $Applications->Letterhead->Upload->DbValue;
} else {
$Applications->Letterhead->EditValue = "";
}
// DateCreated
$Applications->DateCreated->EditCustomAttributes = "";
$Applications->DateCreated->EditValue = $Applications->DateCreated->CurrentValue;
$Applications->DateCreated->EditValue = ew_FormatDateTime($Applications->DateCreated->EditValue, 5);
$Applications->DateCreated->CssStyle = "";
$Applications->DateCreated->CssClass = "";
$Applications->DateCreated->ViewCustomAttributes = "";
// Status
$Applications->Status->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("P", "Pending");
$arwrk[] = array("A", "Approved");
$arwrk[] = array("R", "Rejected");
$Applications->Status->EditValue = $arwrk;
// DateApproved
$Applications->DateApproved->EditCustomAttributes = "";
$Applications->DateApproved->EditValue = ew_HtmlEncode(ew_FormatDateTime($Applications->DateApproved->CurrentValue, 5));
// Comments
$Applications->Comments->EditCustomAttributes = "";
$Applications->Comments->EditValue = ew_HtmlEncode($Applications->Comments->CurrentValue);
// Edit refer script
// ApplicationID
$Applications->ApplicationID->HrefValue = "";
// FirmName
$Applications->FirmName->HrefValue = "";
// PhysicalAddress
$Applications->PhysicalAddress->HrefValue = "";
// FoundingDate
$Applications->FoundingDate->HrefValue = "";
// VATNumber
$Applications->VATNumber->HrefValue = "";
// AppForm
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->HrefValue = ew_UploadPathEx(FALSE, $Applications->AppForm->UploadPath) . ((!empty($Applications->AppForm->EditValue)) ? $Applications->AppForm->EditValue : $Applications->AppForm->CurrentValue);
if ($Applications->Export <> "") $Applications->AppForm->HrefValue = ew_ConvertFullUrl($Applications->AppForm->HrefValue);
} else {
$Applications->AppForm->HrefValue = "";
}
// CIPCReg
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->HrefValue = ew_UploadPathEx(FALSE, $Applications->CIPCReg->UploadPath) . ((!empty($Applications->CIPCReg->EditValue)) ? $Applications->CIPCReg->EditValue : $Applications->CIPCReg->CurrentValue);
if ($Applications->Export <> "") $Applications->CIPCReg->HrefValue = ew_ConvertFullUrl($Applications->CIPCReg->HrefValue);
} else {
$Applications->CIPCReg->HrefValue = "";
}
// MPRes
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->HrefValue = ew_UploadPathEx(FALSE, $Applications->MPRes->UploadPath) . ((!empty($Applications->MPRes->EditValue)) ? $Applications->MPRes->EditValue : $Applications->MPRes->CurrentValue);
if ($Applications->Export <> "") $Applications->MPRes->HrefValue = ew_ConvertFullUrl($Applications->MPRes->HrefValue);
} else {
$Applications->MPRes->HrefValue = "";
}
// PIInsurance
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->HrefValue = ew_UploadPathEx(FALSE, $Applications->PIInsurance->UploadPath) . ((!empty($Applications->PIInsurance->EditValue)) ? $Applications->PIInsurance->EditValue : $Applications->PIInsurance->CurrentValue);
if ($Applications->Export <> "") $Applications->PIInsurance->HrefValue = ew_ConvertFullUrl($Applications->PIInsurance->HrefValue);
} else {
$Applications->PIInsurance->HrefValue = "";
}
// Letterhead
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->HrefValue = ew_UploadPathEx(FALSE, $Applications->Letterhead->UploadPath) . ((!empty($Applications->Letterhead->EditValue)) ? $Applications->Letterhead->EditValue : $Applications->Letterhead->CurrentValue);
if ($Applications->Export <> "") $Applications->Letterhead->HrefValue = ew_ConvertFullUrl($Applications->Letterhead->HrefValue);
} else {
$Applications->Letterhead->HrefValue = "";
}
// DateCreated
$Applications->DateCreated->HrefValue = "";
// Status
$Applications->Status->HrefValue = "";
// DateApproved
$Applications->DateApproved->HrefValue = "";
// Comments
$Applications->Comments->HrefValue = "";
}
// Call Row Rendered event
if ($Applications->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$Applications->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $Applications;
// Initialize form error message
$gsFormError = "";
if (!ew_CheckFileType($Applications->AppForm->Upload->FileName)) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("WrongFileType");
}
if ($Applications->AppForm->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $Applications->AppForm->Upload->FileSize > EW_MAX_FILE_SIZE) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
}
if (in_array($Applications->AppForm->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("PhpUploadErr" . $Applications->AppForm->Upload->Error);
}
if (!ew_CheckFileType($Applications->CIPCReg->Upload->FileName)) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("WrongFileType");
}
if ($Applications->CIPCReg->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $Applications->CIPCReg->Upload->FileSize > EW_MAX_FILE_SIZE) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
}
if (in_array($Applications->CIPCReg->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("PhpUploadErr" . $Applications->CIPCReg->Upload->Error);
}
if (!ew_CheckFileType($Applications->MPRes->Upload->FileName)) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("WrongFileType");
}
if ($Applications->MPRes->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $Applications->MPRes->Upload->FileSize > EW_MAX_FILE_SIZE) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
}
if (in_array($Applications->MPRes->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("PhpUploadErr" . $Applications->MPRes->Upload->Error);
}
if (!ew_CheckFileType($Applications->PIInsurance->Upload->FileName)) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("WrongFileType");
}
if ($Applications->PIInsurance->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $Applications->PIInsurance->Upload->FileSize > EW_MAX_FILE_SIZE) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
}
if (in_array($Applications->PIInsurance->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("PhpUploadErr" . $Applications->PIInsurance->Upload->Error);
}
if (!ew_CheckFileType($Applications->Letterhead->Upload->FileName)) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("WrongFileType");
}
if ($Applications->Letterhead->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $Applications->Letterhead->Upload->FileSize > EW_MAX_FILE_SIZE) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
}
if (in_array($Applications->Letterhead->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("PhpUploadErr" . $Applications->Letterhead->Upload->Error);
}
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!ew_CheckDate($Applications->FoundingDate->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $Applications->FoundingDate->FldErrMsg();
}
if (!ew_CheckDate($Applications->DateApproved->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $Applications->DateApproved->FldErrMsg();
}
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Update record based on key values
function EditRow() {
global $conn, $Security, $Language, $Applications;
$sFilter = $Applications->KeyFilter();
$Applications->CurrentFilter = $sFilter;
$sSql = $Applications->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();
// FirmName
$Applications->FirmName->SetDbValueDef($rsnew, $Applications->FirmName->CurrentValue, NULL, FALSE);
// PhysicalAddress
$Applications->PhysicalAddress->SetDbValueDef($rsnew, $Applications->PhysicalAddress->CurrentValue, NULL, FALSE);
// FoundingDate
$Applications->FoundingDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($Applications->FoundingDate->CurrentValue, 5, FALSE), NULL);
// VATNumber
$Applications->VATNumber->SetDbValueDef($rsnew, $Applications->VATNumber->CurrentValue, NULL, FALSE);
// AppForm
$Applications->AppForm->Upload->SaveToSession(); // Save file value to Session
if ($Applications->AppForm->Upload->Action == "2" || $Applications->AppForm->Upload->Action == "3") { // Update/Remove
$Applications->AppForm->Upload->DbValue = $rs->fields('AppForm'); // Get original value
if (is_null($Applications->AppForm->Upload->Value)) {
$rsnew['AppForm'] = NULL;
} else {
if ($Applications->AppForm->Upload->FileName == $Applications->AppForm->Upload->DbValue) { // Upload file name same as old file name
$rsnew['AppForm'] = $Applications->AppForm->Upload->FileName;
} else {
$rsnew['AppForm'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $Applications->AppForm->UploadPath), $Applications->AppForm->Upload->FileName);
}
}
}
// CIPCReg
$Applications->CIPCReg->Upload->SaveToSession(); // Save file value to Session
if ($Applications->CIPCReg->Upload->Action == "2" || $Applications->CIPCReg->Upload->Action == "3") { // Update/Remove
$Applications->CIPCReg->Upload->DbValue = $rs->fields('CIPCReg'); // Get original value
if (is_null($Applications->CIPCReg->Upload->Value)) {
$rsnew['CIPCReg'] = NULL;
} else {
if ($Applications->CIPCReg->Upload->FileName == $Applications->CIPCReg->Upload->DbValue) { // Upload file name same as old file name
$rsnew['CIPCReg'] = $Applications->CIPCReg->Upload->FileName;
} else {
$rsnew['CIPCReg'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $Applications->CIPCReg->UploadPath), $Applications->CIPCReg->Upload->FileName);
}
}
}
// MPRes
$Applications->MPRes->Upload->SaveToSession(); // Save file value to Session
if ($Applications->MPRes->Upload->Action == "2" || $Applications->MPRes->Upload->Action == "3") { // Update/Remove
$Applications->MPRes->Upload->DbValue = $rs->fields('MPRes'); // Get original value
if (is_null($Applications->MPRes->Upload->Value)) {
$rsnew['MPRes'] = NULL;
} else {
if ($Applications->MPRes->Upload->FileName == $Applications->MPRes->Upload->DbValue) { // Upload file name same as old file name
$rsnew['MPRes'] = $Applications->MPRes->Upload->FileName;
} else {
$rsnew['MPRes'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $Applications->MPRes->UploadPath), $Applications->MPRes->Upload->FileName);
}
}
}
// PIInsurance
$Applications->PIInsurance->Upload->SaveToSession(); // Save file value to Session
if ($Applications->PIInsurance->Upload->Action == "2" || $Applications->PIInsurance->Upload->Action == "3") { // Update/Remove
$Applications->PIInsurance->Upload->DbValue = $rs->fields('PIInsurance'); // Get original value
if (is_null($Applications->PIInsurance->Upload->Value)) {
$rsnew['PIInsurance'] = NULL;
} else {
if ($Applications->PIInsurance->Upload->FileName == $Applications->PIInsurance->Upload->DbValue) { // Upload file name same as old file name
$rsnew['PIInsurance'] = $Applications->PIInsurance->Upload->FileName;
} else {
$rsnew['PIInsurance'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $Applications->PIInsurance->UploadPath), $Applications->PIInsurance->Upload->FileName);
}
}
}
// Letterhead
$Applications->Letterhead->Upload->SaveToSession(); // Save file value to Session
if ($Applications->Letterhead->Upload->Action == "2" || $Applications->Letterhead->Upload->Action == "3") { // Update/Remove
$Applications->Letterhead->Upload->DbValue = $rs->fields('Letterhead'); // Get original value
if (is_null($Applications->Letterhead->Upload->Value)) {
$rsnew['Letterhead'] = NULL;
} else {
if ($Applications->Letterhead->Upload->FileName == $Applications->Letterhead->Upload->DbValue) { // Upload file name same as old file name
$rsnew['Letterhead'] = $Applications->Letterhead->Upload->FileName;
} else {
$rsnew['Letterhead'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $Applications->Letterhead->UploadPath), $Applications->Letterhead->Upload->FileName);
}
}
}
// Status
$Applications->Status->SetDbValueDef($rsnew, $Applications->Status->CurrentValue, "", FALSE);
// DateApproved
$Applications->DateApproved->SetDbValueDef($rsnew, ew_UnFormatDateTime($Applications->DateApproved->CurrentValue, 5, FALSE), NULL);
// Comments
$Applications->Comments->SetDbValueDef($rsnew, $Applications->Comments->CurrentValue, NULL, FALSE);
// Call Row Updating event
$bUpdateRow = $Applications->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
if (!ew_Empty($Applications->AppForm->Upload->Value)) {
if ($Applications->AppForm->Upload->FileName == $Applications->AppForm->Upload->DbValue) { // Overwrite if same file name
$Applications->AppForm->Upload->SaveToFile($Applications->AppForm->UploadPath, $rsnew['AppForm'], TRUE);
$Applications->AppForm->Upload->DbValue = ""; // No need to delete any more
} else {
$Applications->AppForm->Upload->SaveToFile($Applications->AppForm->UploadPath, $rsnew['AppForm'], FALSE);
}
}
if ($Applications->AppForm->Upload->Action == "2" || $Applications->AppForm->Upload->Action == "3") { // Update/Remove
if ($Applications->AppForm->Upload->DbValue <> "")
@unlink(ew_UploadPathEx(TRUE, $Applications->AppForm->UploadPath) . $Applications->AppForm->Upload->DbValue);
}
if (!ew_Empty($Applications->CIPCReg->Upload->Value)) {
if ($Applications->CIPCReg->Upload->FileName == $Applications->CIPCReg->Upload->DbValue) { // Overwrite if same file name
$Applications->CIPCReg->Upload->SaveToFile($Applications->CIPCReg->UploadPath, $rsnew['CIPCReg'], TRUE);
$Applications->CIPCReg->Upload->DbValue = ""; // No need to delete any more
} else {
$Applications->CIPCReg->Upload->SaveToFile($Applications->CIPCReg->UploadPath, $rsnew['CIPCReg'], FALSE);
}
}
if ($Applications->CIPCReg->Upload->Action == "2" || $Applications->CIPCReg->Upload->Action == "3") { // Update/Remove
if ($Applications->CIPCReg->Upload->DbValue <> "")
@unlink(ew_UploadPathEx(TRUE, $Applications->CIPCReg->UploadPath) . $Applications->CIPCReg->Upload->DbValue);
}
if (!ew_Empty($Applications->MPRes->Upload->Value)) {
if ($Applications->MPRes->Upload->FileName == $Applications->MPRes->Upload->DbValue) { // Overwrite if same file name
$Applications->MPRes->Upload->SaveToFile($Applications->MPRes->UploadPath, $rsnew['MPRes'], TRUE);
$Applications->MPRes->Upload->DbValue = ""; // No need to delete any more
} else {
$Applications->MPRes->Upload->SaveToFile($Applications->MPRes->UploadPath, $rsnew['MPRes'], FALSE);
}
}
if ($Applications->MPRes->Upload->Action == "2" || $Applications->MPRes->Upload->Action == "3") { // Update/Remove
if ($Applications->MPRes->Upload->DbValue <> "")
@unlink(ew_UploadPathEx(TRUE, $Applications->MPRes->UploadPath) . $Applications->MPRes->Upload->DbValue);
}
if (!ew_Empty($Applications->PIInsurance->Upload->Value)) {
if ($Applications->PIInsurance->Upload->FileName == $Applications->PIInsurance->Upload->DbValue) { // Overwrite if same file name
$Applications->PIInsurance->Upload->SaveToFile($Applications->PIInsurance->UploadPath, $rsnew['PIInsurance'], TRUE);
$Applications->PIInsurance->Upload->DbValue = ""; // No need to delete any more
} else {
$Applications->PIInsurance->Upload->SaveToFile($Applications->PIInsurance->UploadPath, $rsnew['PIInsurance'], FALSE);
}
}
if ($Applications->PIInsurance->Upload->Action == "2" || $Applications->PIInsurance->Upload->Action == "3") { // Update/Remove
if ($Applications->PIInsurance->Upload->DbValue <> "")
@unlink(ew_UploadPathEx(TRUE, $Applications->PIInsurance->UploadPath) . $Applications->PIInsurance->Upload->DbValue);
}
if (!ew_Empty($Applications->Letterhead->Upload->Value)) {
if ($Applications->Letterhead->Upload->FileName == $Applications->Letterhead->Upload->DbValue) { // Overwrite if same file name
$Applications->Letterhead->Upload->SaveToFile($Applications->Letterhead->UploadPath, $rsnew['Letterhead'], TRUE);
$Applications->Letterhead->Upload->DbValue = ""; // No need to delete any more
} else {
$Applications->Letterhead->Upload->SaveToFile($Applications->Letterhead->UploadPath, $rsnew['Letterhead'], FALSE);
}
}
if ($Applications->Letterhead->Upload->Action == "2" || $Applications->Letterhead->Upload->Action == "3") { // Update/Remove
if ($Applications->Letterhead->Upload->DbValue <> "")
@unlink(ew_UploadPathEx(TRUE, $Applications->Letterhead->UploadPath) . $Applications->Letterhead->Upload->DbValue);
}
$conn->raiseErrorFn = 'ew_ErrorFn';
$EditRow = $conn->Execute($Applications->UpdateSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($Applications->CancelMessage <> "") {
$this->setMessage($Applications->CancelMessage);
$Applications->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("UpdateCancelled"));
}
$EditRow = FALSE;
}
}
// Call Row_Updated event
if ($EditRow)
$Applications->Row_Updated($rsold, $rsnew);
$rs->Close();
// AppForm
$Applications->AppForm->Upload->RemoveFromSession(); // Remove file value from Session
// CIPCReg
$Applications->CIPCReg->Upload->RemoveFromSession(); // Remove file value from Session
// MPRes
$Applications->MPRes->Upload->RemoveFromSession(); // Remove file value from Session
// PIInsurance
$Applications->PIInsurance->Upload->RemoveFromSession(); // Remove file value from Session
// Letterhead
$Applications->Letterhead->Upload->RemoveFromSession(); // Remove file value from Session
return $EditRow;
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
}
?>