|
|
@@ -22,6 +22,7 @@ use Carbon\CarbonImmutable;
|
|
|
* @property string $area_manager_field_name
|
|
|
* @property int $year_cycle_month
|
|
|
* @property int $show_in_map_overview
|
|
|
+ * @property int $archived
|
|
|
* @property string $config_json
|
|
|
*/
|
|
|
|
|
|
@@ -36,6 +37,7 @@ class Customer extends Model {
|
|
|
"internal_id_field_name", "region_field_name", "area_manager_field_name",
|
|
|
"year_cycle_month",
|
|
|
"show_in_map_overview",
|
|
|
+ "archived",
|
|
|
"config_json",
|
|
|
];
|
|
|
|
|
|
@@ -49,9 +51,19 @@ class Customer extends Model {
|
|
|
|
|
|
$user = Core::$user;
|
|
|
|
|
|
- $customers = $user->getCustomers();
|
|
|
- if(count($customers) == 0) throw new Exception("At least one customer must exist before this page can be accessed.");
|
|
|
- else if(count($customers) == 1) {
|
|
|
+ $nvp = [];
|
|
|
+
|
|
|
+ $include_archived = HTTP::value("include_archived");
|
|
|
+ if(!$include_archived) {
|
|
|
+ $nvp["archived"] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $customers = $user->getCustomers($nvp);
|
|
|
+ if(count($customers) === 0) {
|
|
|
+ throw new RuntimeException("At least one customer must exist before this page can be accessed.");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(count($customers) === 1) {
|
|
|
$customer = array_shift($customers);
|
|
|
}
|
|
|
else {
|
|
|
@@ -325,4 +337,8 @@ class Customer extends Model {
|
|
|
return !empty($config->billingEnabled);
|
|
|
}
|
|
|
|
|
|
+ public function isArchived(): bool {
|
|
|
+ return (bool) $this->archived;
|
|
|
+ }
|
|
|
+
|
|
|
}
|