This commit is contained in:
2026-04-12 21:43:39 +02:00
parent 63bd1e73f2
commit f72a5019e9
27 changed files with 1791 additions and 266 deletions

View File

@@ -55,6 +55,7 @@ final class ProjectMappingController
$pattern = trim((string) $request->input('product_name_pattern', ''));
$scriptName = trim((string) $request->input('script_name', ''));
$outputDir = trim((string) $request->input('output_dir', ''));
$requiresPhoto = (string) $request->input('requires_photo', '') !== '';
if ($pattern === '' || $scriptName === '') {
Flash::set('settings_error', $this->translator->get('settings.project_mapping.flash.validation_error'));
@@ -71,6 +72,7 @@ final class ProjectMappingController
'product_name_pattern' => $pattern,
'script_name' => $scriptName,
'output_dir' => $outputDir !== '' ? $outputDir : null,
'requires_photo' => $requiresPhoto ? 1 : 0,
]);
Flash::set('settings_success', $this->translator->get('settings.project_mapping.flash.created'));
@@ -88,6 +90,7 @@ final class ProjectMappingController
$pattern = trim((string) $request->input('product_name_pattern', ''));
$scriptName = trim((string) $request->input('script_name', ''));
$outputDir = trim((string) $request->input('output_dir', ''));
$requiresPhoto = (string) $request->input('requires_photo', '') !== '';
if ($id <= 0 || $pattern === '' || $scriptName === '') {
Flash::set('settings_error', $this->translator->get('settings.project_mapping.flash.validation_error'));
@@ -98,6 +101,7 @@ final class ProjectMappingController
'product_name_pattern' => $pattern,
'script_name' => $scriptName,
'output_dir' => $outputDir !== '' ? $outputDir : null,
'requires_photo' => $requiresPhoto ? 1 : 0,
]);
Flash::set('settings_success', $this->translator->get('settings.project_mapping.flash.updated'));

View File

@@ -37,13 +37,14 @@ final class ProjectMappingRepository
public function create(array $data): int
{
$statement = $this->pdo->prepare(
'INSERT INTO project_mappings (product_name_pattern, script_name, output_dir, is_active)
VALUES (:product_name_pattern, :script_name, :output_dir, :is_active)'
'INSERT INTO project_mappings (product_name_pattern, script_name, output_dir, requires_photo, is_active)
VALUES (:product_name_pattern, :script_name, :output_dir, :requires_photo, :is_active)'
);
$statement->execute([
':product_name_pattern' => $data['product_name_pattern'],
':script_name' => $data['script_name'],
':output_dir' => $data['output_dir'] ?? null,
':requires_photo' => (int) ($data['requires_photo'] ?? 0),
':is_active' => (int) ($data['is_active'] ?? 1),
]);
@@ -56,7 +57,8 @@ final class ProjectMappingRepository
'UPDATE project_mappings
SET product_name_pattern = :product_name_pattern,
script_name = :script_name,
output_dir = :output_dir
output_dir = :output_dir,
requires_photo = :requires_photo
WHERE id = :id'
);
@@ -64,6 +66,7 @@ final class ProjectMappingRepository
':product_name_pattern' => $data['product_name_pattern'],
':script_name' => $data['script_name'],
':output_dir' => $data['output_dir'] ?? null,
':requires_photo' => (int) ($data['requires_photo'] ?? 0),
':id' => $id,
]);
}