Add controlled lists for loan types and object (ownership) status

This commit is contained in:
Joshua Ramon Enslin 2022-10-09 22:02:43 +02:00
parent a75954ffae
commit 8256231b9c
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
3 changed files with 93 additions and 1 deletions

2
l18n

@ -1 +1 @@
Subproject commit 188f5370b6f8db14e7ff344e79d039c1121ff4cc
Subproject commit 4cea8aba9e47ce802ec0284818aec9f8a8406799

44
src/MDLoanTypesSet.php Normal file
View File

@ -0,0 +1,44 @@
<?PHP
/**
* Contains a list of types of loans.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
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<string>
*/
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<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::LOAN_TYPES, "loan_types", "loan_types");
}
}

48
src/MDObjectStatusSet.php Normal file
View File

@ -0,0 +1,48 @@
<?PHP
/**
* Contains a list of states an object can be in for inventorization.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
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<string>
*/
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<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return parent::getTlSortedList($tlLoader, self::OBJECT_STATUS, "object_status", "object_status");
}
}