From 5aeac737dd5ca38f762cd95c9e6c221ea950aabb Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 23 Jun 2022 17:29:26 +0000 Subject: [PATCH] Bug 31005: Don't inlcude attributes only required for other categories To test: 1 - Create a new patron attribute - check boxes to make it mandatory and visible etc. 2 - Limit it to 'Patron' or other category 3 - Edit a patron not in that category 4 - Attempt to save 5 - 500 Error 6 - Missing mandatory extended attribute (type=MAND) 7 - Apply patch 8 - Attempt aedit again 9 - It succeeds! 10 - Edit a patron in the category with MAND required 11 - on the edit page, right click teh attribute - click 'delete node' 12 - Submit the form 13 - 500 error, but this time that's good, the attribute check works --- Koha/Patron.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index e677f39e87..faa339a21a 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1708,8 +1708,9 @@ sub extended_attributes { Koha::Patron::Attribute::Types->search( { mandatory => 1, + category_code => [ undef, $self->categorycode ], 'borrower_attribute_types_branches.b_branchcode' => - undef + undef, }, { join => 'borrower_attribute_types_branches' } )->get_column('code'); -- 2.30.2