Compare commits
7 Commits
894ff2be48
...
91d064947e
Author | SHA1 | Date | |
---|---|---|---|
91d064947e | |||
9a6e95673e | |||
d24c3bb1cb | |||
2ad637e55f | |||
ac09342c9d | |||
3a1054e1df | |||
0f02c4b5be |
@ -49,7 +49,7 @@ var RVR = {
|
|||||||
document.getElementById('loading').style.visibility = 'visible';
|
document.getElementById('loading').style.visibility = 'visible';
|
||||||
|
|
||||||
var formData = new FormData(form);
|
var formData = new FormData(form);
|
||||||
var formError = form.getElementsByClassName('formError')[0];
|
var formError = document.getElementsByClassName('formError')[0];
|
||||||
var pageLeaveOnSuccess = form.dataset.redirectOnSuccess || form.dataset.reloadOnSuccess;
|
var pageLeaveOnSuccess = form.dataset.redirectOnSuccess || form.dataset.reloadOnSuccess;
|
||||||
|
|
||||||
RVR.httpRequest('POST', form.action, function () {
|
RVR.httpRequest('POST', form.action, function () {
|
||||||
|
@ -85,15 +85,6 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getMembers(Community $community): array
|
|
||||||
{
|
|
||||||
$members = iterator_to_array($this->communityMemberRepository->getAllByCommunity($community, true));
|
|
||||||
usort($members, function($a, $b) {
|
|
||||||
return strnatcmp($a->getUser()->getDisplayName(), $b->getUser()->getDisplayName());
|
|
||||||
});
|
|
||||||
return $members;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function newMember(): ?IContent
|
public function newMember(): ?IContent
|
||||||
{
|
{
|
||||||
if (!$this->checkPermission(\Container::$request->query('communityId'), true, $community, $ownCommunityMember)) {
|
if (!$this->checkPermission(\Container::$request->query('communityId'), true, $community, $ownCommunityMember)) {
|
||||||
@ -160,15 +151,6 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCurrencies(Community $community): array
|
|
||||||
{
|
|
||||||
$currencies = iterator_to_array($this->currencyRepository->getAllByCommunity($community));
|
|
||||||
usort($currencies, function($a, $b) {
|
|
||||||
return strnatcmp($a->getCode(), $b->getCode());
|
|
||||||
});
|
|
||||||
return $currencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function newCurrency(): ?IContent
|
public function newCurrency(): ?IContent
|
||||||
{
|
{
|
||||||
if (!$this->checkPermission(\Container::$request->query('communityId'), true, $community, $ownCommunityMember)) {
|
if (!$this->checkPermission(\Container::$request->query('communityId'), true, $community, $ownCommunityMember)) {
|
||||||
@ -176,7 +158,8 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code = \Container::$request->post('code');
|
$code = \Container::$request->post('code');
|
||||||
if (strlen($code) === 0 || strlen($code) > 3) {
|
$roundDigits = (int)\Container::$request->post('round_digits');
|
||||||
|
if (strlen($code) === 0 || strlen($code) > 3 || $roundDigits < 0 || $roundDigits > 9) {
|
||||||
return new JsonContent([
|
return new JsonContent([
|
||||||
'error' => ['errorText' => 'Please fill all required fields!']
|
'error' => ['errorText' => 'Please fill all required fields!']
|
||||||
]);
|
]);
|
||||||
@ -192,7 +175,7 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
$currency = new Currency();
|
$currency = new Currency();
|
||||||
$currency->setCommunity($community);
|
$currency->setCommunity($community);
|
||||||
$currency->setCode($code);
|
$currency->setCode($code);
|
||||||
$currency->setRoundDigits((int)\Container::$request->post('round_digits'));
|
$currency->setRoundDigits($roundDigits);
|
||||||
\Container::$persistentDataManager->saveToDb($currency);
|
\Container::$persistentDataManager->saveToDb($currency);
|
||||||
|
|
||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
@ -268,6 +251,24 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getMembers(Community $community): array
|
||||||
|
{
|
||||||
|
$members = iterator_to_array($this->communityMemberRepository->getAllByCommunity($community, true));
|
||||||
|
usort($members, function($a, $b) {
|
||||||
|
return strnatcmp($a->getUser()->getDisplayName(), $b->getUser()->getDisplayName());
|
||||||
|
});
|
||||||
|
return $members;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCurrencies(Community $community): array
|
||||||
|
{
|
||||||
|
$currencies = iterator_to_array($this->currencyRepository->getAllByCommunity($community));
|
||||||
|
usort($currencies, function($a, $b) {
|
||||||
|
return strnatcmp($a->getCode(), $b->getCode());
|
||||||
|
});
|
||||||
|
return $currencies;
|
||||||
|
}
|
||||||
|
|
||||||
private function checkPermission(
|
private function checkPermission(
|
||||||
int $communityId,
|
int $communityId,
|
||||||
bool $needToBeOwner,
|
bool $needToBeOwner,
|
||||||
|
@ -40,5 +40,6 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p class="formError justify marginTop"></p>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p class="formError justify marginTop"></p>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user