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>
This commit is contained in:
jeremy breuillard 2022-03-21 15:29:57 +01:00 committed by Lucas Gass
parent da2c777737
commit b7e86347e6
No known key found for this signature in database
GPG Key ID: 693EE0FF4CD08D78
2 changed files with 41 additions and 8 deletions

View File

@ -84,7 +84,10 @@
</li>
[% END %]
<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" />
<div class="required_label required">Required</div>
@ -95,7 +98,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" />
<div class="required_label required">Required</div>
@ -108,21 +114,28 @@
[% UNLESS ( copyrightdate_hidden )%]
<li>
<div title="Copyright or publication year, for example: 2022">
[% IF ( copyrightdate_required ) %]
[% IF biblionumber %]
<label>Publication year:</label>
<span>[% copyrightdate | html %]</span>
[% ELSIF ( copyrightdate_required ) %]
<label for="copyrightdate" class="required">Publication year:</label>
<input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" required="required" />
<div class="required_label required">Required</div>
<span class="hint">Copyright or publication year, for example: 2022</span>
[% ELSE %]
<label for="copyrightdate">Publication year:</label>
<input type="text" id="copyrightdate" name="copyrightdate" pattern="[12]\d{3}" size="10" maxlength="4" value="[% copyrightdate | html %]" />
<span class="hint">Copyright or publication year, for example: 2022</span>
[% END %]
<span class="hint">Copyright or publication year, for example: 2022</span>
</div>
</li>
[% END %]
[% UNLESS ( isbn_hidden or Koha.Preference('OPACSuggestionAutoFill') ) %]
<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" />
<div class="required_label required">Required</div>
@ -134,7 +147,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" />
<div class="required_label required">Required</div>
@ -146,7 +162,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" />
<div class="required_label required">Required</div>
@ -158,7 +177,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 %]" />
<div class="required_label required">Required</div>

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