Skip to content

Commit

Permalink
Add and fix build chain
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 26, 2024
1 parent 588baeb commit f8fee44
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push: ~
pull_request: ~

permissions: read-all

jobs:
ci:
uses: 'terminal42/contao-build-tools/.github/workflows/build-tools.yml@main'
6 changes: 3 additions & 3 deletions assets/styles/leads.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#tl_navigation .group-leads {
background: url(../images/inbox.svg) 3px 2px no-repeat;
background: url('../images/inbox.svg') 3px 2px no-repeat;
background-size: 14px 14px;
}

#tl_buttons .leads_export__csv,
#tl_buttons .leads_export__excel_csv {
background-image: url(../images/export_csv.png) !important;
background-image: url('../images/export_csv.png') !important;
}

#tl_buttons .leads_export__xls,
#tl_buttons .leads_export__xlsx {
background-image: url(../images/export_excel.png) !important;
background-image: url('../images/export_excel.png') !important;
}

table.multicolumnwizard td.column_display div {
Expand Down
11 changes: 11 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;

return (new Configuration())
// Optional integrations
->ignoreErrorsOnPackage('dompdf/dompdf', [ErrorType::DEV_DEPENDENCY_IN_PROD])
->ignoreErrorsOnPackage('mpdf/mpdf', [ErrorType::DEV_DEPENDENCY_IN_PROD])
->ignoreErrorsOnPackage('tecnickcom/tcpdf', [ErrorType::DEV_DEPENDENCY_IN_PROD])
;
29 changes: 27 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,28 @@
"contao/core-bundle": "^4.13 || ^5.0",
"codefog/contao-haste": "^5.0",
"menatwork/contao-multicolumnwizard-bundle": "^3.6",
"phpoffice/phpspreadsheet": "^1.26"
"phpoffice/phpspreadsheet": "^1.26",
"doctrine/dbal": "^3.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/asset": "^5.0 || ^6.0 || ^7.0",
"symfony/config": "^5.0 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0",
"symfony/event-dispatcher-contracts": "^2.0 || ^3.0",
"symfony/expression-language": "^5.0 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.0 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0",
"symfony/http-foundation": "^5.0 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.0 || ^6.0 || ^7.0",
"symfony/routing": "^5.0 || ^6.0 || ^7.0",
"symfony/security-core": "^5.0 || ^6.0 || ^7.0",
"symfony/translation-contracts": "^2.0 || ^3.0"
},
"require-dev": {
"contao/manager-plugin": "^2.0",
"terminal42/contao-build-tools": "dev-main"
"terminal42/contao-build-tools": "dev-main",
"tecnickcom/tcpdf": "^6.5",
"dompdf/dompdf": "^1.0 || ^2.0",
"mpdf/mpdf": "^8.1.1"
},
"suggest": {
"tecnickcom/tcpdf": "Export leads to PDF document (using TCPDF)",
Expand All @@ -51,5 +68,13 @@
},
"extra": {
"contao-manager-plugin": "Terminal42\\LeadsBundle\\ContaoManager\\Plugin"
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"php-http/discovery": false,
"contao/manager-plugin": false,
"terminal42/contao-build-tools": true
}
}
}
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
ignoreErrors:
- '#no value type specified in iterable type array#'
2 changes: 1 addition & 1 deletion src/Cron/PurgeCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __invoke(): void
}

if (null !== $this->contaoCronLogger) {
$this->contaoCronLogger->info(sprintf('Purged %s leads from %s forms.', $deleted, \count($forms)));
$this->contaoCronLogger->info(\sprintf('Purged %s leads from %s forms.', $deleted, \count($forms)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DataContainer/ExportAccessListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Contao\Input;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

#[AsCallback('tl_lead_export', 'config.onload')]
class ExportAccessListener
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DataContainer/ExportButtonsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __invoke(array $buttons): array
$this->export($config, $request->request->all('IDS'));
}

$buttons['export_'.$config['id']] = sprintf(
$buttons['export_'.$config['id']] = \sprintf(
'<button type="submit" name="export_%s" id="export_%s" class="tl_submit" value="1">%s</button>',
$config['id'],
$config['id'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __invoke(): void
$operations[] = [
'label' => $config['name'],
'class' => 'leads_export__'.$config['type'],
'button_callback' => fn ($href, $label, $title, $class, $attributes) => sprintf(
'button_callback' => fn ($href, $label, $title, $class, $attributes) => \sprintf(
'<a href="%s" class="%s" title="%s" %s>%s</a> ',
$this->urlGenerator->generate('terminal42_leads_export', ['id' => $config['id']]),
$class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function getMainFormFields(string $action, int $id, int $mainFormId): ar
$options = [];

foreach ($qb->fetchAllAssociative() as $field) {
$options[$field['id']] = empty($field['label']) ? $field['name'] : sprintf('%s (%s)', $field['label'], $field['name']);
$options[$field['id']] = empty($field['label']) ? $field['name'] : \sprintf('%s (%s)', $field['label'], $field['name']);
}

return $options;
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DataContainer/LeadAccessListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Doctrine\DBAL\Connection;
use Symfony\Component\Asset\Packages;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

#[AsCallback('tl_lead', 'config.onload')]
#[AsCallback('tl_lead_data', 'config.onload')]
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/DataContainer/LeadLabelListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ private function formatToken(string $title, int|string $value): string
return (string) $value;
}

return sprintf('%s [%s]', $title, $value);
return \sprintf('%s [%s]', $title, $value);
}
}
2 changes: 1 addition & 1 deletion src/EventListener/ProcessFormDataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Contao\Validator;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Terminal42\LeadsBundle\Event\FormDataLabelEvent;
use Terminal42\LeadsBundle\Event\FormDataValueEvent;
Expand Down
6 changes: 3 additions & 3 deletions src/Export/AbstractExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function iterateRows(bool $skipHeaders = false): \Generator
foreach ($columns as $column) {
$col = empty($column['targetColumn']) ? $i : $column['targetColumn'];
$row[$col] = $column['name'];
$i++;
++$i;
}

yield $row;
Expand Down Expand Up @@ -367,13 +367,13 @@ protected function getOutput(string $value, string $label, string $format): stri

case self::OUTPUT_BOTH:
if ('' !== $label && '' !== $value && $label !== $value) {
return sprintf('%s [%s]', $label, $value);
return \sprintf('%s [%s]', $label, $value);
}

return '' === $value ? $label : $value;
}

throw new \RuntimeException(sprintf('Unknown output format "%s"', $format));
throw new \RuntimeException(\sprintf('Unknown output format "%s"', $format));
}

protected function format(mixed $value, string $type): int|string
Expand Down
2 changes: 1 addition & 1 deletion src/Export/PhpSpreadsheetExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function generateSpreadsheet(): Spreadsheet
$config = $this->getConfig();

if ($config['useTemplate']) {
$template = FilesModel::findByPk($config['template']);
$template = FilesModel::findById($config['template']);

if (null === $template) {
throw new \RuntimeException('Could not find export template.');
Expand Down

0 comments on commit f8fee44

Please sign in to comment.