add transfer later

This commit is contained in:
2016-03-24 21:35:22 +01:00
parent 167a303296
commit b84ebf0177
8 changed files with 360 additions and 23 deletions

View File

@@ -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);
}
}
}
}