From: marina Date: Mon, 26 Aug 2024 12:18:01 +0000 (+0300) Subject: ERP-85 Реализовать обмен данных с 1С Бухгалтерия X-Git-Tag: 1.4~22^2~16 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=f5e08febc10e4100a242ca49354b5ccd962425fa;p=erp24_rep%2Fyii-erp24%2F.git ERP-85 Реализовать обмен данных с 1С Бухгалтерия --- diff --git a/erp24/controllers/ApiController.php b/erp24/controllers/ApiController.php index ab8d0481..66b4c62d 100644 --- a/erp24/controllers/ApiController.php +++ b/erp24/controllers/ApiController.php @@ -2,6 +2,7 @@ namespace app\controllers; +use yii\db\StaleObjectException; use yii_app\records\AdminGroup; use yii_app\records\StoreGuidBuh; use kartik\select2\Select2; @@ -455,4 +456,21 @@ class ApiController extends Controller 'model' => $model ]); } + + /** + * @throws \Throwable + * @throws StaleObjectException + */ + public function actionDeleteStoreGuidBuh($id) + { + try { + if ($model = StoreGuidBuh::findOne($id)) { + $model->delete(); + } + }catch (\Exception $e) { + throw new \Exception($e); + } + + $this->redirect(Yii::$app->request->referrer); + } } \ No newline at end of file diff --git a/erp24/views/api/store-guid-buh.php b/erp24/views/api/store-guid-buh.php index 56b6038b..333c639b 100644 --- a/erp24/views/api/store-guid-buh.php +++ b/erp24/views/api/store-guid-buh.php @@ -1,8 +1,10 @@ params['breadcrumbs'][] = $this->title; return date('d-m-Y H:i:s', strtotime($model->updated_at)); } ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'buttons' => [ + 'delete' => function ($url, $model, $key) { + return Html::a( + '', + Url::to(['delete-store-guid-buh', 'id' => $model->id]), + [ + 'title' => 'Удалить', + 'data' => [ + 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', + 'method' => 'post', + ], + ] + ); + }, + ], + ], ], ]); ?>