View | Details | Raw Unified | Return to bug 40082
Collapse All | Expand All

(-)a/Koha/REST/V1/Patrons.pm (+12 lines)
Lines 108-113 sub add { Link Here
108
108
109
                my $extended_attributes = delete $body->{extended_attributes} // [];
109
                my $extended_attributes = delete $body->{extended_attributes} // [];
110
110
111
                my $confirm_not_duplicate = $c->req->headers->header('x-confirm-not-duplicate');
112
                if ( !$confirm_not_duplicate ) {
113
                    my $match_result =
114
                        Koha::Patrons->check_for_existing_matches( Koha::Patron->new_from_api($body)->unblessed );
115
                    if ( $match_result->{duplicate_found} ) {
116
                        return $c->render(
117
                            status  => 409,
118
                            openapi => { error => 'A patron record matching these details already exists' }
119
                        );
120
                    }
121
                }
122
111
                my $patron = Koha::Patron->new_from_api($body)->store;
123
                my $patron = Koha::Patron->new_from_api($body)->store;
112
124
113
                my $overrides = $c->stash('koha.overrides');
125
                my $overrides = $c->stash('koha.overrides');
(-)a/api/v1/swagger/paths/patrons.yaml (-1 / +1 lines)
Lines 413-418 Link Here
413
      - patrons
413
      - patrons
414
    summary: Add patron
414
    summary: Add patron
415
    parameters:
415
    parameters:
416
      - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
416
      - name: body
417
      - name: body
417
        in: body
418
        in: body
418
        description: A JSON object containing information about the new patron
419
        description: A JSON object containing information about the new patron
419
- 

Return to bug 40082