fix billing process

This commit is contained in:
Dennis Eichhorn 2023-04-08 04:36:26 +02:00
parent 4035d30c35
commit a3268733c6
4 changed files with 16 additions and 10 deletions

View File

@ -8,9 +8,11 @@ assignees: ''
--- ---
# Bug Description # Bug Description
A clear and concise description of what the bug is. A clear and concise description of what the bug is.
# How to Reproduce # How to Reproduce
Steps to reproduce the behavior: Steps to reproduce the behavior:
1. Go to '...' 1. Go to '...'
@ -19,16 +21,20 @@ Steps to reproduce the behavior:
4. See error 4. See error
# Expected Behavior # Expected Behavior
A clear and concise description of what you expected to happen. A clear and concise description of what you expected to happen.
# Screenshots # Screenshots
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
# System Information # System Information
- System: [e.g. PC or iPhone11, ...] - System: [e.g. PC or iPhone11, ...]
- OS: [e.g. iOS] - OS: [e.g. iOS]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
- KarakaVersion [e.g. 22] - KarakaVersion [e.g. 22]
# Additional Information # Additional Information
Add any other context about the problem here. Add any other context about the problem here.

View File

@ -59,8 +59,8 @@ final class ApiController extends Controller
private function validateNewsCreate(RequestAbstract $request) : array private function validateNewsCreate(RequestAbstract $request) : array
{ {
$val = []; $val = [];
if (($val['title'] = empty($request->getData('title'))) if (($val['title'] = !$request->hasData('title'))
|| ($val['plain'] = empty($request->getData('plain'))) || ($val['plain'] = !$request->hasData('plain'))
|| ($val['lang'] = ( || ($val['lang'] = (
$request->hasData('lang') $request->hasData('lang')
&& !ISO639x1Enum::isValidValue(\strtolower((string) $request->getData('lang'))) && !ISO639x1Enum::isValidValue(\strtolower((string) $request->getData('lang')))
@ -334,7 +334,7 @@ final class ApiController extends Controller
$newsArticle->isFeatured = $request->getDataBool('featured') ?? true; $newsArticle->isFeatured = $request->getDataBool('featured') ?? true;
// allow comments // allow comments
if (!empty($request->getData('allow_comments')) if ($request->hasData('allow_comments')
&& !(($commentApi = $this->app->moduleManager->get('Comments')) instanceof NullModule) && !(($commentApi = $this->app->moduleManager->get('Comments')) instanceof NullModule)
) { ) {
/** @var \Modules\Comments\Controller\ApiController $commentApi */ /** @var \Modules\Comments\Controller\ApiController $commentApi */

View File

@ -173,7 +173,7 @@ final class BackendController extends Controller implements DashboardElementInte
if ($article->createdBy->getId() !== $accountId if ($article->createdBy->getId() !== $accountId
&& !$this->app->accountManager->get($accountId)->hasPermission( && !$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) PermissionType::READ, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::NEWS, $article->getId())
) { ) {
$view->setTemplate('/Web/Backend/Error/403_inline'); $view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;
@ -199,7 +199,7 @@ final class BackendController extends Controller implements DashboardElementInte
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000601001, $request, $response)); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000601001, $request, $response));
$view->addData('news', $article); $view->addData('news', $article);
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission( $view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
PermissionType::MODIFY, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId()) PermissionType::MODIFY, $this->app->unitId, $this->app->appId, self::NAME, PermissionCategory::NEWS, $article->getId())
); );
// allow comments // allow comments

View File

@ -62,7 +62,7 @@ final class ControllerTest extends \PHPUnit\Framework\TestCase
$permission = new AccountPermission(); $permission = new AccountPermission();
$permission->setUnit(1); $permission->setUnit(1);
$permission->setApp('backend'); $permission->setApp(2);
$permission->setPermission( $permission->setPermission(
PermissionType::READ PermissionType::READ
| PermissionType::CREATE | PermissionType::CREATE