@@ -94,17 +94,20 @@ class ProducerController extends BackendController | |||
$logoFilenameOld = $model->logo; | |||
$photoFilenameOld = $model->photo; | |||
$documentImageBottomFilenameOld = $model->document_image_bottom; | |||
$producerBuilder->initOptionDashboardDatesDisplay($model); | |||
if ($model->load(\Yii::$app->request->post())) { | |||
$model->logoFile = UploadedFile::getInstance($model, 'logoFile'); | |||
$model->photoFile = UploadedFile::getInstance($model, 'photoFile'); | |||
$model->document_image_bottomFile = UploadedFile::getInstance($model, 'document_image_bottomFile'); | |||
if($model->validate()) { | |||
$producerBuilder->processUploadImage($model, 'logo', $logoFilenameOld, $request->post('delete_logo', 0)); | |||
$producerBuilder->processUploadImage($model, 'photo', $photoFilenameOld, $request->post('delete_photo', 0)); | |||
$producerBuilder->processUploadImage($model, 'document_image_bottom', $documentImageBottomFilenameOld, $request->post('delete_document_image_bottom', 0)); | |||
$producerBuilder->initOptionDashboardDatesBeforeSave($model); | |||
$producerBuilder->savePrivateKeysStripe($model); | |||
$model->save(); |
@@ -446,6 +446,15 @@ $this->addBreadcrumb($this->getTitle()); | |||
->hint("Affichées juste en dessous de l'adresse"); ?> | |||
<?= $form->field($model, 'document_infos_bottom') | |||
->textarea(['rows' => 8]) ?> | |||
<?= $form->field($model, 'document_image_bottomFile')->fileInput()->hint('') ?> | |||
<?php | |||
if (strlen($model->document_image_bottom)) { | |||
echo '<img src="' . Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl . '/uploads/' . $model->document_image_bottom . '" width="400px" /><br />'; | |||
echo '<input type="checkbox" name="delete_document_image_bottom" id="delete_document_image_bottom" /> <label for="delete_document_image_bottom">Supprimer l\'image</label><br /><br />'; | |||
} | |||
?> | |||
<?= $form->field($model, 'document_infos_quotation') | |||
->textarea(['rows' => 8]) ?> | |||
<?= $form->field($model, 'document_infos_invoice') |
@@ -52,7 +52,13 @@ class DocumentManager extends AbstractManager | |||
]); | |||
$contentFooter = '<div id="footer">'; | |||
$contentFooter .= '<div class="infos-bottom">' . Html::encode($producer->document_infos_bottom) . '</div>'; | |||
if ($this->producerSolver->getConfig('document_image_bottom')) { | |||
$urlDocumentImageBottom = \Yii::$app->urlManagerProducer->getHostInfo() . '/' . \Yii::$app->urlManagerProducer->baseUrl . '/uploads/' . $producer->document_image_bottom; | |||
$contentFooter .= '<div class="image"><img src="'.$urlDocumentImageBottom.'" style="max-height:80px;" /></div>'; | |||
} | |||
if ($this->producerSolver->getConfig('document_infos_bottom')) { | |||
$contentFooter .= '<div class="infos-bottom">'.nl2br($producer->document_infos_bottom).'</div>'; | |||
} | |||
$contentFooter .= '</div>'; | |||
$marginBottom = 10; |
@@ -116,6 +116,11 @@ class Producer extends ActiveRecordCommon | |||
*/ | |||
public $photoFile; | |||
/** | |||
* @var UploadedFile | |||
*/ | |||
public $document_image_bottomFile; | |||
/** | |||
* @inheritdoc | |||
*/ | |||
@@ -138,7 +143,7 @@ class Producer extends ActiveRecordCommon | |||
return $model->tiller == true; | |||
} | |||
], | |||
[['logoFile', 'photoFile'], 'file', 'extensions' => 'png, jpg, jpeg', 'mimeTypes' => 'image/png, image/jpeg'], | |||
[['logoFile', 'photoFile', 'document_image_bottomFile'], 'file', 'extensions' => 'png, jpg, jpeg', 'mimeTypes' => 'image/png, image/jpeg'], | |||
[ | |||
[ | |||
'order_delay', | |||
@@ -242,6 +247,7 @@ class Producer extends ActiveRecordCommon | |||
'contact_email', | |||
'admin_comment', | |||
'export_shopping_cart_labels_format', | |||
'document_image_bottom', | |||
], | |||
'string' | |||
], | |||
@@ -291,6 +297,7 @@ class Producer extends ActiveRecordCommon | |||
'siret', | |||
'logo', | |||
'photo', | |||
'document_image_bottom', | |||
'postcode', | |||
'city', | |||
'code', | |||
@@ -340,8 +347,8 @@ class Producer extends ActiveRecordCommon | |||
'id' => 'ID', | |||
'name' => 'Nom', | |||
'siret' => 'Siret', | |||
'logo' => 'Logo', | |||
'photo' => 'Photo', | |||
'logoFile' => 'Logo', | |||
'photoFile' => 'Photo', | |||
'description' => 'Description', | |||
'postcode' => 'Code postal', | |||
'city' => 'Ville', | |||
@@ -399,6 +406,7 @@ class Producer extends ActiveRecordCommon | |||
'document_delivery_note_first_reference' => 'Première référence des bons de livraison', | |||
'document_infos_top' => 'Informations affichées en haut des documents', | |||
'document_infos_bottom' => 'Informations affichées en bas des documents', | |||
'document_image_bottomFile' => "Image affichée en bas des documents", | |||
'document_infos_quotation' => 'Informations affichées en bas des devis', | |||
'document_infos_invoice' => 'Informations affichées en bas des factures', | |||
'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison', | |||
@@ -459,7 +467,7 @@ class Producer extends ActiveRecordCommon | |||
'export_shopping_cart_labels_format' => 'Étiquettes (PDF) : format', | |||
'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 son compte" | |||
'option_check_by_default_prevent_user_credit' => "Par défaut, prévenir l'utilisateur quand on crédite son compte", | |||
]; | |||
} | |||
@@ -0,0 +1,26 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
/** | |||
* Class m231115_083420_add_column_producer_document_image_bottom | |||
*/ | |||
class m231115_083420_add_column_producer_document_image_bottom extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('producer', 'document_image_bottom', Schema::TYPE_STRING); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('producer', 'document_image_bottom'); | |||
} | |||
} |