From fbbae0aa5b5f624408f9eafe4155c712604549dc Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Thu, 22 Jul 2021 17:06:34 -0600 Subject: [PATCH] Bug 28743 - block changes to biblio records shared with other libraries Content-Type: text/plain; charset="utf-8" With IndependentBranches block changes to biblio records shared with other libraries. Also removes the 'Replace record via z39.50'... button. --- cataloguing/addbiblio.pl | 14 +++++++++++++- .../prog/en/modules/cataloguing/addbiblio.tt | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 138fceab44..a10db97b20 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -742,12 +742,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +my $block_mod = 0; if ($biblionumber){ my $does_bib_exist = Koha::Biblios->find($biblionumber); if (!defined $does_bib_exist){ $biblionumber = undef; $template->param( bib_doesnt_exist => 1 ); } + else { + if ( C4::Context->only_my_library() ) { + my $items_rs = $does_bib_exist->items->search({ "homebranch" => { '!=' => C4::Context->userenv->{branch} } }); + if ( $items_rs->count ) { + $block_mod = 1; + } + } + } } if ($frameworkcode eq 'FA'){ @@ -838,6 +847,9 @@ if ($biblionumber) { my $sth = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?"); $sth->execute($biblionumber); ($biblioitemnumber) = $sth->fetchrow; + + # notify the template if we are blocking modifs + $template->param( block_mod => $block_mod ); } #------------------------------------------------------------------------------------- @@ -859,7 +871,7 @@ if ( $op eq "addbiblio" ) { if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { my $oldbibitemnum; if ( $is_a_modif ) { - ModBiblio( $record, $biblionumber, $frameworkcode ); + ModBiblio( $record, $biblionumber, $frameworkcode ) unless ($block_mod); } else { ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 00c6767d1a..f971f83b36 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -769,6 +769,18 @@ function PopupMARCFieldDoc(field) { [% END # /IF duplicatebiblionumber %] + + [% IF ( block_mod ) %] +
+

Shared record

+

This record is shared with other libraries. You will not be able to save any changes to this record.

+
+ + +
+
+ [% END # /IF block_mod %] + [% END # /UNLESS number %] [% IF ( done ) %] @@ -810,7 +822,9 @@ function PopupMARCFieldDoc(field) { [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] [% IF biblionumber %] + [% UNLESS block_mod %]
Replace record via Z39.50/SRU search
+ [% END %] [% ELSE %]
Z39.50/SRU search
[% END %] -- 2.25.1