@@ -, +, @@ printing on members account when viewing a patron's account with both values Reserve id: [% hold.reserve_id %] Title [% hold.biblio.title %] placing holds for patron --- Koha/Template/Plugin/Notices.pm | 39 +++++++++++++++ .../prog/css/src/staff-global.scss | 3 +- .../prog/en/includes/members-toolbar.inc | 13 +++-- .../prog/en/modules/circ/circulation.tt | 4 +- .../prog/en/modules/tools/letter.tt | 9 +++- .../intranet-tmpl/prog/js/members-menu.js | 47 ++++++------------- members/printslip.pl | 30 ++++++++---- tools/letter.pl | 3 ++ 8 files changed, 98 insertions(+), 50 deletions(-) create mode 100644 Koha/Template/Plugin/Notices.pm --- a/Koha/Template/Plugin/Notices.pm +++ a/Koha/Template/Plugin/Notices.pm @@ -0,0 +1,39 @@ +package Koha::Template::Plugin::Notices; + +# Copyright ByWater Solutions 2023 + +# 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 Template::Plugin; +use base qw( Template::Plugin ); + +use C4::Koha; +use C4::Context; +use Koha::Notice::Templates; + +sub GetTemplates { + my ( $self, $module ) = @_; + my $params = {}; + $params->{module} = $module if $module; + + my @letters = Koha::Notice::Templates->search($params)->as_list; + + return \@letters; +} + +1; --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2516,8 +2516,7 @@ td.bundle { } } -#printclearscreen, -#printclearscreenq { +.printclearscreen { position: absolute; right: 43px; top: 0; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -2,6 +2,7 @@ [% USE Koha %] [% USE Branches %] [% USE Categories %] +[% USE Notices %] [% USE AuthorisedValues %] [% USE scalar %]
@@ -21,16 +22,20 @@
[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -640,10 +640,10 @@ [% IF Koha.Preference('DisplayClearScreenButton') == 'issueslip' %] x - + [% ELSIF Koha.Preference('DisplayClearScreenButton') == 'issueqslip' %] x - + [% END %] [% IF (forceallow) %][% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -155,6 +155,7 @@
  • Interlibrary loans
  • Order acquisition
  • Patrons
  • +
  • Patrons toolbar (slip)
  • Serials (new issue)
  • Suggestions
  • Point of sale
  • @@ -211,7 +212,8 @@ [% CASE 'claimissues' %]Claim serial issue [% CASE 'reserves' %]Holds [% CASE 'ill' %]Interlibrary loans - [% CASE 'members' %]Patrons + [% CASE 'members' %]Patrons + [% CASE 'patron_slip' %]Patrons toolbar (slip) [% CASE 'serial' %]Serials (new issue) [% CASE 'suggestions' %]Suggestions [% CASE 'pos' %]Point of sale @@ -376,6 +378,11 @@ [% ELSE %] [% END %] + [% IF ( module == "patron_slip" ) %] + + [% ELSE %] + + [% END %] [% IF ( module == "serial" ) %] [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -41,38 +41,25 @@ $(document).ready(function(){ $(".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; }); - $("#printcheckinslip").click(function(){ - printx_window("checkinslip"); - $(".btn-group").removeClass("open"); - return false; - }); - $("#printclearscreen").click(function(){ - printx_window("slip"); - window.location.replace("/cgi-bin/koha/circ/circulation.pl"); - }); - $("#printclearscreenq").click(function(){ - printx_window("qslip"); - window.location.replace("/cgi-bin/koha/circ/circulation.pl"); + $(".printslip").click(function(){ + let slip_code = $(this).data('code'); + let clear_screen = $(this).data('clear'); + if( slip_code == 'printsummary' ){ + window.open("/cgi-bin/koha/members/summary-print.pl?borrowernumber=" + borrowernumber, "printwindow"); + } else { + window.open("/cgi-bin/koha/members/printslip.pl?borrowernumber=" + borrowernumber + "&print=" + slip_code, "printwindow"); + } + if( clear_screen ){ + window.location.replace("/cgi-bin/koha/circ/circulation.pl"); + } else { + $(".btn-group").removeClass("open"); + return false; + } }); $("#searchtohold").click(function(){ searchToHold(); @@ -151,12 +138,6 @@ function confirm_reregistration() { 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)); --- a/members/printslip.pl +++ a/members/printslip.pl @@ -66,7 +66,7 @@ my $patron = Koha::Patrons->find( $borrowernumber ); output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); my $branch=C4::Context->userenv->{'branch'}; -my ($slip, $is_html); +my ($letter, $slip, $is_html); if ( $print eq 'checkinslip' ) { my $checkinslip_branch = $session->param('branch') ? $session->param('branch') : $branch; @@ -76,7 +76,7 @@ if ( $print eq 'checkinslip' ) { old_issues => \@issue_ids, ); - my $letter = C4::Letters::GetPreparedLetter( + $letter = C4::Letters::GetPreparedLetter( module => 'circulation', letter_code => 'CHECKINSLIP', branchcode => $checkinslip_branch, @@ -89,14 +89,28 @@ if ( $print eq 'checkinslip' ) { message_transport_type => 'print' ); - $slip = $letter->{content}; - $is_html = $letter->{is_html}; - -} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) { - $slip = $letter->{content}; - $is_html = $letter->{is_html}; +} elsif ( $print eq 'issueslip' ){ + $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, 0); +} elsif ( $print eq 'issueqslip' ){ + $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, 1); +} else { + $letter = C4::Letters::GetPreparedLetter( + module => 'patron_slip', + letter_code => $print, + branchcode => $branch, + lang => $patron->lang, + tables => { + branches => $branch, + borrowers => $borrowernumber + }, + message_transport_type => 'print' + ); } +$slip = $letter->{content}; +$is_html = $letter->{is_html}; + + $template->param( slip => $slip, plain => !$is_html, --- a/tools/letter.pl +++ a/tools/letter.pl @@ -252,6 +252,9 @@ sub add_form { elsif ($module eq 'claimissues') { push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription', 'biblio', 'biblioitems'); } + elsif ($module eq 'patron_slip') { + push @{$field_selection}, add_fields('borrowers'); + } elsif ($module eq 'serial') { push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial'); } --