@@ -111,6 +111,8 @@ class DistributionController extends BackendController | |||
'tiller' => $producer->tiller | |||
]; | |||
$json['means_payment'] = MeanPayment::getAll() ; | |||
$distributionsArray = Distribution::searchAll([ | |||
'active' => 1 | |||
], [ | |||
@@ -915,7 +917,8 @@ class DistributionController extends BackendController | |||
if(!$isSynchro) { | |||
$orders = Order::searchAll([ | |||
'distribution.date' => $date | |||
'distribution.date' => $date, | |||
'order.tiller_synchronization' => 1 | |||
]) ; | |||
$strDate = date('Y-m-d\T12:i:s+0000', strtotime($date) + 1) ; | |||
@@ -933,6 +936,23 @@ class DistributionController extends BackendController | |||
] ; | |||
} | |||
$typePaymentTiller = '' ; | |||
if($order->mean_payment == MeanPayment::MONEY | |||
|| $order->mean_payment == MeanPayment::CREDIT | |||
|| $order->mean_payment == MeanPayment::TRANSFER | |||
|| $order->mean_payment == MeanPayment::OTHER) { | |||
$typePaymentTiller = 'CASH' ; | |||
} | |||
if($order->mean_payment == MeanPayment::CREDIT_CARD) { | |||
$typePaymentTiller = 'CARD' ; | |||
} | |||
if($order->mean_payment == MeanPayment::CHEQUE) { | |||
$typePaymentTiller = 'BANK_CHECK' ; | |||
} | |||
if(!strlen($typePaymentTiller) || !$order->mean_payment) { | |||
$typePaymentTiller = 'CASH' ; | |||
} | |||
$tiller->postOrder([ | |||
'externalId' => $order->id, | |||
'type' => 1, | |||
@@ -941,7 +961,7 @@ class DistributionController extends BackendController | |||
'closeDate' => $strDate, | |||
'lines' => $lines, | |||
'payments' => [[ | |||
'type' => 'CASH', | |||
'type' => $typePaymentTiller, | |||
'amount' => $order->getAmount(Order::AMOUNT_TOTAL) * 100, | |||
'status' => 'ACCEPTED', | |||
'date' => $strDate |
@@ -810,7 +810,7 @@ class OrderController extends BackendController | |||
* @param string $processCredit | |||
*/ | |||
public function actionAjaxCreate( | |||
$date, $idPointSale, $idUser, $username, $products, $comment, $processCredit = 0) | |||
$date, $idPointSale, $idUser, $username, $meanPayment, $products, $comment, $processCredit = 0) | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
@@ -829,6 +829,7 @@ class OrderController extends BackendController | |||
$order = new Order; | |||
$order->date = date('Y-m-d H:i:s') ; | |||
$order->id_point_sale = $idPointSale; | |||
$order->mean_payment = $meanPayment ; | |||
$order->id_distribution = $distribution->id; | |||
$order->origin = Order::ORIGIN_ADMIN; | |||
$order->comment = $comment; | |||
@@ -890,7 +891,7 @@ class OrderController extends BackendController | |||
* @param string $comment | |||
*/ | |||
public function actionAjaxUpdate( | |||
$date, $idOrder, $idPointSale, $idUser, $username, $products, $comment = '', $processCredit = 0) | |||
$date, $idOrder, $idPointSale, $idUser, $username, $meanPayment, $products, $comment = '', $processCredit = 0) | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
@@ -937,6 +938,7 @@ class OrderController extends BackendController | |||
$order->id_point_sale = $idPointSale; | |||
$order->date_update = date('Y-m-d H:i:s'); | |||
$order->mean_payment = $meanPayment; | |||
$order->comment = $comment; | |||
if ($idUser) { | |||
@@ -1073,6 +1075,30 @@ class OrderController extends BackendController | |||
return ['success']; | |||
} | |||
/** | |||
* Modifie l'état de la synchronisation Tiller d'une commande. | |||
* | |||
* @param int $idOrder | |||
* @param boolean $boolSynchroTiller | |||
* @return array | |||
*/ | |||
public function actionAjaxChangeSynchroTiller($idOrder, $boolSynchroTiller) | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
$order = Order::searchOne([ | |||
'id' => (int) $idOrder | |||
]) ; | |||
if($order) { | |||
$order->tiller_synchronization = (int) $boolSynchroTiller ; | |||
$res = $order->save() ; | |||
return ['success']; | |||
} | |||
return ['error']; | |||
} | |||
} | |||
@@ -18,7 +18,8 @@ En contrepartie de l'accessibilité au code source et des droits de copie, | |||
de modification et de redistribution accordés par cette licence, il n'est | |||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||
titulaire des droits patrimoniaux et les concédants successifs. | |||
titulaire des de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||
droits patrimoniaux et les concédants successifs. | |||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||
associés au chargement, à l'utilisation, à la modification et/ou au | |||
@@ -230,6 +231,7 @@ $this->setPageTitle('Distributions') ; | |||
:date="date" | |||
:order="orderCreate" | |||
:points-sale="pointsSale" | |||
:means-payment="meansPayment" | |||
:users="users" | |||
:products="products" | |||
:producer="producer" | |||
@@ -307,6 +309,11 @@ $this->setPageTitle('Distributions') ; | |||
</ul> | |||
</div> | |||
</td> | |||
<td v-if="producer.tiller" class="tiller"> | |||
<input v-if="order.tiller_synchronization == true" type="checkbox" checked="checked" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||
<input v-else type="checkbox" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" /> | |||
<label :for="'checkbox-tiller-synchronization-'+order.id">Tiller</label> | |||
</td> | |||
<td class="column-actions"> | |||
<span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span> | |||
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> | |||
@@ -320,6 +327,7 @@ $this->setPageTitle('Distributions') ; | |||
:date="date" | |||
:id-point-sale="idActivePointSale" | |||
:points-sale="pointsSale" | |||
:means-payment="meansPayment" | |||
:users="users" | |||
:products="products" | |||
:order="ordersUpdate[key]" | |||
@@ -475,9 +483,17 @@ $this->setPageTitle('Distributions') ; | |||
<div class="form-group"> | |||
<label class="control-label" for="select-id-point-sale">Point de vente</label> | |||
<select class="form-control" id="select-id-point-sale" v-model="order.id_point_sale"> | |||
<option value="0">--</option> | |||
<option v-for="pointSale in pointsSale" v-if="pointSale.pointSaleDistribution[0].delivery == 1" :value="pointSale.id">{{ pointSale.name }}</option> | |||
</select> | |||
</div> | |||
<div class="form-group"> | |||
<label class="control-label" for="select-mean-payment">Moyen de paiement</label> | |||
<select class="form-control" id="select-mean-payment" v-model="order.mean_payment"> | |||
<option value="0">--</option> | |||
<option v-for="(wordingMeanPayment, keyMeanPayment) in meansPayment" :value="keyMeanPayment">{{ wordingMeanPayment }}</option> | |||
</select> | |||
</div> | |||
<div class="form-group"> | |||
<label class="control-label" for="textarea-comment">Commentaire</label> | |||
<textarea class="form-control" id="textarea-comment" v-model="order.comment"></textarea> |
@@ -91,11 +91,11 @@ $this->addBreadcrumb('Créditer') ; | |||
]) ?> | |||
<?= $form->field($creditForm, 'amount')->textInput() ?> | |||
<?= $form->field($creditForm, 'mean_payment')->dropDownList([ | |||
CreditHistory::MEAN_PAYMENT_MONEY => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_MONEY), | |||
CreditHistory::MEAN_PAYMENT_CREDIT_CARD => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CREDIT_CARD), | |||
CreditHistory::MEAN_PAYMENT_CHEQUE => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_CHEQUE), | |||
CreditHistory::MEAN_PAYMENT_TRANSFER => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_TRANSFER), | |||
CreditHistory::MEAN_PAYMENT_OTHER => CreditHistory::getStrMeanPaymentBy(CreditHistory::MEAN_PAYMENT_OTHER), | |||
MeanPayment::MONEY => MeanPayment::getStrBy(MeanPayment::MONEY), | |||
MeanPayment::CREDIT_CARD => MeanPayment::getStrBy(MeanPayment::CREDIT_CARD), | |||
MeanPayment::CHEQUE => MeanPayment::getStrBy(MeanPayment::CHEQUE), | |||
MeanPayment::TRANSFER => MeanPayment::getStrBy(MeanPayment::TRANSFER), | |||
MeanPayment::OTHER => MeanPayment::getStrBy(MeanPayment::OTHER), | |||
]) ?> | |||
<?= $form->field($creditForm, 'comment')->textarea() ?> | |||
<?= $form->field($creditForm, 'send_mail')->checkbox() ?> |
@@ -1983,73 +1983,85 @@ termes. | |||
-webkit-border-radius: 10px; | |||
border-radius: 10px; | |||
} | |||
/* line 206, ../sass/distribution/_index.scss */ | |||
/* line 207, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.tiller { | |||
width: 60px; | |||
} | |||
/* line 210, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.tiller label { | |||
font-size: 12px; | |||
cursor: pointer; | |||
position: relative; | |||
top: -2px; | |||
font-weight: normal; | |||
} | |||
/* line 219, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions { | |||
text-align: right; | |||
width: 230px; | |||
} | |||
/* line 210, ../sass/distribution/_index.scss */ | |||
/* line 223, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .modal-form-order, | |||
.distribution-index #orders table td.column-actions .modal-payment { | |||
text-align: left; | |||
} | |||
/* line 215, ../sass/distribution/_index.scss */ | |||
/* line 228, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .add-subscription { | |||
position: relative; | |||
} | |||
/* line 217, ../sass/distribution/_index.scss */ | |||
/* line 230, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { | |||
position: absolute; | |||
top: 4px; | |||
right: 4px; | |||
font-size: 7px; | |||
} | |||
/* line 226, ../sass/distribution/_index.scss */ | |||
/* line 239, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-state-payment { | |||
width: 120px; | |||
} | |||
/* line 231, ../sass/distribution/_index.scss */ | |||
/* line 244, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-payment div.btn-group { | |||
width: 125px; | |||
} | |||
/* line 237, ../sass/distribution/_index.scss */ | |||
/* line 250, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table tr.view ul { | |||
list-style-type: none; | |||
margin-left: 0px; | |||
padding-left: 15px; | |||
} | |||
/* line 246, ../sass/distribution/_index.scss */ | |||
/* line 259, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table tr.view .comment { | |||
margin-top: 20px; | |||
} | |||
/* line 255, ../sass/distribution/_index.scss */ | |||
/* line 268, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .btn-credit { | |||
float: right; | |||
} | |||
/* line 261, ../sass/distribution/_index.scss */ | |||
/* line 274, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products .product-ordered td { | |||
background-color: #e9e9e9; | |||
} | |||
/* line 265, ../sass/distribution/_index.scss */ | |||
/* line 278, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products .product-ordered input { | |||
font-size: 16px; | |||
font-weight: bold; | |||
} | |||
/* line 271, ../sass/distribution/_index.scss */ | |||
/* line 284, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity { | |||
width: 165px; | |||
} | |||
/* line 274, ../sass/distribution/_index.scss */ | |||
/* line 287, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity input { | |||
text-align: center; | |||
color: black; | |||
} | |||
/* line 278, ../sass/distribution/_index.scss */ | |||
/* line 291, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity .form-control { | |||
border-right: 0px none; | |||
padding-right: 4px; | |||
} | |||
/* line 282, ../sass/distribution/_index.scss */ | |||
/* line 295, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { | |||
padding: 5px; | |||
padding-left: 0px; | |||
@@ -2057,35 +2069,35 @@ termes. | |||
border-left: 0px none; | |||
border-right: 0px none; | |||
} | |||
/* line 290, ../sass/distribution/_index.scss */ | |||
/* line 303, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining { | |||
text-align: right; | |||
} | |||
/* line 293, ../sass/distribution/_index.scss */ | |||
/* line 306, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite { | |||
color: #00A65A; | |||
} | |||
/* line 297, ../sass/distribution/_index.scss */ | |||
/* line 310, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { | |||
color: #DD4B39; | |||
} | |||
/* line 301, ../sass/distribution/_index.scss */ | |||
/* line 314, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty { | |||
font-size: 18px; | |||
} | |||
/* line 308, ../sass/distribution/_index.scss */ | |||
/* line 321, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .actions-form button { | |||
margin-left: 15px; | |||
} | |||
/* line 316, ../sass/distribution/_index.scss */ | |||
/* line 329, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-icon { | |||
width: 50px; | |||
} | |||
/* line 318, ../sass/distribution/_index.scss */ | |||
/* line 331, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-icon i { | |||
font-size: 30px; | |||
} | |||
/* line 322, ../sass/distribution/_index.scss */ | |||
/* line 335, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-content { | |||
margin-left: 50px; | |||
} |
@@ -50,6 +50,7 @@ var app = new Vue({ | |||
products: [], | |||
countActiveProducts: 0, | |||
pointsSale: [], | |||
meansPayment: [], | |||
idActivePointSale: 0, | |||
idDefaultPointSale: 0, | |||
countActivePointsSale: 0, | |||
@@ -148,6 +149,7 @@ var app = new Vue({ | |||
app.producer = response.data.producer ; | |||
app.products = response.data.products ; | |||
app.initCountActiveProducts() ; | |||
app.meansPayment = response.data.means_payment ; | |||
app.oneDistributionWeekActive = response.data.one_distribution_week_active ; | |||
@@ -410,7 +412,18 @@ var app = new Vue({ | |||
.then(function(response) { | |||
app.init(app.idActivePointSale) ; | |||
}) ; | |||
} | |||
}, | |||
changeSynchroTiller: function(event) { | |||
var app = this ; | |||
var idOrder = event.currentTarget.getAttribute('data-id-order') ; | |||
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-change-synchro-tiller",{params: { | |||
idOrder: idOrder, | |||
boolSynchroTiller: event.currentTarget.checked ? 1 : 0 | |||
}}) | |||
.then(function(response) { | |||
app.init() ; | |||
}) ; | |||
}, | |||
}, | |||
}); | |||
@@ -419,7 +432,7 @@ Vue.component('modal', { | |||
}) | |||
Vue.component('order-form',{ | |||
props: ['date', 'pointsSale', 'users', 'products', 'order', 'producer'], | |||
props: ['date', 'pointsSale','meansPayment', 'users', 'products', 'order', 'producer'], | |||
data: function() { | |||
return { | |||
errors: [], | |||
@@ -471,6 +484,7 @@ Vue.component('order-form',{ | |||
idPointSale: this.order.id_point_sale, | |||
idUser: this.order.id_user, | |||
username: this.order.username, | |||
meanPayment: this.order.mean_payment, | |||
products: JSON.stringify(this.order.productOrder), | |||
comment: this.order.comment, | |||
processCredit: processCredit | |||
@@ -498,6 +512,7 @@ Vue.component('order-form',{ | |||
+ ('0' + this.date.getDate()).slice(-2), | |||
idOrder: this.order.id, | |||
idPointSale: this.order.id_point_sale, | |||
meanPayment: this.order.mean_payment, | |||
idUser: this.order.id_user, | |||
username: ''+this.order.username, | |||
products: JSON.stringify(this.order.productOrder), |
@@ -203,6 +203,19 @@ termes. | |||
table { | |||
td.tiller { | |||
width: 60px ; | |||
label { | |||
font-size: 12px ; | |||
cursor: pointer ; | |||
position: relative ; | |||
top: -2px ; | |||
font-weight: normal ; | |||
} | |||
} | |||
td.column-actions { | |||
text-align: right ; | |||
width: 230px ; |
@@ -0,0 +1,87 @@ | |||
<?php | |||
/** | |||
Copyright distrib (2018) | |||
contact@opendistrib.net | |||
Ce logiciel est un programme informatique servant à aider les producteurs | |||
à distribuer leur production en circuits courts. | |||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||
sur le site "http://www.cecill.info". | |||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||
de modification et de redistribution accordés par cette licence, il n'est | |||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||
titulaire des droits patrimoniaux et les concédants successifs. | |||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||
associés au chargement, à l'utilisation, à la modification et/ou au | |||
développement et à la reproduction du logiciel par l'utilisateur étant | |||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||
avertis possédant des connaissances informatiques approfondies. Les | |||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
namespace common\helpers; | |||
class MeanPayment { | |||
const CREDIT = 'credit'; | |||
const CREDIT_CARD = 'credit-card'; | |||
const MONEY = 'money'; | |||
const CHEQUE = 'cheque'; | |||
const TRANSFER = 'transfer'; | |||
const OTHER = 'other'; | |||
/** | |||
* Retourne le libellé du moyen de paiement. | |||
* | |||
* @param string $meanPayment | |||
* @return string | |||
*/ | |||
public static function getStrBy($meanPayment) | |||
{ | |||
switch($meanPayment) { | |||
case self::CREDIT_CARD : return 'Carte bancaire' ; | |||
case self::MONEY : return 'Espèces' ; | |||
case self::CHEQUE : return 'Chèque' ; | |||
case self::TRANSFER : return 'Virement' ; | |||
case self::OTHER : return 'Autre' ; | |||
case self::CREDIT : return 'Crédit' ; | |||
default: return 'Crédit' ; | |||
} | |||
} | |||
/** | |||
* etourne tous les moyens de paiement sour forme de tableau. | |||
* | |||
* @return array | |||
*/ | |||
public static function getAll() | |||
{ | |||
return [ | |||
self::CREDIT => self::getStrBy(self::CREDIT), | |||
self::CREDIT_CARD => self::getStrBy(self::CREDIT_CARD), | |||
self::MONEY => self::getStrBy(self::MONEY), | |||
self::CHEQUE => self::getStrBy(self::CHEQUE), | |||
self::TRANSFER => self::getStrBy(self::TRANSFER), | |||
self::OTHER => self::getStrBy(self::OTHER), | |||
self::CREDIT => self::getStrBy(self::CREDIT), | |||
] ; | |||
} | |||
} |
@@ -76,7 +76,8 @@ class Tiller | |||
if($this->producer_tiller) { | |||
$ordersTiller = $this->getOrders($date) ; | |||
$ordersOpendistrib = Order::searchAll([ | |||
'distribution.date' => $date | |||
'distribution.date' => $date, | |||
'order.tiller_synchronization' => 1 | |||
]) ; | |||
$ordersOpendistribSynchro = [] ; |
@@ -67,12 +67,6 @@ class CreditHistory extends ActiveRecordCommon | |||
const TYPE_REFUND = 'refund'; | |||
const TYPE_DEBIT = 'debit'; | |||
const MEAN_PAYMENT_CREDIT_CARD = 'credit-card'; | |||
const MEAN_PAYMENT_MONEY = 'money'; | |||
const MEAN_PAYMENT_CHEQUE = 'cheque'; | |||
const MEAN_PAYMENT_TRANSFER = 'transfer'; | |||
const MEAN_PAYMENT_OTHER = 'other'; | |||
/** | |||
* @inheritdoc | |||
*/ | |||
@@ -197,7 +191,18 @@ class CreditHistory extends ActiveRecordCommon | |||
} elseif ($this->isTypeDebit()) { | |||
$userProducer->credit -= $this->amount; | |||
} | |||
$userProducer->save(); | |||
// set mean payment | |||
$order = Order::searchOne(['id' => $this->id_order]) ; | |||
$paymentStatus = $order->getPaymentStatus() ; | |||
if($paymentStatus == Order::PAYMENT_PAID | |||
|| $paymentStatus == Order::PAYMENT_SURPLUS) { | |||
$order->mean_payment = MeanPayment::CREDIT ; | |||
$order->save() ; | |||
} | |||
// seuil limite de crédit | |||
$newCredit = $userProducer->credit ; | |||
if(!is_null($creditLimitReminder) && | |||
$oldCredit > $creditLimitReminder && $newCredit <= $creditLimitReminder) { | |||
@@ -219,8 +224,6 @@ class CreditHistory extends ActiveRecordCommon | |||
->setSubject('[distrib] Seuil limite de crédit dépassé') | |||
->send(); | |||
} | |||
$userProducer->save(); | |||
} | |||
} | |||
@@ -353,25 +356,7 @@ class CreditHistory extends ActiveRecordCommon | |||
*/ | |||
public function getStrMeanPayment() | |||
{ | |||
return self::getStrMeanPaymentBy($this->mean_payment) ; | |||
} | |||
/** | |||
* Retourne le libellé du moyen de paiement. | |||
* | |||
* @param string $meanPayment | |||
* @return string | |||
*/ | |||
public static function getStrMeanPaymentBy($meanPayment) | |||
{ | |||
switch($meanPayment) { | |||
case CreditHistory::MEAN_PAYMENT_MONEY : return 'Espèces' ; | |||
case CreditHistory::MEAN_PAYMENT_CHEQUE : return 'Chèque' ; | |||
case CreditHistory::MEAN_PAYMENT_CREDIT_CARD : return 'Carte bancaire' ; | |||
case CreditHistory::MEAN_PAYMENT_TRANSFER : return 'Virement' ; | |||
case CreditHistory::MEAN_PAYMENT_OTHER : return 'Autre' ; | |||
default: return 'Crédit' ; | |||
} | |||
return MeanPayment::getStrBy($this->mean_payment) ; | |||
} | |||
/** |
@@ -94,8 +94,8 @@ class Order extends ActiveRecordCommon | |||
return [ | |||
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], | |||
[['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'], | |||
[['auto_payment'], 'boolean'], | |||
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe'] | |||
[['auto_payment', 'tiller_synchronization'], 'boolean'], | |||
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe'] | |||
]; | |||
} | |||
@@ -0,0 +1,17 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\mysql\Schema; | |||
class m191227_090504_ajout_champs_order_mean_payment extends Migration | |||
{ | |||
public function up() | |||
{ | |||
$this->addColumn('order', 'mean_payment', Schema::TYPE_STRING) ; | |||
} | |||
public function down() | |||
{ | |||
$this->dropColumn('order', 'mean_payment') ; | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\mysql\Schema; | |||
class m191227_110133_ajout_champs_order_tiller_synchronisation extends Migration | |||
{ | |||
public function up() | |||
{ | |||
$this->addColumn('order', 'tiller_synchronization', Schema::TYPE_BOOLEAN.' DEFAULT 1') ; | |||
} | |||
public function down() | |||
{ | |||
$this->dropColumn('order', 'tiller_synchronization') ; | |||
} | |||
} |
@@ -164,7 +164,7 @@ class CreditController extends ProducerBaseController | |||
$creditHistory->type = CreditHistory::TYPE_CREDIT ; | |||
$creditHistory->comment = '' ; | |||
$creditHistory->amount = $resource->amount ; | |||
$creditHistory->mean_payment = CreditHistory::MEAN_PAYMENT_CREDIT_CARD ; | |||
$creditHistory->mean_payment = MeanPayment::CREDIT_CARD ; | |||
$creditHistory->save(); | |||
} else if ($resource instanceof \Payplug\Resource\Refund) { |