소스 검색

Merge branch 'develop'

prodstable
Guillaume Bourgeois 1 년 전
부모
커밋
57d7403cf4
13개의 변경된 파일87개의 추가작업 그리고 33개의 파일을 삭제
  1. +11
    -2
      backend/controllers/DocumentController.php
  2. +3
    -3
      backend/controllers/OrderController.php
  3. +2
    -2
      backend/views/distribution/index.php
  4. +1
    -0
      backend/views/producer/update.php
  5. +1
    -2
      backend/web/js/vuejs/distribution-index.js
  6. +1
    -1
      backend/web/js/vuejs/document-form.js
  7. +1
    -1
      common/models/Document.php
  8. +25
    -0
      common/models/Order.php
  9. +13
    -1
      common/models/Producer.php
  10. +1
    -19
      common/models/Subscription.php
  11. +26
    -0
      console/migrations/m230320_080836_producer_add_option_point_sale_wording.php
  12. +1
    -1
      producer/views/order/order.php
  13. +1
    -1
      producer/views/site/index.php

+ 11
- 2
backend/controllers/DocumentController.php 파일 보기

@@ -38,6 +38,7 @@

namespace backend\controllers;

use common\helpers\Price;
use common\models\DeliveryNote;
use common\models\Invoice;
use common\models\PointSale;
@@ -252,6 +253,14 @@ class DocumentController extends BackendController
$price = $productOrder->getInvoicePrice() ;
}

$typeTotal = $document->isInvoicePrice() ? Order::INVOICE_AMOUNT_TOTAL : Order::AMOUNT_TOTAL;
$priceTotal = $productOrder->getPriceByTypeTotal($typeTotal) * $productOrder->quantity;
$tva = Price::getVat(
$priceTotal,
$productOrder->taxRate->value,
$document->tax_calculation_method
);

$datas[] = [
$document->reference, // N° facture externe *
date('d/m/Y', strtotime($document->date)), // Date facture *
@@ -286,8 +295,8 @@ class DocumentController extends BackendController
$price, // PU HT *
'', // Remise
$productOrder->taxRate->value * 100, // TVA
'', // Total TVA
'', // Total HT
$tva, // Total TVA
$priceTotal, // Total HT
'', // Créateur
];
}

+ 3
- 3
backend/controllers/OrderController.php 파일 보기

@@ -814,7 +814,7 @@ class OrderController extends BackendController
* @param string $processCredit
*/
public function actionAjaxCreate(
$date, $idPointSale, $idUser, $username, $meanPayment = '', $products, $comment, $processCredit = 0)
$date, $idPointSale, $idUser, $username, $meanPayment = '', $products, $comment)
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

@@ -894,7 +894,7 @@ class OrderController extends BackendController
}

$order = Order::searchOne(['id' => $order->id]);
if ($order && $processCredit) {
if ($order && $order->isCreditAutoPayment()) {
$order->processCredit();
}

@@ -1024,7 +1024,7 @@ class OrderController extends BackendController
$order->save();

$order = Order::searchOne(['id' => $order->id]);
if ($order && $processCredit) {
if($order && $order->isCreditAutoPayment()) {
// Si changement d'user : on rembourse l'ancien user
$amountPaid = $order->getAmount(Order::AMOUNT_PAID);
if($oldIdUser != $idUser && $amountPaid > 0) {

+ 2
- 2
backend/views/distribution/index.php 파일 보기

@@ -684,8 +684,8 @@ $this->setPageTitle('Distributions') ;
</div>
<div slot="footer">
<div class="actions-form">
<button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-if="!order.id && order.id_user > 0" data-process-credit="1">Créer et payer</button>
<button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id && order.id_user > 0" data-process-credit="1">Modifier et payer</button>
<!--<button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-if="!order.id && order.id_user > 0" data-process-credit="1">Créer et payer</button>
<button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id && order.id_user > 0" data-process-credit="1">Modifier et payer</button>-->

<button class="modal-default-button btn btn-primary" @click="submitFormUpdate" v-if="order.id">Modifier</button>
<button class="modal-default-button btn btn-primary" @click="submitFormCreate" v-if="!order.id">Créer</button>

+ 1
- 0
backend/views/producer/update.php 파일 보기

@@ -123,6 +123,7 @@ $this->addBreadcrumb($this->getTitle());
Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK => 'Jours de la semaine',
Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_INCOMING_DISTRIBUTIONS => 'Distributions à venir',
]); ?>
<?= $form->field($model, 'option_point_sale_wording') ?>
</div>
</div>


+ 1
- 2
backend/web/js/vuejs/distribution-index.js 파일 보기

@@ -830,8 +830,7 @@ Vue.component('order-form',{
username: this.order.username,
meanPayment: this.order.mean_payment,
products: app.getProductOrderArrayRequest(),
comment: this.order.comment,
processCredit: processCredit
comment: this.order.comment
}})
.then(function(response) {
app.order.id_point_sale = 0 ;

+ 1
- 1
backend/web/js/vuejs/document-form.js 파일 보기

@@ -98,7 +98,7 @@ var app = new Vue({
getProductById: function(idProduct) {
var app = this;

for(var i = 0; i <= Object.keys(this.productsArray).length ; i++) {
for(var i = 0; i <= Object.keys(this.productsArray).length + 1 ; i++) {
if(app.productsArray[i] && app.productsArray[i].id == idProduct) {
return app.productsArray[i];
}

+ 1
- 1
common/models/Document.php 파일 보기

@@ -247,7 +247,7 @@ class Document extends ActiveRecordCommon
return '';
}

public function isValidClass($typeDocument)
public static function isValidClass($typeDocument)
{
return in_array($typeDocument, ['Invoice', 'DeliveryNote', 'Quotation']);
}

+ 25
- 0
common/models/Order.php 파일 보기

@@ -1099,4 +1099,29 @@ class Order extends ActiveRecordCommon
|| ($this->quotation && $this->quotation->isStatusValid())
|| ($this->invoice && $this->invoice->isStatusValid());
}

public function isCreditAutoPayment()
{
$pointSale = PointSale::findOne($this->id_point_sale);
$distribution = Distribution::findOne($this->id_distribution);
$creditFunctioning = $pointSale->getCreditFunctioning();

if ($this->id_user && Producer::getConfig('credit') && $pointSale->credit) {
if ($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) {
return 0;
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) {
return 1;
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) {
$userProducer = UserProducer::searchOne([
'id_user' => $this->id_user,
'id_producer' => $distribution->id_producer
]);
if ($userProducer) {
return $userProducer->credit_active;
}
}
}

return 0;
}
}

+ 13
- 1
common/models/Producer.php 파일 보기

@@ -233,7 +233,8 @@ class Producer extends ActiveRecordCommon
'option_online_payment_type',
'option_tax_calculation_method',
'latest_version_opendistrib',
'option_csv_separator'
'option_csv_separator',
'option_point_sale_wording'
],
'string'
],
@@ -288,6 +289,7 @@ class Producer extends ActiveRecordCommon
'document_delivery_note_first_reference',
'option_billing_type',
'option_billing_frequency',
'option_point_sale_wording'
],
'string',
'max' => 255
@@ -410,6 +412,7 @@ class Producer extends ActiveRecordCommon
'option_billing_reduction_percentage' => 'Réduction : pourcentage',
'option_billing_permanent_transfer' => 'Virement permanent',
'option_billing_permanent_transfer_amount' => 'Virement permanent : montant',
'option_point_sale_wording' => 'Libellé points de vente'
];
}

