Bugzilla – Attachment 188585 Details for
Bug 40481
The items table on koha/opac-MARCdetail.pl does not honor OPACHiddenItems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40841: Add limits configuration UI
2c4d154.patch (text/plain), 7.45 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-10-29 18:06:12 UTC
(
hide
)
Description:
Bug 40841: Add limits configuration UI
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-10-29 18:06:12 UTC
Size:
7.45 KB
patch
obsolete
>From 2c4d154aa593d39dfa1c2e0a1c0e637047760b9f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Wed, 29 Oct 2025 10:01:27 -0300 >Subject: [PATCH] Bug 40841: Add limits configuration UI > >This patch adds branch limits selection to the Z30.50/SRU configuration >page. >--- > admin/z3950servers.pl | 37 ++++++++++++++----- > .../prog/en/modules/admin/z3950servers.tt | 32 +++++++++++++++- > 2 files changed, 59 insertions(+), 10 deletions(-) > >diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl >index 04d1f7310d6..b420e2e1144 100755 >--- a/admin/z3950servers.pl >+++ b/admin/z3950servers.pl >@@ -30,6 +30,7 @@ use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > use Koha::Database; > use Koha::Z3950Servers; >+use Try::Tiny qw( catch try ); > > # Initialize CGI, template, database > >@@ -67,18 +68,30 @@ if ( $op eq 'cud-delete_confirmed' && $id ) { > recordtype checked servername servertype sru_options sru_fields attributes > add_xslt/; > my $formdata = _form_data_hashref( $input, \@fields ); >+ my @branches = grep { $_ ne q{} } $input->multi_param('branches'); >+ > if ($id) { > my $server = Koha::Z3950Servers->find($id); > if ($server) { >- $server->set($formdata)->store; >- $template->param( msg_updated => 1, msg_add => $formdata->{servername} ); >+ try { >+ $server->set($formdata)->store; >+ $server->replace_library_limits( \@branches ); >+ $template->param( msg_updated => 1, msg_add => $formdata->{servername} ); >+ } catch { >+ $template->param( msg_error => 1, msg_add => $formdata->{servername} ); >+ }; > } else { > $template->param( msg_notfound => 1, msg_add => $id ); > } > $id = 0; > } else { >- Koha::Z3950Server->new($formdata)->store; >- $template->param( msg_added => 1, msg_add => $formdata->{servername} ); >+ try { >+ my $server = Koha::Z3950Server->new($formdata)->store; >+ $server->replace_library_limits( \@branches ); >+ $template->param( msg_added => 1, msg_add => $formdata->{servername} ); >+ } catch { >+ $template->param( msg_error => 1, msg_add => $formdata->{servername} ); >+ }; > } > } elsif ( $op eq 'search' ) { > >@@ -91,15 +104,21 @@ if ( $op eq 'cud-delete_confirmed' && $id ) { > my $data = []; > if ( $op eq 'add' || $op eq 'edit' ) { > $data = ServerSearch( $schema, $id, $searchfield ) if $searchfield || $id; >- delete $data->[0]->{id} if @$data && $op eq 'add'; #cloning record >+ my $server = $data ? $data->next : undef; >+ if ( $server && $op eq 'add' ) { >+ >+ # Cloning record - remove id >+ $server = $server->unblessed; >+ delete $server->{id}; >+ } > $template->param( >- add_form => 1, server => @$data ? $data->[0] : undef, >- op => $op, type => $op eq 'add' ? lc $type : '' >+ add_form => 1, server => $server, >+ op => $op, type => $op eq 'add' ? lc $type : '' > ); > } else { > $data = ServerSearch( $schema, $id, $searchfield ); > $template->param( >- loop => \@$data, searchfield => $searchfield, id => $id, >+ loop => $data, searchfield => $searchfield, id => $id, > op => 'list' > ); > } >@@ -112,7 +131,7 @@ sub ServerSearch { #find server(s) by id or name > > return Koha::Z3950Servers->search( > $id ? { id => $id } : { servername => { like => $searchstring . '%' } }, >- )->unblessed; >+ ); > } > > sub _form_data_hashref { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index ef73637f27d..ce57b3df422 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -2,6 +2,7 @@ > [% USE Koha %] > [% USE Asset %] > [% USE HtmlTags %] >+[% USE Branches %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >@@ -198,6 +199,13 @@ > <input type="text" name="add_xslt" id="add_xslt" size="100" value="[% server.add_xslt | html %]" /> > <div class="hint">Separate multiple filenames by commas.</div> > </li> >+ <li> >+ <label for="library_limitation">Library limitation: </label> >+ <select id="library_limitation" name="branches" multiple size="10"> >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => server.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] >+ </select> >+ <div class="hint">Limits the use of this server to the selected libraries.</div> >+ </li> > </ol> > </fieldset> > >@@ -220,7 +228,7 @@ > <thead > ><tr > ><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th >- ><th class="no-export no-sort">Actions</th> >+ ><th>Library limitations</th><th class="no-export no-sort">Actions</th> > </tr></thead > > > <tbody> >@@ -237,6 +245,28 @@ > [% END %] > </td> > <td>[% loo.attributes | html %]</td> >+ <td> >+ [% SET library_limits = loo.library_limits %] >+ [% IF library_limits && library_limits.count > 0 %] >+ [% library_str = "" %] >+ [% FOREACH library IN library_limits %] >+ [%- IF loop.first -%] >+ [% library_str = library.branchname _ " (" _ library.branchcode _ ")" %] >+ [% ELSE %] >+ [% library_str = library_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %] >+ [% END %] >+ [% END %] >+ <span class="library_limitation" data-bs-toggle="tooltip" title="[% library_str | html %]"> >+ [% IF library_limits.count > 1 %] >+ <span>[% library_limits.count | html %] library limitations</span> >+ [% ELSE %] >+ <span>[% library_limits.count | html %] library limitation</span> >+ [% END %] >+ </span> >+ [% ELSE %] >+ <span>No limitation</span> >+ [% END %] >+ </td> > <td> > <div class="btn-group dropup"> > <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-bs-toggle="dropdown" href="#"> Actions </a> >-- >2.51.2
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 40481
:
188582
|
188583
|
188584
|
188585
|
188586