diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1be7ac7..1c6e417 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -55,6 +55,9 @@ jobs: - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} + - name: Composer allow plugins + run: composer config -g allow-plugins true + - run: make install - run: make test.composer diff --git a/Makefile b/Makefile index 646a828..7fd3655 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ ${APP_DIR}/node_modules: yarn.install application: .php-version php.ini ${APP_DIR} setup_application ${APP_DIR}/docker-compose.yaml ${APP_DIR}: - (${COMPOSER} create-project --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard="${SYLIUS_VERSION}" ${APP_DIR}) + (${COMPOSER} create-project --no-interaction --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard="${SYLIUS_VERSION}" ${APP_DIR}) setup_application: rm -f ${APP_DIR}/yarn.lock @@ -73,7 +73,8 @@ setup_application: $(MAKE) apply_dist $(MAKE) ${APP_DIR}/.php-version $(MAKE) ${APP_DIR}/php.ini - (cd ${APP_DIR} && ${COMPOSER} install) + cd ${APP_DIR} && ${COMPOSER} install --no-interaction + cd ${APP_DIR} && ${COMPOSER} symfony:recipes:install --no-interaction ${APP_DIR}/docker-compose.yaml: rm -f ${APP_DIR}/docker-compose.yml diff --git a/composer.json b/composer.json index 6e4b913..0a76a88 100644 --- a/composer.json +++ b/composer.json @@ -72,5 +72,13 @@ "branch-alias": { "dev-master": "1.0-dev" } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "symfony/thanks": true, + "ergebnis/composer-normalize": true, + "symfony/flex": true + } } } diff --git a/src/Controller/Admin/ExportController.php b/src/Controller/Admin/ExportController.php index 5bd38b9..6ee9f29 100644 --- a/src/Controller/Admin/ExportController.php +++ b/src/Controller/Admin/ExportController.php @@ -14,6 +14,7 @@ namespace MonsieurBiz\SyliusColishipPlugin\Controller\Admin; use MonsieurBiz\SyliusColishipPlugin\Exporter\ExporterInterface; +use MonsieurBiz\SyliusSettingsPlugin\Settings\SettingsInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -21,6 +22,7 @@ final class ExportController extends AbstractController { public function exportAction( + SettingsInterface $colishipSettings, ChannelRepositoryInterface $channelRepository, ExporterInterface $colishipExporter, string $channelCode @@ -29,6 +31,10 @@ public function exportAction( throw $this->createNotFoundException('Channel not found'); } + $locale = $colishipSettings->getCurrentValue($channel, null, 'exportLocale'); + if (!empty($locale)) { + setlocale(\LC_CTYPE, $locale); + } $file = $colishipExporter->exportToFile($channel); return new StreamedResponse( diff --git a/src/Form/SettingsType.php b/src/Form/SettingsType.php index e501d14..990a565 100644 --- a/src/Form/SettingsType.php +++ b/src/Form/SettingsType.php @@ -19,6 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -95,6 +96,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'multiple' => true, 'choices' => $this->fmtDirectory->getValues(), ]) + ->addWithDefaultCheckbox($builder, 'exportLocale', TextType::class, [ + 'required' => false, + 'label' => 'monsieurbiz_coliship.admin.settings.export_locale', + ]) ; } } diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index d698f6c..05ec2df 100644 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -13,10 +13,11 @@ monsieurbiz_coliship: actions: export: Coliship Export download_fmt: Download the FMT file - settings: - method_code_deprecated: 'Method code (Deprecated, use Method Codes instead)' shipping_method: header: 'Coliship configuration for Shipping Method' + settings: + export_locale: 'Locale used to convert the export file' + method_code_deprecated: 'Method code (Deprecated, use Method Codes instead)' form: address: service: Service diff --git a/src/Resources/translations/messages.fr.yml b/src/Resources/translations/messages.fr.yml index b4a42da..8209115 100644 --- a/src/Resources/translations/messages.fr.yml +++ b/src/Resources/translations/messages.fr.yml @@ -13,10 +13,11 @@ monsieurbiz_coliship: actions: export: Export Coliship download_fmt: Télécharger le fichier FMT - settings: - method_code_deprecated: 'Method code (Déprécié, utiliser Method Codes)' shipping_method: header: 'Paramètres Coliship du mode de livraison' + settings: + export_locale: 'Locale à utiliser dans le fichier d''export' + method_code_deprecated: 'Method code (Déprécié, utiliser Method Codes)' form: address: service: Service