add transfer later
This commit is contained in:
@@ -192,7 +192,9 @@ class ProductSaleForm extends Model
|
||||
$customer = null;
|
||||
$paid_at;
|
||||
$status = Transfer::STATUS_PAID;
|
||||
if ( $this->isAppendToUserCart() ){
|
||||
if ( !Transfer::canMarkPaidByReception($this->payment_method)){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
}else if ( $this->isAppendToUserCart() ){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
}else if ( $this->isAppendToCustomerCart() ){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
@@ -237,10 +239,12 @@ class ProductSaleForm extends Model
|
||||
|
||||
public function appendToUserCart(){
|
||||
if ( $this->isAppendToUserCart() ){
|
||||
$item = new UserSoldItem();
|
||||
$item->id_transfer = $this->transfer->id_transfer;
|
||||
$item->id_user = Yii::$app->user->id;
|
||||
$item->save(false);
|
||||
if ( Transfer::canBeAddedToCart($this->payment_method)){
|
||||
$item = new UserSoldItem();
|
||||
$item->id_transfer = $this->transfer->id_transfer;
|
||||
$item->id_user = Yii::$app->user->id;
|
||||
$item->save(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function isAppendToCustomerCart(){
|
||||
@@ -253,10 +257,12 @@ class ProductSaleForm extends Model
|
||||
|
||||
public function appendToCustomerCart(){
|
||||
if ( $this->isAppendToCustomerCart() && isset($this->customer) ){
|
||||
$item = new ShoppingCart();
|
||||
$item->id_customer = $this->customer->id_customer;
|
||||
$item->id_transfer = $this->transfer->id_transfer;
|
||||
$item->save(false);
|
||||
if ( Transfer::canBeAddedToCart($this->payment_method)){
|
||||
$item = new ShoppingCart();
|
||||
$item->id_customer = $this->customer->id_customer;
|
||||
$item->id_transfer = $this->transfer->id_transfer;
|
||||
$item->save(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,10 @@ class TicketCreate extends Ticket{
|
||||
$transfer->id_account = $this->_account->id_account;
|
||||
|
||||
$status = Transfer::STATUS_PAID;
|
||||
if ( $this->isAppendToUserCart() ){
|
||||
|
||||
if ( !Transfer::canMarkPaidByReception( $this->payment_method ) ){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
}else if ( $this->isAppendToUserCart() ){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
}else if ( $this->isAppendToCustomerCart() ){
|
||||
$status = Transfer::STATUS_NOT_PAID;
|
||||
@@ -284,15 +287,17 @@ class TicketCreate extends Ticket{
|
||||
}
|
||||
|
||||
public function appendToCustomerCart(){
|
||||
if ( $this->isAppendToCustomerCart() && isset($this->customer) ){
|
||||
$item = new ShoppingCart();
|
||||
$item->id_customer = $this->customer->id_customer;
|
||||
$item->id_transfer = $this->_transfer->id_transfer;
|
||||
if ( !$item->save(false) ){
|
||||
\Yii::error("Nem sikerült menteni a bérletet! Vendég kosár hozzárendelés sikertelen!");
|
||||
throw new \Exception("Nem sikerült menteni a bérletet! Vendég kosár hozzárendelés sikertelen!");
|
||||
}
|
||||
|
||||
if ( Transfer::canBeAddedToCart($this->payment_method)){
|
||||
if ( $this->isAppendToCustomerCart() && isset($this->customer) ){
|
||||
$item = new ShoppingCart();
|
||||
$item->id_customer = $this->customer->id_customer;
|
||||
$item->id_transfer = $this->_transfer->id_transfer;
|
||||
if ( !$item->save(false) ){
|
||||
\Yii::error("Nem sikerült menteni a bérletet! Vendég kosár hozzárendelés sikertelen!");
|
||||
throw new \Exception("Nem sikerült menteni a bérletet! Vendég kosár hozzárendelés sikertelen!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{ticket} {ticket_history} {keys} {contract}',
|
||||
'template' => '{ticket} {product} {ticket_history} {keys} {contract}',
|
||||
'buttons' => [
|
||||
'ticket' => function ($url, $model, $key) {
|
||||
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'product' => function ($url, $model, $key) {
|
||||
return Html::a('Új termék', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'ticket_history' => function ($url, $model, $key) {
|
||||
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
@@ -64,6 +67,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
$url = "";
|
||||
if ( 'ticket' == $action ){
|
||||
$url = Url::to(['ticket/create','number' => $model['card_number']]);
|
||||
}else if ( 'product' == $action ){
|
||||
$url = Url::to(['product/sale','number' => $model['card_number']]);
|
||||
}else if ( 'ticket_history' == $action ){
|
||||
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
||||
}else if ( 'keys' == $action ){
|
||||
|
||||
@@ -98,7 +98,7 @@ $discountOptions = mkOptions( ArrayHelper::map($discounts, 'id_discount', 'name'
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class='col-md-12'>
|
||||
<?php echo $form->field($model,'payment_method')->dropDownList(Transfer::paymentMethods()) ?>
|
||||
<?php echo $form->field($model,'payment_method')->dropDownList(Transfer::paymentMethodsForProduct()) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user