mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-15 14:58:40 +00:00
org -> unit change, some new functionality
This commit is contained in:
parent
d9e2804ab7
commit
7ea05be3b7
|
|
@ -160,58 +160,13 @@
|
||||||
"name": "profile_contact_element_content",
|
"name": "profile_contact_element_content",
|
||||||
"type": "VARCHAR(255)",
|
"type": "VARCHAR(255)",
|
||||||
"null": false
|
"null": false
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profile_contact_elementrel": {
|
|
||||||
"name": "profile_contact_elementrel",
|
|
||||||
"fields": {
|
|
||||||
"profile_contact_elementrel_id": {
|
|
||||||
"name": "profile_contact_elementrel_id",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"primary": true,
|
|
||||||
"autoincrement": true
|
|
||||||
},
|
},
|
||||||
"profile_contact_elementrel_contact": {
|
"profile_contact_element_contact": {
|
||||||
"name": "profile_contact_elementrel_contact",
|
"name": "profile_contact_element_contact",
|
||||||
"type": "INT",
|
"type": "INT",
|
||||||
"null": false,
|
"null": false,
|
||||||
"foreignTable": "profile_contact",
|
"foreignTable": "profile_contact",
|
||||||
"foreignKey": "profile_contact_id"
|
"foreignKey": "profile_contact_id"
|
||||||
},
|
|
||||||
"profile_contact_elementrel_element": {
|
|
||||||
"name": "profile_contact_elementrel_element",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"foreignTable": "profile_contact_element",
|
|
||||||
"foreignKey": "profile_contact_element_id"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profile_contactelementrel": {
|
|
||||||
"name": "profile_contactelementrel",
|
|
||||||
"fields": {
|
|
||||||
"profile_contactelementrel_id": {
|
|
||||||
"name": "profile_contactelementrel_id",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"primary": true,
|
|
||||||
"autoincrement": true
|
|
||||||
},
|
|
||||||
"profile_contactelementrel_profile": {
|
|
||||||
"name": "profile_contactelementrel_profile",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"foreignTable": "profile_account",
|
|
||||||
"foreignKey": "profile_account_id"
|
|
||||||
},
|
|
||||||
"profile_contactelementrel_element": {
|
|
||||||
"name": "profile_contactelementrel_element",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"foreignTable": "profile_contact_element",
|
|
||||||
"foreignKey": "profile_contact_element_id"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -240,37 +195,5 @@
|
||||||
"foreignKey": "address_id"
|
"foreignKey": "address_id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"profile_addressrel": {
|
|
||||||
"name": "profile_addressrel",
|
|
||||||
"fields": {
|
|
||||||
"profile_addressrel_id": {
|
|
||||||
"name": "profile_addressrel_id",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"primary": true,
|
|
||||||
"autoincrement": true
|
|
||||||
},
|
|
||||||
"profile_addressrel_profile": {
|
|
||||||
"name": "profile_addressrel_profile",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"foreignTable": "profile_account",
|
|
||||||
"foreignKey": "profile_account_id"
|
|
||||||
},
|
|
||||||
"profile_addressrel_public": {
|
|
||||||
"name": "profile_addressrel_public",
|
|
||||||
"type": "TINYINT",
|
|
||||||
"default": 1,
|
|
||||||
"null": false
|
|
||||||
},
|
|
||||||
"profile_addressrel_address": {
|
|
||||||
"name": "profile_addressrel_address",
|
|
||||||
"type": "INT",
|
|
||||||
"null": false,
|
|
||||||
"foreignTable": "address",
|
|
||||||
"foreignKey": "address_id"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'^.*/profile.*$' => [
|
'^.*/profile$' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\Profile\Controller\ApiController:apiProfileCreate',
|
'dest' => '\Modules\Profile\Controller\ApiController:apiProfileCreate',
|
||||||
'verb' => RouteVerb::PUT,
|
'verb' => RouteVerb::PUT,
|
||||||
|
|
@ -43,6 +43,17 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'^.*/profile/settings/password(\?.*|$)' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\Admin\Controller\ApiController:apiSettingsAccountPasswordSet',
|
||||||
|
'verb' => RouteVerb::SET,
|
||||||
|
'permission' => [
|
||||||
|
'module' => AdminApiController::NAME,
|
||||||
|
'type' => PermissionType::MODIFY,
|
||||||
|
'state' => AdminPermissionCategory::ACCOUNT_SETTINGS,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
'^.*/profile/settings/image(\?.*|$)' => [
|
'^.*/profile/settings/image(\?.*|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\Profile\Controller\ApiController:apiSettingsAccountImageSet',
|
'dest' => '\Modules\Profile\Controller\ApiController:apiSettingsAccountImageSet',
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,6 @@ abstract class PermissionCategory extends Enum
|
||||||
public const PROFILE = 1;
|
public const PROFILE = 1;
|
||||||
|
|
||||||
public const PROFILE_SETTINGS = 2;
|
public const PROFILE_SETTINGS = 2;
|
||||||
|
|
||||||
|
public const LOGIN = 3;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,22 +63,6 @@ class Profile implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public Account $account;
|
public Account $account;
|
||||||
|
|
||||||
/**
|
|
||||||
* Location data.
|
|
||||||
*
|
|
||||||
* @var Location[]
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected array $location = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contact data.
|
|
||||||
*
|
|
||||||
* @var ContactElement[]
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected array $contactElements = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gender.
|
* Gender.
|
||||||
*
|
*
|
||||||
|
|
@ -95,6 +79,14 @@ class Profile implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
protected int $sex = SexType::OTHER;
|
protected int $sex = SexType::OTHER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirmation key.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public string $confirmation = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
@ -104,8 +96,8 @@ class Profile implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function __construct(Account $account = null)
|
public function __construct(Account $account = null)
|
||||||
{
|
{
|
||||||
$this->image = new NullMedia();
|
$this->image = new NullMedia();
|
||||||
$this->account = $account ?? new NullAccount();
|
$this->account = $account ?? new NullAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -184,58 +176,6 @@ class Profile implements \JsonSerializable
|
||||||
$this->sex = $sex;
|
$this->sex = $sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get account locations.
|
|
||||||
*
|
|
||||||
* @return Location[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getLocation() : array
|
|
||||||
{
|
|
||||||
return $this->location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add location.
|
|
||||||
*
|
|
||||||
* @param Location $location Location
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function addLocation(Location $location) : void
|
|
||||||
{
|
|
||||||
$this->location[] = $location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get account contact element.
|
|
||||||
*
|
|
||||||
* @return ContactElement[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getContactElements() : array
|
|
||||||
{
|
|
||||||
return $this->contactElements;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add contact element.
|
|
||||||
*
|
|
||||||
* @param ContactElement $contactElement Contact Element
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function addContactElement(ContactElement $contactElement) : void
|
|
||||||
{
|
|
||||||
$this->contactElements[] = $contactElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
@ -248,8 +188,6 @@ class Profile implements \JsonSerializable
|
||||||
'account' => $this->account,
|
'account' => $this->account,
|
||||||
'image' => $this->image,
|
'image' => $this->image,
|
||||||
'birthday' => $this->birthday,
|
'birthday' => $this->birthday,
|
||||||
'locations' => $this->location,
|
|
||||||
'contactelements' => $this->contactElements,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,27 +70,6 @@ final class ProfileMapper extends DataMapperFactory
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Has many relation.
|
|
||||||
*
|
|
||||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public const HAS_MANY = [
|
|
||||||
'location' => [
|
|
||||||
'mapper' => AddressMapper::class,
|
|
||||||
'table' => 'profile_addressrel',
|
|
||||||
'external' => 'profile_addressrel_address',
|
|
||||||
'self' => 'profile_addressrel_profile',
|
|
||||||
],
|
|
||||||
'contactElements' => [
|
|
||||||
'mapper' => ContactElementMapper::class,
|
|
||||||
'table' => 'profile_contactelementrel',
|
|
||||||
'self' => 'profile_contactelementrel_profile',
|
|
||||||
'external' => 'profile_contactelementrel_element',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model to use by the mapper.
|
* Model to use by the mapper.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ return ['Profile' => [
|
||||||
'Long' => 'Long',
|
'Long' => 'Long',
|
||||||
'Medium' => 'Medium',
|
'Medium' => 'Medium',
|
||||||
'Name' => 'Name',
|
'Name' => 'Name',
|
||||||
|
'OldPassword' => 'Old Password',
|
||||||
|
'NewPassword' => 'New Password',
|
||||||
|
'RepeatPassword' => 'Repeat Password',
|
||||||
|
'Password' => 'Password',
|
||||||
'NoAddressSpecified' => 'No address specified',
|
'NoAddressSpecified' => 'No address specified',
|
||||||
'NoContactSpecified' => 'No contact specified',
|
'NoContactSpecified' => 'No contact specified',
|
||||||
'Numberformat' => 'Numberformat',
|
'Numberformat' => 'Numberformat',
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,10 @@ echo $this->getData('nav')->render();
|
||||||
<div class="tabview tab-2">
|
<div class="tabview tab-2">
|
||||||
<div class="box wf-100 col-xs-12">
|
<div class="box wf-100 col-xs-12">
|
||||||
<ul class="tab-links">
|
<ul class="tab-links">
|
||||||
<li><label for="c-tab-1"><?= $this->getHtml('General'); ?></label></li>
|
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
|
||||||
<?php if ($this->request->header->account === $account->getId()) : ?>
|
<?php if ($this->request->header->account === $account->getId()) : ?>
|
||||||
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
|
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
|
||||||
|
<li><label for="c-tab-3"><?= $this->getHtml('Password'); ?></label></li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -165,7 +166,9 @@ echo $this->getData('nav')->render();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($this->request->header->account === $account->getId()) :
|
<?php
|
||||||
|
|
||||||
|
if ($this->request->header->account === $account->getId()) :
|
||||||
$countryCodes = ISO3166TwoEnum::getConstants();
|
$countryCodes = ISO3166TwoEnum::getConstants();
|
||||||
$countries = ISO3166NameEnum::getConstants();
|
$countries = ISO3166NameEnum::getConstants();
|
||||||
$timezones = TimeZoneEnumArray::getConstants();
|
$timezones = TimeZoneEnumArray::getConstants();
|
||||||
|
|
@ -598,6 +601,39 @@ echo $this->getData('nav')->render();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
|
||||||
|
<div class="tab">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-md-4">
|
||||||
|
<div class="portlet">
|
||||||
|
<form id="fPassword" name="fPassword" action="<?= UriFactory::build('{/api}profile/settings/password'); ?>" method="post">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Password'); ?></div>
|
||||||
|
<div class="portlet-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="iOldPass"><?= $this->getHtml('OldPassword'); ?></label>
|
||||||
|
<input id="iOldPass" name="oldpass" type="password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="iNewPass"><?= $this->getHtml('NewPassword'); ?></label>
|
||||||
|
<input id="iNewPass" name="newpass" type="password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="iRepPass"><?= $this->getHtml('RepeatPassword'); ?></label>
|
||||||
|
<input id="iRepPass" name="reppass" type="password" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="portlet-foot">
|
||||||
|
<input type="submit" name="saveButton" id="iSavePassButton" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->app->dbPool = $GLOBALS['dbpool'];
|
$this->app->dbPool = $GLOBALS['dbpool'];
|
||||||
$this->app->orgId = 1;
|
$this->app->unitId = 1;
|
||||||
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
||||||
$this->app->appSettings = new CoreSettings();
|
$this->app->appSettings = new CoreSettings();
|
||||||
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../Modules/');
|
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../Modules/');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user