From 2b0eb34e8a7cebf98efad77675c6451a37b85ba4 Mon Sep 17 00:00:00 2001 From: jeremy breuillard Date: Mon, 21 Mar 2022 15:29:57 +0100 Subject: [PATCH] Bug 29311: Forbid editing biblio info when creating suggestion for biblio MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When creating a suggestion for an existing biblio, biblio info like title or author should not be editable. Test plan: 1. Enable system preference 'suggestion' 2. Log in at OPAC 3. Go to a biblio record detail page 4. Click 'suggest for purchase' 5. Notice that all fields can be modified (title, author, ...) 6. Apply patch 7. Repeat steps 2 and 3 or refresh the page 8. Verify that the biblio fields cannot be modified now. The only fields that should be editable are: quantity, item type, library, reason for suggestion, and notes Signed-off-by: Séverine QUEUNE Signed-off-by: Laura Escamilla Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit d96393a52ab047939c97b5b5b496f2ed85f58893) Signed-off-by: Jacob O'Mara (cherry picked from commit ca33ff04d66cf26b4030504f632dbce74841250e) Signed-off-by: Lucas Gass (cherry picked from commit b7e86347e6194a869c17a136eac1e5045dc3fa8d) Signed-off-by: Arthur Suzuki --- .../bootstrap/en/modules/opac-suggestions.tt | 30 +++++++++++++++---- opac/opac-suggestions.pl | 11 +++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt index b65e00c984..a507974603 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -78,7 +78,10 @@
  1. - [% IF ( title_required ) %] + [% IF biblionumber %] + + [% title | html %] + [% ELSIF ( title_required ) %] Required @@ -89,7 +92,10 @@
  2. [% UNLESS ( author_hidden ) %]
  3. - [% IF ( author_required ) %] + [% IF biblionumber %] + + [% author | html %] + [% ELSIF ( author_required ) %] Required @@ -115,7 +121,10 @@ [% END %] [% UNLESS ( isbn_hidden )%]
  4. - [% IF ( isbn_required ) %] + [% IF biblionumber %] + + [% isbn | html %] + [% ELSIF ( isbn_required ) %] Required @@ -127,7 +136,10 @@ [% END %] [% UNLESS ( publishercode_hidden ) %]
  5. - [% IF ( publishercode_required ) %] + [% IF biblionumber %] + + [% publishercode | html %] + [% ELSIF ( publishercode_required ) %] Required @@ -139,7 +151,10 @@ [% END %] [% UNLESS ( collectiontitle_hidden ) %]
  6. - [% IF ( collectiontitle_required ) %] + [% IF biblionumber %] + + [% collectiontitle | html %] + [% ELSIF ( collectiontitle_required ) %] Required @@ -151,7 +166,10 @@ [% END %] [% UNLESS ( place_hidden ) %]
  7. - [% IF ( place_required ) %] + [% IF biblionumber %] + + [% place | html %] + [% ELSIF ( place_required ) %] Required diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 8f99595f1f..a0209b5ac5 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -192,6 +192,17 @@ if ( $op eq "add_confirm" ) { $suggestion->{suggesteddate} = dt_from_string; $suggestion->{branchcode} = $input->param('branchcode') || C4::Context->userenv->{"branch"}; $suggestion->{STATUS} = 'ASKED'; + if ( $biblionumber ) { + my $biblio = Koha::Biblios->find($biblionumber); + $suggestion->{biblionumber} = $biblio->biblionumber; + $suggestion->{title} = $biblio->title; + $suggestion->{author} = $biblio->author; + $suggestion->{copyrightdate} = $biblio->copyrightdate; + $suggestion->{isbn} = $biblio->biblioitem->isbn; + $suggestion->{publishercode} = $biblio->biblioitem->publishercode; + $suggestion->{collectiontitle} = $biblio->biblioitem->collectiontitle; + $suggestion->{place} = $biblio->biblioitem->place; + } &NewSuggestion($suggestion); $patrons_pending_suggestions_count++; -- 2.39.5