<% /*
    $Revision$
    $Id$

    File:        putorders.inc
    Description: Generieke functies voor putorders aanroepen vanuit asp.
    Parameters:
    Context:
    Note:

*/ %>
<%
var putorders = {
    _puo_hook:
        function ()
        {   // Gebruik rooturl ipv ../../ omdat we ook vanuit API's worden aangeroepen
            var hook = GetObject("script:" + Server.MapPath(rooturl + "/utils/putorders/puo_putorders.wsc"));
            hook.initialize({ customerId: customerId,
                              S: S,
                              Oracle: Oracle,
                              custabspath: Server.MapPath(custpath),
                              PUO_LOGPATH: Server.MapPath(rooturl + "/temp") + "/"
                            });
            return hook;
        },
    sendnotifications:
        function (pkey, paction)
        {
            var hook = putorders._puo_hook();
            __Log("Sending notification key={0}, pcode={1}".format(pkey, paction));
            hook.sendnotifications(pkey, paction);
            hook = null;
        },
    sendMLDorders:
        function (pkey)
        {
            var hook = putorders._puo_hook();
            __Log("Sending order key={0}".format(pkey));
            var result = hook.sendMLDorders(pkey);
            hook = null;
            return result;
        },
    sendMail:
        function (adrTo, strSubj, strBody, params)
        {
            var hook = putorders._puo_hook();
            __Log("Mailing {0}".format(adrTo));
            var result = hook.puo_sendMail(adrTo, strSubj, strBody, params);
            hook = null;
            return result;
        },
    sendSMS:
        function (telnr, msg)
        {
            var hook = putorders._puo_hook();
            __Log("SMS {0} to {1}".format(msg, telnr));
            var result = hook.puo_sendSMS(telnr, msg);
            hook = null;
            return result;
        }
    }
%>
