Bugzilla – Attachment 127000 Details for
Bug 27360
Libraries should be able to pick which branches display on the public 'Libraries' page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27360: Use 'public' to filter libraries for opac display
Bug-27360-Use-public-to-filter-libraries-for-opac-.patch (text/plain), 5.89 KB, created by
Martin Renvoize (ashimema)
on 2021-10-27 14:10:40 UTC
(
hide
)
Description:
Bug 27360: Use 'public' to filter libraries for opac display
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-27 14:10:40 UTC
Size:
5.89 KB
patch
obsolete
>From 57530afd68c7508c7b6abdfbcbe2437015e2578b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 27 Oct 2021 14:54:43 +0100 >Subject: [PATCH] Bug 27360: Use 'public' to filter libraries for opac display > >This patch adds the ability to set a library as 'public' or not; this >allows librarians to hide back office library branches from the opac. > >Test plan >1/ Set a library as public from `admin > libraries`. >2/ Navigate to the `Libraries` page in the OPAC >3/ Note that only `public` libraries are displayed. >--- > admin/branches.pl | 1 + > api/v1/swagger/definitions/library.json | 4 +++ > .../prog/en/modules/admin/branches.tt | 22 +++++++++++++++- > opac/opac-library.pl | 26 ++++++++++++------- > 4 files changed, 42 insertions(+), 11 deletions(-) > >diff --git a/admin/branches.pl b/admin/branches.pl >index 66b69868f0..88ff021c8c 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -84,6 +84,7 @@ if ( $op eq 'add_form' ) { > opac_info > marcorgcode > pickup_location >+ public > ); > my $is_a_modif = $input->param('is_a_modif'); > >diff --git a/api/v1/swagger/definitions/library.json b/api/v1/swagger/definitions/library.json >index def00d3c4f..2848a49a6d 100644 >--- a/api/v1/swagger/definitions/library.json >+++ b/api/v1/swagger/definitions/library.json >@@ -88,6 +88,10 @@ > "type": "boolean", > "description": "If the library can act as a pickup location" > }, >+ "public": { >+ "type": "boolean", >+ "description": "If the library is visible to the public" >+ }, > "smtp_server": { > "type": ["object", "null"], > "description": "The library effective SMTP server" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >index 6ce5842847..69ffdd74df 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >@@ -265,6 +265,17 @@ Libraries › Administration › Koha > [% END %] > </select> > </li> >+ <li><label for="public">Public: </label> >+ <select name="public" id="public"> >+ [% IF !library || library.public == 1 %] >+ <option value="1" selected="selected">Yes</option> >+ <option value="0">No</option> >+ [% ELSE %] >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ [% END %] >+ </select> >+ </li> > </ol> > </fieldset> > <fieldset class="action"> >@@ -301,6 +312,7 @@ Libraries › Administration › Koha > <th>MARC organization code</th> > <th>IP</th> > <th>Pickup location</th> >+ <th>Public</th> > <th>SMTP server</th> > <th data-class-name="actions noExport">Actions</th> > </tr> >@@ -339,7 +351,7 @@ Libraries › Administration › Koha > 'embed': [ 'smtp_server' ], > 'emptyTable': '<div class="dialog message">'+_("There are no libraries defined.")+' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">'+_("Start defining libraries")+'</a>.</div>', > "columnDefs": [ { >- "targets": [0,1,3,4,6,8,9,10,11,12,13,14,15], >+ "targets": [0,1,3,4,7,9,10,11,12,13,14,15,16], > "render": function (data, type, row, meta) { > if ( type == 'display' ) { > if ( data != null ) { >@@ -410,6 +422,14 @@ Libraries › Administration › Koha > return (data) ? _("Yes") : _("No"); > } > }, >+ { >+ "data": "public", >+ "searchable": true, >+ "orderable": true, >+ "render": function( data, type, row, meta ) { >+ return (data) ? _("Yes") : _("No"); >+ } >+ }, > { > "data": "smtp_server", > "render": function( data, type, row, meta ) { >diff --git a/opac/opac-library.pl b/opac/opac-library.pl >index 951d0b43ab..21e4142f6b 100755 >--- a/opac/opac-library.pl >+++ b/opac/opac-library.pl >@@ -17,7 +17,6 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >- > use Modern::Perl; > > use CGI qw ( -utf8 ); >@@ -27,7 +26,7 @@ use Koha::Libraries; > > my $query = CGI->new(); > >-my $branchcode = $query->param('branchcode'); >+my $branchcode = $query->param('branchcode'); > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { >@@ -38,15 +37,22 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >-if( $branchcode ){ >- my $library = Koha::Libraries->find( $branchcode ); >- $template->param( library => $library ); >+my $found; >+if ($branchcode) { >+ my $library = Koha::Libraries->find($branchcode); >+ if ( $library->public ) { >+ $found++; >+ $template->param( library => $library ); >+ } > } > >-my $libraries = Koha::Libraries->search( {}, { order_by => ['branchname'] }, ); >-$template->param( >- libraries => $libraries, >- branchcode => $branchcode, >-); >+unless ($found) { >+ my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } ); >+ >+ $template->param( >+ libraries => $libraries, >+ branchcode => $branchcode, >+ ); >+} > > output_html_with_http_headers $query, $cookie, $template->output; >-- >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 27360
:
126997
|
126998
|
126999
|
127000
|
127007
|
127008
|
127009
|
127011
|
127012
|
127013
|
127144
|
127145
|
127146
|
127147
|
127158
|
127159
|
127160
|
127161
|
127162
|
127163
|
127253
|
127629