Bugzilla – Attachment 139372 Details for
Bug 29144
Move branches.opac_info to AdditionalContents allowing multi language
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29144: Show html opac_info on opac-detail page
Bug-29144-Show-html-opacinfo-on-opac-detail-page.patch (text/plain), 10.18 KB, created by
Martin Renvoize (ashimema)
on 2022-08-18 12:54:44 UTC
(
hide
)
Description:
Bug 29144: Show html opac_info on opac-detail page
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-18 12:54:44 UTC
Size:
10.18 KB
patch
obsolete
>From d8a4c4b777d270cada1bd42cf7e846657ea939b3 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 3 Aug 2022 12:13:20 +0000 >Subject: [PATCH] Bug 29144: Show html opac_info on opac-detail page > >Note: This patch disables the API call (which is not really needed), >and still needs attention in a following patch. > >Test plan: >Add opac_info for two libraries and a branchurl for one of the two. >Select a biblio with an item having these two libraries as either >home or holding branch. >Toggle OpacLocationBranchToDisplay and check items table on opac >detail. Click on the library name. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bootstrap/en/modules/opac-detail.tt | 89 +++++++++++-------- > opac/opac-detail.pl | 13 ++- > 2 files changed, 66 insertions(+), 36 deletions(-) > >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 9eea246bad..90f10d0488 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1246,16 +1246,19 @@ > <link property="itemOffered" href="#record" /> > <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut"> > >- [% IF ( ITEM_RESULT.holding_branch.opac_info ) %] >- <a href="[% ITEM_RESULT.holding_branch.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.holding_branch.branchcode | html %]"> >- <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.holding_branch.branchname | html %] >+ [%# Show opac_info or branchurl from holding library %] >+ [% SET holding_library_name = ITEM_RESULT.branchname %] >+ [% SET holding_library_url = Branches.GetURL( ITEM_RESULT.holdingbranch ) %] >+ [% IF ( ITEM_RESULT.holding_library_info ) %] >+ <a href="[% holding_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.holding_library_info | html %]" data-name="[% holding_library_name | html %]"> >+ <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %] > </a> >- [% ELSIF ( ITEM_RESULT.holding_branch.branchurl ) %] >- <a href="[% ITEM_RESULT.branchurl | url %]"> >- [% ITEM_RESULT.holding_branch.branchname | html %] >+ [% ELSIF holding_library_url %] >+ <a href="[% holding_library_url | url %]"> >+ [% holding_library_name | html %] > </a> > [% ELSE %] >- <span>[% ITEM_RESULT.holding_branch.branchname | html %]</span> >+ <span>[% holding_library_name | html %]</span> > [% END %] > > [% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %] >@@ -1270,16 +1273,19 @@ > <link property="itemOffered" href="#record" /> > <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut"> > >- [% IF ( ITEM_RESULT.holding_branch.opac_info ) %] [%# FIXME Shouldn't this be home_branch instead of holding_branch? %] >- <a href="[% ITEM_RESULT.home_branch.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.home_branch.branchchode | html %]"> >- <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.home_branch.branchname | html %] >+ [%# Show opac_info or branchurl from home library %] >+ [% SET home_library_name = Branches.GetName( ITEM_RESULT.homebranch ) %] >+ [% SET home_library_url = Branches.GetURL( ITEM_RESULT.homebranch ) %] >+ [% IF ( ITEM_RESULT.home_library_info ) %] >+ <a href="[% home_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.home_library_info | html %]" data-name="[% home_library_name | html %]"> >+ <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %] > </a> >- [% ELSIF ( ITEM_RESULT.home_branch.branchurl ) %] >- <a href="[% ITEM_RESULT.home_branch.branchurl | url %]"> >- [% ITEM_RESULT.home_branch.branchname | html %] >+ [% ELSIF home_library_url %] >+ <a href="[% home_library_url | url %]"> >+ [% home_library_name | html %] > </a> > [% ELSE %] >- <span>[% ITEM_RESULT.home_branch.branchname | html %]</span> >+ <span>[% home_library_name | html %]</span> > [% END %] > > [% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %] >@@ -1997,29 +2003,42 @@ > > $(".library_info").on("click", function(e){ > e.preventDefault(); >- var branchcode = $(this).data("branchcode"); >+ var library_name = $(this).data("name"); >+ var opac_info = $(this).data("info"); > var url = $(this).attr("href"); >- $.ajax({ >- url: "/api/v1/public/libraries/" + branchcode, >- type: 'GET', >- dataType: 'json', >- success: function(result) { >- $("#libraryInfoModalLabel").html( result.name ); >- $("#libraryInfo").html( result.opac_info ); >- if( result.url ){ >- $("#libraryInfoLink").attr("href", result.url ); >- $("#libraryInfoLink").show(); >- } else { >- $("#libraryInfoLink").hide(); >- } >- $("#libraryInfoModal").modal("show"); >- }, >- error: function(xhr, status, error) { >- if( url ){ >- location.href = url; >- } >+ if( 1 ) { >+ $("#libraryInfoModalLabel").html( library_name ); >+ $("#libraryInfo").html( opac_info ); >+ if( url ){ >+ $("#libraryInfoLink").attr("href", url ); >+ $("#libraryInfoLink").show(); >+ } else { >+ $("#libraryInfoLink").hide(); > } >- }); >+ $("#libraryInfoModal").modal("show"); >+ } else { // FIXME Temporary disabled: see BZ 29144 >+ $.ajax({ >+ url: "/api/v1/public/libraries/" + branchcode, >+ type: 'GET', >+ dataType: 'json', >+ success: function(result) { >+ $("#libraryInfoModalLabel").html( result.name ); >+ $("#libraryInfo").html( opac_info ); >+ if( result.url ){ >+ $("#libraryInfoLink").attr("href", result.url ); >+ $("#libraryInfoLink").show(); >+ } else { >+ $("#libraryInfoLink").hide(); >+ } >+ $("#libraryInfoModal").modal("show"); >+ }, >+ error: function(xhr, status, error) { >+ if( url ){ >+ location.href = url; >+ } >+ } >+ }); >+ } > }); > $("#libraryInfoModal").on("hide.bs.modal", function(){ > $("#libraryInfoModalLabel, #libraryInfo").html(""); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 1c5e7949ab..7f972c5a93 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -627,11 +627,12 @@ if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { > > # XSLT processing of some stuff > my $variables = {}; >+my $lang = C4::Languages::getlanguage(); > my @plugin_responses = Koha::Plugins->call( > 'opac_detail_xslt_variables', > { > biblio_id => $biblionumber, >- lang => C4::Languages::getlanguage(), >+ lang => $lang, > patron_id => $borrowernumber, > }, > ); >@@ -680,11 +681,21 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) { > ); > } > else { >+ my $library_info; > while ( my $item = $items->next ) { > my $item_info = $item->unblessed; > $item_info->{holds_count} = $item_reserves{ $item->itemnumber }; > $item_info->{priority} = $priority{ $item->itemnumber }; > >+ # Get opac_info from Additional contents for home and holding library >+ my ( $opac_info_home, $opac_info_holding ); >+ $opac_info_holding = $library_info->{ $item->holdingbranch } // $item->holding_branch->opac_info({ lang => $lang }); >+ $library_info->{ $item->holdingbranch } = $opac_info_holding; >+ $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info({ lang => $lang }); >+ $library_info->{ $item->homebranch } = $opac_info_home; >+ $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding; >+ $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; >+ > $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( > { item => $item, patron => $patron } ) > unless $allow_onshelf_holds; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29144
:
138473
|
138474
|
138527
|
138528
|
138599
|
138600
|
138601
|
138602
|
138603
|
138604
|
138605
|
138606
|
138607
|
138608
|
138609
|
139182
|
139183
|
139184
|
139185
|
139186
|
139187
|
139188
|
139189
|
139190
|
139191
|
139192
|
139197
|
139198
|
139199
|
139200
|
139201
|
139202
|
139203
|
139204
|
139205
|
139206
|
139207
|
139208
|
139366
|
139367
|
139368
|
139369
|
139370
|
139371
|
139372
|
139373
|
139374
|
139375
|
139376
|
139377
|
140020
|
140021
|
140022
|
140023
|
140024
|
140025
|
140026
|
140027
|
140028
|
140029
|
140030
|
140707