From 8256231b9c06b27a46c5b4ce036b5a630a03d546 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 9 Oct 2022 22:02:43 +0200 Subject: [PATCH] Add controlled lists for loan types and object (ownership) status --- l18n | 2 +- src/MDLoanTypesSet.php | 44 +++++++++++++++++++++++++++++++++++ src/MDObjectStatusSet.php | 48 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 src/MDLoanTypesSet.php create mode 100644 src/MDObjectStatusSet.php diff --git a/l18n b/l18n index 188f537..4cea8ab 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit 188f5370b6f8db14e7ff344e79d039c1121ff4cc +Subproject commit 4cea8aba9e47ce802ec0284818aec9f8a8406799 diff --git a/src/MDLoanTypesSet.php b/src/MDLoanTypesSet.php new file mode 100644 index 0000000..06361e8 --- /dev/null +++ b/src/MDLoanTypesSet.php @@ -0,0 +1,44 @@ + + */ +declare(strict_types = 1); + +/** + * Contains a list of types of loans. + */ +final class MDLoanTypesSet extends MDValueSet { + + const DEFAULT_LOAN_TYPE = 'outgoing'; + + const LOAN_TYPES = [ + 'outgoing', + 'incoming', + ]; + + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::LOAN_TYPES, "loan_types", "loan_types"); + + } + + /** + * Gets a list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + return parent::getTlSortedList($tlLoader, self::LOAN_TYPES, "loan_types", "loan_types"); + + } +} diff --git a/src/MDObjectStatusSet.php b/src/MDObjectStatusSet.php new file mode 100644 index 0000000..25518b1 --- /dev/null +++ b/src/MDObjectStatusSet.php @@ -0,0 +1,48 @@ + + */ +declare(strict_types = 1); + +/** + * Contains a list of states an object can be in for inventorization. + */ +final class MDObjectStatusSet extends MDValueSet { + + const DEFAULT_OBJECT_STATUS_TYPE = 'owned'; + + const OBJECT_STATUS_TYPES = [ + 'owned', + 'permanent_loan', + 'borrowed', + 'to_check_for_gift', + 'to_check', + 'deaccessed', + ]; + + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return parent::getTlUnsortedList($tlLoader, self::OBJECT_STATUS, "object_status", "object_status"); + + } + + /** + * Gets a list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + return parent::getTlSortedList($tlLoader, self::OBJECT_STATUS, "object_status", "object_status"); + + } +}