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 748-754 sub update { Link Here
748
            );
749
            );
749
        }
750
        }
750
751
751
        ModBiblio( $record, $biblio->id, $frameworkcode );
752
        my $record_source_id = $headers->header('x-record-source-id');
753
754
        my $options = {};
755
756
        if ($record_source_id) {
757
758
            # We've been passed a record source. Verify they are allowed to
759
            unless (
760
                haspermission(
761
                    $c->stash('koha.user')->userid,
762
                    { editcatalogue => 'set_record_sources' }
763
                )
764
              )
765
            {
766
                return $c->render(
767
                    status  => 403,
768
                    openapi => {
769
                        error =>
770
                          'You do not have permission to set the record source'
771
                    }
772
                );
773
            }
774
775
            # find record source name to given id
776
            my $record_source = Koha::RecordSources->search(
777
                { record_source_id => $record_source_id } )->single;
778
779
            unless ($record_source) {
780
                return $c->render(
781
                    status  => 409,
782
                    openapi =>
783
                      { error => 'Given record_source_id does not exist' }
784
                );
785
            }
786
787
            $options->{'overlay_context'}  = { source => $record_source->name };
788
            $options->{'record_source_id'} = $record_source_id;
789
        }
790
791
        unless ( $options->{'overlay_context'}->{'source'} ) {
792
            $options->{'overlay_context'} = { source => '*' };
793
        }
794
795
        ModBiblio( $record, $biblio->id, $frameworkcode, $options );
796
752
797
753
        $c->render(
798
        $c->render(
754
            status  => 200,
799
            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