]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix(ERP-247): add CSRF token to AJAX calls in WriteOffsErp view origin/feature_filippov_fix_write_offs_erp_csrf
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Sat, 28 Feb 2026 17:23:29 +0000 (20:23 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Sat, 28 Feb 2026 17:23:29 +0000 (20:23 +0300)
$.ajax() calls for confirm-write-off and re-send-write-off were posting
without _csrf token, causing BadRequestHttpException 400 on every request.
Added yii.getCsrfToken() to data payload of both calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
erp24/views/write_offs_erp/view.php

index cd56a7d992de047f1e5092bc7ea58d729f434a8c..1286b973b7b1c223b0f0ad0f0c851e0b6a0f5ed2 100644 (file)
@@ -242,7 +242,8 @@ $this->registerJsFile('/js/plyr.min.js', ['position' => View::POS_END]);
                     type: 'POST',
                     dataType: 'json',
                     data: {
-                        id : '" . $model->id . "'
+                        id : '" . $model->id . "',
+                        _csrf: yii.getCsrfToken()
                     },
                     success: function(model) {
                         console.log(model);
@@ -295,7 +296,8 @@ $this->registerJsFile('/js/plyr.min.js', ['position' => View::POS_END]);
                                         type: 'POST',
                                         dataType: 'json',
                                         data: {
-                                            id : '" . $model->id . "'
+                                            id : '" . $model->id . "',
+                                            _csrf: yii.getCsrfToken()
                                         },
                                         success: function(model) {
                                             console.log(model);