Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Dec 31, 2023
2 parents 30a7b68 + 638836e commit 75e1a16
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
22 changes: 13 additions & 9 deletions app/admin/formwidgets/StatusEditor.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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,
]),
];
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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());
Expand Down
9 changes: 6 additions & 3 deletions app/admin/widgets/DashboardContainer.php
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions app/system/libraries/Assets.php
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -60,7 +60,8 @@
},
"config": {
"allow-plugins": {
"composer/installers": true
"composer/installers": true,
"wikimedia/composer-merge-plugin": true
}
}
}
2 changes: 1 addition & 1 deletion config/system.php
Expand Up @@ -193,7 +193,7 @@
|
*/

'urlPolicy' => 'force',
'urlPolicy' => env('IGNITER_URL_POLICY', 'detect'),

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 75e1a16

Please sign in to comment.