Browse Source

[Administration] Documents : logo et nom/adresse du producteur sur la même ligne #1394

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
80918a779f
9 changed files with 245 additions and 197 deletions
  1. +6
    -6
      backend/views/document/_download_product_line.php
  2. +29
    -20
      backend/views/document/download.php
  3. +1
    -1
      backend/views/producer/update.php
  4. +57
    -44
      backend/web/css/document/download.css
  5. +121
    -103
      backend/web/sass/document/download.scss
  6. +0
    -13
      common/logic/Document/Document/Service/DocumentManager.php
  7. +2
    -2
      common/logic/Producer/Producer/Model/Producer.php
  8. +3
    -8
      common/logic/Producer/Producer/Service/ProducerSolver.php
  9. +26
    -0
      console/migrations/m231108_092151_rename_column_producer_option_document_height_logo.php

+ 6
- 6
backend/views/document/_download_product_line.php View File

?> ?>


<tr class="<?php if(isset($displayOrders) && $displayOrders): ?>order<?php endif; ?>"> <tr class="<?php if(isset($displayOrders) && $displayOrders): ?>order<?php endif; ?>">
<td class="align-left">
<td class="align-left column-product">
<?php if($productOrder->product): ?> <?php if($productOrder->product): ?>
<?= Html::encode($productOrder->product->name) ?> <?= Html::encode($productOrder->product->name) ?>
<?php endif; ?> <?php endif; ?>
?> ?>


<?php if($displayPrices): ?> <?php if($displayPrices): ?>
<td class="align-center">
<td class="align-center column-unit-price">
<?= Price::format($price, $documentPriceDecimals) ?> <?= Price::format($price, $documentPriceDecimals) ?>
</td> </td>
<?php endif; ?> <?php endif; ?>
<td class="align-center">
<td class="align-center column-quantity">
<?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?> <?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?>
</td> </td>
<td class="align-center"><?= $productModule->getSolver()->strUnit($productOrder->product, 'wording') ?></td>
<td class="align-center column-unit"><?= $productModule->getSolver()->strUnit($productOrder->product, 'wording') ?></td>
<?php if($displayPrices): ?> <?php if($displayPrices): ?>
<?php if($producer->taxRate->value != 0): ?> <?php if($producer->taxRate->value != 0): ?>
<td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td>
<td class="align-center column-tax-rate"><?= $productOrder->taxRate->value * 100 ?> %</td>
<?php endif; ?> <?php endif; ?>
<td class="align-center">
<td class="align-center column-price">
<?php if($documentModule->getClass($document) == ''): ?> <?php if($documentModule->getClass($document) == ''): ?>
<?= Price::format($price * $productOrder->quantity) ?> <?= Price::format($price * $productOrder->quantity) ?>
<?php else: ?> <?php else: ?>

+ 29
- 20
backend/views/document/download.php View File

<div id="block-addresses"> <div id="block-addresses">
<div class="producer"> <div class="producer">
<?php if (strlen($producer->logo)) : ?> <?php if (strlen($producer->logo)) : ?>
<div class="logo">
<?php $optionDocumentHeightLogo = $producerModule->getSolver()->getConfig('option_document_height_logo'); ?>
<img style="height: <?= $optionDocumentHeightLogo ?: 100; ?>px;" src="<?= $producerModule->getUrlLogo($producer) ?>"/>
<?php $optionDocumentWidthLogo = $producerModule->getSolver()->getConfig('option_document_width_logo'); ?>
<div class="logo" style="width: <?= $optionDocumentWidthLogo ?: 100; ?>px;">
<img src="<?= $producerModule->getUrlLogo($producer) ?>"/>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="address"> <div class="address">
<?= $producerModule->getFullAddress($producer, true); ?>
<?= $producerModule->getFullAddressAsHtml($producer); ?>
</div> </div>
<?php if (strlen($producer->document_infos_top)): ?> <?php if (strlen($producer->document_infos_top)): ?>
<div class="infos-top"> <div class="infos-top">
</div> </div>
</div> </div>


<?php if($documentModule->getSolver()->isStatusDraft($document)): ?>
<div class="block-is-draft">
<?= $documentModule->getType($document); ?> non
validé<?= ($documentModule->getType($document) == 'Facture') ? 'e' : '' ?></div>
<?php endif; ?>

