mirror of
https://github.com/Karaka-Management/oms-Customs.git
synced 2026-02-14 17:38:41 +00:00
Test fixes
This commit is contained in:
parent
dd5e2e73e0
commit
af73bc7d6c
|
|
@ -14,14 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Customs\Admin;
|
namespace Modules\Customs\Admin;
|
||||||
|
|
||||||
use Modules\Admin\Models\NullAccount;
|
|
||||||
use phpOMS\Application\ApplicationAbstract;
|
|
||||||
use phpOMS\Config\SettingsInterface;
|
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
use phpOMS\Module\ModuleInfo;
|
|
||||||
use phpOMS\System\File\PathException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer class.
|
* Installer class.
|
||||||
|
|
@ -40,12 +33,4 @@ final class Installer extends InstallerAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const PATH = __DIR__;
|
public const PATH = __DIR__;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
|
||||||
{
|
|
||||||
parent::install($app, $info, $cfgHandler);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,5 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\Dashboard\Controller\ApiController;
|
|
||||||
use Modules\Dashboard\Models\PermissionCategory;
|
|
||||||
use phpOMS\Account\PermissionType;
|
|
||||||
use phpOMS\Router\RouteVerb;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Customs\Controller;
|
namespace Modules\Customs\Controller;
|
||||||
|
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
|
||||||
use phpOMS\Message\ResponseAbstract;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api controller for the dashboard module.
|
* Api controller for the dashboard module.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
||||||
'db' => 'sqlite',
|
'db' => 'sqlite',
|
||||||
'database' => __DIR__ . '/../Data/customs.sqlite'
|
'database' => __DIR__ . '/../Data/customs.sqlite',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$con->connect();
|
$con->connect();
|
||||||
|
|
@ -140,7 +140,7 @@ final class BackendController extends Controller
|
||||||
LIMIT 100;
|
LIMIT 100;
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()->fetchAll());
|
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()?->fetchAll() ?? []);
|
||||||
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT sanction_us_cons.Ent_num,
|
SELECT sanction_us_cons.Ent_num,
|
||||||
|
|
@ -158,7 +158,7 @@ final class BackendController extends Controller
|
||||||
LIMIT 100;
|
LIMIT 100;
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()->fetchAll());
|
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()?->fetchAll() ?? []);
|
||||||
|
|
||||||
// EU Consolidated
|
// EU Consolidated
|
||||||
$name = '';
|
$name = '';
|
||||||
|
|
@ -246,7 +246,7 @@ final class BackendController extends Controller
|
||||||
LIMIT 500;
|
LIMIT 500;
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()->fetchAll());
|
$view->data['sanctions'] = \array_merge($view->data['sanctions'], $query->raw($sql)->execute()?->fetchAll() ?? []);
|
||||||
|
|
||||||
$con->close();
|
$con->close();
|
||||||
|
|
||||||
|
|
@ -349,20 +349,35 @@ final class BackendController extends Controller
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create HS code view
|
||||||
|
*
|
||||||
|
* @param RequestAbstract $request Request
|
||||||
|
* @param ResponseAbstract $response Response
|
||||||
|
* @param array $data Generic data
|
||||||
|
*
|
||||||
|
* @return RenderableInterface
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function viewHSCodeView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
public function viewHSCodeView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||||
{
|
{
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
$view->setTemplate('/Modules/Customs/Theme/Backend/hscode-view');
|
$view->setTemplate('/Modules/Customs/Theme/Backend/hscode-view');
|
||||||
|
|
||||||
|
$original = $request->getDataString('id') ?? '';
|
||||||
|
|
||||||
if (!$request->hasData('id')
|
if (!$request->hasData('id')
|
||||||
|| \preg_match('/^[0-9 ]+$/', $original = $request->getDataString('id')) !== 1
|
|| \preg_match('/^[0-9 ]+$/', $original) !== 1
|
||||||
) {
|
) {
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
||||||
'db' => 'sqlite',
|
'db' => 'sqlite',
|
||||||
'database' => __DIR__ . '/../Data/customs.sqlite'
|
'database' => __DIR__ . '/../Data/customs.sqlite',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$con->connect();
|
$con->connect();
|
||||||
|
|
@ -395,7 +410,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$query = new Builder($con);
|
$query = new Builder($con);
|
||||||
|
|
||||||
$view->data['goods'] = $query->raw($sql)->execute()->fetchAll();
|
$view->data['goods'] = $query->raw($sql)->execute()?->fetchAll() ?? [];
|
||||||
|
|
||||||
if (empty($view->data['goods'])) {
|
if (empty($view->data['goods'])) {
|
||||||
return $view;
|
return $view;
|
||||||
|
|
@ -425,7 +440,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$query = new Builder($con);
|
$query = new Builder($con);
|
||||||
|
|
||||||
$view->data['footnotes'] = $query->raw($sql)->execute()->fetchAll();
|
$view->data['footnotes'] = $query->raw($sql)->execute()?->fetchAll() ?? [];
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +469,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
$con = new \phpOMS\DataStorage\Database\Connection\SQLiteConnection([
|
||||||
'db' => 'sqlite',
|
'db' => 'sqlite',
|
||||||
'database' => __DIR__ . '/../Data/customs.sqlite'
|
'database' => __DIR__ . '/../Data/customs.sqlite',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$con->connect();
|
$con->connect();
|
||||||
|
|
@ -474,7 +489,7 @@ final class BackendController extends Controller
|
||||||
$query->bind(['value' => '%' . $request->getDataString('hscode') . '%'], ':description');
|
$query->bind(['value' => '%' . $request->getDataString('hscode') . '%'], ':description');
|
||||||
$query->bind(['value' => '%' . $request->getDataString('hscode') . '%'], ':code');
|
$query->bind(['value' => '%' . $request->getDataString('hscode') . '%'], ':code');
|
||||||
|
|
||||||
$temp = $query->raw($sql)->execute()->fetchAll();
|
$temp = $query->raw($sql)->execute()?->fetchAll() ?? [];
|
||||||
|
|
||||||
if (($exactCount = \count($temp)) === 0) {
|
if (($exactCount = \count($temp)) === 0) {
|
||||||
return $view;
|
return $view;
|
||||||
|
|
@ -536,7 +551,7 @@ final class BackendController extends Controller
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
$query = new Builder($con);
|
$query = new Builder($con);
|
||||||
$view->data['codes'] = $query->raw($sql)->execute()->fetchAll();
|
$view->data['codes'] = $query->raw($sql)->execute()?->fetchAll() ?? [];
|
||||||
|
|
||||||
$con->close();
|
$con->close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.2
|
||||||
|
*
|
||||||
|
* @package Modules\Customs\Data
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// Sources:
|
// Sources:
|
||||||
|
|
||||||
|
|
@ -35,7 +47,15 @@ $con = new SQLiteConnection(
|
||||||
);
|
);
|
||||||
$con->connect();
|
$con->connect();
|
||||||
|
|
||||||
$schema = \json_decode(\file_get_contents(__DIR__ . '/schema.json'), true);
|
$schemaContent = \file_get_contents(__DIR__ . '/schema.json');
|
||||||
|
if ($schemaContent === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$schema = \json_decode($schemaContent, true);
|
||||||
|
if (!\is_array($schema)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($schema as $table) {
|
foreach ($schema as $table) {
|
||||||
Builder::createFromSchema($table, $con)->execute();
|
Builder::createFromSchema($table, $con)->execute();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# Structure
|
|
||||||
|
|
||||||
## ER
|
|
||||||
|
|
||||||

|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB |
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$footnotes = $this->data['footnotes'] ?? [];
|
$footnotes = $this->data['footnotes'] ?? [];
|
||||||
$goods = $this->data['goods'] ?? [];
|
$goods = $this->data['goods'] ?? [];
|
||||||
$baseDate = strtotime("1899-12-30");
|
$baseDate = \strtotime("1899-12-30");
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-6">
|
||||||
|
|
@ -9,8 +9,8 @@ $baseDate = strtotime("1899-12-30");
|
||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
<?php foreach ($goods as $good) : ?>
|
<?php foreach ($goods as $good) : ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label><?= $good['Goods_code'] ?></label>
|
<label><?= $good['Goods_code']; ?></label>
|
||||||
<p><?= $good['Description'] ?></p>
|
<p><?= $good['Description']; ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"creator": {
|
"creator": {
|
||||||
"name": "Jingga",
|
"name": "Jingga",
|
||||||
"website": "jingga.app"
|
"website": "https://jingga.app"
|
||||||
},
|
},
|
||||||
"description": "The customs module.",
|
"description": "The customs module.",
|
||||||
"directory": "Customs",
|
"directory": "Customs",
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@ use phpOMS\DataStorage\Session\HttpSession;
|
||||||
use phpOMS\Dispatcher\Dispatcher;
|
use phpOMS\Dispatcher\Dispatcher;
|
||||||
use phpOMS\Event\EventManager;
|
use phpOMS\Event\EventManager;
|
||||||
use phpOMS\Localization\L11nManager;
|
use phpOMS\Localization\L11nManager;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
|
||||||
use phpOMS\Module\ModuleAbstract;
|
use phpOMS\Module\ModuleAbstract;
|
||||||
use phpOMS\Module\ModuleManager;
|
use phpOMS\Module\ModuleManager;
|
||||||
use phpOMS\Router\WebRouter;
|
use phpOMS\Router\WebRouter;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user