implement feature 'put to cart ticket installment request'
This commit is contained in:
@@ -2,15 +2,14 @@
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use backend\components\ContractManager;
|
||||
use Yii;
|
||||
use common\models\Contract;
|
||||
use backend\models\ContractSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use backend\models\ContractCustomerSearch;
|
||||
use common\models\Customer;
|
||||
use yii\db\Query;
|
||||
use backend\models\ContractRequestSearch;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
use common\models\Ticket;
|
||||
@@ -64,6 +63,7 @@ class ContractController extends Controller {
|
||||
/**
|
||||
* Lists all Contract models.
|
||||
*
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
@@ -197,17 +197,21 @@ class ContractController extends Controller {
|
||||
], [
|
||||
'id_contract' => $model->id_contract
|
||||
] );
|
||||
$ticket = Ticket::find ()->andWhere ( [
|
||||
|
||||
/** @var \common\models\Ticket $ticket */
|
||||
$ticket = Ticket::find ()->andWhere ( [
|
||||
'id_contract' => $model->id_contract
|
||||
] )->one ();
|
||||
|
||||
$transfer = Transfer::find ()->andWhere ( [
|
||||
|
||||
|
||||
/** @var \common\models\Transfer $transfer */
|
||||
$transfer = Transfer::find ()->andWhere ( [
|
||||
'type' => Transfer::TYPE_TICKET
|
||||
] )->andWhere ( [
|
||||
'id_object' => $ticket->id_ticket
|
||||
] )->one ();
|
||||
|
||||
$transfer->storno ();
|
||||
$transfer->storno();
|
||||
|
||||
$tx->commit ();
|
||||
// $tx->rollBack();
|
||||
@@ -239,8 +243,7 @@ class ContractController extends Controller {
|
||||
'contract' => $contract
|
||||
] );
|
||||
|
||||
// $searchModel->contract = $contract;
|
||||
|
||||
|
||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||
|
||||
return $this->render ( 'details', [
|
||||
@@ -249,6 +252,16 @@ class ContractController extends Controller {
|
||||
'dataProvider' => $dataProvider
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @throws NotFoundHttpException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function actionRequestToCart($id){
|
||||
$contractManager = new ContractManager();
|
||||
$contractManager->openRequestAndPutItItoCart($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the Contract model based on its primary key value.
|
||||
|
||||
Reference in New Issue
Block a user