Owen Leonard
24ffe470ff
This patch modifies an include file so that it is possible with edit a patron's image on any patron-related page which uses that include. To test you must have the patronimages system preference enabled. Apply the patch and open any patron record for viewing. - Hover the mouse over the patron image. - If the patron has a previously-defined patron image, should you see an "Edit" button appear. Clicking the button should display a modal dialog titled "Edit patron image." Test that the "Upload," "Delete," and "Cancel" buttons work correctly. - If a patron has no patron image defined, you should see an "Add" button appear. Clicking the button should display a modal dialog titled "Edit patron image." Test that the "Upload," "Delete," and "Cancel" buttons work correctly. This process should work from any page which shows the patron sidebar: Check out, Details, Fines, Routing lists, Circulation history, etc. Patch works as described. Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
142 lines
5.6 KiB
JavaScript
142 lines
5.6 KiB
JavaScript
/* global borrowernumber advsearch dateformat _ CAN_user_borrowers_edit_borrowers number_of_adult_categories destination */
|
|
|
|
$(document).ready(function(){
|
|
$("#filteraction_off, #filteraction_on").on('click', function(e) {
|
|
e.preventDefault();
|
|
$('#filters').toggle();
|
|
$('.filteraction').toggle();
|
|
if (typeof Sticky !== "undefined" && typeof hcSticky === "function") {
|
|
Sticky.hcSticky('update');
|
|
}
|
|
});
|
|
if( advsearch ){
|
|
$("#filteraction_on").toggle();
|
|
$("#filters").show();
|
|
} else {
|
|
$("#filteraction_off").toggle();
|
|
}
|
|
$("#searchfieldstype").change(function() {
|
|
var MSG_DATE_FORMAT = "";
|
|
if ( $(this).val() == 'dateofbirth' ) {
|
|
if( dateformat == 'us' ){
|
|
MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'MM/DD/YYYY'");
|
|
} else if( dateformat == 'iso' ){
|
|
MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'YYYY-MM-DD'");
|
|
} else if( dateformat == 'metric' ){
|
|
MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD/MM/YYYY'");
|
|
} else if( dateformat == 'dmydot' ){
|
|
MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD.MM.YYYY'");
|
|
}
|
|
$('#searchmember').attr("title", MSG_DATE_FORMAT).tooltip('show');
|
|
} else {
|
|
$('#searchmember').tooltip('destroy');
|
|
}
|
|
});
|
|
|
|
if( CAN_user_borrowers_edit_borrowers ){
|
|
$("#deletepatron").click(function(){
|
|
window.location='/cgi-bin/koha/members/deletemem.pl?member=' + borrowernumber;
|
|
});
|
|
$("#renewpatron").click(function(){
|
|
confirm_reregistration();
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#updatechild").click(function(e){
|
|
if( $(this).data("toggle") == "tooltip"){ // Disabled menu option has tooltip attribute
|
|
e.preventDefault();
|
|
} else {
|
|
update_child();
|
|
$(".btn-group").removeClass("open");
|
|
}
|
|
});
|
|
}
|
|
|
|
$("#updatechild, #patronflags, #renewpatron, #deletepatron, #exportbarcodes").tooltip();
|
|
$("#exportcheckins").click(function(){
|
|
export_barcodes();
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#printsummary").click(function(){
|
|
printx_window("page");
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#printslip").click(function(){
|
|
printx_window("slip");
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#printquickslip").click(function(){
|
|
printx_window("qslip");
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#print_overdues").click(function(){
|
|
window.open("/cgi-bin/koha/members/print_overdues.pl?borrowernumber=" + borrowernumber, "printwindow");
|
|
$(".btn-group").removeClass("open");
|
|
return false;
|
|
});
|
|
$("#printclearscreen").click(function(){
|
|
printx_window("slip");
|
|
window.location.replace("/cgi-bin/koha/circ/circulation.pl");
|
|
});
|
|
$("#searchtohold").click(function(){
|
|
searchToHold();
|
|
return false;
|
|
});
|
|
$("#select_patron_messages").on("change",function(){
|
|
$("#borrower_message").val( $(this).val() );
|
|
});
|
|
|
|
$(".edit-patronimage").on("click", function(e){
|
|
e.preventDefault();
|
|
var borrowernumber = $(this).data("borrowernumber");
|
|
$.get("/cgi-bin/koha/members/moremember.pl", { borrowernumber : borrowernumber }, function( data ){
|
|
var image_form = $(data).find("#picture-upload");
|
|
image_form.show().find(".cancel").remove();
|
|
$("#patronImageEdit .modal-body").html( image_form );
|
|
});
|
|
var modalTitle = $(this).attr("title");
|
|
$("#patronImageEdit .modal-title").text(modalTitle);
|
|
$("#patronImageEdit").modal("show");
|
|
});
|
|
});
|
|
|
|
function confirm_updatechild() {
|
|
var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category? This cannot be undone."));
|
|
if (is_confirmed) {
|
|
window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=' + borrowernumber;
|
|
}
|
|
}
|
|
|
|
function update_child() {
|
|
if( number_of_adult_categories > 1 ){
|
|
window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=' + borrowernumber,'UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
|
|
} else {
|
|
confirm_updatechild();
|
|
}
|
|
}
|
|
|
|
function confirm_reregistration() {
|
|
var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?"));
|
|
if (is_confirmed) {
|
|
window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=' + borrowernumber + '&destination=' + destination + '&reregistration=y';
|
|
}
|
|
}
|
|
function export_barcodes() {
|
|
window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=' + borrowernumber + '&op=export_barcodes');
|
|
}
|
|
var slip_re = /slip/;
|
|
function printx_window(print_type) {
|
|
var handler = print_type.match(slip_re) ? "printslip" : "summary-print";
|
|
window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=" + borrowernumber + "&print=" + print_type, "printwindow");
|
|
return false;
|
|
}
|
|
function searchToHold(){
|
|
var date = new Date();
|
|
date.setTime(date.getTime() + (10 * 60 * 1000));
|
|
$.cookie("holdfor", borrowernumber, { path: "/", expires: date });
|
|
location.href="/cgi-bin/koha/catalogue/search.pl";
|
|
}
|