From 347249009f434009f4dd5a6d101cd47ce1c47164 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:22:57 +0100 Subject: [PATCH 1/6] Fix issue with assignee not populating when assignee group is selected Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/admin/formwidgets/StatusEditor.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/admin/formwidgets/StatusEditor.php b/app/admin/formwidgets/StatusEditor.php index f99c178ae0..0bb770ad0b 100644 --- a/app/admin/formwidgets/StatusEditor.php +++ b/app/admin/formwidgets/StatusEditor.php @@ -162,15 +162,13 @@ public function onSaveRecord() throw new ApplicationException(sprintf(lang('admin::lang.statuses.alert_already_added'), $context, $context)); $this->validateFormWidget($form, $saveData); - } - catch (ValidationException $ex) { + } catch (ValidationException $ex) { throw new ApplicationException($ex->getMessage()); } if ($this->saveRecord($saveData, $keyFrom)) { flash()->success(sprintf(lang('admin::lang.alert_success'), lang($this->getModeConfig('formName')).' '.'updated'))->now(); - } - else { + } else { flash()->error(lang('admin::lang.alert_error_try_again'))->now(); } @@ -207,7 +205,7 @@ public function onLoadAssigneeList() $formField = $form->getField($this->assigneeKeyFrom); return [ - '#'.$formField->getId() => $form->renderField($formField, [ + '#'.$formField->getId('group') => $form->renderField($formField, [ 'useContainer' => false, ]), ]; @@ -335,8 +333,7 @@ protected function saveRecord(array $saveData, string $keyFrom) $staff = Staffs_model::find(array_get($saveData, $keyFrom)); if ($record = $this->model->updateAssignTo($group, $staff)) AssigneeUpdated::log($record, $this->getController()->getUser()); - } - else { + } else { $status = Statuses_model::find(array_get($saveData, $keyFrom)); if ($record = $this->model->addStatusHistory($status, $saveData)) StatusUpdated::log($record, $this->getController()->getUser()); From 4e0d6368d2e99fcdc8522cf0ed9b0c819f9318f4 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:24:39 +0100 Subject: [PATCH 2/6] Apply locationable on status editor assignee dropdown Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/admin/formwidgets/StatusEditor.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/admin/formwidgets/StatusEditor.php b/app/admin/formwidgets/StatusEditor.php index 0bb770ad0b..21572eaa0a 100644 --- a/app/admin/formwidgets/StatusEditor.php +++ b/app/admin/formwidgets/StatusEditor.php @@ -7,6 +7,7 @@ use Admin\Classes\BaseFormWidget; use Admin\Classes\FormField; use Admin\Facades\AdminAuth; +use Admin\Facades\AdminLocation; use Admin\Models\Orders_model; use Admin\Models\Staff_groups_model; use Admin\Models\Staffs_model; @@ -234,9 +235,15 @@ public static function getAssigneeOptions($form, $field) if (!strlen($groupId = post('groupId', $form->getField('assignee_group_id')->value))) return []; - return Staffs_model::whereHas('groups', function ($query) use ($groupId) { + $query = Staffs_model::whereHas('groups', function ($query) use ($groupId) { $query->where('staff_groups.staff_group_id', $groupId); - })->isEnabled()->dropdown('staff_name'); + }); + + if ($locationId = AdminLocation::getId()) { + $query->whereHasLocation($locationId); + } + + return $query->isEnabled()->dropdown('staff_name'); } public static function getAssigneeGroupOptions() From 1c262c49792277a6ef516c738e3d8d6710cd0693 Mon Sep 17 00:00:00 2001 From: Vijay Sapkota Date: Thu, 28 Dec 2023 00:13:25 +0100 Subject: [PATCH 3/6] system.urlPolicy config can be set from env variable (#1063) --- config/system.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/system.php b/config/system.php index 171ed1e74f..9e2a669f92 100644 --- a/config/system.php +++ b/config/system.php @@ -193,7 +193,7 @@ | */ - 'urlPolicy' => 'force', + 'urlPolicy' => env('IGNITER_URL_POLICY', 'detect'), /* |-------------------------------------------------------------------------- From f916a3407c68f852f1fa170cef2fafdb1b9df1c1 Mon Sep 17 00:00:00 2001 From: Luca Benati <97920581+Concreta09@users.noreply.github.com> Date: Thu, 28 Dec 2023 00:24:35 +0100 Subject: [PATCH 4/6] Resolve temporarily open_basedir issue (#1061) * open_basedir issue Resolve open_basedir issue adding dot for relativize filename path * Fix code style * add comments Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --------- Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Co-authored-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/system/libraries/Assets.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/system/libraries/Assets.php b/app/system/libraries/Assets.php index 15316b94da..2eb9ea2b86 100644 --- a/app/system/libraries/Assets.php +++ b/app/system/libraries/Assets.php @@ -249,6 +249,10 @@ protected function getAssetPath($name) if (File::isPathSymbol($name)) return File::symbolizePath($name); + // Resolve temporarily open_basedir issue https://github.com/tastyigniter/TastyIgniter/pull/1061 + if (File::isFile('.'.$name)) + return '.'.$name; + if (File::isFile($name)) return $name; From 95557519ee22555f7d40b7a8af58ea2384b1cbaf Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sun, 31 Dec 2023 14:20:05 +0000 Subject: [PATCH 5/6] Catch broken dashboard widgets exception Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- app/admin/widgets/DashboardContainer.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/admin/widgets/DashboardContainer.php b/app/admin/widgets/DashboardContainer.php index c2827ddece..78ca40d761 100644 --- a/app/admin/widgets/DashboardContainer.php +++ b/app/admin/widgets/DashboardContainer.php @@ -372,10 +372,13 @@ protected function makeDashboardWidget($alias, $widgetConfig) $widgetConfig['widget'] = $widgetCode = $widgetConfig['widget'] ?? $widgetConfig['class'] ?? $alias; $widgetClass = Widgets::instance()->resolveDashboardWidget($widgetCode); - $widget = $this->makeWidget($widgetClass, $widgetConfig); - $widget->bindToController(); - return $widget; + return rescue(function () use ($widgetClass, $widgetConfig) { + $widget = $this->makeWidget($widgetClass, $widgetConfig); + $widget->bindToController(); + + return $widget; + }); } protected function resetWidgets() From 638836efcb255ff2f9594b46db11be88733f1e02 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sun, 31 Dec 2023 14:25:25 +0000 Subject: [PATCH 6/6] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 74aa753b63..7106bb5963 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,8 @@ }, "config": { "allow-plugins": { - "composer/installers": true + "composer/installers": true, + "wikimedia/composer-merge-plugin": true } } }