瀏覽代碼

Merge branch 'dev'

prodstable
Guillaume Bourgeois 1 年之前
父節點
當前提交
3303bfe867
共有 21 個文件被更改,包括 119 次插入23 次删除
  1. +6
    -1
      backend/controllers/DistributionController.php
  2. +10
    -1
      backend/controllers/DocumentController.php
  3. +29
    -4
      backend/controllers/PointSaleController.php
  4. +1
    -0
      backend/controllers/UserController.php
  5. +1
    -1
      backend/views/distribution/index.php
  6. +6
    -0
      backend/views/document/_form.php
  7. +1
    -1
      backend/views/subscription/_form.php
  8. +1
    -1
      backend/web/css/screen.css
  9. +1
    -1
      backend/web/sass/_adminlte.scss
  10. +4
    -0
      common/components/ActiveRecordCommon.php
  11. +1
    -1
      common/config/params.php
  12. +1
    -1
      common/models/DeliveryNote.php
  13. +2
    -2
      common/models/Document.php
  14. +1
    -1
      common/models/Invoice.php
  15. +2
    -1
      common/models/PointSale.php
  16. +5
    -3
      common/models/PointSaleSearch.php
  17. +1
    -1
      common/models/Quotation.php
  18. +16
    -0
      common/versions/23.1.A.php
  19. +26
    -0
      console/migrations/m230119_083942_point_sale_add_status.php
  20. +2
    -2
      producer/controllers/OrderController.php
  21. +2
    -1
      producer/controllers/SiteController.php

+ 6
- 1
backend/controllers/DistributionController.php 查看文件

@@ -345,6 +345,8 @@ class DistributionController extends BackendController
// bons de livraison
$deliveryNotesArray = DeliveryNote::searchAll([
'distribution.date' => $date,
], [
'join_with' => ['user AS user_delivery_note', 'orders', 'producer']
]);
$deliveryNotesByPointSaleArray = [];
foreach ($deliveryNotesArray as $deliveryNote) {
@@ -534,8 +536,11 @@ class DistributionController extends BackendController

if ($invoicePrice != $productOrder->price) {
$productOrder->invoice_price = $invoicePrice;
$productOrder->save();
}
else {
$productOrder->invoice_price = null;
}
$productOrder->save();
}
}
}

+ 10
- 1
backend/controllers/DocumentController.php 查看文件

@@ -316,6 +316,14 @@ class DocumentController extends BackendController
return $document->downloadPdf();
}

public function actionRegenerate($id)
{
$document = $this->findModel($id);
$document->downloadPdf(true);
Yii::$app->getSession()->setFlash('success', 'Le document PDF a bien été regénéré.');
return $this->redirect([$this->getControllerUrl() . '/update', 'id' => $id]);
}

