Show a notification on homepage and server info page if there is a new version available.

This commit is contained in:
Jan Böhmer 2023-08-04 23:49:26 +02:00
parent fa4af99525
commit 1fb334b0ca
16 changed files with 1741 additions and 1346 deletions

View file

@ -251,6 +251,8 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
label: "perm.server_infos" label: "perm.server_infos"
manage_oauth_tokens: manage_oauth_tokens:
label: "Manage OAuth tokens" label: "Manage OAuth tokens"
show_updates:
label: "perm.system.show_available_updates"
attachments: attachments:
label: "perm.part.attachments" label: "perm.part.attachments"

View file

@ -25,6 +25,7 @@ namespace App\Controller;
use App\DataTables\LogDataTable; use App\DataTables\LogDataTable;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
use App\Services\Misc\GitVersionInfo; use App\Services\Misc\GitVersionInfo;
use App\Services\System\UpdateAvailableManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use const DIRECTORY_SEPARATOR; use const DIRECTORY_SEPARATOR;
use Omines\DataTablesBundle\DataTableFactory; use Omines\DataTablesBundle\DataTableFactory;
@ -62,7 +63,8 @@ class HomepageController extends AbstractController
} }
#[Route(path: '/', name: 'homepage')] #[Route(path: '/', name: 'homepage')]
public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager): Response public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager,
UpdateAvailableManager $updateAvailableManager): Response
{ {
if ($this->isGranted('@tools.lastActivity')) { if ($this->isGranted('@tools.lastActivity')) {
$table = $this->dataTable->createFromType( $table = $this->dataTable->createFromType(
@ -97,6 +99,9 @@ class HomepageController extends AbstractController
'git_commit' => $versionInfo->getGitCommitHash(), 'git_commit' => $versionInfo->getGitCommitHash(),
'show_first_steps' => $show_first_steps, 'show_first_steps' => $show_first_steps,
'datatable' => $table, 'datatable' => $table,
'new_version_available' => $updateAvailableManager->isUpdateAvailable(),
'new_version' => $updateAvailableManager->getLatestVersionString(),
'new_version_url' => $updateAvailableManager->getLatestVersionUrl(),
]); ]);
} }
} }

View file

@ -28,6 +28,7 @@ use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\Attachments\BuiltinAttachmentsFinder; use App\Services\Attachments\BuiltinAttachmentsFinder;
use App\Services\Misc\GitVersionInfo; use App\Services\Misc\GitVersionInfo;
use App\Services\Misc\DBInfoHelper; use App\Services\Misc\DBInfoHelper;
use App\Services\System\UpdateAvailableManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@ -47,7 +48,7 @@ class ToolsController extends AbstractController
#[Route(path: '/server_infos', name: 'tools_server_infos')] #[Route(path: '/server_infos', name: 'tools_server_infos')]
public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper, public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper,
AttachmentSubmitHandler $attachmentSubmitHandler): Response AttachmentSubmitHandler $attachmentSubmitHandler, UpdateAvailableManager $updateAvailableManager): Response
{ {
$this->denyAccessUnlessGranted('@system.server_infos'); $this->denyAccessUnlessGranted('@system.server_infos');
@ -90,6 +91,11 @@ class ToolsController extends AbstractController
'db_size' => $DBInfoHelper->getDatabaseSize(), 'db_size' => $DBInfoHelper->getDatabaseSize(),
'db_name' => $DBInfoHelper->getDatabaseName() ?? 'Unknown', 'db_name' => $DBInfoHelper->getDatabaseName() ?? 'Unknown',
'db_user' => $DBInfoHelper->getDatabaseUsername() ?? 'Unknown', 'db_user' => $DBInfoHelper->getDatabaseUsername() ?? 'Unknown',
//New version section
'new_version_available' => $updateAvailableManager->isUpdateAvailable(),
'new_version' => $updateAvailableManager->getLatestVersionString(),
'new_version_url' => $updateAvailableManager->getLatestVersionUrl(),
]); ]);
} }

