Merged in Full-ticket-create-logic (pull request #32)
(Guillermo) full ticket create
This commit is contained in:
commit
a98cf9176b
|
@ -11,7 +11,7 @@ class CreateController extends Controller {
|
|||
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'any',
|
||||
'permission' => 'user',
|
||||
'requestData' => [
|
||||
'title' => [
|
||||
'validation' => DataValidator::length(3, 30),
|
||||
|
@ -48,13 +48,12 @@ class CreateController extends Controller {
|
|||
'language' => $this->language,
|
||||
'department' => $this->departmentId,
|
||||
'file' => '',
|
||||
'date' => date('F j, Y, g:i a'),
|
||||
'date' => Date::getCurrentDate(),
|
||||
'unread' => false,
|
||||
'closed' => false
|
||||
));
|
||||
|
||||
//TODO: Add logged user as author
|
||||
$ticket->setAuthor(User::getUser(1));
|
||||
$ticket->setAuthor(Controller::getLoggedUser());
|
||||
|
||||
$ticket->store();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ include_once 'libs/Controller.php';
|
|||
include_once 'libs/ControllerGroup.php';
|
||||
include_once 'libs/Hashing.php';
|
||||
include_once 'libs/MailSender.php';
|
||||
include_once 'libs/Date.php';
|
||||
|
||||
// LOAD DATA
|
||||
spl_autoload_register(function ($class) {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
class Date {
|
||||
public static function getCurrentDate() {
|
||||
return date('F j, Y, g:i a');
|
||||
}
|
||||
}
|
|
@ -65,6 +65,6 @@ class Session {
|
|||
}
|
||||
|
||||
private function generateToken() {
|
||||
return Hashing::generateRandomToken();;
|
||||
return Hashing::generateRandomToken();
|
||||
}
|
||||
}
|
|
@ -52,5 +52,5 @@ describe '/ticket/create' do
|
|||
(result['status']).should.equal('success')
|
||||
ticket = $database.getRow('ticket','Winter is coming','title')
|
||||
(ticket['content']).should.equal('The north remembers')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue