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

(-)a/Koha/REST/V1/Biblios.pm (+23 lines)
Lines 859-862 sub list { Link Here
859
    };
859
    };
860
}
860
}
861
861
862
sub merge {
863
    my $c = shift->openapi->valid_input or return;
864
    my $bn = $c->validation->param('biblio_id');
865
    my $bn_merge = $c->validation->param('biblio_id_to_merge');
866
    my $biblio          = Koha::Biblios->find( $bn );
867
    if ( not defined $biblio ) {
868
        return $c->render(
869
            status  => 404,
870
            openapi => { error => sprintf("[%s] biblio to merge into not found", $bn) }
871
        );
872
    }
873
874
    my $biblio_to_merge = Koha::Biblios->find( $bn_merge );
875
    if ( not defined $biblio_to_merge ) {
876
        return $c->render(
877
            status  => 404,
878
            openapi => { error => sprintf("[%s] biblio to merge from not found", $bn_merge) }
879
        );
880
    }
881
882
    return $c->render( status => 200, openapi => sprintf("OK %s <= %s, %s, %s", $bn, $bn_merge, $biblio->title, $biblio_to_merge->title) );
883
}
884
862
1;
885
1;
(-)a/api/v1/swagger/paths/biblios_merge.yaml (+45 lines)
Line 0 Link Here
1
---
2
"/biblios/{biblio_id}/merge/{biblio_id_to_merge}":
3
  put:
4
    x-mojo-to: Biblios#merge
5
    operationId: mergeBiblios
6
    tags:
7
    - merge_biblios
8
    summary: Merge Biblios
9
    parameters:
10
    - name: biblio_id
11
      in: path
12
      description: Bilblionumber to be merged into
13
      required: true
14
      type: string
15
    - name: biblio_id_to_merge
16
      in: path
17
      required: true
18
      description: Biblionumber from which to merge
19
      type: string
20
    responses:
21
      '200':
22
        description: OK message
23
##        schema:
24
##          type: string
25
##          items:
26
##            "$ref": "../swagger.yaml#/definitions/item_group"
27
##      '401':
28
##        description: Authentication required
29
##        schema:
30
##          "$ref": "../swagger.yaml#/definitions/error"
31
##      '403':
32
##        description: Access forbidden
33
##        schema:
34
##          "$ref": "../swagger.yaml#/definitions/error"
35
##      '500':
36
##        description: Internal server error
37
##        schema:
38
##          "$ref": "../swagger.yaml#/definitions/error"
39
##      '503':
40
##        description: Under maintenance
41
##        schema:
42
##          "$ref": "../swagger.yaml#/definitions/error"
43
    x-koha-authorization:
44
      permissions:
45
        catalogue: "manage_item_groups"
(-)a/api/v1/swagger/swagger.yaml (-1 / +2 lines)
Lines 183-188 paths: Link Here
183
    $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items"
183
    $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items"
184
  "/biblios/{biblio_id}/item_groups/{item_group_id}/items/{item_id}":
184
  "/biblios/{biblio_id}/item_groups/{item_group_id}/items/{item_id}":
185
    $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items~1{item_id}"
185
    $ref: "./paths/biblios_item_groups.yaml#/~1biblios~1{biblio_id}~1item_groups~1{item_group_id}~1items~1{item_id}"
186
  "/biblios/{biblio_id}/merge/{biblio_id_to_merge}":
187
    $ref: "./paths/biblios_merge.yaml#/~1biblios~1{biblio_id}~1merge~1{biblio_id_to_merge}"
186
  "/cash_registers/{cash_register_id}/cashups":
188
  "/cash_registers/{cash_register_id}/cashups":
187
    $ref: "./paths/cash_registers.yaml#/~1cash_registers~1{cash_register_id}~1cashups"
189
    $ref: "./paths/cash_registers.yaml#/~1cash_registers~1{cash_register_id}~1cashups"
188
  "/cashups/{cashup_id}":
190
  "/cashups/{cashup_id}":
189
- 

Return to bug 33036