From cc790858206f5a8dac9ea5c79cdb0770c49d7752 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 15 Jun 2016 12:14:12 -0400 Subject: [PATCH] Bug 16752 - Remove the use of event attributes from some acquisitions templates - Funds This patch modifies the funds administration page and other files related to the process of searching for and selecting fund owners and users in order to remove the use of event attributes like 'onclick.' Also changed in this patch: I have revised the way the "select owner" and "select user" controls look. They are now links with Font Awesome icons. - Go to Administration -> Funds and open a fund for editing. - Test the process of adding and updating an owner: - Click the 'Select owner' link. - Search for and select an owner in the pop-up window. - Save the fund and verify that the owner was saved correctly. - Perform the same test with the 'Remove owner' link. - Use the same process to test the addition and removal of users. - Confirm that the 'Remove' link works correctly before and after submitting the form to save changes to the fund. This patch changes a file which is used by both the funds template and the template used when setting a guarantor on a patron. To test the changes in that context: - Open a 'child' type patron record. - Under 'Guarantor information,' test the process of setting and removing a guarantor to confirm that data is saved correctly. Signed-off-by: Aleisha Amohia Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../modules/acqui/tables/members_results.tt | 2 +- .../prog/en/modules/admin/aqbudgets.tt | 63 ++++++++++++------- .../prog/en/modules/common/patron_search.tt | 4 +- .../members/tables/guarantor_search.tt | 2 +- 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/tables/members_results.tt index 1bdd8eddee..ebe4612464 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/tables/members_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/tables/members_results.tt @@ -16,7 +16,7 @@ "[% data.category_description |html %] ([% data.category_type |html %])", "dt_action": [%- IF selection_type == 'select' -%] - "Select" + "Select" [%- ELSE -%] " Add" [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index 5f6b3eebbb..97e250c591 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -54,10 +54,10 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") if(borrowernumber && ids.indexOf(borrowernumber) == -1) { var li = '
  • ' + '' + borrowername - + ' [Remove]
  • '; - $(li).insertBefore("li#add_user_button"); + + borrowernumber + '">' + borrowername + ' ' + + ' • Remove ' + + ''; + $("#budget_users").prepend(li); ids.push(borrowernumber); $("#budget_users_id").val(ids.join(':')); } else { @@ -143,6 +143,29 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") alert(alertString2); } } + $(document).ready(function(){ + $("#remove_owner").on("click",function(e){ + e.preventDefault(); + ownerRemove(); + }); + $("#edit_owner").on("click",function(e){ + e.preventDefault(); + ownerPopup(); + }); + $("body").on("click",".del_user",function(e){ + e.preventDefault(); + var borrowernumber = $(this).data("borrowernumber"); + del_user(borrowernumber); + }); + $("#add_user_button").on("click",function(e){ + e.preventDefault(); + userPopup(); + }); + $("#edit_fund").on("submit",function(e){ + e.preventDefault(); + Check(this); + }); + }); //]]> [% ELSIF op == 'list' %] @@ -430,7 +453,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") [% IF op == 'add_form' && !error_not_authorised_to_modify %] -
    +
    [% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund [% IF ( budget_period_description ) %] @@ -478,20 +501,20 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
  • Owner: - - - [% budget_owner_name %] - - + [% IF ( budget_owner_name ) %] + + + [% budget_owner_name %] + | + + [% END %] + Select owner + Remove owner - - -
  • + [% IF budget_has_children %]
  • [% END %] -
  • - -
  • +
  • Add users
  • +
  • Cancel + Cancel
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt index 9af05109e3..4deed87515 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt @@ -112,8 +112,8 @@ $(document).ready(function(){ $("body").on("click",".select_user",function(e){ e.preventDefault(); var borrowernumber = $(this).data("borrowernumber"); - var guarantor_data = $("#guarantor_data"+borrowernumber).val(); - select_user( borrowernumber, JSON.parse(guarantor_data) ); + var borrower_data = $("#borrower_data"+borrowernumber).val(); + select_user( borrowernumber, JSON.parse(borrower_data) ); }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt index fee361b540..53f445b3b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt @@ -17,7 +17,7 @@ "dt_address": "[% INCLUDE escape_address data=data %]", "dt_action": - "Select" + "Select" }[% UNLESS loop.last %],[% END %] [% END %] ] -- 2.39.5