130 lines
4.3 KiB
Plaintext
130 lines
4.3 KiB
Plaintext
<%@language = "javascript" %>
|
|
<% Server.ScriptTimeout=6000; %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: fac_refresh_accept.asp
|
|
Description: Refresh de acceptatie database
|
|
Parameters:
|
|
|
|
Context:
|
|
Note:
|
|
*/
|
|
%>
|
|
|
|
<!-- #include file="../Shared/common.inc" -->
|
|
<!-- #include file="../Shared/iface.inc" -->
|
|
|
|
<%
|
|
FCLTHeader.Requires({ plugins:["jQuery"] });
|
|
|
|
user.checkAutorisation("WEB_FACRFR");
|
|
var fso = Server.CreateObject("Scripting.FileSystemObject");
|
|
|
|
|
|
function getUserEmail()
|
|
{
|
|
var adr = user.prs_perslid_email() || S("puo_forcemailaddress");
|
|
if (adr.indexOf("<") > 0)
|
|
{ // Verwijder de eventuele alias voor het echte mailadres.
|
|
adr = adr.substr(adr.indexOf("<")+1);
|
|
adr = adr.substr(0, adr.indexOf(">"));
|
|
}
|
|
return adr;
|
|
}
|
|
|
|
// Let op! De settings kunnen overruled worden in \CUST\custenv.wsc
|
|
var dumpfile = S("refreshfromdumpfile", "");
|
|
if (!dumpfile)
|
|
abort_with_warning(L("lcl_fac_refresh_environment")); // Alleen voor acceptatieomgeving
|
|
|
|
if (!fso.FileExists(dumpfile))
|
|
abort_with_warning(L("lcl_fac_refresh_nodumpfile").format(dumpfile));
|
|
|
|
if ( S("refreshfromdumpscriptfolder", "") == "")
|
|
abort_with_warning(L("lcl_fac_refresh_paramserror")); // Onvoldoende parameters
|
|
|
|
var refresh_bat = S("refreshfromdumpscriptfolder") + "\\refresh_" + customerId + "_TEST.bat";
|
|
var isscheduled = fso.FileExists(refresh_bat);
|
|
if (isscheduled)
|
|
var scheduled_timestamp = fso.getFile(refresh_bat).DateLastModified;
|
|
|
|
var dumpfile_timestamp = fso.getFile(dumpfile).DateLastModified;
|
|
%>
|
|
|
|
<html>
|
|
<head>
|
|
<% FCLTHeader.Generate(); %>
|
|
<script>
|
|
function isValidEmailAddress(emailAddress)
|
|
{
|
|
var pattern = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
|
|
return pattern.test(emailAddress);
|
|
}
|
|
|
|
function doSchedule()
|
|
{
|
|
if (!validateForm("refreshform"))
|
|
return false;
|
|
|
|
var m = $("#emailadr").val();
|
|
if (!isValidEmailAddress(m))
|
|
return false;
|
|
|
|
$.post( $("form[name=refreshform]")[0].action
|
|
, $("[name=refreshform]").serialize()
|
|
, doScheduleCallback
|
|
, "json"
|
|
);
|
|
return true; // disable button
|
|
}
|
|
|
|
function doScheduleCallback(jsondata)
|
|
{
|
|
var txt = "<%=safe.jsstring(L("lcl_fac_refresh_newschedule").format(customerId))%>";
|
|
FcltToast(txt);
|
|
$("#accept_msg").text(txt);
|
|
}
|
|
|
|
function doCancel()
|
|
{
|
|
FcltMgr.closeDetail(window, { cancel: true } );
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body class="modal" id="mod_refresh">
|
|
<% MODAL_START();
|
|
%>
|
|
<form id="refreshform" name="refreshform" action="fac_refresh_accept_save.asp">
|
|
<% MODAL_BLOCK_START("dbrefresh", L("lcl_fac_refresh_accept"), {icon: "fa-siren-on"}); %>
|
|
<input type="hidden" id="batfile" name="batfile" value="<%=safe.htmlattr(refresh_bat)%>">
|
|
<% ROFIELDTR("fld", L("lcl_fac_refresh_dumpfile"), dumpfile);
|
|
RWFIELDTR("emailadr", "fld mailto", L("lcl_fac_refresh_notify"), getUserEmail(), {readonly: (isscheduled?true:false)});
|
|
ROFIELDTR("fldfacrefresh", "", isscheduled?L("lcl_fac_refresh_oldschedule").format(customerId, toDateTimeString(scheduled_timestamp)):"", {id: "accept_msg"});
|
|
// Hier kunnen dan allerlei waarschuwingen worden getoond.
|
|
if (!isscheduled)
|
|
ROTEXTAREATR("fldfacrefresh", L("lcl_fac_refresh_messagelbl"), L("lcl_fac_refresh_message").replace(/\x0D/g, "<br>").format(toDateTimeString(dumpfile_timestamp)), { ishtmlsafe: true });
|
|
|
|
MODAL_BLOCK_END();
|
|
|
|
var buttons = [];
|
|
buttons.push({id: "docancel", title: L("lcl_cancel"), icon: "fa-fclt-cancel", action: "doCancel()" });
|
|
|
|
if (!isscheduled)
|
|
{
|
|
buttons.push({id: "dorefresh", title: L("lcl_fac_refresh_inplannen"), action: "doSchedule()", singlepress: true, icon: "fa-fclt-refresh"});
|
|
}
|
|
SIMPLE_BLOCK_START();
|
|
CreateButtons(buttons);
|
|
SIMPLE_BLOCK_END();
|
|
IFACE.FORM_END();
|
|
%>
|
|
</form>
|
|
<% MODAL_END(); %>
|
|
</body>
|
|
</html>
|
|
<% ASPPAGE_END(); %>
|