Bugzilla – Attachment 188472 Details for
Bug 28846
MarcRecordFromNewSuggestion needs mapping to biblioitems.itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28846: Check if biblioitems.itemtype mapping exists before using itemtypes in suggestions
Bug-28846-Check-if-biblioitemsitemtype-mapping-exi.patch (text/plain), 4.18 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-10-27 11:33:35 UTC
(
hide
)
Description:
Bug 28846: Check if biblioitems.itemtype mapping exists before using itemtypes in suggestions
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-10-27 11:33:35 UTC
Size:
4.18 KB
patch
obsolete
>From aefdfccec77328aad996ae7c614d3e0be23f4b0d Mon Sep 17 00:00:00 2001 >From: Koha User <support@biblibre.com> >Date: Mon, 20 Oct 2025 16:04:40 +0200 >Subject: [PATCH] Bug 28846: Check if biblioitems.itemtype mapping exists > before using itemtypes in suggestions > >Test plan: >1 - Ensure you have no mappings on biblioitems.itemtype >2 - Create a suggestion -> there is a field "Document type" you get an error when submitting. >3 - Apply patch >4 - Create a suggestion -> there is no field anymore and you get no error >5 - Put back the mapping on biblioitems.itemtype and check the field "Document type" is still present suggestion form >--- > C4/Suggestions.pm | 10 ++++++---- > .../prog/en/modules/suggestion/suggestion.tt | 10 ++++++---- > suggestion/suggestion.pl | 5 +++++ > 3 files changed, 17 insertions(+), 8 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 07040b9d5..785f252d4 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -440,10 +440,12 @@ sub MarcRecordFromNewSuggestion { > } > > my ( $it_tag, $it_subfield ) = GetMarcFromKohaField('biblioitems.itemtype'); >- if ( $record->field($it_tag) ) { >- $record->field($it_tag)->add_subfields( $it_subfield => $suggestion->{itemtype} ); >- } else { >- $record->append_fields( MARC::Field->new( $it_tag, ' ', ' ', $it_subfield => $suggestion->{itemtype} ) ); >+ if ($it_tag) { >+ if ( $record->field($it_tag) ) { >+ $record->field($it_tag)->add_subfields( $it_subfield => $suggestion->{itemtype} ); >+ } else { >+ $record->append_fields( MARC::Field->new( $it_tag, ' ', ' ', $it_subfield => $suggestion->{itemtype} ) ); >+ } > } > > return $record; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 3c287e1e2..afbd72840 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -412,10 +412,12 @@ > <label for="collectiontitle">Collection title:</label> > <input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]" /> > </li> >- <li> >- <label for="itemtype">Document type:</label> >- [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=itemtype, empty=1 %] >- </li> >+ [% UNLESS hide_itemtype %] >+ <li> >+ <label for="itemtype">Document type:</label> >+ [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size=20, default=itemtype, empty=1 %] >+ </li> >+ [% END %] > [% IF patron_reason_loop %] > <li> > <label for="patronreason">Reason for suggestion: </label> >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 249ae1843..21fc6de27 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -24,6 +24,7 @@ use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ); > use C4::Suggestions; > use C4::Koha qw( GetAuthorisedValues ); >+use C4::Biblio qw( GetMarcFromKohaField ); > use C4::Budgets qw( GetBudget GetBudgets GetBudgetHierarchy CanUserUseBudget ); > use C4::Search qw( FindDuplicate GetDistinctValues ); > use C4::Members; >@@ -285,6 +286,10 @@ if ( $op =~ /cud-save/ ) { > } elsif ( $op eq 'add_form' ) { > > #Adds suggestion >+ my ( $it_tag, $it_subfield ) = GetMarcFromKohaField('biblioitems.itemtype'); >+ unless ($it_tag) { >+ $template->param( hide_itemtype => 1 ); >+ } > Init($suggestion_ref); > $op = 'save'; > } elsif ( $op eq 'edit_form' ) { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28846
: 188472