diff --git a/APPL/RES/res_list.inc b/APPL/RES/res_list.inc index 7123da2808..a48c6db903 100644 --- a/APPL/RES/res_list.inc +++ b/APPL/RES/res_list.inc @@ -662,6 +662,7 @@ function res_list (pautfunction, params) + ", rec2.res_rsv_ruimte_prijs" + ", rec2.dirtlevel" + ", rec2.res_rsv_ruimte_afgerond" + + ", rec2.approval" + ", rec2.waar" + ", MIN(rec2.datumvan) datumvan" + ", MAX(rec2.datumtot) datumtot" @@ -710,7 +711,8 @@ function res_list (pautfunction, params) + ", rec2.res_rsv_ruimte_key" + ", rec2.res_srtactiviteit_prefix" + ", rec2.verval" - + ", rec2.res_rsv_ruimte_afgerond"; + + ", rec2.res_rsv_ruimte_afgerond" + + ", rec2.approval"; if (fronto) { @@ -753,72 +755,97 @@ function res_list (pautfunction, params) } if (res_tobeapproved) { - approve_sql.push("rec2.res_rsv_ruimte_afgerond = 0" - +" AND ( (rec2.res_rsv_ruimte_prijs IS NOT NULL AND rec2.res_status_bo_key = 5)" - + " OR (rec2.res_rsv_ruimte_prijs IS NULL AND rec2.res_status_bo_key IS NULL))"); - } - if (res_notapproved) // deze kan weg!! - { - approve_sql.push("rec2.res_rsv_ruimte_afgerond = 0"); + switch (S("res_approval")) + { + case 0: // geen approval + break; + case 1: // goedkeuren na reserveringdatum + approve_sql.push("rec2.res_rsv_ruimte_afgerond = 0" + +" AND (rec2.datumtot < TRUNC(SYSDATE, 'DD'))"); + break; + case 2: // goedkeuren na afmelden + approve_sql.push("rec2.res_rsv_ruimte_afgerond = 0" + +" AND ( (rec2.res_rsv_ruimte_prijs IS NOT NULL AND rec2.res_status_bo_key = 5)" + + " OR (rec2.res_rsv_ruimte_prijs IS NULL AND rec2.res_status_bo_key IS NULL))"); + break; + } } var sqlinside = "WITH " + thePerslid + "," + theResrsv + " " + sqlR + " UNION ALL " + sqlDe + " UNION ALL " + sqlA; // Indien verschillende dirtlevels bij dirty reservering, neem dan het maximum om dubbele regels te voorkomen // Geld hier alleen voor fronto en frontend - sqlinside = " SELECT res_reservering_key" - + ", res_reservering_ispool" - + ", res_rsv_ruimte_key" - + ", descr" - + ", res_status_bo_key" - + ", res_status_fo_key" - + ", res_rsv_ruimte_flag" - + ", res_rsv_ruimte_prijs" - + ", MAX(dirtlevel) dirtlevel" - + ", res_rsv_ruimte_afgerond" - + ", waar" - + ", datumvan" - + ", datumtot" - + ", contact" - + ", gastheer" - + ", res_rsv_ruimte_contact_key" - + ", res_rsv_ruimte_host_key" - + ", restype" - + ", bezoekers" - + ", res_rsv_ruimte_verwijder" - + ", prs_afdeling_key" - + ", remark" - + ", res_rsv_ruimte_volgnr" - + ", res_srtactiviteit_prefix" - + ", CASE" - + " WHEN (res_ruimte_vervaldatum IS NULL OR res_ruimte_vervaldatum > datumtot)" - + " THEN 1" - + " ELSE 0" - + " END verval" - + " FROM (" + sqlinside + ")" - + " GROUP BY res_reservering_key" - + ", res_reservering_ispool" - + ", res_rsv_ruimte_key" - + ", descr" - + ", res_status_bo_key" - + ", res_status_fo_key" - + ", res_rsv_ruimte_flag" - + ", res_rsv_ruimte_prijs" - + ", waar" - + ", datumvan" - + ", datumtot" - + ", contact" - + ", gastheer" - + ", res_rsv_ruimte_contact_key" - + ", res_rsv_ruimte_host_key" - + ", restype" - + ", bezoekers" - + ", res_rsv_ruimte_verwijder" - + ", prs_afdeling_key" - + ", remark" - + ", res_rsv_ruimte_volgnr" - + ", res_srtactiviteit_prefix" - + ", res_ruimte_vervaldatum" - + ", res_rsv_ruimte_afgerond"; + var sql_rec2 = " SELECT res_reservering_key" + + ", res_reservering_ispool" + + ", res_rsv_ruimte_key" + + ", descr" + + ", res_status_bo_key" + + ", res_status_fo_key" + + ", res_rsv_ruimte_flag" + + ", res_rsv_ruimte_prijs" + + ", MAX(dirtlevel) dirtlevel" + + ", res_rsv_ruimte_afgerond" + + ", waar" + + ", datumvan" + + ", datumtot" + + ", contact" + + ", gastheer" + + ", res_rsv_ruimte_contact_key" + + ", res_rsv_ruimte_host_key" + + ", restype" + + ", bezoekers" + + ", res_rsv_ruimte_verwijder" + + ", prs_afdeling_key" + + ", remark" + + ", res_rsv_ruimte_volgnr" + + ", res_srtactiviteit_prefix" + + ", CASE" + + " WHEN (res_ruimte_vervaldatum IS NULL OR res_ruimte_vervaldatum > datumtot)" + + " THEN 1" + + " ELSE 0" + + " END verval" + + ", CASE" + + " WHEN res_rsv_ruimte_afgerond = 0"; + + switch (S("res_approval")) + { + case 0: // niets aan toevoegen + break; + case 1: sql_rec2 += " AND (datumtot < TRUNC(SYSDATE, 'DD'))"; + break; + case 2: sql_rec2 += " AND ( (res_rsv_ruimte_prijs IS NOT NULL AND res_status_bo_key = 5)" + + " OR (res_rsv_ruimte_prijs IS NULL AND res_status_bo_key IS NULL)" + + " )"; + break; + }; + + sql_rec2 += " THEN 1" + + " ELSE 0" + + " END approval" + + " FROM (" + sqlinside + ")" + + " GROUP BY res_reservering_key" + + ", res_reservering_ispool" + + ", res_rsv_ruimte_key" + + ", descr" + + ", res_status_bo_key" + + ", res_status_fo_key" + + ", res_rsv_ruimte_flag" + + ", res_rsv_ruimte_prijs" + + ", waar" + + ", datumvan" + + ", datumtot" + + ", contact" + + ", gastheer" + + ", res_rsv_ruimte_contact_key" + + ", res_rsv_ruimte_host_key" + + ", restype" + + ", bezoekers" + + ", res_rsv_ruimte_verwijder" + + ", prs_afdeling_key" + + ", remark" + + ", res_rsv_ruimte_volgnr" + + ", res_srtactiviteit_prefix" + + ", res_ruimte_vervaldatum" + + ", res_rsv_ruimte_afgerond"; // Voeg laatste tracking datum toe sqltrack = ", (SELECT MAX(t.fac_tracking_datum)" @@ -829,7 +856,7 @@ function res_list (pautfunction, params) + " AND sn.fac_srtnotificatie_xmlnode = 'reservering') recentdatum"; sql = "SELECT " + sql_select + sqltrack - + " FROM (" + sqlinside + ") rec2" + + " FROM (" + sql_rec2 + ") rec2" + " WHERE 1=1 " + (!res_key && approve_sql.length > 0 ? " AND (" + approve_sql.join(" OR ") + ")" : "") @@ -1007,7 +1034,7 @@ function res_list (pautfunction, params) rst.addColumn(new Column({caption: L("lcl_res_requestor"), content: fncolHostRequestor, combine: (S("res_allow_for_others")?true:false)})); rst.addColumn(new Column({caption: L("lcl_descr"), content: "descr"})); if (S("res_approval") > 0) - rst.addColumn(new Column({caption: L("lcl_res_approved"), content: fncolResApproved})); + rst.addColumn(new Column({caption: L("lcl_res_approval"), content: fncolResApproved})); // Acties rst.addAction({ action: "resEdit", caption: L("lcl_edit"), isDefault: true}); @@ -2180,7 +2207,23 @@ function res_list (pautfunction, params) function fncolResApproved(oRs) { - return oRs("res_rsv_ruimte_afgerond").Value == 1? L("lcl_Yes") : "" + var approved_txt = ""; + if (oRs("res_rsv_ruimte_afgerond").Value == 1) + { + approved_txt = L("lcl_res_resappr"); + } + else + { + if (frontend) + { + if (oRs("approval").Value == 1) + approved_txt = L("lcl_res_tobeapproved"); + //else 'nog niet goed te keuren' + } + else + approved_txt = L("lcl_res_notapproved"); + } + return approved_txt; } /*************************************************************************** @@ -2250,7 +2293,7 @@ function res_list (pautfunction, params) if (outputmode != 0) rst.addColumn(new Column({caption: L("lcl_activity"), content: "res_activiteit_omschrijving"})); if (S("res_approval") > 0) - rst.addColumn(new Column({caption: L("lcl_res_approved"), content: fncolResApproved})); + rst.addColumn(new Column({caption: L("lcl_res_approval"), content: fncolResApproved})); // Acties rst.addAction({action: "resEdit", caption: L("lcl_edit"), isDefault: true}); diff --git a/APPL/RES/res_search.asp b/APPL/RES/res_search.asp index ca8f00158b..3863cf327f 100644 --- a/APPL/RES/res_search.asp +++ b/APPL/RES/res_search.asp @@ -132,9 +132,9 @@ var res_closed = (getFParamInt("res_closed", (minfo? 1 : 0)) == 1); // Standaard if (!res_open && !res_closed) res_open = true; -var res_approved = getFParamInt("res_approved", 1); // Standaard aangevinkt. +var res_approved = getFParamInt("res_approved", (frontend?0:1)); // Standaard aangevinkt (frontend uit). var res_notapproved = getFParamInt("res_notapproved", 1); // Standaard aangevinkt. -var res_tobeapproved = getFParamInt("res_tobeapproved", 1); // Standaard aangevinkt. +var res_tobeapproved = getFParamInt("res_tobeapproved", (frontend?0:1)); // Standaard aangevinkt (frontend uit). // minimaal één van beiden moet aangekruist zijn if (!res_approved && !res_notapproved) res_approved = true; @@ -669,20 +669,20 @@ var authparams = user.checkAutorisation(autfunction); { %> > - + <% } if (frontend) { %> > - + <% } if (backo || minfo || frontend) { %> > - + <% } %>