mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 08:44:58 +02:00
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() {
|
public function validations() {
|
||||||
return [
|
return [
|
||||||
'permission' => 'any',
|
'permission' => 'user',
|
||||||
'requestData' => [
|
'requestData' => [
|
||||||
'title' => [
|
'title' => [
|
||||||
'validation' => DataValidator::length(3, 30),
|
'validation' => DataValidator::length(3, 30),
|
||||||
@ -48,13 +48,12 @@ class CreateController extends Controller {
|
|||||||
'language' => $this->language,
|
'language' => $this->language,
|
||||||
'department' => $this->departmentId,
|
'department' => $this->departmentId,
|
||||||
'file' => '',
|
'file' => '',
|
||||||
'date' => date('F j, Y, g:i a'),
|
'date' => Date::getCurrentDate(),
|
||||||
'unread' => false,
|
'unread' => false,
|
||||||
'closed' => false
|
'closed' => false
|
||||||
));
|
));
|
||||||
|
|
||||||
//TODO: Add logged user as author
|
$ticket->setAuthor(Controller::getLoggedUser());
|
||||||
$ticket->setAuthor(User::getUser(1));
|
|
||||||
|
|
||||||
$ticket->store();
|
$ticket->store();
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ include_once 'libs/Controller.php';
|
|||||||
include_once 'libs/ControllerGroup.php';
|
include_once 'libs/ControllerGroup.php';
|
||||||
include_once 'libs/Hashing.php';
|
include_once 'libs/Hashing.php';
|
||||||
include_once 'libs/MailSender.php';
|
include_once 'libs/MailSender.php';
|
||||||
|
include_once 'libs/Date.php';
|
||||||
|
|
||||||
// LOAD DATA
|
// LOAD DATA
|
||||||
spl_autoload_register(function ($class) {
|
spl_autoload_register(function ($class) {
|
||||||
|
6
server/libs/Date.php
Normal file
6
server/libs/Date.php
Normal file
@ -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() {
|
private function generateToken() {
|
||||||
return Hashing::generateRandomToken();;
|
return Hashing::generateRandomToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,5 +52,5 @@ describe '/ticket/create' do
|
|||||||
(result['status']).should.equal('success')
|
(result['status']).should.equal('success')
|
||||||
ticket = $database.getRow('ticket','Winter is coming','title')
|
ticket = $database.getRow('ticket','Winter is coming','title')
|
||||||
(ticket['content']).should.equal('The north remembers')
|
(ticket['content']).should.equal('The north remembers')
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user