View file

@ -43,7 +43,7 @@ final class PermissionData implements \JsonSerializable
/** /**
* The current schema version of the permission data * The current schema version of the permission data
*/ */
public const CURRENT_SCHEMA_VERSION = 2; public const CURRENT_SCHEMA_VERSION = 3;
/** /**
* Creates a new Permission Data Instance using the given data. * Creates a new Permission Data Instance using the given data.

View file

@ -0,0 +1,106 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Helpers;
/**
* Helper functions for logic operations with trinary logic.
* True and false are represented as classical boolean values, undefined is represented as null.
*/
class TrinaryLogicHelper
{
/**
* Implements the trinary logic NOT.
* @param bool|null $a
* @return bool|null
*/
public static function not(?bool $a): ?bool
{
if ($a === null) {
return null;
}
return !$a;
}
/**
* Returns the trinary logic OR of the given parameters. At least one parameter is required.
* @param bool|null ...$args
* @return bool|null
*/
public static function or(?bool ...$args): ?bool
{
if (count($args) === 0) {
throw new \LogicException('At least one parameter is required.');
}
// The trinary or is the maximum of the integer representation of the parameters.
return self::intToBool(
max(array_map(self::boolToInt(...), $args))
);
}
/**
* Returns the trinary logic AND of the given parameters. At least one parameter is required.
* @param bool|null ...$args
* @return bool|null
*/
public static function and(?bool ...$args): ?bool
{
if (count($args) === 0) {
throw new \LogicException('At least one parameter is required.');
}
// The trinary and is the minimum of the integer representation of the parameters.
return self::intToBool(
min(array_map(self::boolToInt(...), $args))
);
}
/**
* Convert the trinary bool to an integer, where true is 1, false is -1 and null is 0.
* @param bool|null $a
* @return int
*/
private static function boolToInt(?bool $a): int
{
if ($a === null) {
return 0;
}
return $a ? 1 : -1;
}
/**
* Convert the integer to a trinary bool, where 1 is true, -1 is false and 0 is null.
* @param int $a
* @return bool|null
*/
private static function intToBool(int $a): ?bool
{
if ($a === 0) {
return null;
}
return $a > 0;
}
}

View file

@ -0,0 +1,108 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Services\System;
use Shivas\VersioningBundle\Service\VersionManagerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Version\Version;
/**
* This class checks if a new version of Part-DB is available.
*/
class UpdateAvailableManager
{
private const API_URL = 'https://api.github.com/repos/Part-DB/Part-DB-server/releases/latest';
private const CACHE_KEY = 'uam_latest_version';
private const CACHE_TTL = 60 * 60 * 24 * 2; // 2 day
public function __construct(private readonly HttpClientInterface $httpClient, private readonly CacheInterface $updateCache, private readonly VersionManagerInterface $versionManager)
{
}
/**
* Gets the latest version of Part-DB as string (e.g. "1.2.3").
* This value is cached for 2 days.
* @return string
*/
public function getLatestVersionString(): string
{
return $this->getLatestVersionInfo()['version'];
}
/**
* Gets the latest version of Part-DB as Version object.
*/
public function getLatestVersion(): Version
{
return Version::fromString($this->getLatestVersionString());
}
/**
* Gets the URL to the latest version of Part-DB on GitHub.
* @return string
*/
public function getLatestVersionUrl(): string
{
return $this->getLatestVersionInfo()['url'];
}
/**
* Checks if a new version of Part-DB is available. This value is cached for 2 days.
* @return bool
*/
public function isUpdateAvailable(): bool
{
$latestVersion = $this->getLatestVersion();
$currentVersion = $this->versionManager->getVersion();
return $latestVersion->isGreaterThan($currentVersion);
}
/**
* Get the latest version info. The value is cached for 2 days.
* @return array
* @phpstan-return array{version: string}
*/
private function getLatestVersionInfo(): array
{
return $this->updateCache->get(self::CACHE_KEY, function (ItemInterface $item) {
$item->expiresAfter(self::CACHE_TTL);
$response = $this->httpClient->request('GET', self::API_URL);
$result = $response->toArray();
$tag_name = $result['tag_name'];
// Remove the leading 'v' from the tag name
$version = substr($tag_name, 1);
return [
'version' => $version,
'url' => $result['html_url'],
];
});
}
}

