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

(-)a/Koha/REST/V1/Biblios.pm (-1 / +66 lines)
Lines 22-28 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use Koha::Biblios;
22
use Koha::Biblios;
23
use Koha::Ratings;
23
use Koha::Ratings;
24
use Koha::RecordProcessor;
24
use Koha::RecordProcessor;
25
use C4::Biblio qw( DelBiblio AddBiblio );
25
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio );
26
use C4::Search qw( FindDuplicate );
26
use C4::Search qw( FindDuplicate );
27
27
28
use List::MoreUtils qw( any );
28
use List::MoreUtils qw( any );
Lines 550-553 sub add { Link Here
550
    };
550
    };
551
}
551
}
552
552
553
=head3 update
554
555
Controller function that handles modifying an biblio object
556
557
=cut
558
559
sub update {
560
    my $c = shift->openapi->valid_input or return;
561
562
    my $biblionumber = $c->validation->param('biblio_id');
563
    my $biblio = Koha::Biblios->find( $biblionumber );
564
565
    if ( not defined $biblio ) {
566
        return $c->render(
567
            status  => 404,
568
            openapi => { error => "Object not found" }
569
        );
570
    }
571
572
    try {
573
        my $body = $c->validation->param('Body');
574
575
        my $flavour =
576
            C4::Context->preference('marcflavour') eq 'UNIMARC'
577
            ? 'UNIMARCAUTH'
578
            : 'MARC21';
579
580
        my $record;
581
        my $frameworkcode;
582
583
        if ( $c->req->headers->content_type =~ m/application\/json/ ) {
584
            $record = MARC::Record->new_from_xml( $body->{marcxml}, 'UTF-8', $flavour );
585
            $frameworkcode = $body->{framework_id} || $biblio->frameworkcode;
586
        } else {
587
            $frameworkcode = $c->validation->param('x-framework-id') || $biblio->frameworkcode;
588
            if ( $c->req->headers->content_type =~ m/application\/marcxml\+xml/ ) {
589
                $record = MARC::Record->new_from_xml( $body, 'UTF-8', $flavour );
590
            } elsif ( $c->req->headers->content_type =~ m/application\/marc-in-json/ ) {
591
                $record = MARC::Record->new_from_mij_structure( $body );
592
            } elsif ( $c->req->headers->content_type =~ m/application\/marc/ ) {
593
                $record = MARC::Record->new_from_usmarc( $body );
594
            } else {
595
                return $c->render(
596
                    status  => 406,
597
                    openapi => [
598
                        "application/json",
599
                        "application/marcxml+xml",
600
                        "application/marc-in-json",
601
                        "application/marc"
602
                    ]
603
                );
604
            }
605
        }
606
607
        ModBiblio( $record, $biblionumber, $frameworkcode );
608
609
        $c->render(
610
            status  => 200,
611
            openapi => { id => $biblionumber }
612
        );
613
    }
614
    catch {
615
        $c->unhandled_exception($_);
616
    };
617
}
553
1;
618
1;
(-)a/api/v1/swagger/paths/biblios.yaml (+60 lines)
Lines 148-153 Link Here
148
    x-koha-authorization:
148
    x-koha-authorization:
149
      permissions:
149
      permissions:
150
        editcatalogue: edit_catalogue
150
        editcatalogue: edit_catalogue
151
  put:
152
    x-mojo-to: Biblios#update
153
    operationId: updateBiblio
154
    tags:
155
      - biblios
156
    summary: Update biblio
157
    parameters:
158
      - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
159
      - name: Body
160
        in: body
161
        description: A JSON object or the Marc string describing a biblio
162
        required: true
163
        schema:
164
          type:
165
            - string
166
            - object
167
      - $ref: "../swagger.yaml#/parameters/framework_id_header"
168
      - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header"
169
    produces:
170
      - application/json
171
    responses:
172
      "200":
173
        description: A biblio
174
      "400":
175
        description: Bad request
176
        schema:
177
          $ref: "../swagger.yaml#/definitions/error"
178
      "401":
179
        description: Authentication required
180
        schema:
181
          $ref: "../swagger.yaml#/definitions/error"
182
      "403":
183
        description: Access forbidden
184
        schema:
185
          $ref: "../swagger.yaml#/definitions/error"
186
      "404":
187
        description: Biblio not found
188
        schema:
189
          $ref: "../swagger.yaml#/definitions/error"
190
      "406":
191
        description: Not acceptable
192
        schema:
193
          type: array
