diff --git a/app/admin/formwidgets/StatusEditor.php b/app/admin/formwidgets/StatusEditor.php index f99c178ae0..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; @@ -162,15 +163,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 +206,7 @@ public function onLoadAssigneeList() $formField = $form->getField($this->assigneeKeyFrom); return [ - '#'.$formField->getId() => $form->renderField($formField, [ + '#'.$formField->getId('group') => $form->renderField($formField, [ 'useContainer' => false, ]), ]; @@ -236,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() @@ -335,8 +340,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()); 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() 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; 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 } } } 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'), /* |--------------------------------------------------------------------------