From 8cd4dc9bb782dfec4fda2a4946635fffdf271e38 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 12 Oct 2015 09:34:41 +0100 Subject: [PATCH] Bug 14544: QA fixes - some minor bug fixes See comment 171 and 172 for more details. This patch mainly fixes typo or silly error in templates. It also uses the relationships added by previous patch to join the biblioitems and items tables (changes in opac-shelves.pl and shelves.pl). Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- Koha/Exceptions.pm | 2 +- .../prog/en/modules/catalogue/detail.tt | 2 +- .../prog/en/modules/virtualshelves/shelves.tt | 42 +++++++++++-------- .../bootstrap/en/modules/opac-detail.tt | 2 +- .../bootstrap/en/modules/opac-shareshelf.tt | 2 +- .../bootstrap/en/modules/opac-shelves.tt | 8 ++-- opac/opac-sendshelf.pl | 2 +- opac/opac-shelves.pl | 11 ++++- virtualshelves/shelves.pl | 11 ++++- 9 files changed, 53 insertions(+), 29 deletions(-) diff --git a/Koha/Exceptions.pm b/Koha/Exceptions.pm index 44092967cf..beef949973 100644 --- a/Koha/Exceptions.pm +++ b/Koha/Exceptions.pm @@ -15,7 +15,7 @@ use Exception::Class ( 'Koha::Exceptions::Virtualshelves::DuplicateObject' => { isa => 'Koha::Exceptions::DuplicateObject', - description => "poeut", + description => "Duplicate shelf object", }, 'Koha::Exceptions::Virtualshelves::InvalidInviteKey' => { isa => 'Koha::Exceptions::Exception', diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 681629a275..a83b6ba722 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -357,7 +357,7 @@ function verify_images() { [% IF ( XSLTDetailsDisplay ) %] [% XSLTBloc %] - [% IF shelves %] + [% IF shelves.count %] Lists that include this title: [% FOREACH s IN shelves %] [% s.shelfname %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 414342be2a..ffc12de77a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -564,24 +564,30 @@ function placeHold () { [% END %] - [% FOR permission IN ['allow_add', 'allow_delete_own', 'allow_delete_other'] %] -
  • - [% IF loop.first %] - - [% ELSE %] - - [% END %] - - [% SWITCH permission %] - [% CASE 'allow_add' %] anyone else to add entries. - [% CASE 'allow_delete_own' %] anyone to remove his own contributed entries. - [% CASE 'allow_delete_other' %] anyone to remove other contributed entries. - [% END %] -
  • - [% END %] +
  • + + +  anyone else to add entries. +
  • +
  • + + +  anyone to remove his own contributed entries. +
  • +
  • + + +  anyone to remove other contributed entries. +
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 65fc3bb5ec..410f795a4f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -390,7 +390,7 @@ [% END # / LibraryThingForLibrariesID %] - [% IF shelves %] + [% IF shelves.count %] List(s) this item appears in: [% FOREACH s IN shelves %] [% s.shelfname %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt index ac5a19bb02..c36168a7c4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt @@ -59,7 +59,7 @@
    - Cancel + Cancel
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 9ae89276ea..113c05604a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -22,8 +22,8 @@
  •  anyone to remove his own contributed entries.
  • @@ -168,7 +168,7 @@ Download list [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] - Send list + Send list [% END %] Print list @@ -521,7 +521,7 @@ [% END %] [% IF itemsloop && can_remove_biblios %] - + diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index 91ab4ada6a..fb7d532179 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -52,7 +52,7 @@ my $email = $query->param('email'); my $dbh = C4::Context->dbh; my $shelf = Koha::Virtualshelves->find( $shelfid ); -if ( $shelf->can_be_viewed( $borrowernumber ) ) { +if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { if ( $email ) { my $message = Koha::Email->new(); diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index e4e4eaa6d0..067eb10f15 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -222,7 +222,16 @@ if ( $op eq 'view' ) { $rows = C4::Context->preference('OPACnumSearchResults') || 20; $page = ( $query->param('page') ? $query->param('page') : 1 ); } - my $contents = $shelf->get_contents->search({}, { join => [ 'biblionumber' ], page => $page, rows => $rows, order_by => "$sortfield $direction", }); + my $order_by = $sortfield eq 'itemcallnumber' ? 'items.itemcallnumber' : $sortfield; + my $contents = $shelf->get_contents->search( + {}, + { + prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ], + page => $page, + rows => $rows, + order_by => "$order_by $direction", + } + ); # get biblionumbers stored in the cart my @cart_list; diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index a6328ce8ed..5a82e0b10e 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -201,7 +201,16 @@ if ( $op eq 'view' ) { $page = ( $query->param('page') ? $query->param('page') : 1 ); } - my $contents = $shelf->get_contents->search({}, { join => [ 'biblionumber' ], page => $page, rows => $rows, order_by => "$sortfield $direction", }); + my $order_by = $sortfield eq 'itemcallnumber' ? 'items.itemcallnumber' : $sortfield; + my $contents = $shelf->get_contents->search( + {}, + { + prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ], + page => $page, + rows => $rows, + order_by => "$order_by $direction", + } + ); my $borrower = GetMember( borrowernumber => $loggedinuser ); -- 2.20.1