194
          description: Accepted content-types
195
          items:
196
            type: string
197
      "500":
198
        description: |
199
          Internal server error. Possible `error_code` attribute values:
200
201
          * `internal_server_error`
202
        schema:
203
          $ref: "../swagger.yaml#/definitions/error"
204
      "503":
205
        description: Under maintenance
206
        schema:
207
          $ref: "../swagger.yaml#/definitions/error"
208
    x-koha-authorization:
209
      permissions:
210
        editcatalogue: edit_catalogue
151
"/biblios/{biblio_id}/checkouts":
211
"/biblios/{biblio_id}/checkouts":
152
  get:
212
  get:
153
    x-mojo-to: Biblios#get_checkouts
213
    x-mojo-to: Biblios#get_checkouts
(-)a/t/db_dependent/api/v1/biblios.t (-2 / +542 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use utf8;
20
use utf8;
21
use Encode;
21
use Encode;
22
22
23
use Test::More tests => 9;
23
use Test::More tests => 10;
24
use Test::MockModule;
24
use Test::MockModule;
25
use Test::Mojo;
25
use Test::Mojo;
26
use Test::Warn;
26
use Test::Warn;
Lines 1245-1249 subtest 'post() tests' => sub { Link Here
1245
      ->status_is(200)
1245
      ->status_is(200)
1246
      ->json_has('/id');
1246
      ->json_has('/id');
1247
1247
1248
    $schema->storage->txn_rollback;
1249
};
1250
1251
subtest 'put() tests' => sub {
1252
1253
    plan tests => 18;
1254
1255
    $schema->storage->txn_begin;
1256
1257
    my $patron = $builder->build_object(
1258
        {
1259
            class => 'Koha::Patrons',
1260
            value => { flags => 0 } # no permissions
1261
        }
1262
    );
1263
    my $password = 'thePassword123';
1264
    $patron->set_password( { password => $password, skip_validation => 1 } );
1265
    my $userid = $patron->userid;
1266
1267
    my $frameworkcode = 'BKS';
1268
    my $biblio = $builder->build_sample_biblio({frameworkcode => $frameworkcode});
1269
1270
    my $biblionumber = $biblio->biblionumber;
1271
1272
    my $marcxml = q|<?xml version="1.0" encoding="UTF-8"?>
1273
<record
1274
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1275
    xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
1276
    xmlns="http://www.loc.gov/MARC21/slim">
1277
1278
  <leader>01102pam a2200289 a 6500</leader>
1279
  <controlfield tag="001">2504398</controlfield>
1280
  <controlfield tag="005">20200421093816.0</controlfield>
1281
  <controlfield tag="008">920610s1993    caub         s001 0 eng  </controlfield>
1282
  <datafield tag="010" ind1=" " ind2=" ">
1283
    <subfield code="a">   92021731 </subfield>
1284
  </datafield>
1285
  <datafield tag="020" ind1=" " ind2=" ">
1286
    <subfield code="a">05200784384 (Test json)</subfield>
1287
  </datafield>
1288
  <datafield tag="020" ind1=" " ind2=" ">
1289
    <subfield code="a">05200784464 (Test json)</subfield>
1290
  </datafield>
1291
  <datafield tag="040" ind1=" " ind2=" ">
1292
    <subfield code="a">DLC</subfield>
1293
    <subfield code="c">DLC</subfield>
1294
    <subfield code="d">DLC</subfield>
1295
  </datafield>
1296
  <datafield tag="041" ind1="0" ind2=" ">
1297
    <subfield code="a">enggrc</subfield>
1298
  </datafield>
1299
  <datafield tag="050" ind1="0" ind2="0">
1300
    <subfield code="a">PA522</subfield>
1301
    <subfield code="b">.M38 1993</subfield>
1302
  </datafield>
1303
  <datafield tag="082" ind1="0" ind2="0">
1304
    <subfield code="a">480</subfield>
1305
    <subfield code="2">20</subfield>
1306
  </datafield>
1307
  <datafield tag="100" ind1="1" ind2=" ">
1308
    <subfield code="a">Mastronarde, Donald J.</subfield>
1309
    <subfield code="9">389</subfield>
1310
  </datafield>
1311
  <datafield tag="245" ind1="1" ind2="0">
1312
    <subfield code="a">Introduction to Attic Greek  (Using marcxml) /</subfield>
1313
    <subfield code="c">Donald J. Mastronarde.</subfield>
1314
  </datafield>
1315
  <datafield tag="260" ind1=" " ind2=" ">
1316
    <subfield code="a">Berkeley :</subfield>
1317
    <subfield code="b">University of California Press,</subfield>
1318
    <subfield code="c">c1993.</subfield>
1319
  </datafield>
1320
  <datafield tag="300" ind1=" " ind2=" ">
1321
    <subfield code="a">ix, 425 p. :</subfield>
1322
    <subfield code="b">maps ;</subfield>
1323
    <subfield code="c">26 cm.</subfield>
1324
  </datafield>
1325
  <datafield tag="500" ind1=" " ind2=" ">
1326
    <subfield code="a">Includes index.</subfield>
1327
  </datafield>
1328
  <datafield tag="650" ind1=" " ind2="0">
1329
    <subfield code="a">Attic Greek dialect</subfield>
1330
    <subfield code="9">7</subfield>
1331
  </datafield>
1332
  <datafield tag="856" ind1="4" ind2="2">
1333
    <subfield code="3">Contributor biographical information</subfield>
1334
    <subfield code="u">http://www.loc.gov/catdir/bios/ucal051/92021731.html</subfield>
1335
  </datafield>
1336
  <datafield tag="856" ind1="4" ind2="2">
1337
    <subfield code="3">Publisher description</subfield>
1338
    <subfield code="u">http://www.loc.gov/catdir/description/ucal041/92021731.html</subfield>
1339
  </datafield>
1340
  <datafield tag="906" ind1=" " ind2=" ">
1341
    <subfield code="a">7</subfield>
1342
    <subfield code="b">cbc</subfield>
1343
    <subfield code="c">orignew</subfield>
1344
    <subfield code="d">1</subfield>
1345
    <subfield code="e">ocip</subfield>
1346
    <subfield code="f">19</subfield>
1347
    <subfield code="g">y-gencatlg</subfield>
1348
  </datafield>
1349
  <datafield tag="942" ind1=" " ind2=" ">
1350
    <subfield code="2">ddc</subfield>
1351
    <subfield code="c">BK</subfield>
1352
  </datafield>
1353
  <datafield tag="955" ind1=" " ind2=" ">
1354
    <subfield code="a">pc05 to ea00 06-11-92; ea04 to SCD 06-11-92; fd11 06-11-92 (PA522.M...); fr21 06-12-92; fs62 06-15-92; CIP ver. pv07 11-12-93</subfield>
1355
  </datafield>
1356
  <datafield tag="999" ind1=" " ind2=" ">
1357
    <subfield code="c">3</subfield>
1358
    <subfield code="d">3</subfield>
1359
  </datafield>
1360
</record>|;
1361
1362
    my $mij = q|{
1363
  "fields": [
1364
    {
1365
      "001": "2504398"
1366
    },
1367
    {
1368
      "005": "20200421093816.0"
1369
    },
1370
    {
1371
      "008": "920610s1993    caub         s001 0 eng  "
1372
    },
1373
    {
1374
      "010": {
1375
        "ind1": " ",
1376
        "subfields": [
1377
          {
1378
            "a": "   92021731 "
1379
          }
1380
        ],
1381
        "ind2": " "
1382
      }
1383
    },
1384
    {
1385
      "020": {
1386
        "subfields": [
1387
          {
1388
            "a": "05200784382 (Test mij)"
1389
          }
1390
        ],
1391
        "ind2": " ",
1392
        "ind1": " "
1393
      }
1394
    },
1395
    {
1396
      "020": {
1397
        "subfields": [
1398
          {
1399
            "a": "05200784462 (Test mij)"
1400
          }
1401
        ],
1402
        "ind1": " ",
1403
        "ind2": " "
1404
      }
1405
    },
1406
    {
1407
      "040": {
1408
        "subfields": [
1409
          {
1410
            "a": "DLC"
1411
          },
1412
          {
1413
            "c": "DLC"
1414
          },
1415
          {
1416
            "d": "DLC"
1417
          }
1418
        ],
1419
        "ind2": " ",
1420
        "ind1": " "
1421
      }
1422
    },
1423
    {
1424
      "041": {
1425
        "ind2": " ",
1426
        "subfields": [
1427
          {
1428
            "a": "enggrc"
1429
          }
1430
        ],
1431
        "ind1": "0"
1432
      }
1433
    },
1434
    {
1435
      "050": {
1436
        "subfields": [
1437
          {
1438
            "a": "PA522"
1439
          },
1440
          {
1441
            "b": ".M38 1993"
1442
          }
1443
        ],
1444
        "ind1": "0",
1445
        "ind2": "0"
1446
      }
1447
    },
1448
    {
1449
      "082": {
1450
        "subfields": [
1451
          {
1452
            "a": "480"
1453
          },
1454
          {
1455
            "2": "20"
1456
          }
1457
        ],
1458
        "ind2": "0",
1459
        "ind1": "0"
1460
      }
1461
    },
1462
    {
1463
      "100": {
1464
        "ind2": " ",
1465
        "subfields": [
1466
          {
1467
            "a": "Mastronarde, Donald J."
1468
          },
1469
          {
1470
            "9": "389"
1471
          }
1472
        ],
1473
        "ind1": "1"
1474
      }
1475
    },
1476
    {
1477
      "245": {
1478
        "ind1": "1",
1479
        "subfields": [
1480
          {
1481
            "a": "Introduction to Attic Greek  (Using mij) /"
1482
          },
1483
          {
1484
            "c": "Donald J. Mastronarde."
1485
          }
1486
        ],
1487
        "ind2": "0"
1488
      }
1489
    },
1490
    {
1491
      "260": {
1492
        "subfields": [
1493
          {
1494
            "a": "Berkeley :"
1495
          },
1496
          {
1497
            "b": "University of California Press,"
1498
          },
1499
          {
1500
            "c": "c1993."
1501
          }
1502
        ],
1503
        "ind2": " ",
1504
        "ind1": " "
1505
      }
1506
    },
1507
    {
1508
      "300": {
1509
        "ind1": " ",
1510
        "subfields": [
1511
          {
1512
            "a": "ix, 425 p. :"
1513
          },
1514
          {
1515
            "b": "maps ;"
1516
          },
1517
          {
1518
            "c": "26 cm."
1519
          }
1520
        ],
1521
        "ind2": " "
1522
      }
1523
    },
1524
    {
1525
      "500": {
1526
        "subfields": [
1527
          {
1528
            "a": "Includes index."
1529
          }
1530
        ],
1531
        "ind1": " ",
1532
        "ind2": " "
1533
      }
1534
    },
1535
    {
1536
      "650": {
1537
        "subfields": [
1538
          {
1539
            "a": "Attic Greek dialect"
1540
          },
1541
          {
1542
            "9": "7"
1543
          }
1544
        ],
1545
        "ind2": "0",
1546
        "ind1": " "
1547
      }
1548
    },
1549
    {
1550
      "856": {
1551
        "subfields": [
1552
          {
1553
            "3": "Contributor biographical information"
1554
          },
1555
          {
1556
            "u": "http://www.loc.gov/catdir/bios/ucal051/92021731.html"
1557
          }
1558
        ],
1559
        "ind2": "2",
1560
        "ind1": "4"
1561
      }
1562
    },
1563
    {
1564
      "856": {
1565
        "ind1": "4",
1566
        "subfields": [
1567
          {
1568
            "3": "Publisher description"
1569
          },
1570
          {
1571
            "u": "http://www.loc.gov/catdir/description/ucal041/92021731.html"
1572
          }
1573
        ],
1574
        "ind2": "2"
1575
      }
1576
    },
1577
    {
1578
      "906": {
1579
        "subfields": [
1580
          {
1581
            "a": "7"
1582
          },
1583
          {
1584
            "b": "cbc"
1585
          },
1586
          {
1587
            "c": "orignew"
1588
          },
1589
          {
1590
            "d": "1"
1591
          },
1592
          {
1593
            "e": "ocip"
1594
          },
1595
          {
1596
            "f": "19"
1597
          },
1598
          {
1599
            "g": "y-gencatlg"
1600
          }
1601
        ],
1602
        "ind1": " ",
1603
        "ind2": " "
1604
      }
1605
    },
1606
    {
1607
      "942": {
1608
        "subfields": [
1609
          {
1610
            "2": "ddc"
1611
          },
1612
          {
1613
            "c": "BK"
1614
          }
1615
        ],
1616
        "ind2": " ",
1617
        "ind1": " "
1618
      }
1619
    },
1620
    {
1621
      "955": {
1622
        "subfields": [
1623
          {
1624
            "a": "pc05 to ea00 06-11-92; ea04 to SCD 06-11-92; fd11 06-11-92 (PA522.M...); fr21 06-12-92; fs62 06-15-92; CIP ver. pv07 11-12-93"
1625
          }
1626
        ],
1627
        "ind2": " ",
1628
        "ind1": " "
1629
      }
1630
    },
1631
    {
1632
      "999": {
1633
        "subfields": [
1634
          {
1635
            "c": "3"
1636
          },
1637
          {
1638
            "d": "3"
1639
          }
1640
        ],
1641
        "ind1": " ",
1642
        "ind2": " "
1643
      }
1644
    }
1645
  ],
1646
  "leader": "01102pam a2200289 a 8500"
1647
}|;
1648
    my $marc = q|01116pam a2200289 a 4500001000800000005001700008008004100025010001700066020002800083020002800111040001800139041001100157050002100168082001200189100003200201245007500233260005600308300003300364500002000397650002700417856009500444856008700539906004500626942001200671955013000683999001300813250439820221223213433.0920610s1993    caub         s001 0 eng    a   92021731   a05200784384 (Test json)  a05200784464 (Test json)  aDLCcDLCdDLC0 aenggrc00aPA522b.M38 199300a4802201 aMastronarde, Donald J.938910aIntroduction to Attic Greek  (Using usmarc) /cDonald J. Mastronarde.  aBerkeley :bUniversity of California Press,cc1993.  aix, 425 p. :bmaps ;c26 cm.  aIncludes index. 0aAttic Greek dialect97423Contributor biographical informationuhttp://www.loc.gov/catdir/bios/ucal051/92021731.html423Publisher descriptionuhttp://www.loc.gov/catdir/description/ucal041/92021731.html  a7bcbccorignewd1eocipf19gy-gencatlg  2ddccBK  apc05 to ea00 06-11-92; ea04 to SCD 06-11-92; fd11 06-11-92 (PA522.M...); fr21 06-12-92; fs62 06-15-92; CIP ver. pv07 11-12-93  c715d715|;
1649
    my $json = {
1650
      framework_id => $frameworkcode,
1651
      marcxml      => q|<?xml version="1.0" encoding="UTF-8"?>
1652
<record
1653
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1654
    xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
1655
    xmlns="http://www.loc.gov/MARC21/slim">
1656
1657
  <leader>01102pam a2200289 a 6500</leader>
1658
  <controlfield tag="001">2504398</controlfield>
1659
  <controlfield tag="005">20200421093816.0</controlfield>
1660
  <controlfield tag="008">920610s1993    caub         s001 0 eng  </controlfield>
1661
  <datafield tag="010" ind1=" " ind2=" ">
1662
    <subfield code="a">   92021731 </subfield>
1663
  </datafield>
1664
  <datafield tag="020" ind1=" " ind2=" ">
1665
    <subfield code="a">05200784384 (Test json)</subfield>
1666
  </datafield>
1667
  <datafield tag="020" ind1=" " ind2=" ">
1668
    <subfield code="a">05200784464 (Test json)</subfield>
1669
  </datafield>
1670
  <datafield tag="040" ind1=" " ind2=" ">
1671
    <subfield code="a">DLC</subfield>
1672
    <subfield code="c">DLC</subfield>
1673
    <subfield code="d">DLC</subfield>
1674
  </datafield>
1675
  <datafield tag="041" ind1="0" ind2=" ">
1676
    <subfield code="a">enggrc</subfield>
1677
  </datafield>
1678
  <datafield tag="050" ind1="0" ind2="0">
1679
    <subfield code="a">PA522</subfield>
1680
    <subfield code="b">.M38 1993</subfield>
1681
  </datafield>
1682
  <datafield tag="082" ind1="0" ind2="0">
1683
    <subfield code="a">480</subfield>
1684
    <subfield code="2">20</subfield>
1685
  </datafield>
1686
  <datafield tag="100" ind1="1" ind2=" ">
1687
    <subfield code="a">Mastronarde, Donald J.</subfield>
1688
    <subfield code="9">389</subfield>
1689
  </datafield>
1690
  <datafield tag="245" ind1="1" ind2="0">
1691
    <subfield code="a">Introduction to Attic Greek  (Using json) /</subfield>
1692
    <subfield code="c">Donald J. Mastronarde.</subfield>
1693
  </datafield>
1694
  <datafield tag="260" ind1=" " ind2=" ">
1695
    <subfield code="a">Berkeley :</subfield>
1696
    <subfield code="b">University of California Press,</subfield>
1697
    <subfield code="c">c1993.</subfield>
1698
  </datafield>
1699
  <datafield tag="300" ind1=" " ind2=" ">
1700
    <subfield code="a">ix, 425 p. :</subfield>
1701
    <subfield code="b">maps ;</subfield>
1702
    <subfield code="c">26 cm.</subfield>
1703
  </datafield>
1704
  <datafield tag="500" ind1=" " ind2=" ">
1705
    <subfield code="a">Includes index.</subfield>
1706
  </datafield>
1707
  <datafield tag="650" ind1=" " ind2="0">
1708
    <subfield code="a">Attic Greek dialect</subfield>
1709
    <subfield code="9">7</subfield>
1710
  </datafield>
1711
  <datafield tag="856" ind1="4" ind2="2">
1712
    <subfield code="3">Contributor biographical information</subfield>
1713
    <subfield code="u">http://www.loc.gov/catdir/bios/ucal051/92021731.html</subfield>
1714
  </datafield>
1715
  <datafield tag="856" ind1="4" ind2="2">
1716
    <subfield code="3">Publisher description</subfield>
1717
    <subfield code="u">http://www.loc.gov/catdir/description/ucal041/92021731.html</subfield>
1718
  </datafield>
1719
  <datafield tag="906" ind1=" " ind2=" ">
1720
    <subfield code="a">7</subfield>
1721
    <subfield code="b">cbc</subfield>
1722
    <subfield code="c">orignew</subfield>
1723
    <subfield code="d">1</subfield>
1724
    <subfield code="e">ocip</subfield>
1725
    <subfield code="f">19</subfield>
1726
    <subfield code="g">y-gencatlg</subfield>
1727
  </datafield>
1728
  <datafield tag="942" ind1=" " ind2=" ">
1729
    <subfield code="2">ddc</subfield>
1730
    <subfield code="c">BK</subfield>
1731
  </datafield>
1732
  <datafield tag="955" ind1=" " ind2=" ">
1733
    <subfield code="a">pc05 to ea00 06-11-92; ea04 to SCD 06-11-92; fd11 06-11-92 (PA522.M...); fr21 06-12-92; fs62 06-15-92; CIP ver. pv07 11-12-93</subfield>
1734
  </datafield>
1735
  <datafield tag="999" ind1=" " ind2=" ">
1736
    <subfield code="c">3</subfield>
1737
    <subfield code="d">3</subfield>
1738
  </datafield>
1739
</record>|
1740
    };
1741
1742
    $t->put_ok("//$userid:$password@/api/v1/biblios/$biblionumber")
1743
      ->status_is(403, 'Not enough permissions makes it return the right code');
1744
1745
    # Add permissions
1746
    $builder->build(
1747
        {
1748
            source => 'UserPermission',
1749
            value  => {
1750
                borrowernumber => $patron->borrowernumber,
1751
                module_bit     => 9,
1752
                code           => 'edit_catalogue'
1753
            }
1754
        }
1755
    );
1756
1757
    $t->put_ok("//$userid:$password@/api/v1/biblios/$biblionumber" => json => $json)
1758
      ->status_is(200)
1759
      ->json_has('/id');
1760
1761
    $biblio = Koha::Biblios->find($biblionumber);
1762
1763
    is($biblio->title, 'Introduction to Attic Greek  (Using json) /');
1764
1765
    $t->put_ok("//$userid:$password@/api/v1/biblios/$biblionumber" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode} => $marcxml)
1766
      ->status_is(200)
1767
      ->json_has('/id');
1768
1769
    $biblio = Koha::Biblios->find($biblionumber);
1770
1771
    is($biblio->title, 'Introduction to Attic Greek  (Using marcxml) /');
1772
1773
    $t->put_ok("//$userid:$password@/api/v1/biblios/$biblionumber" => {'Content-Type' => 'application/marc-in-json', 'x-framework-id' => $frameworkcode} => $mij)
1774
      ->status_is(200)
1775
      ->json_has('/id');
1776
1777
    $biblio = Koha::Biblios->find($biblionumber);
1778
1779
    is($biblio->title, 'Introduction to Attic Greek  (Using mij) /');
1780
1781
    $t->put_ok("//$userid:$password@/api/v1/biblios/$biblionumber" => {'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode} => $marc)
1782
      ->status_is(200)
1783
      ->json_has('/id');
1784
1785
    $biblio = Koha::Biblios->find($biblionumber);
1786
1787
    is($biblio->title, 'Introduction to Attic Greek  (Using usmarc) /');
1788
1248
    $schema->storage->txn_rollback;
1789
    $schema->storage->txn_rollback;
1249
};
1790
};
1250
- 

Return to bug 31801