Anpassungen aus Analyse vornehmen

Name Validierung bei Assembly Angabe in Stücklisten anpassen. permission_layout.html hinsichtlich Synonym-Ausgabe Datenquelle anpassen. Anpassung aus Analyse.
This commit is contained in:
Marcel Diegelmann 2025-07-17 10:54:44 +02:00
parent 6976ab0cc2
commit 67480f2652
5 changed files with 22 additions and 11 deletions

View file

@ -13,11 +13,16 @@
* Initializes the datatable dynamically.
*/
$.fn.initDataTables = function(config, options) {
//Update default used url, so it reflects the current location (useful on single side apps)
//CHANGED jbtronics: Preserve the get parameters (needed so we can pass additional params to query)
$.fn.initDataTables.defaults.url = window.location.origin + window.location.pathname + window.location.search;
$.fn.dataTable.ext.errMode = function(settings, helpPage, message) {
if (message.includes('ColReorder')) {
console.warn('ColReorder does not fit the number of columns', message);
}
};
var root = this,
config = $.extend({}, $.fn.initDataTables.defaults, config),
state = ''
@ -105,7 +110,6 @@
}
}
root.html(data.template);
dt = $('table', root).DataTable(dtOpts);
if (config.state !== 'none') {

View file

@ -18,7 +18,7 @@ final class Version20250304154507 extends AbstractMultiPlatformMigration
public function mySQLUp(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE parts ADD built_assembly_id INT DEFAULT NULL
ALTER TABLE parts ADD built_assembly_id INT DEFAULT NULL AFTER build_project_id
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE parts ADD CONSTRAINT FK_6940A7FECC660B3C FOREIGN KEY (built_assembly_id) REFERENCES assemblies (id)

View file

@ -127,6 +127,8 @@ class AssemblyBomEntriesDataTable implements DataTableTypeInterface
'render' => function ($value, AssemblyBOMEntry $context) {
if($context->getPart() instanceof Part) {
return $context->getPart()->getIpn();
} elseif($context->getReferencedAssembly() instanceof Assembly) {
return $context->getReferencedAssembly()->getIpn();
}
return '';

View file

@ -106,7 +106,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
/**
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
*/
#[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.assembly.bom_entry.name_or_part_needed')]
#[Assert\Expression('this.getPart() !== null or this.getReferencedAssembly() !== null or this.getName() !== null', message: 'validator.assembly.bom_entry.name_or_part_needed')]
#[ORM\Column(type: Types::STRING, nullable: true)]
#[Groups(['bom_entry:read', 'bom_entry:write', 'import', 'simple', 'extended', 'full'])]
protected ?string $name = null;
@ -206,7 +206,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
*/
public function getName(): ?string
{
return $this->name;
return trim($this->name ?? '') === '' ? null : $this->name;
}
/**
@ -214,7 +214,7 @@ class AssemblyBOMEntry extends AbstractDBElement implements UniqueValidatableInt
*/
public function setName(?string $name): AssemblyBOMEntry
{
$this->name = $name;
$this->name = trim($name ?? '') === '' ? null : $name;
return $this;
}

View file

@ -7,15 +7,15 @@
<input type="checkbox" class="form-check-input tristate permission-checkbox permission_multicheckbox" id="mulit_check_{{ form.vars.label }}">
<label class="form-check-label" for="mulit_check_{{ form.vars.label }}">
{% set dataSource = '' %}
{% if (form.vars.label == 'perm.categories') %}
{% if (form.vars.label == 'perm.part.categories') %}
{% set dataSource = 'category' %}
{% elseif (form.vars.label == 'perm.storelocations') %}
{% set dataSource = 'storagelocation' %}
{% elseif (form.vars.label == 'perm.footprints') %}
{% elseif (form.vars.label == 'perm.part.footprints') %}
{% set dataSource = 'footprint' %}
{% elseif (form.vars.label == 'perm.manufacturers') %}
{% elseif (form.vars.label == 'perm.part.manufacturers') %}
{% set dataSource = 'manufacturer' %}
{% elseif (form.vars.label == 'perm.suppliers') %}
{% elseif (form.vars.label == 'perm.part.supplier') %}
{% set dataSource = 'supplier' %}
{% elseif (form.vars.label == 'perm.projects') %}
{% set dataSource = 'project' %}
@ -25,7 +25,12 @@
{% set dataSourceName = get_data_source_name(dataSource, form.vars.label) %}
{% set translatedSource = form.vars.label|trans %}
{% if dataSourceName != translatedSource %}<b>{{ 'datasource.synonym'|trans({'%name%': translatedSource ~ '<br>', '%synonym%': dataSourceName})|raw }}{% else %}{{ translatedSource }}</b>{% endif %}
{% if dataSourceName != translatedSource %}
{{ translatedSource }}
<i class="fas fa-fw fa-info" title="{{ 'datasource.synonym'|trans({'%name%': '', '%synonym%': dataSourceName })|raw }}"></i>
{% else %}
{{ translatedSource }}
{% endif %}
</label>
</div>