Add an editable menu name and reserve billing material numbers on creation
- Company details get an optional "Valikon nimi", shown at the left of the main menu; it falls back to the application name when empty. - A billing material gets its running number (billing_exports.number) only when it is created, so discarded drafts leave no gaps. Drafts have no number; existing created materials are numbered by the migration, and the CSV file name uses the number. - TaskAssigneeMigrationTest rolls back from its own migration onward instead of assuming it is the last one. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -16,6 +16,7 @@ final readonly class CompanyDetails
|
||||
public ?string $address = null,
|
||||
public ?string $phone = null,
|
||||
public ?string $email = null,
|
||||
public ?string $menuName = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ final class CompanyDetailsStore
|
||||
'address' => 'shared.company_address',
|
||||
'phone' => 'shared.company_phone',
|
||||
'email' => 'shared.company_email',
|
||||
'menu_name' => 'shared.company_menu_name',
|
||||
];
|
||||
|
||||
public function __construct(private Settings $settings) {}
|
||||
@@ -47,6 +48,7 @@ final class CompanyDetailsStore
|
||||
$this->settings->get(self::KEYS['address']),
|
||||
$this->settings->get(self::KEYS['phone']),
|
||||
$this->settings->get(self::KEYS['email']),
|
||||
$this->settings->get(self::KEYS['menu_name']),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,6 +74,15 @@ final class CompanyDetailsStore
|
||||
$this->settings->put(self::KEYS['address'], self::text($details->address));
|
||||
$this->settings->put(self::KEYS['phone'], self::text($details->phone));
|
||||
$this->settings->put(self::KEYS['email'], $email);
|
||||
$this->settings->put(self::KEYS['menu_name'], self::text($details->menuName));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name shown at the left of the main menu: the saved one, or the application name.
|
||||
*/
|
||||
public function menuName(): string
|
||||
{
|
||||
return $this->settings->get(self::KEYS['menu_name']) ?? (string) config('app.name');
|
||||
}
|
||||
|
||||
private static function text(?string $value): ?string
|
||||
|
||||
Reference in New Issue
Block a user