From f4dd12b14da2b08105250f2556dd2794da166805 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=UTF-8 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 --- .../bootstrap/en/modules/opac-suggestions.tt | 38 +++++++++++++++---- opac/opac-suggestions.pl | 11 ++++++ 2 files changed, 41 insertions(+), 8 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 76bcf0b4e0..11ad867662 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt @@ -84,7 +84,10 @@ [% END %]
  • - [% IF ( title_required ) %] + [% IF biblionumber %] + + [% title | html %] + [% ELSIF ( title_required ) %]
    Required
    @@ -95,7 +98,10 @@
  • [% UNLESS ( author_hidden ) %]
  • - [% IF ( author_required ) %] + [% IF biblionumber %] + + [% author | html %] + [% ELSIF ( author_required ) %]
    Required
    @@ -108,21 +114,28 @@ [% UNLESS ( copyrightdate_hidden )%]
  • - [% IF ( copyrightdate_required ) %] + [% IF biblionumber %] + + [% copyrightdate | html %] + [% ELSIF ( copyrightdate_required ) %]
    Required
    + Copyright or publication year, for example: 2022 [% ELSE %] + Copyright or publication year, for example: 2022 [% END %] - Copyright or publication year, for example: 2022
  • [% END %] [% UNLESS ( isbn_hidden or Koha.Preference('OPACSuggestionAutoFill') ) %]
  • - [% IF ( isbn_required ) %] + [% IF biblionumber %] + + [% isbn | html %] + [% ELSIF ( isbn_required ) %]
    Required
    @@ -134,7 +147,10 @@ [% END %] [% UNLESS ( publishercode_hidden ) %]
  • - [% IF ( publishercode_required ) %] + [% IF biblionumber %] + + [% publishercode | html %] + [% ELSIF ( publishercode_required ) %]
    Required
    @@ -146,7 +162,10 @@ [% END %] [% UNLESS ( collectiontitle_hidden ) %]
  • - [% IF ( collectiontitle_required ) %] + [% IF biblionumber %] + + [% collectiontitle | html %] + [% ELSIF ( collectiontitle_required ) %]
    Required
    @@ -158,7 +177,10 @@ [% END %] [% UNLESS ( place_hidden ) %]
  • - [% IF ( place_required ) %] + [% IF biblionumber %] + + [% place | html %] + [% ELSIF ( place_required ) %]
    Required
    diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index dceae6c766..cdedea0aa6 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -199,6 +199,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.30.2