Bugzilla – Attachment 117947 Details for
Bug 27857
Koha::Patron->extended_attributes skips checks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27857: Make Koha::Patron->extended_attributes validate data
Bug-27857-Make-KohaPatron-extendedattributes-valid.patch (text/plain), 1.67 KB, created by
David Nind
on 2021-03-08 18:51:33 UTC
(
hide
)
Description:
Bug 27857: Make Koha::Patron->extended_attributes validate data
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-03-08 18:51:33 UTC
Size:
1.67 KB
patch
obsolete
>From e6e1d197d3b2a9acbc86861184e22c63908071cd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 4 Mar 2021 09:37:42 -0300 >Subject: [PATCH] Bug 27857: Make Koha::Patron->extended_attributes validate > data > >This patch makes the extended_attributes method use >Koha::Patron->add_extended_attribute inside the loop, instead of direct >DB access. This way, it takes advantage of the validation that is done >there. > >All happens inside a transaction, so if 'add_extended_attribute' throws >an exception, everything is rolled back. > >To test: >1. Apply the previous patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Patron.t >=> FAIL: The behavior is not the correct one, tests fail >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Patron.pm | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 8c1592c3f2..2d484beae7 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1562,14 +1562,7 @@ sub extended_attributes { > > # Insert the new ones > for my $attribute (@$attributes) { >- eval { >- $self->_result->create_related('borrower_attributes', $attribute); >- }; >- # FIXME We should: >- # 1 - Raise an exception >- # 2 - Execute in a transaction and don't save >- # or Insert anyway but display a message on the UI >- warn $@ if $@; >+ $self->add_extended_attribute($attribute); > } > } > ); >-- >2.11.0
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 27857
:
117709
|
117710
|
117711
|
117938
|
117945
|
117946
|
117947
|
117948
|
117953
|
117954
|
117955
|
117956
|
117957
|
119009
|
119038
|
119040
|
119443
|
119937
|
119938