From be54a1b29a51695c61745f8cfe7baa7a8da2054e Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 26 Jun 2017 23:31:17 +0000 Subject: [PATCH] Bug 17698: [FOLLOW-UP] Changing to Koha Objects style, adding circ sidebar Marcel, can you please have a look at this patch. I tried to implement the change my @notes = $schema->resultset('Issue')->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] }); to my @notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] }); but am having problems on the template side. I can access the item and biblio information about the issue, but not the borrower information, even though the query is definitely pulling it correctly. Any suggestions or ideas as to why this breaks? This patch also adds the implementation of the circSidebar. --- circ/branchoverdues.pl | 4 +++ circ/checkout-notes.pl | 8 +++-- circ/circulation.pl | 4 +++ circ/on-site_checkouts.pl | 4 ++- circ/renew.pl | 4 +++ circ/returns.pl | 4 +++ circ/selectbranchprinter.pl | 4 +++ circ/transferstoreceive.pl | 8 +++-- circ/view_holdsqueue.pl | 5 ++- circ/waitingreserves.pl | 5 +++ .../intranet-tmpl/prog/en/includes/circ-nav.inc | 3 ++ .../prog/en/modules/circ/checkout-notes.tt | 42 ++++++++++++++-------- 12 files changed, 74 insertions(+), 21 deletions(-) diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index 29aad88..2450971 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -28,6 +28,7 @@ use C4::Koha; use C4::Debug; use Koha::DateUtils; use Koha::BiblioFrameworks; +use Koha::Checkouts; use Data::Dumper; =head1 branchoverdues.pl @@ -99,10 +100,13 @@ foreach my $num (@getoverdues) { push( @overduesloop, \%overdueforbranch ); } +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; + # initiate the templates for the overdueloop $template->param( overduesloop => \@overduesloop, location => $location, + pending_checkout_notes => $pending_checkout_notes, ); # Checking if there is a Fast Cataloging Framework diff --git a/circ/checkout-notes.pl b/circ/checkout-notes.pl index ceb52c9..b0638f4 100755 --- a/circ/checkout-notes.pl +++ b/circ/checkout-notes.pl @@ -37,10 +37,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my $schema = Koha::Database->new()->schema(); -my @notes = $schema->resultset('Issue')->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] }); +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; +my @notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] }); + $template->param( - notes => \@notes, + pending_checkout_notes => $pending_checkout_notes, + notes => \@notes, ); my $action; diff --git a/circ/circulation.pl b/circ/circulation.pl index 5dc5d89..0713024 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -56,6 +56,7 @@ use Koha::Patron::Messages; use Koha::SearchEngine; use Koha::SearchEngine::Search; use Koha::Patron::Modifications; +use Koha::Checkouts; use Date::Calc qw( Today @@ -130,6 +131,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( } ); +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; +$template->param( pending_checkout_notes => $pending_checkout_notes ); + my $force_allow_issue = $query->param('forceallow') || 0; if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force_checkout' } )) { $force_allow_issue = 0; diff --git a/circ/on-site_checkouts.pl b/circ/on-site_checkouts.pl index aac5e79..bcf78cc 100755 --- a/circ/on-site_checkouts.pl +++ b/circ/on-site_checkouts.pl @@ -23,6 +23,7 @@ use C4::Circulation qw( GetPendingOnSiteCheckouts ); use C4::Output; use C4::Koha; use Koha::BiblioFrameworks; +use Koha::Checkouts; my $cgi = new CGI; @@ -39,11 +40,12 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( # Checking if there is a Fast Cataloging Framework $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); - +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; my $pending_onsite_checkouts = C4::Circulation::GetPendingOnSiteCheckouts(); $template->param( pending_onsite_checkouts => $pending_onsite_checkouts, + pending_onsite_notes => $pending_onsite_notes, ); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/circ/renew.pl b/circ/renew.pl index 246c266..01c37cd 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -28,6 +28,7 @@ use C4::Koha; use Koha::DateUtils; use Koha::Database; use Koha::BiblioFrameworks; +use Koha::Checkouts; my $cgi = new CGI; @@ -121,4 +122,7 @@ if ($barcode) { # Checking if there is a Fast Cataloging Framework $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; +$template->param( pending_checkout_notes => $pending_checkout_notes ); + output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/circ/returns.pl b/circ/returns.pl index 247a71e..b9de065 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -53,6 +53,7 @@ use Koha::BiblioFrameworks; use Koha::Holds; use Koha::Items; use Koha::Patrons; +use Koha::Checkouts; my $query = new CGI; @@ -630,6 +631,8 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { push @riloop, \%ri; } +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; + $template->param( riloop => \@riloop, printer => $printer, @@ -640,6 +643,7 @@ $template->param( forgivemanualholdsexpire => $forgivemanualholdsexpire, overduecharges => $overduecharges, AudioAlerts => C4::Context->preference("AudioAlerts"), + pending_checkout_notes => $pending_checkout_notes, ); $itemnumber = GetItemnumberFromBarcode( $barcode ); diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index 8099a38..aa7d8cc 100755 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -28,6 +28,7 @@ use C4::Print; # GetPrinters use C4::Koha; use Koha::BiblioFrameworks; use Koha::Libraries; +use Koha::Checkouts; # this will be the script that chooses branch and printer settings.... @@ -127,11 +128,14 @@ if (scalar @updated and not scalar @recycle_loop) { print $query->redirect($referer || '/cgi-bin/koha/circ/circulation.pl'); } +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; + $template->param( referer => $referer, printerloop => \@printerloop, branch => $branch, recycle_loop=> \@recycle_loop, + pending_checkout_notes => $pending_checkout_notes, ); # Checking if there is a Fast Cataloging Framework diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 0929ed3..229a125 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -41,6 +41,7 @@ use Koha::Libraries; use Koha::DateUtils; use Koha::BiblioFrameworks; use Koha::Patrons; +use Koha::Checkouts; my $input = new CGI; my $itemnumber = $input->param('itemnumber'); @@ -132,11 +133,14 @@ while ( my $library = $libraries->next ) { push( @branchesloop, \%branchloop ) if %branchloop; } +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; + $template->param( branchesloop => \@branchesloop, show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), - TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'), - latetransfers => $latetransfers ? 1 : 0, + TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'), + latetransfers => $latetransfers ? 1 : 0, + pending_checkout_notes => $pending_checkout_notes, ); # Checking if there is a Fast Cataloging Framework diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl index 3d8649a..fc7fe80 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -31,7 +31,7 @@ use C4::Biblio; use C4::Items; use C4::HoldsQueue qw(GetHoldsQueueItems); use Koha::BiblioFrameworks; - +use Koha::Checkouts; use Koha::ItemTypes; my $query = new CGI; @@ -62,6 +62,9 @@ if ( $run_report ) { ); } +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; +$template->param( pending_checkout_notes => $pending_checkout_notes ); + # Checking if there is a Fast Cataloging Framework $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 332c5dd..5ec1bb7 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -40,6 +40,7 @@ use Koha::BiblioFrameworks; use Koha::Items; use Koha::ItemTypes; use Koha::Patrons; +use Koha::Checkouts; my $input = new CGI; @@ -154,6 +155,9 @@ while ( my $hold = $holds->next ) { } $template->param(cancel_result => \@cancel_result) if @cancel_result; + +my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; + $template->param( reserveloop => \@reservloop, reservecount => $reservcount, @@ -162,6 +166,7 @@ $template->param( show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), ReservesMaxPickUpDelay => $max_pickup_delay, tab => $tab, + pending_checkout_notes => $pending_checkout_notes, ); # Checking if there is a Fast Cataloging Framework diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc index 844926c..b4ac72c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc @@ -33,6 +33,9 @@ [% IF ( fast_cataloging ) %][% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
  • Fast cataloging
  • [% END %][% END %] + [% IF Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes %] +
  • Checkout notes [% IF pending_checkout_notes %][% pending_checkout_notes %][% END %]
  • + [% END %]
    Circulation reports
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt index 2fb1ec8..aa44abe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt @@ -83,9 +83,10 @@ Checkout notes -
    +[% IF Koha.Preference('CircSidebar') %]
    [% ELSE %]
    [% END %]
    + [% IF Koha.Preference('CircSidebar') %]
    [% END %]

    Checkout notes

    @@ -127,20 +128,24 @@ [% FOREACH note IN notes %] - [% note.item.biblionumber.title %] - [% note.item.biblionumber.author %] (
    [% note.item.barcode %]) + [% note.item.biblio.title %] - [% note.item.biblio.author %] ([% note.item.barcode %]) [% note.note %] [% note.notedate | $KohaDates %] - [% note.borrower.firstname %] [% note.borrower.surname %] ([% note.borrower.cardnumber %]) - [% IF ( note.noteseen == 0 ) %] - Not seen - [% ELSIF ( note.noteseen == 1 ) %] - Seen - [% END %] - [% IF ( note.noteseen == 1 ) %] - - [% ELSIF ( note.noteseen == 0 ) %] - - [% END %] + [% IF note.borrower.title %][% note.borrower.title [% END %][% note.borrower.firstname %] [% note.borrower.surname %] ([% note.borrower.cardnumber %]) + + [% IF ( note.noteseen == 0 ) %] + Not seen + [% ELSIF ( note.noteseen == 1 ) %] + Seen + [% END %] + + + [% IF ( note.noteseen == 1 ) %] + + [% ELSIF ( note.noteseen == 0 ) %] + + [% END %] + [% END %] @@ -157,7 +162,16 @@ [% END %] -
    +
    + + [% IF Koha.Preference('CircSidebar') %] +
    + +
    + [% INCLUDE 'circ-nav.inc' %] +
    + [% END %] +
    -- 2.1.4