<%@language = "javascript" %>
<% /*
    $Revision$
    $Id$

    File:           fac_usrrapx_clone.asp
    Description:    Maakt een kopie van een rapport definitie

    Parameters:
    Context:
    Note:
*/
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../shared/save2db.inc" -->
<!-- #include file="../api2/api2.inc" -->
<!-- #include file="../api2/model_reportsx.inc" -->
<%

var authparamsPRSSYS = user.checkAutorisation("WEB_UDRMAN");

var usrrap_key = getQParamInt("usrrap_key");

var oldrap = new model_reportsx(usrrap_key, { include: ["columns"] });
oldrap.data.name = "Clone: " + toDateTimeString(new Date, true) + " " + oldrap.data.name;
if (oldrap.data.styling)
    oldrap.data.styling.id = (oldrap.data.styling.id & (~32)); // Template bitje er af strippen

var newrap = new model_reportsx(-1, { internal: true }); // internal zodat POST op kolommen wordt geaccepteerd
var params = { isNew: true };
var new_key = newrap.REST_POST(params, oldrap.data );

Response.Redirect("../fac/fac_reportx.asp?mode=wrap&id=" + new_key.key);
%>