Bug 33817: (follow-up) Fix spec and messages

This patch should resolve the issues highlighted at signoff time by
Victor.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-06-27 12:03:58 +01:00 committed by Tomas Cohen Arazi
parent 384de4a74a
commit 34b704fb0b
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 9 additions and 1 deletions

View file

@ -308,6 +308,10 @@
description: Bad parameter
schema:
$ref: "../swagger.yaml#/definitions/error"
"409":
description: Conflict in creating resource
schema:
$ref: "../swagger.yaml#/definitions/error"
"401":
description: Authentication required
schema:

View file

@ -1978,6 +1978,8 @@
var response = data.responseJSON;
if ( response.error_code === 'already_bundled' ) {
$('#addResult').replaceWith('<div id="addResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
} else if (response.error_code === 'bundle_checkout_out') {
$('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
} else if (response.error_code === 'checked_out') {
const button = $('<button type="button">')
.addClass('btn btn-xs')
@ -2091,7 +2093,9 @@
var barcode = $('#rm_external_id').val();
if ( data.status === 409 ) {
var response = data.responseJSON;
if ( response.key === "PRIMARY" ) {
if (response.error_code === 'bundle_checkout_out') {
$('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
} else if ( response.key === "PRIMARY" ) {
$('#removeResult').replaceWith('<div id="removeResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
} else {
$('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');