<%@ LANGUAGE = JavaScript %>
<% /*
    $Revision$
    $Id:fac_roundtrip_imp.asp 66040 2024-08-27 14:08:35Z erikg $

    File:               fac_roundtrip_imp.asp
    Description:        Als er een geldige code is meegegeven dan wordt het standaard import scherm geopend
                        waarbij de import module al voorgeselecteerd is.
    Parameters:         code: Een geldige fac_import_app_code.
    Note:               
*/
%>
<!-- #include file="../Shared/common.inc" -->
<%
FCLTHeader.Requires({ plugins:["jQuery"]});
        
var autfunction = "WEB_IMPORT";
var authparams = user.checkAutorisation(autfunction);
var code = getQParamSafe("app_code");
var imp_params = {};

var sql = "SELECT fac_import_app_key"
        + "     , fac_import_app_oms"
        + "     , fac_functie_key"
        + "  FROM fac_import_app"
        + " WHERE fac_import_app_prefix IS NULL"
        + "   AND fac_import_app_code = " + safe.quoted_sql(code);
var oRs = Oracle.Execute(sql);
if (!oRs.eof)
{
    imp_params.success = true;
    imp_params.app_key = oRs("fac_import_app_key").Value;
    imp_params.app_oms = oRs("fac_import_app_oms").Value;
}
else
{
    imp_params.success = false;
    imp_params.warning = "Unknow import code: " + code;
}
oRs.Close();

%>
<html>
    <head>
<% FCLTHeader.Generate(); %>
<script>
    $(function()
        {
            var params = <%=JSON.stringify(imp_params)%>;
            if (params.success)
            {
                FcltMgr.setTitle(params.app_oms);
                window.location.href = "../imp/imp_search_list.asp?import_app_key=" + params.app_key;
            }
            else
            {
                FcltMgr.closeDetail(window, { success: false
                                            , warning: params.warning
                                            , keepForm: false
                                            });
            }
        });

</script>
    </head>
    <body>
    </body>
</html>
<% ASPPAGE_END(); %>
