Bug 38005: Pass opac_editable to search params when interface is OPAC

1. Create a patron attribute.
2. Check it as Mandatory.
3. Do NOT make it display or editable in the OPAC.
4. Go to OPAC self reg form
5. You will not see the attribute.
6. Submit the form and see the 500 error.
7. Apply patch, restart_all.
8. Try again, now you should be able to submit the OPAC form.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fbdd43a6a1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2024-09-25 21:17:22 +00:00
parent 718ecb5328
commit e198c2afde
1 changed files with 16 additions and 11 deletions

View File

@ -2208,17 +2208,22 @@ sub extended_attributes {
}
# Check globally mandatory types
my @required_attribute_types =
Koha::Patron::Attribute::Types->search(
{
mandatory => 1,
category_code => [ undef, $self->categorycode ],
'borrower_attribute_types_branches.b_branchcode' =>
undef,
},
{ join => 'borrower_attribute_types_branches' }
)->get_column('code');
for my $type ( @required_attribute_types ) {
my $interface = C4::Context->interface;
my $params = {
mandatory => 1,
category_code => [ undef, $self->categorycode ],
'borrower_attribute_types_branches.b_branchcode' => undef,
};
if ( $interface eq 'opac' ) {
$params->{opac_editable} = 1;
}
my @required_attribute_types = Koha::Patron::Attribute::Types->search(
$params,
{ join => 'borrower_attribute_types_branches' }
)->get_column('code');
for my $type (@required_attribute_types) {
Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw(
type => $type,
) if !$new_types->{$type};