From 7884a00b7cf3f51f80f6b8eb96fb4dc5e86ee23f Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Sat, 30 Dec 2023 22:52:38 -0500 Subject: [PATCH 1/2] fix javascript calls to delete routes which currently don't work --- react/components/Events/ExistingEvent.tsx | 3 +-- src/skin/js/CRMJSOM.js | 4 ++-- src/skin/js/FamilyView.js | 5 +---- src/skin/js/GroupEditor.js | 3 +-- src/skin/js/users.js | 1 - src/v2/templates/cart/cartlisting.php | 2 +- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/react/components/Events/ExistingEvent.tsx b/react/components/Events/ExistingEvent.tsx index 62ea1a793a..593f3cd5d1 100644 --- a/react/components/Events/ExistingEvent.tsx +++ b/react/components/Events/ExistingEvent.tsx @@ -172,12 +172,11 @@ class ExistingEvent extends React.Component { delete() { fetch(CRMRoot + "/api/events/" + this.props.eventId, { credentials: "include", - method: "POST", + method: "DELETE", headers: { Accept: "application/json", "Content-Type": "application/json", }, - body: JSON.stringify({ _METHOD: "DELETE" }), }).then(() => this.exit()); } diff --git a/src/skin/js/CRMJSOM.js b/src/skin/js/CRMJSOM.js index 9cade00915..0b64c3c4ca 100644 --- a/src/skin/js/CRMJSOM.js +++ b/src/skin/js/CRMJSOM.js @@ -125,9 +125,9 @@ window.CRM.cart = { }, removePerson: function (Persons, callback) { window.CRM.APIRequest({ - method: "POST", + method: "DELETE", path: "cart/", - data: JSON.stringify({ _METHOD: "DELETE", Persons: Persons }), + data: JSON.stringify({ Persons: Persons }), }).done(function (data) { window.CRM.cart.refresh(); if (callback) { diff --git a/src/skin/js/FamilyView.js b/src/skin/js/FamilyView.js index 7327247889..fa71096f56 100644 --- a/src/skin/js/FamilyView.js +++ b/src/skin/js/FamilyView.js @@ -298,7 +298,7 @@ $(document).ready(function () { $("#deletePhoto").click(function () { $.ajax({ - type: "POST", + type: "DELETE", url: window.CRM.root + "/api/family/" + @@ -306,9 +306,6 @@ $(document).ready(function () { "/photo", encode: true, dataType: "json", - data: { - _METHOD: "DELETE", - }, }).done(function (data) { location.reload(); }); diff --git a/src/skin/js/GroupEditor.js b/src/skin/js/GroupEditor.js index 82e8468acd..b6d668fc71 100644 --- a/src/skin/js/GroupEditor.js +++ b/src/skin/js/GroupEditor.js @@ -109,11 +109,10 @@ $("document").ready(function () { $(document).on("click", ".deleteRole", function (e) { var roleID = e.currentTarget.id.split("-")[1]; $.ajax({ - method: "POST", + method: "DELETE", url: window.CRM.root + "/api/groups/" + groupID + "/roles/" + roleID, encode: true, - data: { _METHOD: "DELETE" }, dataType: "json", }).done(function (data) { dataT.clear(); diff --git a/src/skin/js/users.js b/src/skin/js/users.js index 36a68591a1..c29bd12cb6 100644 --- a/src/skin/js/users.js +++ b/src/skin/js/users.js @@ -30,7 +30,6 @@ function deleteUser(userId, userName) { window.CRM.APIRequest({ method: "DELETE", path: "user/" + userId + "/", - data: { _METHOD: "DELETE" }, }).done(function () { window.location.href = window.CRM.root + "/UserList.php"; }); diff --git a/src/v2/templates/cart/cartlisting.php b/src/v2/templates/cart/cartlisting.php index bede264876..aa03d7676d 100644 --- a/src/v2/templates/cart/cartlisting.php +++ b/src/v2/templates/cart/cartlisting.php @@ -33,7 +33,7 @@ getAddress() ?> getEmail() ?> - + getClassificationName() ?> getFamilyRoleName() ?> From e6c99c990db66cc033d0ef7fa4e6c4699bfbd0ac Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Sat, 30 Dec 2023 23:41:44 -0500 Subject: [PATCH 2/2] fix issue with Select Group and Role --- src/skin/js/CRMJSOM.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/skin/js/CRMJSOM.js b/src/skin/js/CRMJSOM.js index 0b64c3c4ca..cd4ae74af1 100644 --- a/src/skin/js/CRMJSOM.js +++ b/src/skin/js/CRMJSOM.js @@ -394,7 +394,7 @@ window.CRM.groups = { window.CRM.groups .getRoles(selectOptions.GroupID) .done(function (rdata) { - rolesList = $.map(rdata.ListOptions, function (item) { + rolesList = $.map(rdata, function (item) { var o = { text: i18next.t(item.OptionName), // to translate the Teacher and Student in localize text id: item.OptionId, @@ -426,7 +426,7 @@ window.CRM.groups = { bootbox.dialog(options).init(initFunction).show(); window.CRM.groups.get().done(function (rdata) { - groupsList = $.map(rdata.Groups, function (item) { + groupsList = $.map(rdata, function (item) { var o = { text: item.Name, id: item.Id, @@ -442,14 +442,14 @@ window.CRM.groups = { $groupSelect2.on("select2:select", function (e) { var targetGroupId = $( - "#targetGroupSelection option:selected", + "#targetGroupSelection option:selected" ).val(); $parent = $("#targetRoleSelection").parent(); $("#targetRoleSelection").empty(); window.CRM.groups .getRoles(targetGroupId) .done(function (rdata) { - rolesList = $.map(rdata.ListOptions, function (item) { + rolesList = $.map(rdata, function (item) { var o = { text: i18next.t(item.OptionName), // this is for the Teacher and Student role id: item.OptionId,