View file

@ -107,6 +107,8 @@ class PermissionPresetsHelper
//Allow to manage Oauth tokens //Allow to manage Oauth tokens
$this->permissionResolver->setPermission($perm_holder, 'system', 'manage_oauth_tokens', PermissionData::ALLOW); $this->permissionResolver->setPermission($perm_holder, 'system', 'manage_oauth_tokens', PermissionData::ALLOW);
//Allow to show updates
$this->permissionResolver->setPermission($perm_holder, 'system', 'show_updates', PermissionData::ALLOW);
} }

View file

@ -25,6 +25,7 @@ namespace App\Services\UserSystem;
use App\Entity\UserSystem\Group; use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\PermissionData; use App\Entity\UserSystem\PermissionData;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
use App\Helpers\TrinaryLogicHelper;
use App\Security\Interfaces\HasPermissionsInterface; use App\Security\Interfaces\HasPermissionsInterface;
/** /**
@ -138,4 +139,22 @@ class PermissionSchemaUpdater
$holder->getPermissions()->removePermission('devices'); $holder->getPermissions()->removePermission('devices');
} }
} }
private function upgradeSchemaToVersion3(HasPermissionsInterface $holder): void //@phpstan-ignore-line This is called via reflection
{
$permissions = $holder->getPermissions();
//If the system.show_updates permission is not defined yet, set it to true, if the user can view server info, server logs or edit users or groups
if (!$permissions->isPermissionSet('system', 'show_updates')) {
$new_value = TrinaryLogicHelper::or(
$permissions->getPermissionValue('system', 'server_infos'),
$permissions->getPermissionValue('system', 'show_logs'),
$permissions->getPermissionValue('users', 'edit'),
$permissions->getPermissionValue('groups', 'edit')
);
$permissions->setPermissionValue('system', 'show_updates', $new_value);
}
}
} }

View file

@ -0,0 +1,9 @@
{% macro new_version_alert(is_available, new_version, new_version_url) %}
{% if is_available %}
<div class="alert alert-success" role="alert">
<h5><i class="fa-solid fa-champagne-glasses"></i> {% trans %}update_manager.new_version_available.title{% endtrans %}</h5>
{% trans %}update_manager.new_version_available.text{% endtrans %}: <b><a href="{{ new_version_url }}" class="alert-link link-external" target="_blank">{% trans %}version.caption{% endtrans %} {{ new_version }}</a></b>
<br><small>{% trans %}update_manager.new_version_available.only_administrators_can_see{% endtrans %}</small>
</div>
{% endif %}
{% endmacro %}

View file

@ -1,6 +1,13 @@
{% extends "base.html.twig" %} {% extends "base.html.twig" %}
{% import "components/new_version.macro.html.twig" as nv %}
{% block content %} {% block content %}
{% if is_granted('@system.show_updates') %}
{{ nv.new_version_alert(new_version_available, new_version, new_version_url) }}
{% endif %}
<div class="rounded p-4 bg-body-secondary"> <div class="rounded p-4 bg-body-secondary">
<h1 class="display-3">{{ partdb_title }}</h1> <h1 class="display-3">{{ partdb_title }}</h1>
<h4> <h4>

View file

@ -1,4 +1,5 @@
{% extends "main_card.html.twig" %} {% extends "main_card.html.twig" %}
{% import "components/new_version.macro.html.twig" as nv %}
{% block title %}{% trans %}tools.server_infos.title{% endtrans %}{% endblock %} {% block title %}{% trans %}tools.server_infos.title{% endtrans %}{% endblock %}
@ -6,6 +7,12 @@
<i class="fas fa-database"></i> {% trans %}tools.server_infos.title{% endtrans %} <i class="fas fa-database"></i> {% trans %}tools.server_infos.title{% endtrans %}
{% endblock %} {% endblock %}
{% block before_card %}
{% if is_granted('@system.show_updates') %}
{{ nv.new_version_alert(new_version_available, new_version, new_version_url) }}
{% endif %}
{% endblock %}
{% block card_content %} {% block card_content %}
<nav> <nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist"> <div class="nav nav-tabs" id="nav-tab" role="tablist">

View file

@ -0,0 +1,87 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Tests\Helpers;
use App\Helpers\TrinaryLogicHelper;
use PHPUnit\Framework\TestCase;
class TrinaryLogicHelperTest extends TestCase
{
public function testNot()
{
$this->assertTrue(TrinaryLogicHelper::not(false));
$this->assertFalse(TrinaryLogicHelper::not(true));
$this->assertNull(TrinaryLogicHelper::not(null));
}
public function testOr(): void
{
$this->assertFalse(TrinaryLogicHelper::or(false, false));
$this->assertNull(TrinaryLogicHelper::or(null, false));
$this->assertTrue(TrinaryLogicHelper::or(false, true));
$this->assertNull(TrinaryLogicHelper::or(null, false));
$this->assertNull(TrinaryLogicHelper::or(null, null));
$this->assertTrue(TrinaryLogicHelper::or(false, true));
$this->assertTrue(TrinaryLogicHelper::or(true, false));
$this->assertTrue(TrinaryLogicHelper::or(true, null));
$this->assertTrue(TrinaryLogicHelper::or(true, true));
//Should work for longer arrays too
$this->assertTrue(TrinaryLogicHelper::or(true, true, false, null));
$this->assertNull(TrinaryLogicHelper::or(false, false, false, false, null));
$this->assertFalse(TrinaryLogicHelper::or(false, false, false));
//Test for one argument
$this->assertTrue(TrinaryLogicHelper::or(true));
$this->assertFalse(TrinaryLogicHelper::or(false));
$this->assertNull(TrinaryLogicHelper::or(null));
}
public function testAnd(): void
{
$this->assertFalse(TrinaryLogicHelper::and(false, false));
$this->assertFalse(TrinaryLogicHelper::and(false, null));
$this->assertFalse(TrinaryLogicHelper::and(false, true));
$this->assertFalse(TrinaryLogicHelper::and(null, false));
$this->assertNull(TrinaryLogicHelper::and(null, null));
$this->assertNull(TrinaryLogicHelper::and(null, true));
$this->assertFalse(TrinaryLogicHelper::and(true, false));
$this->assertNull(TrinaryLogicHelper::and(true, null));
$this->assertTrue(TrinaryLogicHelper::and(true, true));
//Should work for longer arrays too
$this->assertFalse(TrinaryLogicHelper::and(true, true, false, null));
$this->assertFalse(TrinaryLogicHelper::and(false, false, false, false, null));
$this->assertFalse(TrinaryLogicHelper::and(false, false, false));
$this->assertNull(TrinaryLogicHelper::and(true, true, null));
$this->assertTrue(TrinaryLogicHelper::and(true, true, true));
//Test for one argument
$this->assertTrue(TrinaryLogicHelper::and(true));
$this->assertFalse(TrinaryLogicHelper::and(false));
$this->assertNull(TrinaryLogicHelper::and(null));
}
}

View file

@ -110,4 +110,17 @@ class PermissionSchemaUpdaterTest extends WebTestCase
self::assertEquals(PermissionData::INHERIT, $user->getPermissions()->getPermissionValue('projects', 'edit')); self::assertEquals(PermissionData::INHERIT, $user->getPermissions()->getPermissionValue('projects', 'edit'));
self::assertEquals(PermissionData::DISALLOW, $user->getPermissions()->getPermissionValue('projects', 'delete')); self::assertEquals(PermissionData::DISALLOW, $user->getPermissions()->getPermissionValue('projects', 'delete'));
} }
public function testUpgradeSchemaToVersion3(): void
{
$perm_data = new PermissionData();
$perm_data->setSchemaVersion(2);
$perm_data->setPermissionValue('system', 'server_infos', PermissionData::ALLOW);
$user = new TestPermissionHolder($perm_data);
//After the upgrade the server.show_updates should be set to ALLOW
self::assertTrue($this->service->upgradeSchema($user, 3));
self::assertSame(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('system', 'show_updates'));
}
} }

File diff suppressed because it is too large Load diff

View file

@ -2,13 +2,13 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="en"> <xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="en">
<file id="security.en"> <file id="security.en">
<unit id="aazoCks" name="user.login_error.user_disabled"> <unit id="aazoCks" name="user.login_error.user_disabled">
<segment state="translated"> <segment>
<source>user.login_error.user_disabled</source> <source>user.login_error.user_disabled</source>
<target>Your account is disabled! Contact an administrator if you think this is wrong.</target> <target>Your account is disabled! Contact an administrator if you think this is wrong.</target>
</segment> </segment>
</unit> </unit>
<unit id="Dpb9AmY" name="saml.error.cannot_login_local_user_per_saml"> <unit id="Dpb9AmY" name="saml.error.cannot_login_local_user_per_saml">
<segment state="translated"> <segment>
<source>saml.error.cannot_login_local_user_per_saml</source> <source>saml.error.cannot_login_local_user_per_saml</source>
<target>You cannot login as local user via SSO! Use your local user password instead.</target> <target>You cannot login as local user via SSO! Use your local user password instead.</target>
</segment> </segment>

View file

@ -37,7 +37,7 @@
<note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note> <note priority="1">Part-DB1\src\Entity\UserSystem\Group.php:0</note>
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note> <note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>part.master_attachment.must_be_picture</source> <source>part.master_attachment.must_be_picture</source>
<target>The preview attachment must be a valid picture!</target> <target>The preview attachment must be a valid picture!</target>
</segment> </segment>
@ -82,7 +82,7 @@
<note priority="1">src\Entity\StructuralDBElement.php:0</note> <note priority="1">src\Entity\StructuralDBElement.php:0</note>
<note priority="1">src\Entity\Supplier.php:0</note> <note priority="1">src\Entity\Supplier.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>structural.entity.unique_name</source> <source>structural.entity.unique_name</source>
<target>An element with this name already exists on this level!</target> <target>An element with this name already exists on this level!</target>
</segment> </segment>
@ -102,7 +102,7 @@
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note>
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>parameters.validator.min_lesser_typical</source> <source>parameters.validator.min_lesser_typical</source>
<target>Value must be lesser or equal the the typical value ({{ compared_value }}).</target> <target>Value must be lesser or equal the the typical value ({{ compared_value }}).</target>
</segment> </segment>
@ -122,7 +122,7 @@
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note>
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>parameters.validator.min_lesser_max</source> <source>parameters.validator.min_lesser_max</source>
<target>Value must be lesser than the maximum value ({{ compared_value }}).</target> <target>Value must be lesser than the maximum value ({{ compared_value }}).</target>
</segment> </segment>
@ -142,7 +142,7 @@
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\StorelocationParameter.php:0</note>
<note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\Parameters\SupplierParameter.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>parameters.validator.max_greater_typical</source> <source>parameters.validator.max_greater_typical</source>
<target>Value must be greater or equal than the typical value ({{ compared_value }}).</target> <target>Value must be greater or equal than the typical value ({{ compared_value }}).</target>
</segment> </segment>
@ -152,7 +152,7 @@
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note> <note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>validator.user.username_already_used</source> <source>validator.user.username_already_used</source>
<target>A user with this name is already exisiting</target> <target>A user with this name is already exisiting</target>
</segment> </segment>
@ -162,7 +162,7 @@
<note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note> <note category="file-source" priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
<note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note> <note priority="1">Part-DB1\src\Entity\UserSystem\User.php:0</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>user.invalid_username</source> <source>user.invalid_username</source>
<target>The username must contain only letters, numbers, underscores, dots, pluses or minuses!</target> <target>The username must contain only letters, numbers, underscores, dots, pluses or minuses!</target>
</segment> </segment>
@ -171,7 +171,7 @@
<notes> <notes>
<note category="state" priority="1">obsolete</note> <note category="state" priority="1">obsolete</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>validator.noneofitschild.self</source> <source>validator.noneofitschild.self</source>
<target>An element can not be its own parent!</target> <target>An element can not be its own parent!</target>
</segment> </segment>
@ -180,139 +180,139 @@
<notes> <notes>
<note category="state" priority="1">obsolete</note> <note category="state" priority="1">obsolete</note>
</notes> </notes>
<segment state="translated"> <segment>
<source>validator.noneofitschild.children</source> <source>validator.noneofitschild.children</source>
<target>You can not assign children element as parent (This would cause loops)!</target> <target>You can not assign children element as parent (This would cause loops)!</target>
</segment> </segment>
</unit> </unit>
<unit id="ayNr6QK" name="validator.select_valid_category"> <unit id="ayNr6QK" name="validator.select_valid_category">
<segment state="translated"> <segment>
<source>validator.select_valid_category</source> <source>validator.select_valid_category</source>
<target>Please select a valid category!</target> <target>Please select a valid category!</target>
</segment> </segment>
</unit> </unit>
<unit id="6vIlN5q" name="validator.part_lot.only_existing"> <unit id="6vIlN5q" name="validator.part_lot.only_existing">
<segment state="translated"> <segment>
<source>validator.part_lot.only_existing</source> <source>validator.part_lot.only_existing</source>
<target>Can not add new parts to this location as it is marked as "Only Existing"</target> <target>Can not add new parts to this location as it is marked as "Only Existing"</target>
</segment> </segment>
</unit> </unit>
<unit id="3xoKOIS" name="validator.part_lot.location_full.no_increase"> <unit id="3xoKOIS" name="validator.part_lot.location_full.no_increase">
<segment state="translated"> <segment>
<source>validator.part_lot.location_full.no_increase</source> <source>validator.part_lot.location_full.no_increase</source>
<target>Location is full. Amount can not be increased (new value must be smaller than {{ old_amount }}).</target> <target>Location is full. Amount can not be increased (new value must be smaller than {{ old_amount }}).</target>
</segment> </segment>
</unit> </unit>
<unit id="R6Ov4Yt" name="validator.part_lot.location_full"> <unit id="R6Ov4Yt" name="validator.part_lot.location_full">
<segment state="translated"> <segment>
<source>validator.part_lot.location_full</source> <source>validator.part_lot.location_full</source>
<target>Location is full. Can not add new parts to it.</target> <target>Location is full. Can not add new parts to it.</target>
</segment> </segment>
</unit> </unit>
<unit id="BNQk2e7" name="validator.part_lot.single_part"> <unit id="BNQk2e7" name="validator.part_lot.single_part">
<segment state="translated"> <segment>
<source>validator.part_lot.single_part</source> <source>validator.part_lot.single_part</source>
<target>This location can only contain a single part and it is already full!</target> <target>This location can only contain a single part and it is already full!</target>
</segment> </segment>
</unit> </unit>
<unit id="4gPskOG" name="validator.attachment.must_not_be_null"> <unit id="4gPskOG" name="validator.attachment.must_not_be_null">
<segment state="translated"> <segment>
<source>validator.attachment.must_not_be_null</source> <source>validator.attachment.must_not_be_null</source>
<target>You must select an attachment type!</target> <target>You must select an attachment type!</target>
</segment> </segment>
</unit> </unit>
<unit id="cDDVrWT" name="validator.orderdetail.supplier_must_not_be_null"> <unit id="cDDVrWT" name="validator.orderdetail.supplier_must_not_be_null">
<segment state="translated"> <segment>
<source>validator.orderdetail.supplier_must_not_be_null</source> <source>validator.orderdetail.supplier_must_not_be_null</source>
<target>You must select an supplier!</target> <target>You must select an supplier!</target>
</segment> </segment>
</unit> </unit>
<unit id="k5DDdB4" name="validator.measurement_unit.use_si_prefix_needs_unit"> <unit id="k5DDdB4" name="validator.measurement_unit.use_si_prefix_needs_unit">
<segment state="translated"> <segment>
<source>validator.measurement_unit.use_si_prefix_needs_unit</source> <source>validator.measurement_unit.use_si_prefix_needs_unit</source>
<target>To enable SI prefixes, you have to set a unit symbol!</target> <target>To enable SI prefixes, you have to set a unit symbol!</target>
</segment> </segment>
</unit> </unit>
<unit id="DuzIOCr" name="part.ipn.must_be_unique"> <unit id="DuzIOCr" name="part.ipn.must_be_unique">
<segment state="translated"> <segment>
<source>part.ipn.must_be_unique</source> <source>part.ipn.must_be_unique</source>
<target>The internal part number must be unique. {{ value }} is already in use!</target> <target>The internal part number must be unique. {{ value }} is already in use!</target>
</segment> </segment>
</unit> </unit>
<unit id="Z4Kuuo2" name="validator.project.bom_entry.name_or_part_needed"> <unit id="Z4Kuuo2" name="validator.project.bom_entry.name_or_part_needed">
<segment state="translated"> <segment>
<source>validator.project.bom_entry.name_or_part_needed</source> <source>validator.project.bom_entry.name_or_part_needed</source>
<target>You have to choose a part for a part BOM entry or set a name for a non-part BOM entry.</target> <target>You have to choose a part for a part BOM entry or set a name for a non-part BOM entry.</target>
</segment> </segment>
</unit> </unit>
<unit id="WF_v4ih" name="project.bom_entry.name_already_in_bom"> <unit id="WF_v4ih" name="project.bom_entry.name_already_in_bom">
<segment state="translated"> <segment>
<source>project.bom_entry.name_already_in_bom</source> <source>project.bom_entry.name_already_in_bom</source>
<target>There is already an BOM entry with this name!</target> <target>There is already an BOM entry with this name!</target>
</segment> </segment>
</unit> </unit>
<unit id="5v4p85H" name="project.bom_entry.part_already_in_bom"> <unit id="5v4p85H" name="project.bom_entry.part_already_in_bom">
<segment state="translated"> <segment>
<source>project.bom_entry.part_already_in_bom</source> <source>project.bom_entry.part_already_in_bom</source>
<target>This part already exists in the BOM!</target> <target>This part already exists in the BOM!</target>
</segment> </segment>
</unit> </unit>
<unit id="3lM32Tw" name="project.bom_entry.mountnames_quantity_mismatch"> <unit id="3lM32Tw" name="project.bom_entry.mountnames_quantity_mismatch">
<segment state="translated"> <segment>
<source>project.bom_entry.mountnames_quantity_mismatch</source> <source>project.bom_entry.mountnames_quantity_mismatch</source>
<target>The number of mountnames has to match the BOMs quantity!</target> <target>The number of mountnames has to match the BOMs quantity!</target>
</segment> </segment>
</unit> </unit>
<unit id="x47D5WT" name="project.bom_entry.can_not_add_own_builds_part"> <unit id="x47D5WT" name="project.bom_entry.can_not_add_own_builds_part">
<segment state="translated"> <segment>
<source>project.bom_entry.can_not_add_own_builds_part</source> <source>project.bom_entry.can_not_add_own_builds_part</source>
<target>You can not add a project's own builds part to the BOM.</target> <target>You can not add a project's own builds part to the BOM.</target>
</segment> </segment>
</unit> </unit>
<unit id="2x2XDI_" name="project.bom_has_to_include_all_subelement_parts"> <unit id="2x2XDI_" name="project.bom_has_to_include_all_subelement_parts">
<segment state="translated"> <segment>
<source>project.bom_has_to_include_all_subelement_parts</source> <source>project.bom_has_to_include_all_subelement_parts</source>
<target>The project BOM has to include all subprojects builds parts. Part %part_name% of project %project_name% missing!</target> <target>The project BOM has to include all subprojects builds parts. Part %part_name% of project %project_name% missing!</target>
</segment> </segment>
</unit> </unit>
<unit id="U9b1EzD" name="project.bom_entry.price_not_allowed_on_parts"> <unit id="U9b1EzD" name="project.bom_entry.price_not_allowed_on_parts">
<segment state="translated"> <segment>
<source>project.bom_entry.price_not_allowed_on_parts</source> <source>project.bom_entry.price_not_allowed_on_parts</source>
<target>Prices are not allowed on BOM entries associated with a part. Define the price on the part instead.</target> <target>Prices are not allowed on BOM entries associated with a part. Define the price on the part instead.</target>
</segment> </segment>
</unit> </unit>
<unit id="ID056SR" name="validator.project_build.lot_bigger_than_needed"> <unit id="ID056SR" name="validator.project_build.lot_bigger_than_needed">
<segment state="translated"> <segment>
<source>validator.project_build.lot_bigger_than_needed</source> <source>validator.project_build.lot_bigger_than_needed</source>
<target>You have selected more quantity to withdraw than needed! Remove unnecessary quantity.</target> <target>You have selected more quantity to withdraw than needed! Remove unnecessary quantity.</target>
</segment> </segment>
</unit> </unit>
<unit id="6hV5UqD" name="validator.project_build.lot_smaller_than_needed"> <unit id="6hV5UqD" name="validator.project_build.lot_smaller_than_needed">
<segment state="translated"> <segment>
<source>validator.project_build.lot_smaller_than_needed</source> <source>validator.project_build.lot_smaller_than_needed</source>
<target>You have selected less quantity to withdraw than needed for the build! Add additional quantity.</target> <target>You have selected less quantity to withdraw than needed for the build! Add additional quantity.</target>
</segment> </segment>
</unit> </unit>
<unit id="G9ZKt.4" name="part.name.must_match_category_regex"> <unit id="G9ZKt.4" name="part.name.must_match_category_regex">
<segment state="translated"> <segment>
<source>part.name.must_match_category_regex</source> <source>part.name.must_match_category_regex</source>
<target>The part name does not match the regular expression stated by the category: %regex%</target> <target>The part name does not match the regular expression stated by the category: %regex%</target>
</segment> </segment>
</unit> </unit>
<unit id="m8kMFhf" name="validator.attachment.name_not_blank"> <unit id="m8kMFhf" name="validator.attachment.name_not_blank">
<segment state="translated"> <segment>
<source>validator.attachment.name_not_blank</source> <source>validator.attachment.name_not_blank</source>
<target>Set a value here, or upload a file to automatically use its filename as name for the attachment.</target> <target>Set a value here, or upload a file to automatically use its filename as name for the attachment.</target>
</segment> </segment>
</unit> </unit>
<unit id="nwGaNBW" name="validator.part_lot.owner_must_match_storage_location_owner"> <unit id="nwGaNBW" name="validator.part_lot.owner_must_match_storage_location_owner">
<segment state="translated"> <segment>
<source>validator.part_lot.owner_must_match_storage_location_owner</source> <source>validator.part_lot.owner_must_match_storage_location_owner</source>
<target>The owner of this lot must match the owner of the selected storage location (%owner_name%)!</target> <target>The owner of this lot must match the owner of the selected storage location (%owner_name%)!</target>
</segment> </segment>
</unit> </unit>
<unit id="HXSz3nQ" name="validator.part_lot.owner_must_not_be_anonymous"> <unit id="HXSz3nQ" name="validator.part_lot.owner_must_not_be_anonymous">
<segment state="translated"> <segment>
<source>validator.part_lot.owner_must_not_be_anonymous</source> <source>validator.part_lot.owner_must_not_be_anonymous</source>
<target>A lot owner must not be the anonymous user!</target> <target>A lot owner must not be the anonymous user!</target>
</segment> </segment>