Explorar el Código

Merge branch 'develop'

master
Guillaume Bourgeois hace 1 mes
padre
commit
0792af3da0
Se han modificado 4 ficheros con 45 adiciones y 5 borrados
  1. +2
    -0
      backend/views/producer/update.php
  2. +26
    -0
      console/migrations/m240912_071102_add_column_producer_export_shopping_cart_labels_pdf_in_cart_label_specific_format.php
  3. +15
    -5
      domain/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php
  4. +2
    -0
      domain/Producer/Producer/Producer.php

+ 2
- 0
backend/views/producer/update.php Ver fichero

@@ -336,6 +336,8 @@ $this->addBreadcrumb($this->getTitle());
<?php if($featureChecker->isEnabled(Feature::ALIAS_EXPORT_SHOPPING_CART_LABELS_ADVANCED)): ?>
<?= $form->field($model, 'export_shopping_cart_labels_format')
->dropDownList($distributionExportManager->getGenerator(ExportManager::SHOPPING_CART_LABELS_PDF)->populateDropdownSpecificFormats()); ?>
<?= $form->field($model, 'export_shopping_cart_labels_pdf_in_cart_label_specific_format')
->dropDownList(Dropdown::noYesChoices()); ?>
<?php else: ?>
<?= $form->field($model, 'export_shopping_cart_labels_number_per_column')
->dropDownList(Dropdown::numberChoices(1, 20)); ?>

+ 26
- 0
console/migrations/m240912_071102_add_column_producer_export_shopping_cart_labels_pdf_in_cart_label_specific_format.php Ver fichero

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240912_071102_add_column_producer_export_shopping_cart_labels_pdf_in_cart_label_specific_format
*/
class m240912_071102_add_column_producer_export_shopping_cart_labels_pdf_in_cart_label_specific_format extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'export_shopping_cart_labels_pdf_in_cart_label_specific_format', Schema::TYPE_BOOLEAN);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'export_shopping_cart_labels_pdf_in_cart_label_specific_format');
}
}

+ 15
- 5
domain/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php Ver fichero

@@ -17,6 +17,7 @@ use yii\base\ErrorException;
class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator implements DistributionExportGeneratorInterface
{
const FORMAT_70_42 = '70x42';
const FORMAT_100_150 = '100x150';

protected ProducerSolver $producerSolver;
protected OrderRepository $orderRepository;
@@ -36,7 +37,8 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
public function getSpecificFormatDetailsArray(): array
{
return [
self::FORMAT_70_42 => [70, 42]
self::FORMAT_70_42 => [70, 42],
self::FORMAT_100_150 => [100, 150],
];
}

@@ -69,10 +71,11 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
]);

if($isSpecificFormat) {
$pdf = $this->getPdf($distribution, $content, true, $specificFormatWidth, $specificFormatHeight);
$pdfInCartLabelSpecificFormat = $this->producerSolver->getConfig('export_shopping_cart_labels_pdf_in_cart_label_specific_format');
$pdf = $this->getPdf($distribution, $content, $pdfInCartLabelSpecificFormat, true, $specificFormatWidth, $specificFormatHeight);
}
else {
$pdf = $this->getPdf($distribution, $content, false);
$pdf = $this->getPdf($distribution, $content, false, false);
$pdf->getApi()->SetColumns(4);
$pdf->getApi()->keepColumns = true;
}
@@ -80,11 +83,18 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
return $pdf->render();
}

public function getPdf(Distribution $distribution, string $content, bool $isSpecificFormat, float $specificFormatWidth = 0, float $specificFormatHeight = 0)
public function getPdf(Distribution $distribution, string $content, bool $pdfInCartLabelSpecificFormat, bool $isSpecificFormat, float $specificFormatWidth = 0, float $specificFormatHeight = 0)
{
if($pdfInCartLabelSpecificFormat) {
$format = [$specificFormatWidth, $specificFormatHeight];
}
else {
$format = Pdf::FORMAT_A4;
}

return new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'format' => $format,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_BROWSER,
'filename' => \Yii::getAlias(

+ 2
- 0
domain/Producer/Producer/Producer.php Ver fichero

@@ -311,6 +311,7 @@ class Producer extends ActiveRecordCommon
'option_leave_period_message_display',
'sponsorship_sponsor_reward',
'sponsorship_godson_reward',
'export_shopping_cart_labels_pdf_in_cart_label_specific_format'
],
'boolean'
],
@@ -527,6 +528,7 @@ class Producer extends ActiveRecordCommon
'option_document_width_logo' => 'Largeur du logo dans les documents',
'export_shopping_cart_labels_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne",
'export_shopping_cart_labels_format' => 'Étiquettes (PDF) : format',
'export_shopping_cart_labels_pdf_in_cart_label_specific_format' => 'Étiquettes (PDF) : PDF au format d\'étiquette spécifique',
'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme",
'id_user_group_default' => "Groupe utilisateur par défaut attribué à l'inscription",
'option_check_by_default_prevent_user_credit' => "Par défaut, prévenir l'utilisateur quand on crédite sa cagnotte",

Cargando…
Cancelar
Guardar