mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-02-15 09:18:41 +00:00
fix bugs
This commit is contained in:
parent
ce8ec287c6
commit
1906bed5ca
|
|
@ -29,6 +29,10 @@ return [
|
||||||
'Connection' => 'Connection',
|
'Connection' => 'Connection',
|
||||||
'Self' => 'Self',
|
'Self' => 'Self',
|
||||||
'Custom' => 'Custom',
|
'Custom' => 'Custom',
|
||||||
|
'Column1' => 'Column1',
|
||||||
|
'Column2' => 'Column2',
|
||||||
|
'Filter1' => 'Filter1',
|
||||||
|
'Filter2' => 'Filter2',
|
||||||
'SrcType' => 'Src-Type',
|
'SrcType' => 'Src-Type',
|
||||||
'DestType' => 'Dest-Type',
|
'DestType' => 'Dest-Type',
|
||||||
'IsPrimary' => 'Is Primary?',
|
'IsPrimary' => 'Is Primary?',
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Exchange",
|
"name": "Exchange",
|
||||||
"uri": "{/base}/admin/exchange/log/list?{?}",
|
"uri": "{/base}/admin/exchange/log/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 50,
|
"order": 50,
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Dashboard",
|
"name": "Dashboard",
|
||||||
"uri": "{/base}/admin/exchange/log/list?{?}",
|
"uri": "{/base}/admin/exchange/log/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Import",
|
"name": "Import",
|
||||||
"uri": "{/base}/admin/exchange/import/list?{?}",
|
"uri": "{/base}/admin/exchange/import/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Export",
|
"name": "Export",
|
||||||
"uri": "{/base}/admin/exchange/export/list?{?}",
|
"uri": "{/base}/admin/exchange/export/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Exchange\Admin;
|
namespace Modules\Exchange\Admin;
|
||||||
|
|
||||||
|
use Modules\Exchange\Admin\Install\Media;
|
||||||
use Modules\Exchange\Models\NullInterfaceManager;
|
use Modules\Exchange\Models\NullInterfaceManager;
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
use phpOMS\Config\SettingsInterface;
|
use phpOMS\Config\SettingsInterface;
|
||||||
|
|
@ -46,6 +47,7 @@ final class Installer extends InstallerAbstract
|
||||||
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||||
{
|
{
|
||||||
parent::install($app, $info, $cfgHandler);
|
parent::install($app, $info, $cfgHandler);
|
||||||
|
Media::install($app, self::PATH);
|
||||||
|
|
||||||
$interfaces = \scandir(__DIR__ . '/Install/Interfaces');
|
$interfaces = \scandir(__DIR__ . '/Install/Interfaces');
|
||||||
if ($interfaces === false) {
|
if ($interfaces === false) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ use Modules\Exchange\Models\PermissionCategory;
|
||||||
use Modules\Exchange\Models\Report;
|
use Modules\Exchange\Models\Report;
|
||||||
use Modules\Exchange\Models\SettingsEnum;
|
use Modules\Exchange\Models\SettingsEnum;
|
||||||
use Modules\Media\Models\CollectionMapper;
|
use Modules\Media\Models\CollectionMapper;
|
||||||
use Modules\Media\Models\MediaMapper;
|
|
||||||
use Modules\Media\Models\NullCollection;
|
use Modules\Media\Models\NullCollection;
|
||||||
use Modules\Media\Models\PathSettings;
|
use Modules\Media\Models\PathSettings;
|
||||||
use Modules\Organization\Models\UnitMapper;
|
use Modules\Organization\Models\UnitMapper;
|
||||||
|
|
@ -205,62 +204,24 @@ final class ApiController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($uploadedFiles = $request->files)) {
|
$files = new NullCollection();
|
||||||
$path = '/Modules/Exchange/Interface/' . $request->getData('title');
|
if (!empty($request->files)) {
|
||||||
|
$path = '/Modules/Exchange/Interfaces/' . $request->getData('title');
|
||||||
|
|
||||||
/** @var \Modules\Media\Models\Media[] $uploaded */
|
/** @var \Modules\Media\Models\Media[] $uploaded */
|
||||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
$files = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
names: $request->getDataList('names'),
|
names: $request->getDataList('names'),
|
||||||
fileNames: $request->getDataList('filenames'),
|
fileNames: $request->getDataList('filenames'),
|
||||||
files: $uploadedFiles,
|
files: $request->files,
|
||||||
account: $request->header->account,
|
account: $request->header->account,
|
||||||
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||||
virtualPath: $path,
|
virtualPath: $path,
|
||||||
pathSettings: PathSettings::FILE_PATH
|
pathSettings: PathSettings::FILE_PATH,
|
||||||
|
type: $request->getDataInt('type')
|
||||||
);
|
);
|
||||||
|
|
||||||
$collection = null;
|
|
||||||
foreach ($uploaded as $media) {
|
|
||||||
if ($request->hasData('type')) {
|
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
|
||||||
$media->id,
|
|
||||||
$request->getDataInt('type'),
|
|
||||||
MediaMapper::class,
|
|
||||||
'types',
|
|
||||||
'',
|
|
||||||
$request->getOrigin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($collection === null) {
|
|
||||||
/** @var \Modules\Media\Models\Collection $collection */
|
|
||||||
$collection = MediaMapper::getParentCollection($path)
|
|
||||||
->limit(1)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
if ($collection->id === 0) {
|
|
||||||
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
|
|
||||||
$path,
|
|
||||||
$request->header->account,
|
|
||||||
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
|
||||||
$collection->id,
|
|
||||||
$media->id,
|
|
||||||
CollectionMapper::class,
|
|
||||||
'sources',
|
|
||||||
'',
|
|
||||||
$request->getOrigin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$interface = $this->createInterfaceFromRequest($request, $collection?->id ?? 0);
|
$interface = $this->createInterfaceFromRequest($request, empty($files->sources) ? 0 : $files->id);
|
||||||
|
|
||||||
$this->createModel($request->header->account, $interface, InterfaceManagerMapper::class, 'interface', $request->getOrigin());
|
$this->createModel($request->header->account, $interface, InterfaceManagerMapper::class, 'interface', $request->getOrigin());
|
||||||
$this->createStandardCreateResponse($request, $response, $interface);
|
$this->createStandardCreateResponse($request, $response, $interface);
|
||||||
|
|
|
||||||
|
|
@ -50,21 +50,15 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-log-list');
|
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-log-list');
|
||||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response);
|
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response);
|
||||||
|
|
||||||
$mapper = ExchangeLogMapper::getAll()
|
$view->data['logs'] = ExchangeLogMapper::getAll()
|
||||||
->with('exchange')
|
->with('exchange')
|
||||||
->with('createdBy')
|
->with('createdBy')
|
||||||
->limit(50);
|
->limit(50)
|
||||||
|
->paginate(
|
||||||
if ($request->getData('ptype') === 'p') {
|
'id',
|
||||||
$view->data['logs'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '<')
|
$request->getDataString('ptype') ?? '',
|
||||||
->execute();
|
$request->getDataInt('offset')
|
||||||
} elseif ($request->getData('ptype') === 'n') {
|
)->executeGetArray();
|
||||||
$view->data['logs'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '>')
|
|
||||||
->execute();
|
|
||||||
} else {
|
|
||||||
$view->data['logs'] = $mapper->where('id', 0, '>')
|
|
||||||
->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,4 @@ echo $this->data['nav']->render();
|
||||||
|
|
||||||
$interface = $this->data['interface'];
|
$interface = $this->data['interface'];
|
||||||
|
|
||||||
$a = $interface->source->getAbsolutePath();
|
|
||||||
|
|
||||||
include $interface->source->getAbsolutePath() . '/import.tpl.php';
|
include $interface->source->getAbsolutePath() . '/import.tpl.php';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user