Skip to content

Commit 636cb23

Browse files
author
Kiril Kirkov
committed
Big fix in first ticket add
Set default values of some columns on tickets table
1 parent 045c94c commit 636cb23

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

DATABASE.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,18 @@ CREATE TABLE IF NOT EXISTS `tickets` (
215215
`addedby` tinyint(4) NOT NULL,
216216
`message_uid` int(11) NOT NULL DEFAULT '0' COMMENT 'uid of message',
217217
`message_id` varchar(255) DEFAULT NULL,
218-
`message_from_email` varchar(255) NOT NULL,
219-
`message_from_name` varchar(255) NOT NULL,
220-
`message_attachments` varchar(255) NOT NULL,
221-
`message_to_email` varchar(255) NOT NULL,
222-
`send` tinyint(1) NOT NULL,
218+
`message_from_email` varchar(255) DEFAULT NULL,
219+
`message_from_name` varchar(255) DEFAULT NULL,
220+
`message_attachments` varchar(255) DEFAULT NULL,
221+
`message_to_email` varchar(255) DEFAULT NULL,
222+
`send` tinyint(1) NOT NULL DEFAULT '0',
223223
`duedate` int(12) unsigned NOT NULL,
224-
`pph` varchar(10) NOT NULL,
225-
`pph_c` varchar(5) NOT NULL,
224+
`pph` varchar(10) DEFAULT NULL,
225+
`pph_c` varchar(5) DEFAULT NULL,
226226
`estimated_seconds` int(10) unsigned NOT NULL COMMENT 'estimated time in seconds',
227227
`timecreated` int(12) unsigned NOT NULL,
228228
`timeclosed` int(10) unsigned NOT NULL,
229-
`lastupdate` int(10) unsigned NOT NULL,
229+
`lastupdate` int(10) unsigned DEFAULT NULL,
230230
PRIMARY KEY (`id`),
231231
KEY `status` (`status`)
232232
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

_html_parts/tickets/newissue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<label class="control-label col-sm-2" for="assignee"><?= $this->lang_php['assignee'] ?></label>
146146
<div class="col-sm-10">
147147
<select class="selectpicker form-control show-tick show-menu-arrow" name="assignee" id="assignee">
148-
<option></option>
148+
<option value="0"></option>
149149
<?php foreach ($users as $user) { ?>
150150
<option <?= isset($_POST['assignee']) && $_POST['assignee'] == $user['id'] ? 'selected' : '' ?> value="<?= $user['id'] ?>"><?= $user['fullname'] ?></option>
151151
<?php } ?>

classes/class.database.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ public function setTicket($post, $update) {
395395
$post['subject'] = mb_substr($post['subject'], 0, 200);
396396
}
397397
$post['estimated_seconds'] = strtotime($post['estimated_days'] . ' day ' . $post['estimated_hours'] . ' hour ' . $post['estimated_minutes'] . ' minute', 0);
398+
if($post['estimated_seconds'] === false) {
399+
$post['estimated_seconds'] = 0;
400+
}
398401
unset($post['estimated_days']);
399402
unset($post['estimated_hours']);
400403
unset($post['estimated_minutes']);

inc/helpers.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ function word_limiter($word, $limit_to, $start_from = 0) {
9898
}
9999

100100
function secondsToTime($seconds, $want_array = false) {
101-
if ($seconds < 0)
101+
if ($seconds < 0) {
102102
$minus = '- ';
103-
else
103+
}
104+
else {
104105
$minus = '';
106+
}
105107
$dtF = new DateTime("@0");
106108
$dtT = new DateTime("@$seconds");
107109
if ($want_array === false) {

0 commit comments

Comments
 (0)