<div id="block-infos-document"> <div id="block-infos-document">
<div class="type">
<strong><?= $documentModule->getType($document); ?></strong>
</div>
<div class="date"> <div class="date">
Le <?= strftime('%d %B %Y', strtotime($document->date)) ?>
<strong>Date : </strong>
<?= strftime('%d %B %Y', strtotime($document->date)) ?>
</div> </div>
<?php if (strlen($document->reference)) : ?>
<div class="reference"> <div class="reference">
<?php if (strlen($document->reference)) : ?>
<?= $documentModule->getType($document); ?> N°<?= $document->reference; ?>
<?php else: ?>
<div class="block-is-draft"><?= $documentModule->getType($document); ?> non
validé<?= ($documentModule->getType($document) == 'Facture') ? 'e' : '' ?></div>
<?php endif; ?>
<strong>Référence : </strong>
<?= $document->reference; ?>
</div> </div>
<?php endif; ?>
<div class="name"> <div class="name">
<strong>Libellé : </strong><?= $document->name; ?>
<strong>Libellé : </strong>
<?= $document->name; ?>
</div> </div>
<?php if (strlen($document->comment)): ?>
<div class="comment">
<br>
<strong>Commentaire</strong><br>
<?= Html::encode($document->comment) ?>
</div>
<?php endif; ?>
</div> </div>


<?php if (strlen($document->comment)): ?>
<div class="block-infos">
<strong>Commentaire</strong><br/>
<?= Html::encode($document->comment) ?>
</div>
<?php endif; ?>

<div id="block-products"> <div id="block-products">
<?php if (count($document->orders) > 0) : ?> <?php if (count($document->orders) > 0) : ?>
<table class="table table-bordered"> <table class="table table-bordered">
$fieldProducerDocumentInfo = 'document_infos_' . str_replace('deliverynote', 'delivery_note', strtolower($documentModule->getClass($document))); ?> $fieldProducerDocumentInfo = 'document_infos_' . str_replace('deliverynote', 'delivery_note', strtolower($documentModule->getClass($document))); ?>
<?php if (strlen($producer->$fieldProducerDocumentInfo)): ?> <?php if (strlen($producer->$fieldProducerDocumentInfo)): ?>
<div class="block-infos"> <div class="block-infos">
<strong>Informations</strong><br/>
<strong>Informations générales</strong><br/>
<?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?> <?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
</div> </div>
<?php endif; ?> <?php endif; ?>

+ 1
- 1
backend/views/producer/update.php View File

0 => 'Non', 0 => 'Non',
1 => 'Oui' 1 => 'Oui'
]); ?> ]); ?>
<?= $form->field($model, 'option_document_height_logo')
<?= $form->field($model, 'option_document_width_logo')
->dropDownList(Dropdown::numberChoices(50, 250, true, 'px', 50)); ?> ->dropDownList(Dropdown::numberChoices(50, 250, true, 'px', 50)); ?>
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList(Dropdown::noYesChoices()); ?> <?= $form->field($model, 'document_display_orders_invoice')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'document_display_orders_delivery_note')->dropDownList(Dropdown::noYesChoices()); ?> <?= $form->field($model, 'document_display_orders_delivery_note')->dropDownList(Dropdown::noYesChoices()); ?>

+ 57
- 44
backend/web/css/document/download.css View File

/* line 5, ../../sass/document/download.scss */
/* line 4, ../../sass/document/download.scss */
body { body {
padding-bottom: 200px; padding-bottom: 200px;
} }


