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

(-)a/Koha/REST/V1/Biblios.pm (-1 / +46 lines)
Lines 22-27 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use Koha::Biblios;
22
use Koha::Biblios;
23
use Koha::DateUtils;
23
use Koha::DateUtils;
24
use Koha::Ratings;
24
use Koha::Ratings;
25
use Koha::RecordSources;
25
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio );
26
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio );
26
use C4::Search qw( FindDuplicate );
27
use C4::Search qw( FindDuplicate );
27
28
Lines 753-759 sub update { Link Here
753
            );
754
            );
754
        }
755
        }
755
756
756
        ModBiblio( $record, $biblio->id, $frameworkcode );
757
        my $record_source_id = $headers->header('x-record-source-id');
758
759
        my $options = {};
760
761
        if ($record_source_id) {
762
763
            # We've been passed a record source. Verify they are allowed to
764
            unless (
765
                haspermission(
766
                    $c->stash('koha.user')->userid,
767
                    { editcatalogue => 'set_record_sources' }
768
                )
769
              )
770
            {
771
                return $c->render(
772
                    status  => 403,
773
                    openapi => {
774
                        error =>
775
                          'You do not have permission to set the record source'
776
                    }
777
                );
778
            }
779
780
            # find record source name to given id
781
            my $record_source = Koha::RecordSources->search(
782
                { record_source_id => $record_source_id } )->single;
783
784
            unless ($record_source) {
785
                return $c->render(
786
                    status  => 409,
787
                    openapi =>
788
                      { error => 'Given record_source_id does not exist' }
789
                );
790
            }
791
792
            $options->{'overlay_context'}  = { source => $record_source->name };
793
            $options->{'record_source_id'} = $record_source_id;
794
        }
795
796
        unless ( $options->{'overlay_context'}->{'source'} ) {
797
            $options->{'overlay_context'} = { source => '*' };
798
        }
799
800
        ModBiblio( $record, $biblio->id, $frameworkcode, $options );
801
757
802
758
        $c->render(
803
        $c->render(
759
            status  => 200,
804
            status  => 200,
(-)a/api/v1/swagger/paths/biblios.yaml (-1 / +5 lines)
Lines 251-256 Link Here
251
      - $ref: "../swagger.yaml#/parameters/framework_id_header"
251
      - $ref: "../swagger.yaml#/parameters/framework_id_header"
252
      - $ref: "../swagger.yaml#/parameters/marc_schema_header"
252
      - $ref: "../swagger.yaml#/parameters/marc_schema_header"
253
      - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
253
      - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
254
      - $ref: "../swagger.yaml#/parameters/record_source_id_header"
254
    produces:
255
    produces:
255
      - application/json
256
      - application/json
256
    responses:
257
    responses:
Lines 279-284 Link Here
279
          description: Accepted content-types
280
          description: Accepted content-types
280
          items:
281
          items:
281
            type: string
282
            type: string
283
      "409":
284
        description: Conflict
285
        schema:
286
          $ref: "../swagger.yaml#/definitions/error"
282
      "500":
287
      "500":
283
        description: |
288
        description: |
284
          Internal server error. Possible `error_code` attribute values:
289
          Internal server error. Possible `error_code` attribute values:
285
- 

Return to bug 35380