Bug 29311: Forbid editing biblio info when creating suggestion for biblio

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 <severine.queune@bulac.fr>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit d96393a52a)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>
(cherry picked from commit ca33ff04d6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit b7e86347e6)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
jeremy breuillard 2022-03-21 15:29:57 +01:00 committed by Arthur Suzuki
parent 5231d0dda4
commit 2b0eb34e8a
No known key found for this signature in database
GPG Key ID: 7558BEE2BEEEBCAA
2 changed files with 35 additions and 6 deletions

View File

@ -78,7 +78,10 @@
<fieldset class="rows">
<ol>
<li>
[% IF ( title_required ) %]
[% IF biblionumber %]
<label>Title:</label>
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]">[% title | html %]</a>
[% ELSIF ( title_required ) %]
<label for="title" class="required">Title:</label>
<input type="text" id="title" name="title" class="span6" maxlength="255" value="[% title | html %]" required="required" />
<span class="required">Required</span>
@ -89,7 +92,10 @@
</li>
[% UNLESS ( author_hidden ) %]
<li>
[% IF ( author_required ) %]
[% IF biblionumber %]
<label>Author:</label>
<span>[% author | html %]</span>
[% ELSIF ( author_required ) %]
<label for="author" class="required">Author:</label>
<input type="text" id="author" name="author" class="span6" maxlength="80" value="[% author | html %]" required="required" />
<span class="required">Required</span>
@ -115,7 +121,10 @@
[% END %]
[% UNLESS ( isbn_hidden )%]
<li>
[% IF ( isbn_required ) %]
[% IF biblionumber %]
<label>Standard number (ISBN, ISSN or other):</label>
<span>[% isbn | html %]</span>
[% ELSIF ( isbn_required ) %]
<label for="isbn" class="required">Standard number (ISBN, ISSN or other):</label>
<input type="text" id="isbn" name="isbn" maxlength="80" value="[% isbn | html %]" required="required" />
<span class="required">Required</span>
@ -127,7 +136,10 @@
[% END %]
[% UNLESS ( publishercode_hidden ) %]
<li>
[% IF ( publishercode_required ) %]
[% IF biblionumber %]
<label>Publisher:</label>
<span>[% publishercode | html %]</span>
[% ELSIF ( publishercode_required ) %]
<label for="publishercode" class="required">Publisher:</label>
<input type="text" id="publishercode" name="publishercode" class="span6" maxlength="80" value="[% publishercode | html %]" required="required" />
<span class="required">Required</span>
@ -139,7 +151,10 @@
[% END %]
[% UNLESS ( collectiontitle_hidden ) %]
<li>
[% IF ( collectiontitle_required ) %]
[% IF biblionumber %]
<label for="collectiontitle" class="required">Collection title:</label>
<span>[% collectiontitle | html %]</span>
[% ELSIF ( collectiontitle_required ) %]
<label for="collectiontitle" class="required">Collection title:</label>
<input type="text" id="collectiontitle" name="collectiontitle" class="span6" maxlength="80" value="[% collectiontitle | html %]" required="required" />
<span class="required">Required</span>
@ -151,7 +166,10 @@
[% END %]
[% UNLESS ( place_hidden ) %]
<li>
[% IF ( place_required ) %]
[% IF biblionumber %]
<label for="place" class="required">Publication place:</label>
<span>[% place | html %]</span>
[% ELSIF ( place_required ) %]
<label for="place" class="required">Publication place:</label>
<input type="text" id="place" name="place" required="required" maxlength="80" value="[% place | html %]" />
<span class="required">Required</span>

View File

@ -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++;