-
Notifications
You must be signed in to change notification settings - Fork 5
HP-2869: add installment page #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
c4595fb
58517f4
6da29ec
aeeb807
a0a7bc1
997cd0b
8fa8950
1e5c108
a752faf
000b5ad
b05a721
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
| /** | ||
| * Finance module for HiPanel | ||
| * | ||
| * @link https://github.com/hiqdev/hipanel-module-finance | ||
| * @package hipanel-module-finance | ||
| * @license BSD-3-Clause | ||
| * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) | ||
| */ | ||
|
|
||
| namespace hipanel\modules\finance\controllers; | ||
|
|
||
| use hipanel\actions\IndexAction; | ||
| use hipanel\actions\SmartCreateAction; | ||
| use hipanel\actions\SmartDeleteAction; | ||
| use hipanel\actions\SmartUpdateAction; | ||
| use hipanel\actions\ValidateFormAction; | ||
| use hipanel\actions\ViewAction; | ||
| use hipanel\filters\EasyAccessControl; | ||
| use hipanel\modules\client\models\stub\ClientRelationFreeStub; | ||
| use hipanel\modules\finance\actions\ChangeBuyerAction; | ||
| use hipanel\modules\finance\models\Plan; | ||
| use hipanel\modules\finance\models\query\SaleQuery; | ||
| use Yii; | ||
| use yii\base\Event; | ||
|
|
||
| class InstallmentController extends \hipanel\base\CrudController | ||
| { | ||
| public function behaviors() | ||
| { | ||
| return array_merge(parent::behaviors(), [ | ||
| [ | ||
| 'class' => EasyAccessControl::class, | ||
| 'actions' => [ | ||
| '*' => 'sale.read', | ||
| ], | ||
| ], | ||
| ]); | ||
| } | ||
|
|
||
| public function actions() | ||
| { | ||
| return array_merge(parent::actions(), [ | ||
| 'index' => [ | ||
| 'class' => IndexAction::class, | ||
| ], | ||
| ]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| declare(strict_types=1); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| namespace hipanel\modules\finance\grid; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| use hipanel\components\User; | ||||||||||||||||||||||||||||||
| use hipanel\grid\BoxedGridView; | ||||||||||||||||||||||||||||||
| use hipanel\modules\stock\widgets\combo\PartnoCombo; | ||||||||||||||||||||||||||||||
| use hipanel\modules\client\grid\ClientColumn; | ||||||||||||||||||||||||||||||
| use hipanel\modules\stock\widgets\combo\LocationsCombo; | ||||||||||||||||||||||||||||||
| use hipanel\modules\finance\models\Installment; | ||||||||||||||||||||||||||||||
| use Yii; | ||||||||||||||||||||||||||||||
| use yii\helpers\Html; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| class InstallmentGridView extends BoxedGridView | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| private User $user; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| public function init() | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| parent::init(); | ||||||||||||||||||||||||||||||
| $this->user = Yii::$app->user; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| public function columns(): array | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| return array_merge(parent::columns(), [ | ||||||||||||||||||||||||||||||
| 'serial' => [ | ||||||||||||||||||||||||||||||
| 'label' => Yii::t('hipanel:stock', 'Serial'), | ||||||||||||||||||||||||||||||
| 'filterOptions' => ['class' => 'narrow-filter'], | ||||||||||||||||||||||||||||||
| 'filterAttribute' => 'serial_ilike', | ||||||||||||||||||||||||||||||
| 'format' => 'raw', | ||||||||||||||||||||||||||||||
| 'value' => fn($model) => Html::a(Html::encode($model->serial), ['@part/view', 'id' => $model->id], ['class' => 'text-bold']), | ||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||
|
Comment on lines
+29
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix serial link to target the part ID (not installment ID). Line 34 links to ✅ Suggested fix- 'value' => fn($model) => Html::a(Html::encode($model->serial), ['@part/view', 'id' => $model->id], ['class' => 'text-bold']),
+ 'value' => fn($model) => Html::a(Html::encode($model->serial), ['@part/view', 'id' => $model->part_id], ['class' => 'text-bold']),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| 'model' => [ | ||||||||||||||||||||||||||||||
| 'filterAttribute' => 'model_like', | ||||||||||||||||||||||||||||||
| 'filter' => function ($column, $model, $attribute) { | ||||||||||||||||||||||||||||||
| return PartnoCombo::widget([ | ||||||||||||||||||||||||||||||
| 'model' => $model, | ||||||||||||||||||||||||||||||
| 'attribute' => $attribute, | ||||||||||||||||||||||||||||||
| 'formElementSelector' => 'td', | ||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| 'format' => 'raw', | ||||||||||||||||||||||||||||||
| 'label' => Yii::t('hipanel:stock', 'Part No.'), | ||||||||||||||||||||||||||||||
| 'value' => static function (Installment $model): string { | ||||||||||||||||||||||||||||||
| $partNo = Html::encode($model->model); | ||||||||||||||||||||||||||||||
| if (Yii::$app->user->can('model.read')) { | ||||||||||||||||||||||||||||||
| return Html::a($partNo, ['@model/view', 'id' => $model->model_id], [ | ||||||||||||||||||||||||||||||
| 'data' => ['toggle' => 'tooltip'], | ||||||||||||||||||||||||||||||
| 'title' => Html::encode(sprintf( | ||||||||||||||||||||||||||||||
| "%s %s", | ||||||||||||||||||||||||||||||
| Yii::t('hipanel:stock', $model->model_type_label), | ||||||||||||||||||||||||||||||
| Yii::t('hipanel:stock', $model->model_brand_label), | ||||||||||||||||||||||||||||||
| )), | ||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| return $partNo; | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||
| 'device' => [ | ||||||||||||||||||||||||||||||
| 'filterAttribute' => 'device_like', | ||||||||||||||||||||||||||||||
| 'format' => 'raw', | ||||||||||||||||||||||||||||||
| 'value' => static function (Installment $model) { | ||||||||||||||||||||||||||||||
| return Html::tag('b', Html::encode($model->device), ['style' => 'margin-left:1em']); | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <?php | ||
| /** | ||
| * Finance module for HiPanel | ||
| * | ||
| * @link https://github.com/hiqdev/hipanel-module-finance | ||
| * @package hipanel-module-finance | ||
| * @license BSD-3-Clause | ||
| * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) | ||
| */ | ||
|
|
||
| namespace hipanel\modules\finance\grid; | ||
|
|
||
| use hiqdev\higrid\representations\RepresentationCollection; | ||
| use Yii; | ||
|
|
||
| class InstallmentRepresentations extends RepresentationCollection | ||
| { | ||
| protected function fillRepresentations() | ||
| { | ||
| $this->representations = array_filter([ | ||
| 'common' => [ | ||
| 'label' => Yii::t('hipanel', 'common'), | ||
| 'columns' => [ | ||
| 'checkbox', | ||
| 'client', 'seller', | ||
| 'serial', 'model', 'device', | ||
| 'start', 'finish', 'period', | ||
| ], | ||
| ], | ||
| ]); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -106,11 +106,15 @@ public function items() | |||||||||||||||||||
| 'url' => ['@consumption/index'], | ||||||||||||||||||||
| 'visible' => $user->can('consumption.read'), | ||||||||||||||||||||
| ], | ||||||||||||||||||||
| 'installment' => [ | ||||||||||||||||||||
| 'label' => Yii::t('hipanel:finance', 'Installments'), | ||||||||||||||||||||
| 'url' => ['@installment/index'], | ||||||||||||||||||||
| ], | ||||||||||||||||||||
|
Comment on lines
+109
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add permission-based visibility for the Installments menu item. Without a 🔧 Suggested change 'installment' => [
'label' => Yii::t('hipanel:finance', 'Installments'),
'url' => ['@installment/index'],
+ 'visible' => $user->can('sale.read'),
],📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| 'billing-registry' => [ | ||||||||||||||||||||
| 'label' => Yii::t('hipanel:finance', 'Billing registry'), | ||||||||||||||||||||
| 'url' => ['@billing-registry/index'], | ||||||||||||||||||||
| 'visible' => $user->can('owner-staff'), | ||||||||||||||||||||
| ] | ||||||||||||||||||||
| ], | ||||||||||||||||||||
| ], | ||||||||||||||||||||
| ], | ||||||||||||||||||||
| ]; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <?php | ||
| /** | ||
| * Finance module for HiPanel | ||
| * | ||
| * @link https://github.com/hiqdev/hipanel-module-finance | ||
| * @package hipanel-module-finance | ||
| * @license BSD-3-Clause | ||
| * @copyright Copyright (c) 2015-2026, HiQDev (http://hiqdev.com/) | ||
| */ | ||
|
|
||
| namespace hipanel\modules\finance\models; | ||
|
|
||
| use hipanel\modules\finance\models\query\SaleQuery; | ||
| use hipanel\modules\server\models\Server; | ||
| use hiqdev\hiart\ActiveQuery; | ||
| use Yii; | ||
|
|
||
| /** | ||
| * Class Installment. | ||
| * | ||
| * @author Yurii Myronchuk <bladeroot@gmail.com> | ||
| */ | ||
| class Installment extends \hipanel\base\Model | ||
| { | ||
| use \hipanel\base\ModelTrait; | ||
|
|
||
| public function rules() | ||
| { | ||
| return array_merge(parent::rules(), [ | ||
| [['id', 'client_id', 'seller_id', 'part_id', 'model_id', 'model_type_id', 'model_brand_id', 'device_id'], 'integer'], | ||
| [['client', 'seller', 'serial', 'model', 'model_type', 'model_type_label', 'model_brand', 'model_brand_label', 'device'], 'string'], | ||
| [['start', 'finish'], 'datetime', 'format' => 'php:Y-m-d'], | ||
| [['period'], 'integer'], | ||
| ]); | ||
| } | ||
|
|
||
| public function attributeLabels() | ||
| { | ||
| return array_merge(parent::attributeLabels(), [ | ||
| 'client' => Yii::t('hipanel:finance:sale', 'Buyer'), | ||
| 'client_id' => Yii::t('hipanel:finance:sale', 'Buyer'), | ||
| 'seller' => Yii::t('hipanel:finance:sale', 'Seller'), | ||
| 'seller_id' => Yii::t('hipanel:finance:sale', 'Seller'), | ||
| 'part_id' => Yii::t('hipanel:stock', 'Part No.'), | ||
| 'serial' => Yii::t('hipanel:stock', 'Serial'), | ||
| 'model_id' => Yii::t('hipanel:stock', 'Part No.'), | ||
| 'model' => Yii::t('hipanel:stock', 'Part No.'), | ||
| 'model_type_id' => Yii::t('hipanel', 'Type'), | ||
| 'model_type' => Yii::t('hipanel', 'Type'), | ||
| 'model_type_label' => Yii::t('hipanel', 'Type'), | ||
| 'model_brand_id' => Yii::t('hipanel:stock', 'Manufacturer'), | ||
| 'model_brand' => Yii::t('hipanel:stock', 'Manufacturer'), | ||
| 'model_brand_label' => Yii::t('hipanel:stock', 'Manufacturer'), | ||
| 'device_id' => Yii::t('hipanel:finance:sale', 'Device'), | ||
| 'device' => Yii::t('hipanel:finance:sale', 'Device'), | ||
| 'start' => Yii::t('hipanel:finance:sale', 'Installment start'), | ||
| 'finish' => Yii::t('hipanel:finance:sale', 'Installment end'), | ||
| 'period' => Yii::t('hipanel:finance:sale', 'Periods left'), | ||
| ]); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
| /** | ||
| * Finance module for HiPanel | ||
| * | ||
| * @link https://github.com/hiqdev/hipanel-module-finance | ||
| * @package hipanel-module-finance | ||
| * @license BSD-3-Clause | ||
| * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) | ||
| */ | ||
|
|
||
| namespace hipanel\modules\finance\models; | ||
|
|
||
| use hipanel\base\SearchModelTrait; | ||
| use hipanel\helpers\ArrayHelper; | ||
| use Yii; | ||
|
|
||
| class InstallmentSearch extends Installment | ||
| { | ||
|
|
||
| use SearchModelTrait { | ||
| searchAttributes as defaultSearchAttributes; | ||
| } | ||
|
|
||
| public function searchAttributes() | ||
| { | ||
| return ArrayHelper::merge($this->defaultSearchAttributes(), [ | ||
| 'month', | ||
| ]); | ||
| } | ||
|
Comment on lines
24
to
29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f -name "InstallmentSearch.php" | head -20Repository: hiqdev/hipanel-module-finance Length of output: 107 🏁 Script executed: find . -type f -name "Installment.php" | grep -E "models|src" | head -20Repository: hiqdev/hipanel-module-finance Length of output: 101 🏁 Script executed: cat -n ./src/models/InstallmentSearch.phpRepository: hiqdev/hipanel-module-finance Length of output: 1096 🏁 Script executed: cat -n ./src/models/Installment.phpRepository: hiqdev/hipanel-module-finance Length of output: 2949 🏁 Script executed: find . -type f -name "SearchModelTrait.php" | head -10Repository: hiqdev/hipanel-module-finance Length of output: 55 🏁 Script executed: rg -A 20 "class SearchModelTrait" --type phpRepository: hiqdev/hipanel-module-finance Length of output: 55 🏁 Script executed: find . -type f -name "*.php" -exec grep -l "searchAttributes" {} \; | head -20Repository: hiqdev/hipanel-module-finance Length of output: 523 🏁 Script executed: rg "use SearchModelTrait" --type php -A 10 | head -50Repository: hiqdev/hipanel-module-finance Length of output: 2796 🏁 Script executed: cat -n ./src/models/RequisiteSearch.phpRepository: hiqdev/hipanel-module-finance Length of output: 1775 🏁 Script executed: cat -n ./src/models/SaleSearch.phpRepository: hiqdev/hipanel-module-finance Length of output: 2123 Add a In Yii2 search models, attributes must be declared in Suggested fix class InstallmentSearch extends Installment
{
+ public function rules()
+ {
+ return array_merge(parent::rules(), [
+ [['month'], 'safe'],
+ ]);
+ }
+
use SearchModelTrait {
searchAttributes as defaultSearchAttributes;
}🤖 Prompt for AI Agents |
||
|
|
||
| public function attributeLabels() | ||
| { | ||
| return array_merge(parent::attributeLabels(), [ | ||
| ]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?php | ||
|
|
||
| /** @var \hipanel\widgets\AdvancedSearch $search */ | ||
|
|
||
| use hipanel\modules\client\widgets\combo\ClientCombo; | ||
| use hipanel\modules\client\widgets\combo\SellerCombo; | ||
| use hipanel\modules\finance\widgets\TariffCombo; | ||
| use hiqdev\combo\StaticCombo; | ||
| use hiqdev\yii2\daterangepicker\DateRangePicker; | ||
| use yii\bootstrap\Html; | ||
|
|
||
| ?> | ||
|
|
||
| <div class="col-md-4 col-sm-6 col-xs-12"> | ||
| <?= $search->field('seller_id')->widget(SellerCombo::class) ?> | ||
| </div> | ||
|
|
||
| <div class="col-md-4 col-sm-6 col-xs-12"> | ||
| <?= $search->field('client_id')->widget(ClientCombo::class) ?> | ||
| </div> | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,50 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\models\IndexPageUiOptions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\modules\finance\grid\InstallmentGridView; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\modules\finance\grid\InstallmentRepresentations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\modules\finance\models\SInstallmentSearch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\widgets\gridLegend\GridLegend; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use hipanel\widgets\IndexPage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use yii\bootstrap\Dropdown; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use yii\bootstrap\Html; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use yii\data\ActiveDataProvider; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use yii\web\View; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @var View $this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @var SaleSearch $model | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @var IndexPageUiOptions $uiModel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @var SaleRepresentations $representationCollection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @var ActiveDataProvider $dataProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the import/type hints to match Installment classes. The 🔧 Suggested change-use hipanel\modules\finance\models\SInstallmentSearch;
+use hipanel\modules\finance\models\InstallmentSearch;
/**
* `@var` View $this
- * `@var` SaleSearch $model
+ * `@var` InstallmentSearch $model
* `@var` IndexPageUiOptions $uiModel
- * `@var` SaleRepresentations $representationCollection
+ * `@var` InstallmentRepresentations $representationCollection
* `@var` ActiveDataProvider $dataProvider
*/📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $user = Yii::$app->user; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->title = Yii::t('hipanel:finance:sale', 'Installment'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->params['breadcrumbs'][] = $this->title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $subtitle = array_filter(Yii::$app->request->get($model->formName(), [])) ? Yii::t('hipanel', 'filtered list') : Yii::t('hipanel', 'full list'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page = IndexPage::begin(['model' => $model, 'dataProvider' => $dataProvider]) ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->beginContent('sorter-actions') ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?= $page->renderSorter(['attributes' => ['id', 'start', 'finish']]) ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->endContent() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->beginContent('representation-actions') ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?= $page->renderRepresentations($representationCollection) ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->endContent() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->beginContent('table') ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->beginBulkForm() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?= InstallmentGridView::widget([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'boxed' => false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'dataProvider' => $dataProvider, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'filterModel' => $model, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'columns' => $representationCollection->getByName($uiModel->representation)->getColumns(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]) ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->endBulkForm() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->endContent() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <?php $page->end() ?> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: hiqdev/hipanel-module-finance
Length of output: 7106
🏁 Script executed:
Repository: hiqdev/hipanel-module-finance
Length of output: 1564
🌐 Web query:
hipanel-core CrudController default actions💡 Result:
In hipanel-core,
CrudControllerfollows Yii2’s standard CRUD convention: the “default” CRUD actions are:index(list)view(read one)create(create)update(update)delete(delete)This matches Yii2’s own CRUD generator/guide expectations (CRUD = Create/Read/Update/Delete, plus the listing page as
index). [1][2]Sources:
[1] Yii2 Guide – Generating CRUD code with Gii: https://www.yiiframework.com/doc/guide/2.0/en/start-gii
[2] Yii2 Guide – Controller/action conventions (action IDs like
view,update, etc.): https://www.yiiframework.com/doc/guide/2.0/en/structure-controllersRemove write action exposure and restrict access to index only.
The
EasyAccessControlwith'*' => 'sale.read'combined witharray_merge(parent::actions(), ...)exposes create/update/delete actions with only read-level permissions. This grants write access based on a read-only permission and should be restricted to the index action.🔧 Suggested change
public function behaviors() { return array_merge(parent::behaviors(), [ [ 'class' => EasyAccessControl::class, 'actions' => [ - '*' => 'sale.read', + 'index' => 'sale.read', ], ], ]); } public function actions() { - return array_merge(parent::actions(), [ - 'index' => [ - 'class' => IndexAction::class, - ], - ]); + return [ + 'index' => [ + 'class' => IndexAction::class, + ], + ]; }🤖 Prompt for AI Agents