openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 681ca8d66d3d5e60889431791e1908e4809687a3
parent fb98b09b0649e5708adafdbe7b4cb9b4fc037313
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 27 Feb 2021 00:02:03 +0100

Fix: Adding projects with project name.

Diffstat:
Mmodules/cms/action/projectlist/ProjectlistAddAction.class.php | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/cms/action/projectlist/ProjectlistAddAction.class.php b/modules/cms/action/projectlist/ProjectlistAddAction.class.php @@ -9,7 +9,8 @@ use util\exception\SecurityException; class ProjectlistAddAction extends ProjectlistAction implements Method { public function view() { - if( ! $this->userIsAdmin() ) + + if( ! $this->userIsAdmin() ) throw new SecurityException('user is not allowed to add a project'); $this->setTemplateVar( 'projects',Project::getAllProjects() ); @@ -21,6 +22,7 @@ class ProjectlistAddAction extends ProjectlistAction implements Method { if( !$this->userIsAdmin()) throw new SecurityException(); + /* $projectid = $this->request->getVar('projectid'); if ( $projectid ) { @@ -31,18 +33,16 @@ class ProjectlistAddAction extends ProjectlistAction implements Method { $project->export($db->id); $this->addNoticeFor($project,Messages::DONE); - } else { - $name = $this->request->has('name'); + } else {*/ - if ( !$name ) - throw new \util\exception\ValidationException('name'); + $name = $this->request->getRequiredText('name'); - $project = new Project(); - $project->name = $name; - $project->persist(); - $this->addNoticeFor($project,Messages::ADDED); + $project = new Project(); + $project->name = $name; + $project->persist(); - } + $this->addNoticeFor( $project,Messages::ADDED ); + //} } }