Bugzilla – Attachment 158089 Details for
Bug 35190
Additional_fields table should allow null values for authorised_value_category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35190: Adjust UI handling to avoid inserting an empty starting
Bug-35190-Adjust-UI-handling-to-avoid-inserting-an.patch (text/plain), 3.28 KB, created by
Emily Lamancusa (emlam)
on 2023-10-30 17:26:17 UTC
(
hide
)
Description:
Bug 35190: Adjust UI handling to avoid inserting an empty starting
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2023-10-30 17:26:17 UTC
Size:
3.28 KB
patch
obsolete
>From c8f0f6895e3c2e81b2ca796625a7290ec248d48c Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Mon, 30 Oct 2023 13:19:02 -0400 >Subject: [PATCH] Bug 35190: Adjust UI handling to avoid inserting an empty > starting > >To test: >1. In the Administration module, create an Additional Field that is > not linked to an authorized value >2. Create another Additional Field that is linked to an authorized > value >3. Access the database in the command line (koha-mysql kohadev) >4. Select all from additional_fields >5. Confirm that each field correctly lists either the appropriate > authorized value, or NULL >--- > admin/additional-fields.pl | 40 +++++++++++++++++++++----------------- > 1 file changed, 22 insertions(+), 18 deletions(-) > >diff --git a/admin/additional-fields.pl b/admin/additional-fields.pl >index 5e6b1e32d7..35dd1a97b1 100755 >--- a/admin/additional-fields.pl >+++ b/admin/additional-fields.pl >@@ -49,21 +49,23 @@ my @messages; > > if ( $op eq 'add' ) { > my $name = $input->param('name') // q{}; >- my $authorised_value_category = $input->param('authorised_value_category') // q{}; >+ my $authorised_value_category = $input->param('authorised_value_category'); > my $marcfield = $input->param('marcfield') // q{}; > my $marcfield_mode = $input->param('marcfield_mode') // 'get'; > my $searchable = $input->param('searchable') ? 1 : 0; > if ( $field_id and $name ) { >- my $updated = 0; >+ my $updated = 0; >+ my $set_fields = { >+ name => $name, >+ marcfield => $marcfield, >+ marcfield_mode => $marcfield_mode, >+ searchable => $searchable, >+ }; >+ $set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category; >+ > eval { > my $af = Koha::AdditionalFields->find($field_id); >- $af->set({ >- name => $name, >- authorised_value_category => $authorised_value_category, >- marcfield => $marcfield, >- marcfield_mode => $marcfield_mode, >- searchable => $searchable, >- }); >+ $af->set($set_fields); > $updated = $af->store ? 1 : 0; > }; > push @messages, { >@@ -71,16 +73,18 @@ if ( $op eq 'add' ) { > number => $updated, > }; > } elsif ( $name ) { >- my $inserted = 0; >+ my $inserted = 0; >+ my $set_fields = { >+ tablename => $tablename, >+ name => $name, >+ marcfield => $marcfield, >+ marcfield_mode => $marcfield_mode, >+ searchable => $searchable, >+ }; >+ $set_fields->{authorised_value_category} = $authorised_value_category if $authorised_value_category; >+ > eval { >- my $af = Koha::AdditionalField->new({ >- tablename => $tablename, >- name => $name, >- authorised_value_category => $authorised_value_category, >- marcfield => $marcfield, >- marcfield_mode => $marcfield_mode, >- searchable => $searchable, >- }); >+ my $af = Koha::AdditionalField->new($set_fields); > $inserted = $af->store ? 1 : 0; > }; > push @messages, { >-- >2.34.1
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 35190
:
158087
|
158088
|
158089
|
158090
|
158116
|
158117
|
158118
|
158203
|
158204
|
158205