diff --git a/rero_ils/modules/items/jsonschemas/items/item-v0.0.1.json b/rero_ils/modules/items/jsonschemas/items/item-v0.0.1.json index 7ac3081f51..121fb7e0cc 100644 --- a/rero_ils/modules/items/jsonschemas/items/item-v0.0.1.json +++ b/rero_ils/modules/items/jsonschemas/items/item-v0.0.1.json @@ -21,6 +21,7 @@ "item_type", "temporary_item_type", "location", + "temporary_location", "type", "url", "pac_code", @@ -230,6 +231,54 @@ } } }, + "temporary_location": { + "title": "Temporary location", + "additionalProperties": false, + "type": "object", + "propertiesOrder": [ + "$ref", + "end_date" + ], + "required": [ + "$ref" + ], + "properties": { + "$ref": { + "title": "Location URI", + "type": "string", + "pattern": "^https://ils.rero.ch/api/locations/.+?$", + "form": { + "templateOptions": { + "hideLabel": true + }, + "fieldMap": "location" + } + }, + "end_date": { + "title": "Deletion date", + "type": "string", + "format": "date", + "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$", + "form": { + "type": "datepicker", + "validation": { + "messages": { + "pattern": "Should be in the ISO 8601, YYYY-MM-DD." + } + } + } + } + }, + "form": { + "templateOptions": { + "cssClass": "editor-title" + }, + "hide": true, + "navigation": { + "essential": true + } + } + }, "type": { "title": "Item type", "type": "string", diff --git a/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json b/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json index aa65a3a6ab..b79fa0f378 100644 --- a/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json +++ b/rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json @@ -58,6 +58,19 @@ } } }, + "temporary_location": { + "properties": { + "type": { + "type": "keyword" + }, + "pid": { + "type": "keyword" + }, + "end_date": { + "type": "date" + } + } + }, "library": { "properties": { "type": { diff --git a/tests/unit/test_items_jsonschema.py b/tests/unit/test_items_jsonschema.py index 2bad5e1211..a806a99019 100644 --- a/tests/unit/test_items_jsonschema.py +++ b/tests/unit/test_items_jsonschema.py @@ -50,6 +50,7 @@ def test_item_all_jsonschema_keys_values( {'key': 'second_call_number', 'value': 25}, {'key': 'item_type', 'value': 25}, {'key': 'location', 'value': 25}, + {'key': 'temporary_location', 'value': 25}, {'key': 'enumerationAndChronology', 'value': 25}, {'key': 'document', 'value': 25}, {'key': 'type', 'value': 25},