public function actionSend($id, $backUpdateForm = false)
{
$document = $this->findModel($id);
@@ -367,7 +375,8 @@ class DocumentController extends BackendController

if ($classDocument == 'Invoice') {
$options = [
'orderby' => 'distribution.date ASC'
'orderby' => 'distribution.date ASC',
'join_with' => ['user AS user_delivery_note', 'orders', 'producer']
];
$deliveryNotesCreateArray = DeliveryNote::searchAll([
'id_user' => $user->id,

+ 29
- 4
backend/controllers/PointSaleController.php 查看文件

@@ -178,12 +178,37 @@ class PointSaleController extends BackendController
$pointSale = $this->findModel($id) ;
if($confirm) {
$pointSale->delete();
$pointSale->status = -1;
$pointSale->save();

// Suppression du lien entre les utilisateurs et le point de vente
UserPointSale::deleteAll(['id_point_sale' => $id]);
PointSaleDistribution::deleteAll(['id_point_sale' => $id]) ;
Order::updateAll(['id_point_sale' => 0], 'id_point_sale = :id_point_sale', [':id_point_sale' => $id]) ;

// Suppression du lien PointSaleDistribution pour toutes les distributions à venir
$incomingDistributions = Distribution::getIncomingDistributions();
foreach ($incomingDistributions as $distribution) {
PointSaleDistribution::deleteAll(['id_point_sale' => $id, 'id_distribution' => $distribution->id]);
}

// Suppression de toutes les commandes à venir de ce point de vente
$ordersArray = Order::searchAll(
[
'id_point_sale' => $id,
],
[
'conditions' => 'date_delete IS NULL AND distribution.date > :today',
'params' => [':today' => date('Y-m-d')]
]
);

if($ordersArray) {
foreach($ordersArray as $order) {
$order->delete(true);
}
}

Yii::$app->getSession()->setFlash('success', 'Point de vente <strong>'.Html::encode($pointSale->name).'</strong> supprimé.');
}
}
else {
Yii::$app->getSession()->setFlash('info', 'Souhaitez-vous vraiment supprimer le point de vente <strong>'.Html::encode($pointSale->name).'</strong> ? '
. Html::a('Oui',['point-sale/delete','id' => $id, 'confirm' => 1], ['class' => 'btn btn-default']).' '.Html::a('Non', ['point-sale/index'], ['class' => 'btn btn-default']));

+ 1
- 0
backend/controllers/UserController.php 查看文件

@@ -154,6 +154,7 @@ class UserController extends BackendController
$pointsSaleArray = PointSale::find()
->where([
'id_producer' => GlobalParam::getCurrentProducerId(),
'status' => 1
])
->joinWith(['userPointSale' => function ($query) use ($model) {
if ($model->id) {

+ 1
- 1
backend/views/distribution/index.php 查看文件

@@ -175,7 +175,7 @@ $this->setPageTitle('Distributions') ;
</tr>
</thead>
<tbody>
<tr v-for="pointSale in pointsSale">
<tr v-for="pointSale in pointsSale" v-if="pointSale.status == 1">
<td>
<button class="btn btn-success" v-if="pointSale.pointSaleDistribution[0].delivery == 1"><span class="glyphicon glyphicon-ok"></span></button>
<button class="btn btn-default" v-else data-delivery-point-sale="1" :data-id-point-sale="pointSale.id" @click="pointSaleActiveClick"><span class="glyphicon glyphicon-ok"></span></button>

+ 6
- 0
backend/views/document/_form.php 查看文件

@@ -209,6 +209,12 @@ use common\models\Producer;
<div class="info-box-content">
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/download', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-download-alt"></span> Télécharger (PDF)</a>

<?php if($model->isStatusValid()): ?>
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/regenerate', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-repeat"></span> Regénérer (PDF)</a>
<?php endif; ?>

<?php if ($model->getClass() == 'Invoice' && Producer::getConfig('option_export_evoliz')): ?>
<a href="<?= Yii::$app->urlManager->createUrl([Yii::$app->controller->getControllerUrl() . '/export-csv-evoliz', 'id' => $model->id]) ?>"
class="btn btn-sm btn-default"><span class="glyphicon glyphicon-save-file"></span> Export Evoliz

+ 1
- 1
backend/views/subscription/_form.php 查看文件

@@ -64,7 +64,7 @@ use common\helpers\GlobalParam ;
<div class="clr"></div>
<?= $form->field($model, 'id_producer')->hiddenInput() ?>
<?= $form->field($model, 'id_point_sale')->dropDownList(ArrayHelper::map(PointSale::find()->where('id_producer = '.GlobalParam::getCurrentProducerId())->all(), 'id', function($model, $defaultValue) {
<?= $form->field($model, 'id_point_sale')->dropDownList(ArrayHelper::map(PointSale::searchAll(), 'id', function($model, $defaultValue) {
return $model['name'];
}), ['prompt' => '--','class' => 'form-control user-id']) ?>
<?= $form->field($model, 'date_begin') ?>

+ 1
- 1
backend/web/css/screen.css 查看文件

@@ -1657,7 +1657,7 @@ body.skin-black .content-wrapper .alert a.btn {
body.skin-black .content-wrapper .alert .close {
font-size: 30px;
position: relative;
top: -25px;
top: -15px;
text-decoration: none;
color: white;
opacity: 0.6;

+ 1
- 1
backend/web/sass/_adminlte.scss 查看文件

@@ -142,7 +142,7 @@ body.skin-black {
.close {
font-size: 30px;
position: relative;
top: -25px;
top: -15px;
text-decoration: none;
color: white;
opacity: 0.6;

+ 4
- 0
common/components/ActiveRecordCommon.php 查看文件

@@ -81,6 +81,10 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
$options['type_search'] = self::SEARCH_ALL;
}

if($class == 'common\models\PointSale' && !isset($options['status'])) {
$params['status'] = 1;
}

$records = $class::find();

// With

+ 1
- 1
common/config/params.php 查看文件

@@ -37,7 +37,7 @@
*/

return [
'version' => '22.12.A',
'version' => '23.1.A',
'adminEmail' => 'contact@opendistrib.net',
'supportEmail' => 'contact@opendistrib.net',
'user.passwordResetTokenExpire' => 3600,

+ 1
- 1
common/models/DeliveryNote.php 查看文件

@@ -84,7 +84,7 @@ class DeliveryNote extends Document
{
return [
'with' => [],
'join_with' => ['user AS user_delivery_note', 'orders', 'producer'],
'join_with' => ['user AS user_delivery_note', 'producer'],
'orderby' => 'date ASC',
'attribute_id_producer' => 'delivery_note.id_producer'
];

+ 2
- 2
common/models/Document.php 查看文件

@@ -283,11 +283,11 @@ class Document extends ActiveRecordCommon
}
}

public function downloadPdf()
public function downloadPdf($regenerate = false)
{
$filenameComplete = $this->getFilenameComplete();

if (!file_exists($filenameComplete) || $this->isStatusDraft()) {
if (!file_exists($filenameComplete) || $this->isStatusDraft() || $regenerate) {
$this->generatePdf(Pdf::DEST_FILE);
}


+ 1
- 1
common/models/Invoice.php 查看文件

@@ -85,7 +85,7 @@ class Invoice extends Document
{
return [
'with' => [],
'join_with' => ['user AS user_invoice', 'orders', 'producer'],
'join_with' => ['user AS user_invoice', 'producer'],
'orderby' => 'date ASC',
'attribute_id_producer' => 'invoice.id_producer'
];

+ 2
- 1
common/models/PointSale.php 查看文件

@@ -88,7 +88,7 @@ class PointSale extends ActiveRecordCommon
'delivery_wednesday', 'delivery_thursday', 'delivery_friday',
'delivery_saturday', 'delivery_sunday', 'default', 'is_bread_box'], 'boolean'],
['point_production', 'default', 'value' => 0],
[['id_producer', 'id_user', 'maximum_number_orders'], 'integer'],
[['id_producer', 'id_user', 'maximum_number_orders', 'status'], 'integer'],
['id_producer', 'required'],
[['users', 'users_comment', 'code'], 'safe'],
[['product_price_percent'], 'double'],
@@ -130,6 +130,7 @@ class PointSale extends ActiveRecordCommon
'maximum_number_orders' => 'Nombre maximum de commandes',
'is_bread_box' => 'Boîte à pain',
'bread_box_code' => 'Code boîte à pain',
'status' => 'Statut'
];
}


+ 5
- 3
common/models/PointSaleSearch.php 查看文件

@@ -69,9 +69,11 @@ class PointSaleSearch extends PointSale
$query = PointSale::find()
->with($optionsSearch['with'])
->innerJoinWith($optionsSearch['join_with'], true)
->where(['point_sale.id_producer' => GlobalParam::getCurrentProducerId()])
->orderBy('is_bread_box ASC, name ASC')
;
->where([
'status' => 1,
'point_sale.id_producer' => GlobalParam::getCurrentProducerId()
])
->orderBy('is_bread_box ASC, name ASC');
$dataProvider = new ActiveDataProvider([
'query' => $query,

+ 1
- 1
common/models/Quotation.php 查看文件

@@ -82,7 +82,7 @@ class Quotation extends Document
{
return [
'with' => [],
'join_with' => ['user AS user_quotation', 'orders', 'producer'],
'join_with' => ['user AS user_quotation', 'producer'],
'orderby' => 'date ASC',
'attribute_id_producer' => 'quotation.id_producer'
];

+ 16
- 0
common/versions/23.1.A.php 查看文件

@@ -0,0 +1,16 @@

<h4>Date de sortie</h4>
<ul>
<li>23/01/2023</li>
</ul>

<h4>Évolutions</h4>
<ul>
<li>[Administration] Documents : possibilité de regénérer les PDF</li>
</ul>

<h4>Maintenance</h4>
<ul>
<li>[Administration] Documents > listes : optimisation chargement</li>
<li>[Espace producteur] Commander : ajustement ordre des points de vente</li>
</ul>

+ 26
- 0
console/migrations/m230119_083942_point_sale_add_status.php 查看文件

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

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

/**
* Class m230119_083942_point_sale_add_status
*/
class m230119_083942_point_sale_add_status extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('point_sale', 'status', Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 1');
}

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

+ 2
- 2
producer/controllers/OrderController.php 查看文件

@@ -955,10 +955,10 @@ class OrderController extends ProducerBaseController

$pointsSaleArray = $pointsSaleArray->where(['id_producer' => $idProducer])
->andWhere(
'restricted_access = 0 OR (restricted_access = 1 AND (SELECT COUNT(*) FROM user_point_sale WHERE point_sale.id = user_point_sale.id_point_sale AND user_point_sale.id_user = :id_user) > 0)'
'status = 1 AND (restricted_access = 0 OR (restricted_access = 1 AND (SELECT COUNT(*) FROM user_point_sale WHERE point_sale.id = user_point_sale.id_point_sale AND user_point_sale.id_user = :id_user) > 0))'
)
->params([':id_user' => User::getCurrentId()])
->orderBy('default DESC, code ASC, restricted_access ASC, is_bread_box ASC, name ASC')
->orderBy('code ASC, restricted_access ASC, is_bread_box ASC, `default` DESC, name ASC')
->all();

$creditFunctioningProducer = Producer::getConfig('credit_functioning');

+ 2
- 1
producer/controllers/SiteController.php 查看文件

@@ -98,7 +98,8 @@ class SiteController extends ProducerBaseController
->where([
'id_producer' => $this->getProducer(
)->id,
'restricted_access' => 0
'restricted_access' => 0,
'status' => 1
])->orderBy(
'default DESC, is_bread_box ASC, name ASC'
),

Loading…
取消
儲存