Bugzilla – Attachment 166022 Details for
Bug 35929
Don't submit 'empty' changes to personal details in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35929: Don't record a change for empty fields submitted in patron form
Bug-35929-Dont-record-a-change-for-empty-fields-su.patch (text/plain), 2.85 KB, created by
Nick Clemens (kidclamp)
on 2024-05-01 18:27:12 UTC
(
hide
)
Description:
Bug 35929: Don't record a change for empty fields submitted in patron form
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-05-01 18:27:12 UTC
Size:
2.85 KB
patch
obsolete
>From 0717d424faba1887e003d44d731eef3a9f663ee2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 1 May 2024 18:19:42 +0000 >Subject: [PATCH] Bug 35929: Don't record a change for empty fields submitted > in patron form > >This is reminiscent of bug 36159 - when a field is submitted as empty, and null in the DB >we need to reject this as a change. I tried to copy the logic from that bug, as well as >deleting submitted changes for hidden fields (from html manipulation) > >This should be tested extensively. One note: If you submit a valid change request, then submit a second with no change the second will be ignored, but the first will remain. i.e. if you change your name from 'Nick' to 'Nack' - then realize your typo you cannot submit a new request to change it back untl the initial request is cleared > >To test: >1 - Play with PatronSelfModificationBorrowerUnwantedField and PatronSelfModificationMandatory field to have some fields set >2 - Add a patron attribute, or several, that are editable in the OPAC >3 - Try submitting a form with no changes, note a modification requets is submitted >4 - Approve the request >5 - Apply patch, restart all >6 - Try submitted a blank request, you are notified there were no changes >7 - Try to force an unwanted field via html modification >8 - No changes reported >9 - Confirm attributes changes are successful >10 - After a successful request, try submitting a blank request >11 - Note no changes are recorded, but the initial request is still active >--- > opac/opac-memberentry.pl | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 279417431d8..af8ee15e7e7 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -340,7 +340,7 @@ elsif ( $op eq 'cud-update' ) { > $borrower_changes{'changed_fields'} = join ',', keys %borrower_changes; > my $extended_attributes_changes = FilterUnchangedAttributes( $borrowernumber, $attributes ); > >- if ( %borrower_changes || scalar @{$extended_attributes_changes} > 0 ) { >+ if ( $borrower_changes{'changed_fields'} || scalar @{$extended_attributes_changes} > 0 ) { > ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "opac-memberentry-update-submitted.tt", >@@ -577,10 +577,8 @@ sub DelUnchangedFields { > > > foreach my $key ( keys %new_data ) { >- next if defined($new_data{$key}) xor defined($current_data->{$key}); >- if ( !defined($new_data{$key}) || $current_data->{$key} eq $new_data{$key} || $hidden_fields->{$key} ) { >- delete $new_data{$key}; >- } >+ next if ( ($new_data{$key} || $current_data->{$key}) && ( $new_data{$key} ne $current_data->{$key} ) && !($hidden_fields->{$key}) ); >+ delete $new_data{$key}; > } > > return %new_data; >-- >2.39.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 35929
:
166022
|
166023
|
167006
|
167007