mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-02-01 03:18:42 +00:00
bug and media fixes
This commit is contained in:
parent
9cf2887c3b
commit
a710da7d2a
|
|
@ -15,23 +15,20 @@ declare(strict_types=1);
|
|||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\ContractManagement\Models\Contract;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractType;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11nMapper;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use Modules\ContractManagement\Models\NullContractType;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\NotificationLevel;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Model\Message\FormValidation;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
use Modules\ContractManagement\Models\Contract;
|
||||
use Modules\ContractManagement\Models\NullContractType;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Api controller for the contracts module.
|
||||
|
|
@ -143,7 +140,8 @@ final class ApiController extends Controller
|
|||
}
|
||||
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
[$request->getData('name') ?? ''],
|
||||
$request->getDataList('names') ?? [],
|
||||
$request->getDataList('filenames') ?? [],
|
||||
$uploadedFiles,
|
||||
$request->header->account,
|
||||
__DIR__ . '/../../../Modules/Media/Files/Modules/ContractManagement/Contracts/' . ($request->getData('contract_title') ?? '0'),
|
||||
|
|
|
|||
|
|
@ -14,17 +14,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\ContractManagement\Models\PermissionState;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractType;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
|
||||
/**
|
||||
* Backend controller for the contracts module.
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use Modules\Media\Models\Media;
|
||||
use Modules\Admin\Models\Account;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Media\Models\Media;
|
||||
use phpOMS\Localization\Money;
|
||||
|
||||
/**
|
||||
|
|
@ -129,17 +129,17 @@ class Contract
|
|||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'start' => $this->start,
|
||||
'end' => $this->end,
|
||||
'duration' => $this->duration,
|
||||
'warning' => $this->warning,
|
||||
'start' => $this->start,
|
||||
'end' => $this->end,
|
||||
'duration' => $this->duration,
|
||||
'warning' => $this->warning,
|
||||
'responsible' => $this->responsible,
|
||||
'createdAt' => $this->createdAt,
|
||||
'costs' => $this->costs,
|
||||
'type' => $this->type,
|
||||
'createdAt' => $this->createdAt,
|
||||
'costs' => $this->costs,
|
||||
'type' => $this->type,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
|
|
@ -35,18 +35,18 @@ final class ContractMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'contractmgmt_contract_id' => ['name' => 'contractmgmt_contract_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_contract_title' => ['name' => 'contractmgmt_contract_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||
'contractmgmt_contract_id' => ['name' => 'contractmgmt_contract_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_contract_title' => ['name' => 'contractmgmt_contract_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||
'contractmgmt_contract_description' => ['name' => 'contractmgmt_contract_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'contractmgmt_contract_account' => ['name' => 'contractmgmt_contract_account', 'type' => 'int', 'internal' => 'account'],
|
||||
'contractmgmt_contract_costs' => ['name' => 'contractmgmt_contract_costs', 'type' => 'Serializable', 'internal' => 'costs'],
|
||||
'contractmgmt_contract_duration' => ['name' => 'contractmgmt_contract_duration', 'type' => 'int', 'internal' => 'duration'],
|
||||
'contractmgmt_contract_warning' => ['name' => 'contractmgmt_contract_warning', 'type' => 'int', 'internal' => 'warning'],
|
||||
'contractmgmt_contract_start' => ['name' => 'contractmgmt_contract_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'contractmgmt_contract_end' => ['name' => 'contractmgmt_contract_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'contractmgmt_contract_account' => ['name' => 'contractmgmt_contract_account', 'type' => 'int', 'internal' => 'account'],
|
||||
'contractmgmt_contract_costs' => ['name' => 'contractmgmt_contract_costs', 'type' => 'Serializable', 'internal' => 'costs'],
|
||||
'contractmgmt_contract_duration' => ['name' => 'contractmgmt_contract_duration', 'type' => 'int', 'internal' => 'duration'],
|
||||
'contractmgmt_contract_warning' => ['name' => 'contractmgmt_contract_warning', 'type' => 'int', 'internal' => 'warning'],
|
||||
'contractmgmt_contract_start' => ['name' => 'contractmgmt_contract_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'contractmgmt_contract_end' => ['name' => 'contractmgmt_contract_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'contractmgmt_contract_responsible' => ['name' => 'contractmgmt_contract_responsible', 'type' => 'int', 'internal' => 'responsible'],
|
||||
'contractmgmt_contract_type' => ['name' => 'contractmgmt_contract_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'contractmgmt_contract_created_at' => ['name' => 'contractmgmt_contract_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
'contractmgmt_contract_type' => ['name' => 'contractmgmt_contract_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'contractmgmt_contract_created_at' => ['name' => 'contractmgmt_contract_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class ContractType implements \JsonSerializable, ArrayableInterface
|
|||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'id' => $this->id,
|
||||
'l11n' => $this->l11n,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ class ContractTypeL11n implements \JsonSerializable, ArrayableInterface
|
|||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'type' => $this->type,
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'type' => $this->type,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ final class ContractTypeMapper extends DataMapperAbstract
|
|||
'column' => 'title',
|
||||
'conditional' => true,
|
||||
'external' => null,
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Create' => 'Create',
|
||||
'Contract' => 'Contract',
|
||||
'Create' => 'Create',
|
||||
'Contract' => 'Contract',
|
||||
'Contracts' => 'Contracts',
|
||||
'List' => 'List',
|
||||
'List' => 'List',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Contract' => 'Contract',
|
||||
'Contract' => 'Contract',
|
||||
'Contracts' => 'Contracts',
|
||||
'Title' => 'Title',
|
||||
'Title' => 'Title',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -12,11 +12,10 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract[] $contracts
|
||||
*/
|
||||
$contracts = $this->getData('contracts') ?? [];
|
||||
|
|
|
|||
|
|
@ -12,11 +12,8 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract $contract
|
||||
*/
|
||||
$contract = $this->getData('contract');
|
||||
|
|
|
|||
|
|
@ -16,26 +16,22 @@ namespace Modules\ContractManagement\tests\Controller;
|
|||
|
||||
use Model\CoreSettings;
|
||||
use Modules\Admin\Models\AccountPermission;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Account\Account;
|
||||
use phpOMS\Account\AccountManager;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
use phpOMS\Dispatcher\Dispatcher;
|
||||
use phpOMS\Event\EventManager;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
use Modules\Media\Models\UploadStatus;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Router\WebRouter;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\ContractManagement\tests\Controller\ApiControllerTest: ContractManagement api controller
|
||||
|
|
|
|||
|
|
@ -59,26 +59,26 @@ final class ContractTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->contract->title = 'Title';
|
||||
$this->contract->title = 'Title';
|
||||
$this->contract->description = 'Description';
|
||||
$this->contract->duration = 123;
|
||||
$this->contract->warning = 2;
|
||||
$this->contract->duration = 123;
|
||||
$this->contract->warning = 2;
|
||||
|
||||
$serialized = $this->contract->jsonSerialize();
|
||||
unset($serialized['createdAt']);
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
'description' => 'Description',
|
||||
'start' => null,
|
||||
'end' => null,
|
||||
'duration' => 123,
|
||||
'warning' => 2,
|
||||
'start' => null,
|
||||
'end' => null,
|
||||
'duration' => 123,
|
||||
'warning' => 2,
|
||||
'responsible' => null,
|
||||
'costs' => null,
|
||||
'type' => new ContractType(),
|
||||
'costs' => null,
|
||||
'type' => new ContractType(),
|
||||
],
|
||||
$serialized
|
||||
);
|
||||
|
|
|
|||
|
|
@ -70,16 +70,16 @@ final class ContractTypeL11nTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->l11n->title = 'Title';
|
||||
$this->l11n->title = 'Title';
|
||||
$this->l11n->type = 2;
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
'id' => 0,
|
||||
'title' => 'Title',
|
||||
'type' => 2,
|
||||
'language' => ISO639x1Enum::_DE,
|
||||
'language' => ISO639x1Enum::_DE,
|
||||
],
|
||||
$this->l11n->jsonSerialize()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Modules\ContractManagement\tests\Models;
|
|||
|
||||
use Modules\ContractManagement\Models\ContractType;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -67,7 +66,7 @@ final class ContractTypeTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'l11n' => new ContractTypeL11n(),
|
||||
'l11n' => new ContractTypeL11n(),
|
||||
],
|
||||
$this->type->jsonSerialize()
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user