<% /* $Revision$ $Id$ File: notes.inc Description: Generieke functies die door modules gebruikt worden op notities te tonen, wijzigen en aan te maken. Parameters: Context: Vanuit xxx_show_note2 asp bestanden Note: */ %> <% notes = { note_toggles: function (pmodule, params) { params = params || {}; // params.pkey is sowieso nodig maargoed %> <% Response.Write("
"); // Wie ben ik? (BO = FOBO) // MELDING: FE &1 / BO &2 // OPDR: FE &1 / BO &2 / UITV &4 var BITROLE = { "EXT": 0, "FE": 1, "BO": 2, "Geen": 3, // Ik heb geen specifieke rechten maar mag toch notities maken, public melding ofzo? "UITV": 4 }; // Ja, deze is andersom .. var BITACTIONROLE = { "FE": 2, "BO": 1, "UITV": 4 }; // Defaults (Die kunnen we net zo goed hier bepalen, de objecten met info zijn vaak al aangemaakt en server-side 'globaal' benaderbaar) if (pmodule === "MLD") { if (typeof mfe === "undefined") var mfe = mld.func_enabled_melding(params.pkey); if (typeof mld_info === "undefined") var mld_info = mld.mld_melding_info(params.pkey); params.note_zichtbaarExt = mld_info.canholdthirdparty && mld_info.email_ext; params.haschild = mld_info.haschild; params.publiek = mld_info.publiek; params.eigenMelding = user.isCollega(mld_info.melder_key); params.myRole = "myRole" in params ? params.myRole : (mfe.haveOnlyFErights ? 1 : (mfe.canFOread || mfe.canBOread ? 2 : 3)); params.fobo_prskey = (("mld_ins_discipline_key" in mld_info && mld_info.mld_ins_discipline_key > 0) ? mld_info.behandel2_key : mld_info.behandel_key); } if (pmodule === "OPDR") { if (typeof this_opdr === "undefined") var this_opdr = mld.func_enabled_opdracht(params.pkey); if (typeof mld_info === "undefined") var mld_info = mld.mld_melding_info(this_opdr.mld_opdr.mld_key); params.myRole = "myRole" in params ? params.myRole : this_opdr.myRole; params.opdr_actiecode = this_opdr.mld_opdr.actiecode; params.typeopdr_zichtbaarfe = this_opdr.mld_opdr.typeopdr_zichtbaarfe; params.uitv_naam = this_opdr.mld_opdr.uitv_naam; params.fobo_prskey = this_opdr.mld_opdr.contactpers_key; } // Voor zowel MLD als OPDR params.mld_actiecode = mld_info.actiecode; params.stdm_notes = mld_info.stdm_notes; params.mld_fenotes = mld_info.fenotes; params.fe_key = mld_info.melder_key; params.fe_ext_name = (mld_info.naam_ext ? mld_info.naam_ext : mld_info.email_ext); if (!("note_key" in params)) params.note_key = -1; if (pmodule === "MLD" && !(params.stdm_notes & params.myRole)) { Response.Write("
"); return; } var _fnTogglesHtml = function (more_params) { // Combineer de parameters van note_toggles en note_toggle_html in 1 object var combined_params = {}; for (x in params) combined_params[x] = params[x]; for (x in more_params) combined_params[x] = more_params[x]; // Defaults combined_params.from = params.myRole; if (more_params.to === 1 && "fe_key" in params && params.fe_key > -1 && typeof combined_params.to_name === "undefined") combined_params.to_name = new Perslid(params.fe_key).naam(); if (more_params.to === 2) { if (params.fobo_prskey && params.fobo_prskey > -1) combined_params.to_name = new Perslid(params.fobo_prskey).naam(); else combined_params.to_name = L("lcl_mld_behandelaar"); } if (params.note_key > -1) combined_params.has = combined_params.has & 1; // Overige bitjes kunnen bij een bestaande notitie niet meer gewijzigd worden if ((pmodule === "MLD" && S("mld_melding_actiecode") != 1) || (pmodule === "OPDR" && S("mld_opdr_actiecode") != 1)) { combined_params.has = combined_params.has & (127 - 2 - 4 - 8); // Deze bitjes gebruiken we alleen bij S("mld_XXX_actiecode") == 1 } return notes.note_toggle_html(pmodule, combined_params); } /* has & val = Bitwise: &1 = Zichtbaarheid &2 = Notificeren &4 = Melders van kinder-meldingen notificeren &8 = Reactie vragen / Actie ! &16 = E-mail - FUTURE USE */ params.note_flag = params.note_flag || 0; Response.Write(_fnTogglesHtml({ to: params.myRole, has: 0, val: 1 })); // Altijd zichtbaar voor mijzelf if (params.myRole === BITROLE["FE"] && pmodule === "MLD") // Ik ben de aanvrager { // BO toggles; var mld_actie_bij_BO = params.mld_actiecode & BITACTIONROLE["BO"]; // Stond actie al bij backoffice? FE mag nooit terugpakken if (!mld_actie_bij_BO && (params.publiek != 1 || params.eigenMelding)) Response.Write(_fnTogglesHtml({ to: BITROLE["BO"], has: 8, val: 11 })); // UITV toggles; if (params.stdm_notes & BITROLE["UITV"]) { var sql = " SELECT DISTINCT o.mld_opdr_key opdr_key," + " o.mld_opdr_bedrijfopdr_volgnr opdr_nr," + " u.mld_uitvoerende_key uitv_key," + " u.naam" + " FROM mld_typeopdr t," + " mld_opdr o," + " mld_opdr_note n," + " mld_v_uitvoerende u" + " WHERE o.mld_melding_key = " + params.pkey /* = mld_key want pmodule === "MLD" */ + " AND n.mld_opdr_key = o.mld_opdr_key" + " AND o.mld_typeopdr_key = t.mld_typeopdr_key" + " AND u.mld_uitvoerende_key = o.mld_uitvoerende_keys" + " AND t.mld_typeopdr_zichtbaarfe = 1" + " AND BITAND (n.mld_opdr_note_flag, 32) = 32" + " ORDER BY 1, 2"; var oRs = Oracle.Execute(sql); var uitvoerders = []; while (!oRs.EoF) { uitvoerders.push({ opdr_key: oRs("opdr_key").Value, opdr_volgnr: oRs("opdr_nr").Value, uitv_key: oRs("uitv_key").Value, uitv_naam: oRs("naam").Value }); oRs.MoveNext(); } oRs.Close(); var _hasUitv = function(key, this_i) { for (obj in uitvoerders) if (this_i !== obj && uitvoerders[obj].uitv_key === key) return true; return false; } if (params.mobile && uitvoerders.length) // Mobile alleen een tooltip Response.Write("
" + L("lcl_note_invis_uitv").format(safe.html(uitvoerders[0].uitv_naam), I("fa-reply")) + "
"); else { for (i in uitvoerders) { var u = uitvoerders[i]; if (_hasUitv(u.uitv_key, i)) // Hebben we 2 opdrachten met dezelfde uitvoerder -> dan prefixen met opdracht_nr u.uitv_naam = L("lcl_shared_order") + " " + u.opdr_volgnr + ": " + u.uitv_naam; Response.Write(_fnTogglesHtml({ to: BITROLE["UITV"], to_name: u.uitv_naam, opdr_key: u.opdr_key, uid: u.opdr_volgnr, has: 8, val: (i == 0 ? 8 : 0) })); } } } } else if (params.myRole === BITROLE["BO"]) // Ik ben de behandelaar { // FE toggles if (params.stdm_notes & BITROLE["FE"]) { var has = 0; val = 0; var to_name; if (pmodule === "MLD" || params.typeopdr_zichtbaarfe == 1) { if (params.mld_fenotes > 1 || params.eigenMelding) has += 1; if ((params.note_key > -1 && params.note_flag & 1 && pmodule === "MLD") // Bij OPDR niet automatisch zichtbaar voor FE || (params.note_key == -1 && (params.mld_fenotes == 1 || params.mld_fenotes == 3 || params.eigenMelding))) val += 1; if (params.mld_fenotes > 0 && !params.eigenMelding) { if (params.mld_actiecode & 2 || (val & 1 && S("mld_note_default_notifyFE") >= 1)) val += 2; if (params.mld_actiecode & 2 || (val & 1 && S("mld_note_default_notifyFE") == 1)) val += 8; has += 10; if (params.haschild) { has += 4; if (val & 2) val += 4; } } if (params.eigenMelding) to_name = ""; // Ik ben BO en het is mijn eigen melding, laat mijn naam dan maar weg } Response.Write(_fnTogglesHtml({ to: BITROLE["FE"], to_name: to_name, has: has, val: val })); // Externe FE Notificatie toggles if (params.note_zichtbaarExt) Response.Write(_fnTogglesHtml({ to: BITROLE["EXT"], to_name: params.fe_ext_name, has: 2, val: val })); } // UITV toggles if (params.stdm_notes & BITROLE["UITV"] && pmodule === "OPDR") { has = 11; val = 0; if (params.note_key == -1 || params.note_flag & 4) val += 1; if (params.opdr_actiecode & 4) val += 8; Response.Write(_fnTogglesHtml({ to: BITROLE["UITV"], to_name: params.uitv_naam, has: has, val: val })); } } else if (params.myRole === BITROLE["UITV"] && pmodule === "OPDR") // Ik ben de uitvoerder { // FE toggles if (params.typeopdr_zichtbaarfe == 1 && params.stdm_notes & BITROLE["FE"] && params.stdm_notes & BITROLE["UITV"]) // Als de FE of ik (de uitvoerder) niet mee doe met de notities vd melding, heeft deze toggle ook geen zin { var has = 10; var val = 0; if (params.note_flag & 1) // Bestaande notitie: Zichtbaar voor FE val += 1; Response.Write(_fnTogglesHtml({ to: BITROLE["FE"], has: has, val: val })); } // BO toggles has = 2; if (params.opdr_actiecode & 4) has += 8; Response.Write(_fnTogglesHtml({ to: BITROLE["BO"], has: has, val: 1 })); } Response.Write(""); // .note-options }, note_toggle_html: function (pmodule, params) { params = params || {}; var resultHtml = ""; var note_option_icons = [(params.myRole === 2 && params.eigenMelding) ? "fa-unlock" : "fa-eye", // &1 Zichtbaarheid "fa-bell-on", // &2 Notificeren "fa-bells", // &4 Kinders notificeren (params.opdr_key ? "fa-reply-all" : (params.to == 4 && params.from == 2 ? "fa-share" : "fa-reply")), // &8 Vraag reactie / Actie /* "fa-envelope" // &16 E-mail */ ]; var idPostfix; switch (params.to) { case 0: idPostfix = "EXT"; break; case 1: idPostfix = "FE"; break; case 2: idPostfix = "BO"; break; case 4: idPostfix = "UITV"; break; } var note_option_ids = ["zichtbaar" + idPostfix, // VIS "notify" + idPostfix, // NOTI "notify" + idPostfix + "child", // NOTI CHILD "action2" + idPostfix]; // ACTION var note_option_tooltips = []; note_option_tooltips = [ (params.to < 2 ? L("lcl_mld_zichtbaar_FE") : L("lcl_mld_zichtbaar_UITV")), // &1 Zichtbaarheid L("lcl_mld_notify_FE").format(params.to_name), // &2 Notificeren L("lcl_mld_notify_FEchild").format(params.to_name) // &4 Kinders notificeren ]; switch (params.to) { // Vraag reactie / Actie case 0: note_option_tooltips[3] = L("lcl_mld_noti_ext").format(params.to_name); break; case 1: note_option_tooltips[3] = (params.mld_actiecode & 2 && pmodule !== "OPDR" ? L("lcl_mld_latenbij_FE") : L("lcl_mld_toekennen_FE")).format(params.to_name); break; case 2: note_option_tooltips[3] = L("lcl_mld_toekennen_BO"); break; case 4: note_option_tooltips[3] = (pmodule === "OPDR" ? (params.opdr_actiecode & 4 ? L("lcl_mld_latenbij_UITV") : L("lcl_mld_toekennen_UITV")) : L("lcl_note_reply_to")) .format(params.to_name); break; } for (i in note_option_icons) { var bit = 1 << i; if (bit === 1 || params.has & bit) { if (params.mobile) { var actiecode; if (pmodule == "MLD") { var sqlt = "SELECT mld_melding_actiecode" + " FROM mld_melding" + " WHERE mld_melding_key = " + params.pkey; var oRs = Oracle.Execute(sqlt); actiecode = oRs("mld_melding_actiecode").Value; oRs.Close(); } if (params.has & bit) resultHtml += CHB_FIELD_HTML(note_option_ids[i], safe.html(note_option_tooltips[i]), (params.val & bit ? 1 : 0), { html: "data-toggle-type=" + bit // De volgende 3 attributen nodig voor de onclick functie noteOptionToggled // en zijn op deze manier voor de functie toegankelijk. + " module=" + pmodule + " mld_note_hidden_action2FE=" + S("mld_note_hidden_action2FE") + " actiecode=" + (actiecode != null? actiecode : 0), pclass: "note-option-toggle-m", onclick: "noteOptionToggled.call(this, " + bit + ")" }); else resultHtml += ''; } else { var toggle_action = bit & 8 && (params.from === 4 || (params.from === 2 && (params.to === 4 || (params.mld_actiecode & 1) || pmodule === "OPDR"))); resultHtml += '' + '' + (params.has & bit ? '' : ''); } } } // Wrap de resultaten (per persoon) if (params.mobile) { if (resultHtml && (params.has & 127) > 0) // Anders geen -zichtbare- opties, dan ook geen controlgroup-wrapper { resultHtml = '
' + '
' + resultHtml + '
' + '
'; } } else { resultHtml = '
' + resultHtml + ' ' + safe.html(params.to_name) + '' + '
'; } return resultHtml; }, note_actions_html: function (actions) { if (!actions.length) return ""; var _single_action = function(action) { return "" + I(action.icon) + ""; } var not_in_submenu_list = ["edit"]; // Setting? var result = ""; for (x in actions) { if (inArray(actions[x].name, not_in_submenu_list)) { result += _single_action(actions[x]); actions.splice(x, 1); } } if (actions.length === 1) { result += _single_action(actions[0]); } else if (actions.length > 1) { var ddMenu = "
"; for (x in actions) { var action = actions[x]; ddMenu += "
" + I(action.icon) + safe.html(action.label) + "
"; } ddMenu += "
"; result += "" + I("fa-chevron-down") + ddMenu + ""; } return result; }, note_field: function (pkey, pnote_key, pmodule, params) { Response.write(""); /* Tables zijn zo 2020 */ var timestamp_notes = new Date(); var fac_note_group_key; var parent_key = -1; // == Verder met de nieuwe/bestaande notitie // In tegenstelling tot meldingen heeft mld_opdr_note geen flag veld. // Opdracht, factuur, contracten en objecten notes zijn dus altijd zichtbaar var note_oms = ""; if (pnote_key > -1) { // Bestaande net toegevoegde note voor re-edit: gegevens uit record gebruiken. sql = "SELECT " + params.tabel + "_note_omschrijving" + ( pmodule == 'MLD' || pmodule == 'OPDR' ? ", fac_note_group_key" : "" ) + ( pmodule == 'MLD' || pmodule == 'OPDR' ? ", " + params.tabel + "_note_parent_key parent_key" : "" ) + " FROM " + params.tabel + "_note" + " WHERE " + params.tabel + "_note_key = " + pnote_key; var oRs = Oracle.Execute(sql); note_oms = oRs(params.tabel + "_note_omschrijving").value; fac_note_group_key = ( pmodule == 'MLD' || pmodule == 'OPDR' ? oRs("fac_note_group_key").value : null ); if (pmodule == 'MLD' || pmodule == 'OPDR') parent_key = oRs("parent_key").value || -1; oRs.Close(); } // Voeg eventueel weer toe wat er voor de reload als gevolg van upload bijlage stond. note_oms = (params.tmp_note != "" ? params.tmp_note : note_oms); if (pmodule == 'MLD' && tracking) // Voor nu alleen voor MLD { var sql = "SELECT fac_srtnotificatie_code," + " MIN(fac_notificatie_receiver_email) fac_notificatie_receiver_email," + " COUNT(*) aantal," + " MIN(fac_notificatie_datum) fac_notificatie_datum," + " MIN(fac_notificatie_key) fac_notificatie_key" + " FROM fac_v_notifyqueue" + " WHERE BITAND(fac_notificatie_status, 2) = 2" // email + " AND fac_srtnotificatie_xmlnode = 'melding'" + " AND fac_notificatie_refkey = " + pkey + " GROUP BY fac_srtnotificatie_code" + " ORDER BY fac_notificatie_datum, " + " fac_notificatie_key" var oRs = Oracle.Execute(sql); while (!oRs.EOF) { var code = oRs("fac_srtnotificatie_code").Value; var aantal = oRs("aantal").Value; var email = oRs("fac_notificatie_receiver_email").Value; // Het volgende lijkt leuk maar MLDNOB heeft bijvoorbeeld geen lcl in status.inc omdat hij // wel wordt gebruikt voor notificatie maar nooit voor tracking //var srtnotitxt = "{1}".format(code, status.getsrtnotificatietext(code)); var srtnotitxt = code; Response.Write("
" + L("lcl_puo_willsendnoti").format(srtnotitxt, safe.html(email) + (aantal>1?L("lcl_puo_willsendnotimore").format(aantal-1):"")) + "
"); oRs.MoveNext(); } oRs.Close(); } // Response.Write("
" + L("lcl_puo_willsendnoti").format("test", safe.html("tst@facilitor.nl") + L("lcl_puo_willsendnotimore").format(3e54)) + "
"); if (params.showNote && (!("writeNote" in params) || params.writeNote)) { if (pnote_key < 0 && params.afgehandeld) { Response.Write("
" + L("lcl_" + pmodule.toLowerCase() + "_edit_note_completed") + "
"); } %>
"> <% if (pnote_key > -1 && parent_key > -1) { Response.Write(notes.inlineReplyNote(parent_key, (pmodule == "MLD" ? "M" : "O"), { "editmode": 1 })); } %> <% if (pnote_key > -1) { %>
" onClick="cancel_note_edit()" tabindex="0"><%=I("fa-times fa-2x", { fastyle: "fal", fa_fw: false })%>
<% } %>
<% // Voor MLD geldt het volgende: // Er zijn notes die voor iedereen (relevant) zichtbaar zijn en notes die alleen voor FOBO // zichtbaar zijn. Dat hangt af van mld_melding_note_flag. Die zichtbaarheid is hierboven geregeld. // // Dan kunnen er notes worden toegevoegd. Dat kan altijd en door iedereen (relevant) // alleen *niet* door de FE indien params.mld_fenotes==0 // dus wel door FOBO zelfs indien params.mld_fenotes==0 // dus wel door FE indien params.mld_fenotes>0 // Let op: fenotes is geen bitwise codering (meer), gewoon 0-3 if (pmodule == "MLD" || pmodule == "OPDR") { params.pkey = pkey; params.note_key = pnote_key; notes.note_toggles(pmodule, params); var pmod_obj = { "MLD": "melding", "OPDR": "opdracht" }; var selector_sql = "SELECT fac_note_group_key, fac_note_group_naam, fac_note_group_omschrijving" + " FROM fac_note_group" + " WHERE fac_note_group_xmlnode = " + safe.quoted_sql(pmod_obj[pmodule]) + " AND fac_note_group_vervaldatum IS NULL" + " ORDER BY fac_note_group_xmlnode, fac_note_group_volgnr"; var selector_oRs = Oracle.Execute(selector_sql); if (!selector_oRs.Eof) { %>
<% while(!selector_oRs.Eof) { %>
<% selector_oRs.MoveNext(); } %>
<% } selector_oRs.Close(); } %>
" onClick="note_submit()" tabindex="0"> <%=I("fa-paper-plane fa-1-5x", { fastyle: "fal", fa_fw: false })%>
<% IFACE.FORM_END(); %>
<% } }, inlineReplyNote: function (note_key, mod, params) { params = params || {}; var mod = mod || "O"; var tables = { "M": "mld_melding_note", "O": "mld_opdr_note" }; var note_table = tables[mod]; var result = ""; var class_postfix = (params.mobile ? "-m" : ""); if (note_key > -1) { var sql = "SELECT note." + note_table + "_omschrijving" + " , prs.prs_perslid_key" + " , prs.prs_perslid_naam_friendly" + " FROM prs_v_perslid_fullnames_all prs" + " , " + note_table + " note" + " WHERE note.prs_perslid_key = prs.prs_perslid_key" + " AND note." + note_table + "_key = " + note_key; var oRs = Oracle.Execute(sql); var parent_note_oms = oRs(note_table + "_omschrijving").Value; var parent_note_fullname_html = params.mobile ? safe.html(oRs("prs_perslid_naam_friendly").Value) : notes.fnPerslidNaamFull(oRs, true); oRs.Close(); var safe_parent_note_oms = safe.html(shared.stripbbcodes(parent_note_oms)); var author_html = "{0}".format(parent_note_fullname_html); var close_icon_html = params.editmode ? "" + I("fa-times", { fastyle: "fal" }) + "" : ""; var note_uid_prefix = (mod == "M" ? "1" : (mod == "O" ? "2" : "")); // Melding-notities worden met een '1' geprefixed, Opdr met een '2', overige modules (nog) niet var parent_note = "{2}".format(note_uid_prefix, note_key, safe_parent_note_oms); result = "
{0}{1}
{2}
".format(author_html, close_icon_html, parent_note); } return result; }, fnPerslidNaamFull: function (oRs, inReply) { if (!oRs("prs_perslid_key").Value) return ""; if (outputmode != 0) return safe.html(oRs("prs_perslid_naam_friendly").Value); if (oRs("prs_perslid_key").Value == user_key) { var html = "" if (inReply) { var html = "" + L("lcl_You") + ""; } else { /* Mijn eigen naam hoeft niet meer als mijn eigen tekst rechts staat. */ } } else { var html = "" + safe.html(oRs("prs_perslid_naam_friendly").Value) + ""; } return html; }, note_save: function (pkey, params) { var params = params || {}; if (params.note != "") { var note_key = params.note_key; var fields = [ { dbs: params.table + "_key", typ: "key", val: pkey }, { dbs: "prs_perslid_key", typ: "key", val: user_key }, { dbs: params.table + "_note_omschrijving", typ: "varchar", val: params.note, len: 4000 } ]; if (params.module === "MLD") // Opdracht- of Melding notitie { fields.push({ dbs: params.table + "_note_flag", typ: "number", val: params.flag }); fields.push({ dbs: "fac_note_group_key", typ: "number", val: (params.fac_note_group_key ? params.fac_note_group_key : null) }); if (params.note_parent_key > 0) fields.push({ dbs: params.table + "_note_parent_key", typ: "number", val: params.note_parent_key }); else if (note_key > -1) // Maak hem dan leeg fields.push({ dbs: params.table + "_note_parent_key", typ: "number", val: null }); } if (note_key > -1) { var sql = buildUpdate(params.table + "_note", fields) + " " + params.table + "_note_key = " + note_key + " AND prs_perslid_key = " + user_key; // Voorkom dat er een notitie van een ander aangepast wordt. Oracle.Execute(sql); } else { fields.push({ dbs: params.table + "_note_key", typ: "key", seq: params.module.toLowerCase() + "_s_" + params.table + "_note_key" }); var noteIns = buildInsert(params.table + "_note", fields, { noValidateToken: params.noValidateToken }); note_key = noteIns.sequences[params.table + "_note_key"]; Oracle.Execute(noteIns.sql); } if (params.module == "CNT") cnt.lock(pkey); } return note_key; }, show_note2: function (pmodule, pkey, pkenmerk_key, pthis_mod, pafgehandeld, pupload_url) { var tracking = getQParamInt("tracking", 1) == 1; // tracking erbij tonen? Onderdrukken met 0 var tmp_note = getQParam("tmp_note", ""); var parent_reload = getQParamInt("parent_reload", 0); var note_key = getQParamInt("note_key", -1); var verynew = getQParamInt("verynew", 0) == 1; // prefix 'fin' or 'cnt' or 'ins' var mod_prefix = pmodule.toLowerCase(); // table 'factuur' or 'contract' or 'deel' var mod_table = pmodule == "FIN" ? "factuur" : (pmodule == "CNT" ? "contract" : "deel"); // note_prefix 'fin_factuur' or 'cnt_contact' or 'ins_deel' var mod_table_prefix = mod_prefix + "_" + mod_table; %> <% FCLTHeader.Generate({outputmode: outputmode}); %> <% SUBFRAME_START(); var buttons = []; buttons.push({ icon: "fa-sync", title: L("lcl_refresh"), action: "FcltMgr.stopEdit(window);FcltMgr.reload()"}); buttons.push({ icon: "fa-print", title: L("lcl_print"), action: "doPrint(" + pkey + ", '" + mod_prefix + "')" }); if (pkenmerk_key != -1) buttons.push({ icon: "fa-folder-open", title: L("lcl_appendixes"), action: "Upload('" + pupload_url + "')" }); IFRAMER_HEADER(L("lcl_" + mod_prefix + "_behandeling"), buttons, { inhamburger: true }); BLOCK_START(mod_prefix + "Historie", (tracking? L("lcl_" + mod_prefix + "_behandeling") : L("lcl_" + mod_prefix + "_frame_notes")), { detailToggle: true, wide: true, nopadding: true, icon: "fa-clipboard-list-check" }); var params = { tabel: mod_table_prefix, tmp_note: tmp_note, showNote: pthis_mod.canReadNotes, afgehandeld: pafgehandeld } if (S("note_sort_ascending") == 0) { notes.note_field(pkey, note_key, pmodule, params); } var sql_n = "SELECT n." + mod_table_prefix + "_note_aanmaak" + " , n." + mod_table_prefix + "_note_key" + " , pf.prs_perslid_key" + " , pf.prs_perslid_naam_friendly" + " , n." + mod_table_prefix + "_note_omschrijving" + " , NULL fac_srtnotificatie_code" + " FROM " + mod_table_prefix + "_note n" + " , prs_v_perslid_fullnames_all pf" + " WHERE n.prs_perslid_key = pf.prs_perslid_key (+)" + " AND n." + mod_table_prefix + "_key = " + pkey; var sqls = [sql_n]; var sql_t = "SELECT tr.fac_tracking_datum" + " , tr.fac_tracking_key" + " , tr.prs_perslid_key" + " , pf.prs_perslid_naam_friendly" + " , tr.fac_tracking_oms" + " , str.fac_srtnotificatie_code" + " FROM fac_tracking tr" + " , fac_srtnotificatie str" + " , prs_v_perslid_fullnames_all pf" + " WHERE tr.fac_srtnotificatie_key = str.fac_srtnotificatie_key" + " AND tr.prs_perslid_key = pf.prs_perslid_key (+)" + " AND (tr.fac_tracking_refkey = " + pkey + " AND str.fac_srtnotificatie_xmlnode = '" + mod_table + "')"; sqls.push(sql_t); // var desc = (S("note_sort_ascending") == 0 ? " DESC " : ""); var sql = "SELECT * FROM (" + sqls.join(" UNION ") + ") ORDER BY 1" + (S("note_sort_ascending") == 0 ? " DESC " : "") + ", 2"; // ook bij gelijktijdigheid chronologisch var oRs = Oracle.Execute(sql); var lasttime = null; var lastuser = null; var firstrec = true; Response.Write("
"); while(!oRs.Eof) { var thisuser = oRs("prs_perslid_naam_friendly").Value; var prs_key = oRs("prs_perslid_key").Value; var thistime = new Date(oRs(mod_table_prefix + "_note_aanmaak").Value); var timestr = toTimeString(thistime); var srtnoti = oRs("fac_srtnotificatie_code").Value; var note_oms = oRs(mod_table_prefix + "_note_omschrijving").Value; var fullname_html = notes.fnPerslidNaamFull(oRs); var last_note_key = oRs(mod_table_prefix + "_note_key").Value; var notechange_url = mod_prefix + "_show_note2.asp?" + mod_prefix + "_key=" + pkey + "¬e_key=" + last_note_key + "&tracking=" + (tracking? 1 : 0); var note_wrapper_class = "note-wrapper"; var note_container_class = "note-container note-module-" + mod_prefix; oRs.MoveNext(); var newestIsNote = false; var newestIsSelfNote = false; if ((firstrec && S("note_sort_ascending") == 0) || // first in descending sort (oRs.Eof && S("note_sort_ascending") == 1)) // last in ascending sort { firstrec = false; newestIsNote = !srtnoti; newestIsSelfNote = newestIsNote && user.isCollega(prs_key); } if (prs_key == user_key) note_wrapper_class += " note-type-self"; // Bij user of dag switch altijd kopje. Ik zou graag systeemmeldingen niet als user-switch zien, // dus die bij het voorgaande kopje laten horen door die te skippen bij lastuser if (newestIsSelfNote && last_note_key == note_key) continue; // uit de while-loop var dedatum = toDateString(thistime, false, true); if (lasttime== null || (S("note_sort_ascending")? thistime.midnight() > lasttime.midnight() : thistime.midnight() < lasttime.midnight())) Response.Write("
{0}
".format(toDateString(thistime, false, true) )); var sameevent = (srtnoti && lastuser == thisuser && lasttime && Math.abs(thistime.getTime() - lasttime.getTime()) < 60000); lasttime = thistime; if (thisuser != null) lastuser = thisuser; // de laatste echte user var safehtml = ""; note_container_class += (srtnoti ? " note-type-tracking" : ""); if (note_oms) // Notitie of tracking met opgeslagen tekst { safehtml = safe.fclthtml(note_oms, true); var note_header_left = ""; if (!sameevent) { note_header_left += "{0}".format(fullname_html); note_header_left += "{1}".format(dedatum, timestr == "00:00" ? "" : (fullname_html != "" ? " - " : "") + timestr); } note_header_left = "{0}".format(note_header_left); var note_header_right = ""; if (newestIsSelfNote) note_header_right += "{2}".format(notechange_url, L("lcl_change"), I("fa-fclt-edit")); note_header_right = "{0}".format(note_header_right); var note_header = "
{0}{1}
".format(note_header_left, note_header_right); var autocollapse = (S("note_autocollapse") != "") && note_oms.match(new RegExp(S("note_autocollapse"))) && note_oms.split("\n").length > 2; var collapse_class = ""; if (!newestIsNote) { if (autocollapse) /* ingeklapt tot 2 regels */ collapse_class += " note-autocollapse"; else if (safehtml.length > S("rs_maxchar") * 5) /* ingeklapt tot 5 regels */ collapse_class += " note-collapsed"; } var toggler = ""; if (autocollapse || safehtml.length > S("rs_maxchar") * 5) toggler += "
{0}
".format(newestIsNote ? L("lcl_rs_truncate") : L("lcl_rs_truncated")); var note_text = "
{1}
{2}
".format(collapse_class, safehtml, toggler); /* Nu hebben we alles om de notitie te printen; */ Response.Write("
{2}{3}
".format(note_wrapper_class, note_container_class, note_header, note_text)); } else if (srtnoti) { safehtml = status.getsrtnotificatietext(srtnoti); // default tracking tekst var note_header = ""; if (!sameevent) { note_header += "{0}".format(fullname_html); note_header += "{1}".format(dedatum, timestr == "00:00" ? "" : (fullname_html != "" ? " - " : "") + timestr); } var note_text = "
{0}
".format(safehtml); if (srtnoti == pmodule + 'UPD') { var arr = safehtml.split("
"); arr.shift(); // Verwijder de tekst 'Factuur/Contract/Object xxx is gewijzigd' for (var i = 0; i < arr.length; i++) // Eerste woord tot ':' vet maken { arr[i] = arr[i].replace(/^([\w]+)\:/, "$1:") } safehtml = arr.join("
"); } /* Nu hebben we alles om de notitie te printen; */ Response.Write("
{2}{3}
".format(note_wrapper_class, note_container_class, note_header, note_text)); } // De MoveNext hebben we al eerder gehad } if (S("note_sort_ascending") == 0) Response.Write("
" + I("fa-chevron-up fa-2x") + "
"); Response.Write("
"); /* .notes-wrapper */ oRs.Close(); if (S("note_sort_ascending") != 0) { notes.note_field(pkey, note_key, pmodule, params); } BLOCK_END(); SUBFRAME_END(); %> <% } } %>