Bugzilla – Attachment 118599 Details for
Bug 27858
Make Koha::Patron::Attribute->store raise an exception on invalid type/code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27858: Make Koha::Patron::Attribute->store raise an exception on invalid type/code
Bug-27858-Make-KohaPatronAttribute-store-raise-an-.patch (text/plain), 1.46 KB, created by
Joonas Kylmälä
on 2021-03-22 14:00:13 UTC
(
hide
)
Description:
Bug 27858: Make Koha::Patron::Attribute->store raise an exception on invalid type/code
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-03-22 14:00:13 UTC
Size:
1.46 KB
patch
obsolete
>From 558147281371da446196a62a912123cd6fe3dac2 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 4 Mar 2021 08:24:54 -0300 >Subject: [PATCH] Bug 27858: Make Koha::Patron::Attribute->store raise an > exception on invalid type/code >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds type validation to the ->store method. And exception >should be thrown if the type is invalid. Things currently explode in >such situations, so this doesn't change the behavior (just adding more >informative failure information). > >To test: >1. Apply the previous patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Patron/Attribute.t >=> FAIL: No exception is thrown on the bad case, weird error >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! Exception thrown! >5. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > Koha/Patron/Attribute.pm | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm >index dc97aa8cc9..26fffeb788 100644 >--- a/Koha/Patron/Attribute.pm >+++ b/Koha/Patron/Attribute.pm >@@ -46,6 +46,9 @@ sub store { > > my $self = shift; > >+ Koha::Exceptions::Patron::Attribute::InvalidType->throw( type => $self->code ) >+ unless Koha::Patron::Attribute::Types->find( $self->code ); >+ > $self->_check_repeatable; > $self->check_unique_id; > >-- >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 27858
:
117678
|
117679
|
117680
|
117713
|
117714
|
117715
|
118465
|
118596
|
118597
|
118598
| 118599 |
118600