/* line 9, ../../sass/document/download.scss */
/* line 8, ../../sass/document/download.scss */
.document-download { .document-download {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
/* line 14, ../../sass/document/download.scss */ /* line 14, ../../sass/document/download.scss */
.document-download #block-addresses {
margin-bottom: 30px;
}
/* line 17, ../../sass/document/download.scss */
.document-download #block-addresses .producer { .document-download #block-addresses .producer {
margin-bottom: 15px;
text-align: left; text-align: left;
margin-bottom: 5px;
line-height: 21px;
} }
/* line 18, ../../sass/document/download.scss */
/* line 22, ../../sass/document/download.scss */
.document-download #block-addresses .producer .logo { .document-download #block-addresses .producer .logo {
margin-bottom: 20px;
float: left;
padding-right: 25px;
} }
/* line 26, ../../sass/document/download.scss */
.document-download #block-addresses .user {
text-align: right;
}
/* line 31, ../../sass/document/download.scss */
.document-download #block-infos-document {
padding-top: 15px;
/* line 27, ../../sass/document/download.scss */
.document-download #block-addresses .producer .name {
font-weight: bold;
font-size: 18px;
margin-bottom: 8px;
} }
/* line 34, ../../sass/document/download.scss */ /* line 34, ../../sass/document/download.scss */
.document-download #block-infos-document .date {
padding-bottom: 10px;
}
/* line 37, ../../sass/document/download.scss */
.document-download #block-infos-document .reference {
padding-bottom: 10px;
font-size: 15px;
font-weight: bold;
.document-download #block-addresses .user {
text-align: right;
} }
/* line 42, ../../sass/document/download.scss */
.document-download #block-infos-document .reference .block-is-draft {
border: solid 2px black;
/* line 39, ../../sass/document/download.scss */
.document-download .block-is-draft {
padding: 10px; padding: 10px;
margin-bottom: 15px;
text-transform: uppercase; text-transform: uppercase;
border: solid 1px black;
}
/* line 46, ../../sass/document/download.scss */
.document-download #block-infos-document {
padding: 10px;
margin-bottom: 15px;
font-size: 11px;
line-height: 18px;
background-color: #efefef;
} }
/* line 53, ../../sass/document/download.scss */ /* line 53, ../../sass/document/download.scss */
.document-download #block-infos-document .type {
text-transform: uppercase;
padding-bottom: 10px;
}
/* line 59, ../../sass/document/download.scss */
.document-download #block-no-product { .document-download #block-no-product {
padding: 10px;
margin-bottom: 15px;
font-weight: bold; font-weight: bold;
border: solid 2px black; border: solid 2px black;
text-transform: uppercase; text-transform: uppercase;
padding: 10px;
} }
/* line 60, ../../sass/document/download.scss */
/* line 67, ../../sass/document/download.scss */
.document-download #block-products { .document-download #block-products {
padding-top: 20px;
margin-bottom: 15px;
} }
/* line 63, ../../sass/document/download.scss */
/* line 70, ../../sass/document/download.scss */
.document-download #block-products table { .document-download #block-products table {
width: 100%; width: 100%;
padding: 0px; padding: 0px;
border-right: solid 1px #c0c0c0; border-right: solid 1px #c0c0c0;
border-collapse: collapse; border-collapse: collapse;
} }
/* line 71, ../../sass/document/download.scss */
/* line 78, ../../sass/document/download.scss */
.document-download #block-products table td, .document-download #block-products table th { .document-download #block-products table td, .document-download #block-products table th {
padding: 2px 5px; padding: 2px 5px;
border-top: solid 1px #c0c0c0; border-top: solid 1px #c0c0c0;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px; font-size: 12px;
} }
/* line 78, ../../sass/document/download.scss */
/* line 85, ../../sass/document/download.scss */
.document-download #block-products table td.align-left, .document-download #block-products table th.align-left { .document-download #block-products table td.align-left, .document-download #block-products table th.align-left {
text-align: left; text-align: left;
} }
/* line 81, ../../sass/document/download.scss */
/* line 89, ../../sass/document/download.scss */
.document-download #block-products table td.align-center, .document-download #block-products table th.align-center { .document-download #block-products table td.align-center, .document-download #block-products table th.align-center {
text-align: center; text-align: center;
} }
/* line 84, ../../sass/document/download.scss */
/* line 93, ../../sass/document/download.scss */
.document-download #block-products table td.align-right, .document-download #block-products table th.align-right { .document-download #block-products table td.align-right, .document-download #block-products table th.align-right {
text-align: right; text-align: right;
} }
/* line 89, ../../sass/document/download.scss */
/* line 98, ../../sass/document/download.scss */
.document-download #block-products table td { .document-download #block-products table td {
font-size: 11px; font-size: 11px;
} }
/* line 95, ../../sass/document/download.scss */
/* line 105, ../../sass/document/download.scss */
.document-download #block-products table td.column-unit-price, .document-download #block-products table td.column-quantity, .document-download #block-products table td.column-unit, .document-download #block-products table td.column-tax-rate, .document-download #block-products table td.column-price {
width: 70px;
}
/* line 116, ../../sass/document/download.scss */
.document-download .block-infos { .document-download .block-infos {
margin-top: 20px;
padding: 10px;
margin-bottom: 15px;
border: solid 1px #c0c0c0; border: solid 1px #c0c0c0;
padding: 10px;
background-color: transparent;
font-size: 11px;
} }
/* line 100, ../../sass/document/download.scss */
/* line 123, ../../sass/document/download.scss */
.document-download .block-infos strong { .document-download .block-infos strong {
font-size: 12px; font-size: 12px;
} }


/* line 106, ../../sass/document/download.scss */
/* line 129, ../../sass/document/download.scss */
#footer { #footer {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center; text-align: center;
padding-top: 10px; padding-top: 10px;
border-top: solid 1px gray; border-top: solid 1px gray;
} }
/* line 112, ../../sass/document/download.scss */
/* line 135, ../../sass/document/download.scss */
#footer .infos-bottom { #footer .infos-bottom {
padding-bottom: 20px;
margin-bottom: 40px;
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
} }
/* line 118, ../../sass/document/download.scss */
#footer .reference-document {
font-weight: bold;
}

+ 121
- 103
backend/web/sass/document/download.scss View File


$font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif ;
$border-color: #c0c0c0 ;
$font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
$border-color: #c0c0c0;


body { body {
padding-bottom: 200px ;
padding-bottom: 200px;
} }


.document-download { .document-download {
font-family: $font-family ;

#block-addresses {

.producer {
text-align: left ;
margin-bottom: 5px ;

.logo {
margin-bottom: 20px ;

}
.address {

}
}
.user {
text-align: right ;
}
$margin-bottom-block: 15px;
$padding-block: 10px;

font-family: $font-family;

#block-addresses {
margin-bottom: 2*$margin-bottom-block;

.producer {
margin-bottom: $margin-bottom-block;
text-align: left;
line-height: 21px;

.logo {
float: left;
padding-right: 25px;
}

.name {
font-weight: bold;
font-size: 18px;
margin-bottom: 8px;
}
}

.user {
text-align: right;
}
}

.block-is-draft {
padding: $padding-block;
margin-bottom: $margin-bottom-block;
text-transform: uppercase;
border: solid 1px black;
}

#block-infos-document {
padding: $padding-block;
margin-bottom: $margin-bottom-block;
font-size: 11px;
line-height: 18px;
background-color: #efefef;

.type {
text-transform: uppercase;
padding-bottom: 10px;
}
}

#block-no-product {
padding: $padding-block;
margin-bottom: $margin-bottom-block;
font-weight: bold;
border: solid 2px black;
text-transform: uppercase;
}

#block-products {
margin-bottom: $margin-bottom-block;

table {
width: 100%;
padding: 0px;
margin: 0px;
border-bottom: solid 1px $border-color;
border-right: solid 1px $border-color;
border-collapse: collapse;

td, th {
padding: 2px 5px;
border-top: solid 1px $border-color;
border-left: solid 1px $border-color;
font-family: $font-family;
font-size: 12px;

&.align-left {
text-align: left;
} }


#block-infos-document {
padding-top: 15px ;

.date {
padding-bottom: 10px ;
}
.reference {
padding-bottom: 10px ;
font-size: 15px ;
font-weight: bold ;

.block-is-draft {
border: solid 2px black ;
padding: 10px ;
text-transform: uppercase ;
}
}
.name {

}
&.align-center {
text-align: center;
} }


#block-no-product {
font-weight: bold ;
border: solid 2px black ;
text-transform: uppercase ;
padding: 10px ;
&.align-right {
text-align: right;
} }
}


#block-products {
padding-top: 20px ;

table {
width: 100% ;
padding: 0px ;
margin: 0px ;
border-bottom: solid 1px $border-color ;
border-right: solid 1px $border-color ;
border-collapse: collapse ;

td, th {
padding: 2px 5px;
border-top: solid 1px $border-color ;
border-left: solid 1px $border-color ;
font-family: $font-family ;
font-size: 12px;

&.align-left {
text-align: left ;
}
&.align-center {
text-align: center ;
}
&.align-right {
text-align: right ;
}
}

td {
font-size: 11px;
}
}
}
td {
font-size: 11px;


.block-infos {
margin-top: 20px ;
padding: 10px ;
border: solid 1px $border-color ;
&.column-product {
}


strong {
font-size: 12px ;
}
&.column-unit-price,
&.column-quantity,
&.column-unit,
&.column-tax-rate,
&.column-price {
width: 70px;
} }
}
}
}

.block-infos {
margin-bottom: $margin-bottom-block;
border: solid 1px $border-color;
padding: $padding-block;
background-color: transparent;
font-size: 11px;

strong {
font-size: 12px;
}
}
} }


#footer { #footer {
font-family: $font-family ;
text-align: center ;
padding-top: 10px ;
border-top: solid 1px gray ;

.infos-bottom {
padding-bottom: 20px ;
margin-bottom: 40px ;
font-size: 12px ;
line-height: 18px ;
}
.reference-document {
font-weight: bold ;
}
font-family: $font-family;
text-align: center;
padding-top: 10px;
border-top: solid 1px gray;

.infos-bottom {
font-size: 12px;
line-height: 18px;
}
} }

+ 0
- 13
common/logic/Document/Document/Service/DocumentManager.php View File



$contentFooter = '<div id="footer">'; $contentFooter = '<div id="footer">';
$contentFooter .= '<div class="infos-bottom">' . Html::encode($producer->document_infos_bottom) . '</div>'; $contentFooter .= '<div class="infos-bottom">' . Html::encode($producer->document_infos_bottom) . '</div>';
if ($this->documentSolver->isStatusValid($document) || $this->documentSolver->isStatusDraft($document)) {
$contentFooter .= '<div class="reference-document">';
if ($this->documentSolver->isStatusValid($document)) {
$contentFooter .= $this->documentSolver->getType($document) . ' N°' . $document->reference;
}
if ($this->documentSolver->isStatusDraft($document)) {
$contentFooter .= $this->documentSolver->getType($document) . ' non validé';
if ($this->documentSolver->getType($document) == 'Facture') {
$contentFooter .= 'e';
}
}
$contentFooter .= '</div>';
}
$contentFooter .= '</div>'; $contentFooter .= '</div>';


$marginBottom = 10; $marginBottom = 10;

+ 2
- 2
common/logic/Producer/Producer/Model/Producer.php View File

'dolibarr_socid', 'dolibarr_socid',
'dolibarr_product_id', 'dolibarr_product_id',
'option_weeks_distributions_activated_in_advance', 'option_weeks_distributions_activated_in_advance',
'option_document_height_logo',
'option_document_width_logo',
'export_shopping_cart_labels_number_per_column' 'export_shopping_cart_labels_number_per_column'
], ],
'integer' 'integer'
'dolibarr_product_id' => 'Dolibarr : id produit', 'dolibarr_product_id' => 'Dolibarr : id produit',
'option_weeks_distributions_activated_in_advance' => "Semaines de distributions à activer à l'avance", 'option_weeks_distributions_activated_in_advance' => "Semaines de distributions à activer à l'avance",
'option_invoice_only_based_on_delivery_notes' => 'Facturer uniquement sur la base des bons de livraison', 'option_invoice_only_based_on_delivery_notes' => 'Facturer uniquement sur la base des bons de livraison',
'option_document_height_logo' => 'Hauteur du logo dans les documents',
'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_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne",
]; ];
} }

+ 3
- 8
common/logic/Producer/Producer/Service/ProducerSolver.php View File

return false; return false;
} }


public function getFullAddress(Producer $producer, bool $nl2br = false): string
public function getFullAddressAsHtml(Producer $producer): string
{ {
$address = '';
$address .= $producer->name . "\n";
$address = '<div class="name">'.$producer->name . '</div>';


if (strlen($producer->address)) { if (strlen($producer->address)) {
$address .= $producer->address . "\n";
$address .= $producer->address . '<br>';
} }


if (strlen($producer->postcode) || strlen($producer->city)) { if (strlen($producer->postcode) || strlen($producer->city)) {
$address .= $producer->postcode . ' ' . $producer->city; $address .= $producer->postcode . ' ' . $producer->city;
} }


if ($nl2br) {
$address = nl2br($address);
}

return $address; return $address;
} }



+ 26
- 0
console/migrations/m231108_092151_rename_column_producer_option_document_height_logo.php View File

<?php

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

/**
* Class m231108_092151_rename_column_producer_option_document_height_logo
*/
class m231108_092151_rename_column_producer_option_document_height_logo extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->renameColumn('producer', 'option_document_height_logo', 'option_document_width_logo');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->renameColumn('producer', 'option_document_width_logo', 'option_document_height_logo');
}
}

Loading…
Cancel
Save