mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-10 15:48:40 +00:00
fix bugs
This commit is contained in:
parent
e3ae3a7834
commit
816a50dee8
|
|
@ -19,7 +19,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Organigram",
|
||||
"uri": "{/base}/organization/organigram?{?}",
|
||||
"uri": "{/base}/organization/organigram",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Units",
|
||||
"uri": "{/base}/organization/unit/list?{?}",
|
||||
"uri": "{/base}/organization/unit/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/organization/unit/list?{?}",
|
||||
"uri": "{/base}/organization/unit/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/organization/unit/create?{?}",
|
||||
"uri": "{/base}/organization/unit/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 25,
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Departments",
|
||||
"uri": "{/base}/organization/department/list?{?}",
|
||||
"uri": "{/base}/organization/department/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/organization/department/list?{?}",
|
||||
"uri": "{/base}/organization/department/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/organization/department/create?{?}",
|
||||
"uri": "{/base}/organization/department/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 25,
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Positions",
|
||||
"uri": "{/base}/organization/position/list?{?}",
|
||||
"uri": "{/base}/organization/position/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 20,
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/organization/position/list?{?}",
|
||||
"uri": "{/base}/organization/position/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/organization/position/create?{?}",
|
||||
"uri": "{/base}/organization/position/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 25,
|
||||
|
|
|
|||
|
|
@ -334,10 +334,9 @@ final class ApiController extends Controller
|
|||
*/
|
||||
public function apiUnitImageSet(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
$uploadedFiles = $request->files;
|
||||
if (empty($uploadedFiles)) {
|
||||
if (empty($request->files)) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $uploadedFiles);
|
||||
$this->createInvalidUpdateResponse($request, $response, $request->files);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -349,16 +348,16 @@ final class ApiController extends Controller
|
|||
$path = '/Modules/Organization/' . $unit->name;
|
||||
|
||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||
$request->getDataList('names'),
|
||||
$request->getDataList('filenames'),
|
||||
$uploadedFiles,
|
||||
$request->header->account,
|
||||
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||
$path,
|
||||
names: $request->getDataList('names'),
|
||||
fileNames: $request->getDataList('filenames'),
|
||||
files: $request->files,
|
||||
account: $request->header->account,
|
||||
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||
virtualPath: $path,
|
||||
pathSettings: PathSettings::FILE_PATH
|
||||
);
|
||||
|
||||
$unit->image = \reset($uploaded);
|
||||
$unit->image = \reset($uploaded->sources);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $unit, UnitMapper::class, 'unit', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $unit);
|
||||
|
|
@ -510,7 +509,7 @@ final class ApiController extends Controller
|
|||
if ($setting->content === '1') {
|
||||
$newRequest = new HttpRequest();
|
||||
$newRequest->header->account = $request->header->account;
|
||||
$newRequest->setData('name', 'org:pos:' . \strtr(\strtolower($position->name), ' ', '_'));
|
||||
$newRequest->setData('name', 'pos:' . \strtr(\strtolower($position->name), ' ', '_'));
|
||||
$newRequest->setData('status', GroupStatus::ACTIVE);
|
||||
$this->app->moduleManager->get('Admin')->apiGroupCreate($newRequest, $response, $data);
|
||||
}
|
||||
|
|
@ -685,7 +684,7 @@ final class ApiController extends Controller
|
|||
if ($setting->content === '1') {
|
||||
$newRequest = new HttpRequest();
|
||||
$newRequest->header->account = $request->header->account;
|
||||
$newRequest->setData('name', 'org:dep:' . \strtolower($department->name));
|
||||
$newRequest->setData('name', 'dep:' . \strtolower($department->name));
|
||||
$newRequest->setData('status', GroupStatus::ACTIVE);
|
||||
$this->app->moduleManager->get('Admin')->apiGroupCreate($newRequest, $response, $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,18 +56,15 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/unit-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004703001, $request, $response);
|
||||
|
||||
$mapper = UnitMapper::getAll()
|
||||
$view->data['units'] = UnitMapper::getAll()
|
||||
->with('parent')
|
||||
->with('image')
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['units'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '<')->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['units'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '>')->execute();
|
||||
} else {
|
||||
$view->data['units'] = $mapper->where('id', 0, '>')->execute();
|
||||
}
|
||||
->limit(25)
|
||||
->paginate(
|
||||
'id',
|
||||
$request->getDataString('ptype') ?? '',
|
||||
$request->getDataInt('offset')
|
||||
)->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -233,18 +230,15 @@ final class BackendController extends Controller
|
|||
$pageLimit = 25;
|
||||
$view->data['pageLimit'] = $pageLimit;
|
||||
|
||||
$mapper = DepartmentMapper::getAll()->with('parent')->with('unit')->limit($pageLimit + 1);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$mapper->where('id', $request->getDataInt('offset') ?? 0, '<');
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$mapper->where('id', $request->getDataInt('offset') ?? 0, '>');
|
||||
} else {
|
||||
$mapper->where('id', 0, '>');
|
||||
}
|
||||
|
||||
/** @var \Modules\Organization\Models\Department[] $departments */
|
||||
$departments = $mapper->execute();
|
||||
$departments = DepartmentMapper::getAll()
|
||||
->with('parent')
|
||||
->with('unit')
|
||||
->limit($pageLimit + 1)
|
||||
->paginate(
|
||||
'id',
|
||||
$request->getDataString('ptype') ?? '',
|
||||
$request->getDataInt('offset')
|
||||
)->executeGetArray();
|
||||
|
||||
$view->data['hasMore'] = ($count = \count($departments)) > $pageLimit;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ final class NullUnit extends Unit
|
|||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->image = new NullMedia();
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user