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