From b7e86347e6194a869c17a136eac1e5045dc3fa8d 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 --- .../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 47ff5eb5df..0d5f4a86d4 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 fcc95801aa..cc4e921a7b 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