some arbitrary improvements (#2032)
* show version in doctor * added flag to import activities as global
This commit is contained in:
@@ -113,6 +113,13 @@ final class KimaiImporterCommand extends Command
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $oldActivities = [];
|
private $oldActivities = [];
|
||||||
|
/**
|
||||||
|
* If true, unknown Activities will be created globally.
|
||||||
|
* Default behavior: create project specific activities
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $unknownAsGlobal = false;
|
||||||
|
|
||||||
public function __construct(UserPasswordEncoderInterface $encoder, ManagerRegistry $registry, ValidatorInterface $validator)
|
public function __construct(UserPasswordEncoderInterface $encoder, ManagerRegistry $registry, ValidatorInterface $validator)
|
||||||
{
|
{
|
||||||
@@ -143,6 +150,7 @@ final class KimaiImporterCommand extends Command
|
|||||||
->addArgument('currency', InputArgument::OPTIONAL, 'The default currency for customer (code like EUR, CHF, GBP or USD)', 'EUR')
|
->addArgument('currency', InputArgument::OPTIONAL, 'The default currency for customer (code like EUR, CHF, GBP or USD)', 'EUR')
|
||||||
->addOption('timezone', null, InputOption::VALUE_OPTIONAL, 'Default timezone for imported users', date_default_timezone_get())
|
->addOption('timezone', null, InputOption::VALUE_OPTIONAL, 'Default timezone for imported users', date_default_timezone_get())
|
||||||
->addOption('language', null, InputOption::VALUE_OPTIONAL, 'Default language for imported users', User::DEFAULT_LANGUAGE)
|
->addOption('language', null, InputOption::VALUE_OPTIONAL, 'Default language for imported users', User::DEFAULT_LANGUAGE)
|
||||||
|
->addOption('global', null, InputOption::VALUE_NONE, 'If set, activities without mapping will be created globally instead of project-specific (default behavior)')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +172,7 @@ final class KimaiImporterCommand extends Command
|
|||||||
$this->connection = DriverManager::getConnection($connectionParams, $config);
|
$this->connection = DriverManager::getConnection($connectionParams, $config);
|
||||||
|
|
||||||
$this->dbPrefix = $input->getArgument('prefix');
|
$this->dbPrefix = $input->getArgument('prefix');
|
||||||
|
$this->unknownAsGlobal = $input->getOption('global');
|
||||||
|
|
||||||
$password = $input->getArgument('password');
|
$password = $input->getArgument('password');
|
||||||
if (null === $password || \strlen($password = trim($password)) < 8) {
|
if (null === $password || \strlen($password = trim($password)) < 8) {
|
||||||
@@ -906,9 +915,13 @@ final class KimaiImporterCommand extends Command
|
|||||||
|
|
||||||
// remember which activity has at least one assigned project
|
// remember which activity has at least one assigned project
|
||||||
$oldActivityMapping = [];
|
$oldActivityMapping = [];
|
||||||
|
if ($this->unknownAsGlobal) {
|
||||||
|
$oldActivityMapping['___GLOBAL___'][] = PHP_INT_MAX;
|
||||||
|
} else {
|
||||||
foreach ($activityToProject as $mapping) {
|
foreach ($activityToProject as $mapping) {
|
||||||
$oldActivityMapping[$mapping['activityID']][] = $mapping['projectID'];
|
$oldActivityMapping[$mapping['activityID']][] = $mapping['projectID'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create global activities
|
// create global activities
|
||||||
foreach ($activities as $oldActivity) {
|
foreach ($activities as $oldActivity) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{% import "doctor/actions.html.twig" as actions %}
|
{% import "doctor/actions.html.twig" as actions %}
|
||||||
|
|
||||||
{% block page_title %}{{ 'menu.doctor'|trans }}{% endblock %}
|
{% block page_title %}{{ 'menu.doctor'|trans }}{% endblock %}
|
||||||
{% block page_subtitle %}Environment: <strong>{{ environment }}</strong>{% endblock %}
|
{% block page_subtitle %}Environment: {{ environment }} – Version: {{ constant('App\\Constants::VERSION') }} {{ constant('App\\Constants::STATUS') }}{% endblock %}
|
||||||
{% block page_actions %}{{ actions.doctor('index') }}{% endblock %}
|
{% block page_actions %}{{ actions.doctor('index') }}{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
|||||||
Reference in New Issue
Block a user