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 <aleishaamohia@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
9fdd7603bf
commit
cc79085820
4 changed files with 46 additions and 25 deletions
|
@ -16,7 +16,7 @@
|
|||
"[% data.category_description |html %] ([% data.category_type |html %])",
|
||||
"dt_action":
|
||||
[%- IF selection_type == 'select' -%]
|
||||
"<a href=\"#\" style='cursor:pointer' onclick='select_user(\"[% data.borrowernumber %]\", [% To.json(data) | html %] );'>Select</a>"
|
||||
"<a class=\"btn btn-mini select_user\" href=\"#\" data-borrowernumber=\"[% data.borrowernumber %]\" data-borrowerdata=\"[% To.json(data) | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber %]\" name=\"borrower_data[% data.borrowernumber %]\" value=\"[% To.json(data) | html %]\" />"
|
||||
[%- ELSE -%]
|
||||
"<a href=\"#\" data-borrowernumber=\"[% data.borrowernumber %]\" data-firstname=\"[% data.firstname %]\" data-surname=\"[% data.surname %]\" class=\"btn btn-mini add_user\"><i class=\"fa fa-plus\"></i> Add</a>"
|
||||
[%- END -%]
|
||||
|
|
|
@ -54,10 +54,10 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
|
|||
if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
|
||||
var li = '<li id="user_' + borrowernumber + '">'
|
||||
+ '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
|
||||
+ borrowernumber + '">' + borrowername
|
||||
+ '</a> [<a style="cursor:pointer"'
|
||||
+ 'onclick="del_user(' + borrowernumber +')">Remove</a>]</li>';
|
||||
$(li).insertBefore("li#add_user_button");
|
||||
+ borrowernumber + '">' + borrowername + '</a> '
|
||||
+ ' • <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> '
|
||||
+ '</li>';
|
||||
$("#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);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
[% ELSIF op == 'list' %]
|
||||
|
@ -430,7 +453,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
|
|||
<!-- ********************************************************************************************** -->
|
||||
<!-- create add/mod entry form -->
|
||||
[% IF op == 'add_form' && !error_not_authorised_to_modify %]
|
||||
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
|
||||
<form action="/cgi-bin/koha/admin/aqbudgets.pl" id="edit_fund" name="Aform" method="post">
|
||||
<fieldset class="rows">
|
||||
<legend>[% 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")
|
|||
|
||||
<li>
|
||||
<span class="label">Owner: </span>
|
||||
<span id="budget_owner_name">
|
||||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
|
||||
[% budget_owner_name %]
|
||||
</a>
|
||||
</span>
|
||||
[% IF ( budget_owner_name ) %]
|
||||
<span id="budget_owner_name">
|
||||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
|
||||
[% budget_owner_name %]
|
||||
</a> |
|
||||
</span>
|
||||
[% END %]
|
||||
<a id="edit_owner" class="new_window" href="#"><i class="fa fa-search"></i> Select owner</a>
|
||||
<a id="remove_owner" href="#"><i class="fa fa-trash"></i> Remove owner</a>
|
||||
<input type="hidden" name="budget_owner_id" id="budget_owner_id"
|
||||
value="[% budget_owner_id %]" />
|
||||
|
||||
<input type="button" id="edit_owner" value="Edit owner"
|
||||
onclick="ownerPopup(); return false;" />
|
||||
<input type="button" id="remove_owner" value="Remove owner"
|
||||
onclick="ownerRemove(); return false;" />
|
||||
</li>
|
||||
|
||||
|
||||
[% IF budget_has_children %]
|
||||
<li class="radio">
|
||||
<label>
|
||||
|
@ -510,15 +533,13 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
|
|||
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
|
||||
[% user.firstname %] [% user.surname %]
|
||||
</a>
|
||||
[<a style="cursor:pointer"
|
||||
onclick="del_user([% user.borrowernumber %])">Remove</a>]
|
||||
• <a href="#" class="del_user" data-borrowernumber="[% user.borrowernumber %]"><i class="fa fa-trash"></i> Remove</a>
|
||||
</li>
|
||||
[% END %]
|
||||
<li id="add_user_button">
|
||||
<input type="button" onclick="userPopup()" value="Add users" />
|
||||
</li>
|
||||
<li><a href="#" id="add_user_button"><i class="fa fa-plus"></i> Add users</a></li>
|
||||
</ul>
|
||||
<input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="budget_branchcode">Library: </label>
|
||||
<select name="budget_branchcode" id="budget_branchcode">
|
||||
|
@ -611,7 +632,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
|
|||
</fieldset>
|
||||
|
||||
<fieldset class="action">
|
||||
<input type="submit" value="Submit" onclick="Check(this.form); return false;" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
|
||||
<input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
|
||||
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -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) );
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"dt_address":
|
||||
"[% INCLUDE escape_address data=data %]",
|
||||
"dt_action":
|
||||
"<a href=\"#\" class=\"btn btn-mini select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"guarantor_data[% data.borrowernumber %]\" name=\"guarantor_data\" value=\"[% To.json(data) | html %]\" />"
|
||||
"<a href=\"#\" class=\"btn btn-mini select_user\" data-borrowernumber=\"[% data.borrowernumber %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber %]\" name=\"borrower_data[% data.borrowernumber %]\" value=\"[% To.json(data) | html %]\" />"
|
||||
}[% UNLESS loop.last %],[% END %]
|
||||
[% END %]
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue