Преглед изворни кода

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

feature/souke
Guillaume Bourgeois пре 1 година
родитељ
комит
80918a779f
9 измењених фајлова са 245 додато и 197 уклоњено
  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 Прегледај датотеку

@@ -10,7 +10,7 @@ $productModule = $this->getProductModule();
?>

<tr class="<?php if(isset($displayOrders) && $displayOrders): ?>order<?php endif; ?>">
<td class="align-left">
<td class="align-left column-product">
<?php if($productOrder->product): ?>
<?= Html::encode($productOrder->product->name) ?>
<?php endif; ?>
@@ -30,19 +30,19 @@ $productModule = $this->getProductModule();
?>

<?php if($displayPrices): ?>
<td class="align-center">
<td class="align-center column-unit-price">
<?= Price::format($price, $documentPriceDecimals) ?>
</td>
<?php endif; ?>
<td class="align-center">
<td class="align-center column-quantity">
<?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?>
</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($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; ?>
<td class="align-center">
<td class="align-center column-price">
<?php if($documentModule->getClass($document) == ''): ?>
<?= Price::format($price * $productOrder->quantity) ?>
<?php else: ?>

+ 29
- 20
backend/views/document/download.php Прегледај датотеку

@@ -20,13 +20,13 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
<div id="block-addresses">
<div class="producer">
<?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>
<?php endif; ?>
<div class="address">
<?= $producerModule->getFullAddress($producer, true); ?>
<?= $producerModule->getFullAddressAsHtml($producer); ?>
</div>
<?php if (strlen($producer->document_infos_top)): ?>
<div class="infos-top">
@@ -43,30 +43,39 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
</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 class="type">
<strong><?= $documentModule->getType($document); ?></strong>
</div>
<div class="date">
Le <?= strftime('%d %B %Y', strtotime($document->date)) ?>
<strong>Date : </strong>
<?= strftime('%d %B %Y', strtotime($document->date)) ?>
</div>
<?php if (strlen($document->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>
<?php endif; ?>
<div class="name">
<strong>Libellé : </strong><?= $document->name; ?>
<strong>Libellé : </strong>
<?= $document->name; ?>
</div>
<?php if (strlen($document->comment)): ?>
<div class="comment">
<br>
<strong>Commentaire</strong><br>
<?= Html::encode($document->comment) ?>
</div>
<?php endif; ?>
</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">
<?php if (count($document->orders) > 0) : ?>
<table class="table table-bordered">
@@ -199,7 +208,7 @@ $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price
$fieldProducerDocumentInfo = 'document_infos_' . str_replace('deliverynote', 'delivery_note', strtolower($documentModule->getClass($document))); ?>
<?php if (strlen($producer->$fieldProducerDocumentInfo)): ?>
<div class="block-infos">
<strong>Informations</strong><br/>
<strong>Informations générales</strong><br/>
<?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
</div>
<?php endif; ?>

+ 1
- 1
backend/views/producer/update.php Прегледај датотеку

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

+ 57
- 44
backend/web/css/document/download.css Прегледај датотеку

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

/* line 9, ../../sass/document/download.scss */
/* line 8, ../../sass/document/download.scss */
.document-download {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/* line 14, ../../sass/document/download.scss */
.document-download #block-addresses {
margin-bottom: 30px;
}
/* line 17, ../../sass/document/download.scss */
.document-download #block-addresses .producer {
margin-bottom: 15px;
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 {
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 */
.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;
margin-bottom: 15px;
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 */
.document-download #block-infos-document .type {
text-transform: uppercase;
padding-bottom: 10px;
}
/* line 59, ../../sass/document/download.scss */
.document-download #block-no-product {
padding: 10px;
margin-bottom: 15px;
font-weight: bold;
border: solid 2px black;
text-transform: uppercase;
padding: 10px;
}
/* line 60, ../../sass/document/download.scss */
/* line 67, ../../sass/document/download.scss */
.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 {
width: 100%;
padding: 0px;
@@ -60,7 +73,7 @@ body {
border-right: solid 1px #c0c0c0;
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 {
padding: 2px 5px;
border-top: solid 1px #c0c0c0;
@@ -68,48 +81,48 @@ body {
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
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 {
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 {
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 {
text-align: right;
}
/* line 89, ../../sass/document/download.scss */
/* line 98, ../../sass/document/download.scss */
.document-download #block-products table td {
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 {
margin-top: 20px;
padding: 10px;
margin-bottom: 15px;
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 {
font-size: 12px;
}

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

+ 121
- 103
backend/web/sass/document/download.scss Прегледај датотеку

@@ -1,121 +1,139 @@

$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 {
padding-bottom: 200px ;
padding-bottom: 200px;
}

.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 {
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 Прегледај датотеку

@@ -53,19 +53,6 @@ class DocumentManager extends AbstractManager

$contentFooter = '<div id="footer">';
$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>';

$marginBottom = 10;

+ 2
- 2
common/logic/Producer/Producer/Model/Producer.php Прегледај датотеку

@@ -165,7 +165,7 @@ class Producer extends ActiveRecordCommon
'dolibarr_socid',
'dolibarr_product_id',
'option_weeks_distributions_activated_in_advance',
'option_document_height_logo',
'option_document_width_logo',
'export_shopping_cart_labels_number_per_column'
],
'integer'
@@ -449,7 +449,7 @@ class Producer extends ActiveRecordCommon
'dolibarr_product_id' => 'Dolibarr : id produit',
'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_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",
];
}

+ 3
- 8
common/logic/Producer/Producer/Service/ProducerSolver.php Прегледај датотеку

@@ -24,23 +24,18 @@ class ProducerSolver extends AbstractService implements SolverInterface
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)) {
$address .= $producer->address . "\n";
$address .= $producer->address . '<br>';
}

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

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

return $address;
}


+ 26
- 0
console/migrations/m231108_092151_rename_column_producer_option_document_height_logo.php Прегледај датотеку

@@ -0,0 +1,26 @@
<?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…
Откажи
Сачувај