@@ -, +, @@
- Fix wrong link 'Create a new batch status message' in case there are no existing batch statuses
- Detail of batch update - View status of any request within a batch
- Fix typo to correctly display status code on batch statuses list page
- Fixed an issue with illrequest api definition that prevented the listing of any ILL requests if any request had a status_alias
- Updated "Add items to batch" css class to match new 22.11 style
- Fixed conflict issue where it prevented the creation of a single request in a backend that is using JS field validation utilizing the #cardnumber selector
- Added a check for metadata enrichment plugins and bail batches JS code if none are found, this prevents a console error
- Remove ysearch from patron auto complete in batch creation and use patron_autocomplete instead
- 'New batch' and 'list batches' buttons no longer show if no metadata plugin is installed
- Fixed tests, all passing now
- Improved error messaging for non-existent cardnumber input in patron in ill batch creation
- Improved error messaging for duplicate batch name creation error
- Fix sidemenu filters and search not working after new batch_id column
---
Koha/REST/V1/Illbatches.pm | 18 ++++++
api/v1/swagger/definitions/illrequest.yaml | 2 +-
api/v1/swagger/paths/illbatches.yaml | 4 ++
.../prog/en/includes/ill-batch-modal.inc | 7 ++-
.../prog/en/includes/ill-toolbar.inc | 2 +-
.../en/modules/admin/ill_batch_statuses.tt | 4 +-
.../intranet-tmpl/prog/js/ill-batch-modal.js | 58 ++++++++++++-------
.../intranet-tmpl/prog/js/ill-list-table.js | 6 +-
t/db_dependent/IllbatchStatuses.t | 17 ++++--
t/db_dependent/api/v1/illbatches.t | 31 ++++++++--
10 files changed, 107 insertions(+), 42 deletions(-)
--- a/Koha/REST/V1/Illbatches.pm
+++ a/Koha/REST/V1/Illbatches.pm
@@ -23,6 +23,8 @@ use Koha::Illbatches;
use Koha::IllbatchStatuses;
use Koha::Illrequests;
+use Try::Tiny qw( catch try );
+
=head1 NAME
Koha::REST::V1::Illbatches
@@ -140,6 +142,14 @@ sub add {
# We receive cardnumber, so we need to look up the corresponding
# borrowernumber
my $patron = Koha::Patrons->find({ cardnumber => $body->{cardnumber} });
+
+ if ( not defined $patron ) {
+ return $c->render(
+ status => 404,
+ openapi => { error => "Patron with cardnumber " . $body->{cardnumber} . " not found" }
+ );
+ }
+
delete $body->{cardnumber};
$body->{borrowernumber} = $patron->borrowernumber;
@@ -162,6 +172,14 @@ sub add {
);
}
catch {
+ if ( blessed $_ ) {
+ if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
+ return $c->render(
+ status => 409,
+ openapi => { error => "A batch named " . $body->{name} . " already exists" }
+ );
+ }
+ }
$c->unhandled_exception($_);
};
}
--- a/api/v1/swagger/definitions/illrequest.yaml
+++ a/api/v1/swagger/definitions/illrequest.yaml
@@ -128,7 +128,7 @@ properties:
description: The request's current status
status_alias:
type:
- - string
+ - object
- "null"
description: The ID of a user defined status for this request
updated:
--- a/api/v1/swagger/paths/illbatches.yaml
+++ a/api/v1/swagger/paths/illbatches.yaml
@@ -72,6 +72,10 @@
description: Access forbidden
schema:
$ref: "../swagger.yaml#/definitions/error"
+ "404":
+ description: Patron with given cardnumber not found
+ schema:
+ $ref: "../swagger.yaml#/definitions/error"
"409":
description: Conflict in creating resource
schema:
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc
@@ -18,8 +18,8 @@
value="" />
-
-
+
+
@@ -65,7 +65,7 @@
-
+
@@ -74,6 +74,7 @@
Identifier value
Metadata
Request ID
+
Request Status
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc
@@ -32,7 +32,7 @@
List requests
[% END %]
- [% IF have_batch.size > 0 %]
+ [% IF have_batch.size > 0 && metadata_enrichment_services %]