@@ -1002,5 +1005,14 @@ class Producer extends ActiveRecordCommon

return $onlinePaymentMinimumAmount;
}

public function getPointSaleWording()
{
if($this->option_point_sale_wording && strlen($this->option_point_sale_wording)) {
return Html::encode($this->option_point_sale_wording);
}

return 'Points de vente';
}
}

+ 1
- 19
common/models/Subscription.php 파일 보기

@@ -217,26 +217,9 @@ class Subscription extends ActiveRecordCommon
$pointSale = PointSale::findOne($this->id_point_sale);

if ($pointSale) {
$creditFunctioning = $pointSale->getCreditFunctioning();

$order->auto_payment = 0;
if($this->auto_payment == self::AUTO_PAYMENT_DEDUCTED) {
if ($order->id_user && Producer::getConfig('credit') && $pointSale->credit) {
if ($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) {
$order->auto_payment = 0;
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) {
$order->auto_payment = 1;
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) {
$user = User::findOne($order->id_user);
$userProducer = UserProducer::searchOne([
'id_user' => $order->id_user,
'id_producer' => $distribution->id_producer
]);
if ($userProducer) {
$order->auto_payment = $userProducer->credit_active;
}
}
}
$order->auto_payment = $order->isCreditAutoPayment();
}
elseif($this->auto_payment == self::AUTO_PAYMENT_YES) {
$order->auto_payment = 1;
@@ -245,7 +228,6 @@ class Subscription extends ActiveRecordCommon
$order->auto_payment = 0;
}


$order->tiller_synchronization = $order->auto_payment;

$userPointSale = UserPointSale::searchOne([

+ 26
- 0
console/migrations/m230320_080836_producer_add_option_point_sale_wording.php 파일 보기

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

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

/**
* Class m230320_080836_producer_add_option_point_sale_wording
*/
class m230320_080836_producer_add_option_point_sale_wording extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_point_sale_wording', Schema::TYPE_STRING .' DEFAULT NULL');
}

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

+ 1
- 1
producer/views/order/order.php 파일 보기

@@ -570,7 +570,7 @@ $producer = $this->context->getProducer();
<script type="text/x-template" id="template-step-point-sale">
<li id="step-point-sale" :class="'col-md-3'+((step == 'point-sale') ? ' active ' : '')+(first ? ' first' : '')">
<button @click="changeStep('point-sale')" :class="'btn '+ (step == 'point-sale' ? 'btn-primary' : 'btn-default')" :disabled="producer && (producer.option_order_entry_point == 'date' && step == 'date')">
<span class="button-content"><span class="glyphicon glyphicon-map-marker"></span> Points de vente</span>
<span class="button-content"><span class="glyphicon glyphicon-map-marker"></span> <?= $producer->getPointSaleWording(); ?></span>
</button>
<div class="info-step" v-if="pointSaleActive">
{{ pointSaleActive.name }}

+ 1
- 1
producer/views/site/index.php 파일 보기

@@ -57,7 +57,7 @@ $this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;


<section id="points-sale">
<h3><span>Points de vente</span></h3>
<h3><span><?= $producer->getPointSaleWording(); ?></span></h3>
<?= GridView::widget([
'dataProvider' => $dataProviderPointsSale,
'summary' => '',

Loading…
취소
저장