From 43b04cd3be4670ca2bc2bc81e6c6cfda39949014 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 21 Mar 2022 17:26:12 +0100 Subject: [PATCH] Bug 6815: Don't make an AJAX request to generate the modal moremember-patronimage.pl|tt were not needed. Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers --- .../prog/en/includes/circ-menu.inc | 80 +++++++++++++++++- .../modules/members/moremember-patronimage.tt | 83 ------------------- .../intranet-tmpl/prog/js/members-menu.js | 15 +--- members/moremember-patronimage.pl | 59 ------------- 4 files changed, 81 insertions(+), 156 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt delete mode 100755 members/moremember-patronimage.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 5bc5fb1082..926008ed94 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -180,6 +180,7 @@ [% END %] +[% IF patronimages && CAN_user_tools_batch_upload_patron_images %] +[% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt deleted file mode 100644 index bbacd022d3..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-patronimage.tt +++ /dev/null @@ -1,83 +0,0 @@ -[% USE Koha %] - -[% IF ( Koha.Preference('patronimages') ) %] - [% IF ( CAN_user_tools_batch_upload_patron_images ) %] -
-
Upload patron photo
-
- [% IF ( patron.image ) %] -
- To update the image for [% patron.title | html %] [% patron.firstname | html %] [% patron.surname | html %], select a new image file and click 'Upload.'
Click the 'Delete' button to - remove the current image. -
- [% ELSE %] -
- [% patron.title | html %] [% patron.firstname | html %] [% patron.surname | html %] does not currently have an image available. To import an image for [% patron.title | html %] [% patron.firstname | html %] [% patron.surname | html %], enter the name of an image file to upload. -
- [% END %] -

Only PNG, GIF, JPEG, XPM formats are supported.

- - -
- - - - - - - [% IF ( patron.image ) %] - Delete - [% END %] -
-
-
-
-
Take patron photo
-
-
-
- -
-
- -
- -
- -
-
-
- -
- - - - - - - - - -
-
- - [% END %] -[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js index fb198bd1d7..1b4f31c48b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -99,19 +99,8 @@ $(document).ready(function(){ var borrowernumber = $(this).data("borrowernumber"); var cardnumber = $(this).data("cardnumber"); var modalTitle = $(this).attr("title"); - $.ajax({ - url: "/cgi-bin/koha/members/moremember-patronimage.pl", - type: "GET", - data: { borrowernumber: borrowernumber, cardnumber: cardnumber }, - success: function ( data ) { - $("#patronImageEdit .modal-body").html( data ); - $("#patronImageEdit .modal-title").text(modalTitle); - $("#patronImageEdit").modal("show"); - }, - error: function () { - location.href="/cgi-bin/koha/members/moremember-patronimage.pl?borrowernumber=" + borrowernumber; - } - }); + $("#patronImageEdit .modal-title").text(modalTitle); + $("#patronImageEdit").modal("show"); $("#patronImageEdit").on("hidden.bs.modal", function(){ /* Stop using the user's camera when modal is closed */ let viewfinder = document.getElementById("viewfinder"); diff --git a/members/moremember-patronimage.pl b/members/moremember-patronimage.pl deleted file mode 100755 index 93708981f3..0000000000 --- a/members/moremember-patronimage.pl +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2020 Mark Tompsett -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; -use CGI qw ( -utf8 ); -use C4::Auth qw( get_template_and_user ); -use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); -use Koha::Patrons; -use Koha::Token; - -my $input = CGI->new; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => 'members/moremember-patronimage.tt', - query => $input, - type => 'intranet', - flagsrequired => { borrowers => 'edit_borrowers' }, - } -); - -my $borrowernumber = $input->param('borrowernumber'); -my $cardnumber = $input->param('cardnumber'); -my $patron = Koha::Patrons->find($borrowernumber); -my $logged_in_user = Koha::Patrons->find($loggedinuser); - -$template->param( - csrf_token => Koha::Token->new->generate_csrf( - { session_id => $input->cookie('CGISESSID'), } - ), - patron => $patron, - logged_in_user => $logged_in_user, -); - -output_html_with_http_headers $input, $cookie, $template->output; - -__END__ - -=head1 moremember-patronimage.pl - - script to provide modal window for patron images - -=cut -- 2.39.5