Bugzilla – Attachment 192110 Details for
Bug 40220
API Incorrectly Requires Mandatory Extended Attributes Not Visible in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40220: Add x-koha-override option for behaving like OPAC when adding patrons via REST API
Bug-40220-Add-x-koha-override-option-for-behaving-.patch (text/plain), 2.79 KB, created by
Lucas Gass (lukeg)
on 2026-01-27 22:00:41 UTC
(
hide
)
Description:
Bug 40220: Add x-koha-override option for behaving like OPAC when adding patrons via REST API
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2026-01-27 22:00:41 UTC
Size:
2.79 KB
patch
obsolete
>From 7b2231b47b666045d0251a8cb0f0d04cf23c1ff1 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 27 Jan 2026 21:57:39 +0000 >Subject: [PATCH] Bug 40220: Add x-koha-override option for behaving like OPAC > when adding patrons via REST API > >--- > Koha/Patron.pm | 6 +++--- > Koha/REST/V1/Patrons.pm | 8 +++++--- > api/v1/swagger/paths/patrons.yaml | 1 + > 3 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index b174636cdd4..ed6e690576b 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1088,7 +1088,7 @@ sub set_password { > module => 'members', > letter_code => 'PASSWORD_CHANGE', > branchcode => $self_from_storage->branchcode, >- , >+ > lang => $self_from_storage->lang || 'default', > tables => { > 'branches' => $self_from_storage->branchcode, >@@ -2582,7 +2582,7 @@ Or setter FIXME > =cut > > sub extended_attributes { >- my ( $self, $attributes ) = @_; >+ my ( $self, $attributes, $options ) = @_; > > if ($attributes) { # setter > my %attribute_changes; >@@ -2674,7 +2674,7 @@ sub extended_attributes { > 'borrower_attribute_types_branches.b_branchcode' => undef, > }; > >- if ( $interface eq 'opac' ) { >+ if ( $interface eq 'opac' || $options->{act_as_opac} ) { > $params->{opac_editable} = 1; > } > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 05ae08688eb..9bd3b6b472c 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -122,10 +122,12 @@ sub add { > > my $patron = Koha::Patron->new_from_api($body)->store; > >- $patron->extended_attributes( >- [ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] ); >- > my $overrides = $c->stash('koha.overrides'); >+ >+ $patron->extended_attributes( >+ [ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ], >+ { act_as_opac => $overrides->{act_as_opac} } >+ ); > if ( $overrides->{welcome_yes} > || ( C4::Context->preference("AutoEmailNewUser") && !$overrides->{welcome_no} ) ) > { >diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml >index 6ec12ddedf6..95c8021e283 100644 >--- a/api/v1/swagger/paths/patrons.yaml >+++ b/api/v1/swagger/paths/patrons.yaml >@@ -435,6 +435,7 @@ > enum: > - welcome_yes > - welcome_no >+ - act_as_opac > collectionFormat: csv > consumes: > - application/json >-- >2.39.5
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 40220
:
183422
| 192110