Bugzilla – Attachment 148409 Details for
Bug 32748
Library limitations will cause data loss when editing items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32748: Prevent data erasing when editing item
Bug-32748-Prevent-data-erasing-when-editing-item.patch (text/plain), 2.43 KB, created by
Thibaud Guillot (thibaud_g)
on 2023-03-20 11:36:38 UTC
(
hide
)
Description:
Bug 32748: Prevent data erasing when editing item
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2023-03-20 11:36:38 UTC
Size:
2.43 KB
patch
obsolete
>From e45a836df3367e94c3c3f4c8e253252faa3eff8a Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Thu, 16 Mar 2023 10:24:42 +0100 >Subject: [PATCH] Bug 32748: Prevent data erasing when editing item > >When we set an authorised value linked to one library, >users who do not belong to this library do not get the >value and can therefore overwrite it. > >This patch add current value to the dropdown list even if it comes from an authorized value of another library. > >Test plan : > >1) Edit an item with one of these fields has an authorized value from >another library. >2) See that you don't get this value on 'edit' >3) Apply this patch >4) Refresh and do step 1 >5) Now you have the value in dropdown list >--- > Koha/UI/Form/Builder/Item.pm | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm >index 3a478ee05e..6ea855394e 100644 >--- a/Koha/UI/Form/Builder/Item.pm >+++ b/Koha/UI/Form/Builder/Item.pm >@@ -252,10 +252,20 @@ sub generate_subfield_form { > else { > push @authorised_values, qq{}; > my $av = GetAuthorisedValues( $subfield->{authorised_value} ); >+ my $current_value_av = Koha::AuthorisedValues->search({ authorised_value => $value })->next; >+ > for my $r (@$av) { > push @authorised_values, $r->{authorised_value}; > $authorised_lib{ $r->{authorised_value} } = $r->{lib}; > } >+ if ( defined $current_value_av ) { >+ my $current_av_code = $current_value_av->authorised_value; >+ my $current_av_lib = $current_value_av->lib; >+ if ( !grep { $_ eq $current_av_code } @authorised_values ) { >+ push @authorised_values, $current_av_code; >+ $authorised_lib{$current_av_code} = $current_av_lib; >+ } >+ } > } > > if ( $subfield->{hidden} > 4 or $subfield->{hidden} <= -4 ) { >@@ -572,7 +582,7 @@ sub edit_form { > prefill_with_default_values => $prefill_with_default_values, > branch_limit => $branch_limit, > default_branches_empty => $default_branches_empty, >- readonly => $readonly >+ readonly => $readonly, > } > ); > push @subfields, $subfield_data; >-- >2.25.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 32748
:
148409
|
148491
|
150155
|
151989
|
154039
|
154040
|
154041
|
154042