diff --git a/account.php b/account.php index 18231ab48938671748b561d05611239e27fe86f5..416cd4761dda9d5b9f851dd40b58a8877bf7c598 100644 --- a/account.php +++ b/account.php @@ -52,7 +52,6 @@ if ($user && $_POST) { if (!$errors && $user->updateInfo($_POST, $errors)) Http::redirect('tickets.php'); } - elseif ($_POST) { $user_form = UserForm::getUserForm()->getForm($_POST); if ($thisclient) { @@ -81,12 +80,12 @@ elseif ($_POST) { $errors['email'] = sprintf(__('%s is a required field'), $user_form->getField('email')->getLocal('label')); elseif (!$user_form->getField('name')->getClean()) $errors['name'] = sprintf(__('%s is a required field'), $user_form->getField('name')->getLocal('label')); + // Registration for existing users + elseif ($addr && !($user = User::lookupByEmail($addr))) + $errors['err'] = __('Unable to register account. See messages below'); // Users created from ClientCreateRequest elseif (isset($_POST['backend']) && !($user = User::fromVars($user_form->getClean()))) $errors['err'] = __('Unable to create local account. See messages below'); - // Registration for existing users - elseif (!$user && !$thisclient && !($user = User::fromVars($user_form->getClean()))) - $errors['err'] = __('Unable to register account. See messages below'); // New users and users registering from a ticket access link elseif (!$user && !($user = $thisclient ?: User::fromForm($user_form))) $errors['err'] = __('Unable to register account. See messages below'); diff --git a/include/ajax.content.php b/include/ajax.content.php index 48cb6f2b012bfbd92d32dea39bbaf582f1b9de6a..38112a11502ec5e80fb61aa2f1f039bc0f889928 100644 --- a/include/ajax.content.php +++ b/include/ajax.content.php @@ -101,7 +101,6 @@ class ContentAjaxAPI extends AjaxController { <tr><td>.lastmessage</td><td>'.__('Last Message').'</td></tr> <tr><td colspan="2" style="padding:5px 0 5px 0;"><em><b>'.__('Thread Entry expansions').'</b></em></td></tr> <tr><td>.poster</td><td>'.__('Poster').'</td></tr> - <tr><td>.posterType</td><td>'.__('Can be User or Agent').'</td></tr> <tr><td>.create_date</td><td>'.__('Date Created').'</td></tr> </table> </td> diff --git a/include/class.dept.php b/include/class.dept.php index 384a749a23b86c9d9a237fb383060fec52fc22be..387e8f7fa4fb4e8a6802a18e49951a49d2ef33c2 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -786,6 +786,7 @@ implements TemplateVariable, Searchable { $this->group_membership = $vars['group_membership']; $this->ticket_auto_response = isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1; $this->message_auto_response = isset($vars['message_auto_response'])?$vars['message_auto_response']:1; + $this->flags = $vars['flags'] ?: 0; $this->setFlag(self::FLAG_ASSIGN_MEMBERS_ONLY, isset($vars['assign_members_only'])); $this->setFlag(self::FLAG_DISABLE_AUTO_CLAIM, isset($vars['disable_auto_claim'])); @@ -812,7 +813,6 @@ implements TemplateVariable, Searchable { $this->setFlag(self::FLAG_ARCHIVED, true); } - $this->flags = 0; $this->setFlag(self::FLAG_DISABLE_AUTO_CLAIM, isset($vars['disable_auto_claim'])); switch ($vars['assignment_flag']) { diff --git a/include/class.email.php b/include/class.email.php index b0dce8bbce91312575695a6b0fcdf070b580d735..41bb55a1a3ca3f84e1fb3b28357558a9e45f1c5e 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -118,7 +118,9 @@ class Email extends VerySimpleModel { function getInfo() { $base = $this->getHashtable(); - $base['mail_proto'] = $this->mail_proto; + $base['mail_proto'] = $this->mail_protocol; + if ($this->mail_encryption != 'NONE') + $base['mail_proto'] .= "/{$this->mail_encryption}"; return $base; } @@ -395,16 +397,16 @@ class Email extends VerySimpleModel { $this->userid = $vars['userid']; $this->mail_active = $vars['mail_active']; $this->mail_host = $vars['mail_host']; - $this->mail_protocol = $vars['mail_protocol']?$vars['mail_protocol']:'POP'; + $this->mail_protocol = $vars['mail_protocol'] ?: 'POP'; $this->mail_encryption = $vars['mail_encryption']; - $this->mail_port = $vars['mail_port']?$vars['mail_port']:0; - $this->mail_fetchfreq = $vars['mail_fetchfreq']?$vars['mail_fetchfreq']:0; - $this->mail_fetchmax = $vars['mail_fetchmax']?$vars['mail_fetchmax']:0; + $this->mail_port = $vars['mail_port'] ?: 0; + $this->mail_fetchfreq = $vars['mail_fetchfreq'] ?: 0; + $this->mail_fetchmax = $vars['mail_fetchmax'] ?: 0; $this->smtp_active = $vars['smtp_active']; $this->smtp_host = $vars['smtp_host']; - $this->smtp_port = $vars['smtp_port']?$vars['smtp_port']:0; + $this->smtp_port = $vars['smtp_port'] ?: 0; $this->smtp_auth = $vars['smtp_auth']; - $this->smtp_spoofing = isset($vars['smtp_spoofing'])?1:0; + $this->smtp_spoofing = isset($vars['smtp_spoofing']) ? 1 : 0; $this->notes = Format::sanitize($vars['notes']); //Post fetch email handling... diff --git a/include/class.report.php b/include/class.report.php index c39ec47cc5ea595aaddcaf46d25323929d58c1cc..12d7322d3dbc6665fed18b86d8b738d49eb091ba 100644 --- a/include/class.report.php +++ b/include/class.report.php @@ -153,6 +153,9 @@ class OverviewReport { 'annulled' => 0, ), )) + ->filter(array( + 'timestamp__range' => array($start, $stop, true), + )) ->aggregate(array( 'ServiceTime' => SqlAggregate::AVG(SqlFunction::timestampdiff( new SqlCode('HOUR'), new SqlField('thread__events__timestamp'), new SqlField('timestamp')) diff --git a/include/class.thread.php b/include/class.thread.php index 7cca14af8f1fdc952e917156fc9a4ad6a81e6f0a..a28c5c369f21df69c82556e446a64cd6edcda384 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -760,7 +760,6 @@ implements TemplateVariable { var $_actions; var $is_autoreply; var $is_bounce; - var $_posterType; static protected $perms = array( self::PERM_EDIT => array( @@ -838,13 +837,6 @@ implements TemplateVariable { return $this->poster; } - function getPosterType() { - $this->staff_id ? - $this->posterType = __('Agent') : $this->posterType = __('User'); - - return $this->posterType; - } - function getTitle() { return $this->title; } diff --git a/include/class.ticket.php b/include/class.ticket.php index 2ca2f89bab9f24ef3e44951e9b74a715006087ba..71e890add94467448a316b9f23728a3ec80c2b34 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -4026,7 +4026,7 @@ implements RestrictedAccess, Threadable, Searchable { // department if ($vars['assignId'] && !( $role - ? $role->hasPerm(Ticket::PERM_ASSIGN) + ? ($role->hasPerm(Ticket::PERM_ASSIGN) || $role->__new__) : $thisstaff->hasPerm(Ticket::PERM_ASSIGN, false) )) { $errors['assignId'] = __('Action Denied. You are not allowed to assign/reassign tickets.'); @@ -4100,12 +4100,6 @@ implements RestrictedAccess, Threadable, Searchable { $attachments = $attachments->merge($response->getAttachments()); } - $message = (string) $message; - if ($response) { - $message .= ($cfg->isRichTextEnabled()) ? "<br><br>" : "\n\n"; - $message .= $response->getBody(); - } - if ($vars['signature']=='mine') $signature=$thisstaff->getSignature(); elseif ($vars['signature']=='dept' && $dept && $dept->isPublic()) @@ -4117,7 +4111,7 @@ implements RestrictedAccess, Threadable, Searchable { array( 'message' => $message, 'signature' => $signature, - 'response' => ($response) ? $response->getBody() : '', + 'response' => $response ?: '', 'recipient' => $ticket->getOwner(), //End user 'staff' => $thisstaff, ) diff --git a/include/class.user.php b/include/class.user.php index 083e0d5bf2b1853e82d6804a53641d353dbf8fd9..71a5289a83a14540662aa159f391c6423b7ec359 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -1147,16 +1147,10 @@ class UserAccount extends VerySimpleModel { } /* - * This assumes the staff is doing the update + * Updates may be done by Staff or by the User if registration + * options are set to Public */ function update($vars, &$errors) { - global $thisstaff; - - - if (!$thisstaff) { - $errors['err'] = __('Access denied'); - return false; - } // TODO: Make sure the username is unique diff --git a/include/i18n/en_US/role.yaml b/include/i18n/en_US/role.yaml index 15dc3be642122ccd8c60dadf666dae5aa29e13e7..ec0832d8d33dd6a27f4e0c3cca1ffa4e46c00d02 100644 --- a/include/i18n/en_US/role.yaml +++ b/include/i18n/en_US/role.yaml @@ -68,6 +68,7 @@ permissions: [ ticket.create, ticket.assign, + ticket.release, ticket.transfer, ticket.refer, ticket.reply diff --git a/include/i18n/en_US/templates/email/ticket.notice.yaml b/include/i18n/en_US/templates/email/ticket.notice.yaml index bf2a6803c92eb299792264774f933620dc8f9d5c..9cfbefb809692e33b99eef05a01d305e370293a1 100644 --- a/include/i18n/en_US/templates/email/ticket.notice.yaml +++ b/include/i18n/en_US/templates/email/ticket.notice.yaml @@ -26,6 +26,9 @@ body: | %{message} <br> <br> + %{response} + <br> + <br> If need be, a representative will follow-up with you as soon as possible. You can also <a href="%{recipient.ticket_link}">view this ticket's progress online</a>. diff --git a/include/staff/dashboard.inc.php b/include/staff/dashboard.inc.php index 8bf11959560114bc18514d9d494aa3312e35d8d7..3c91e3c5fd9135cb550a2c39de52c4a0411445db 100644 --- a/include/staff/dashboard.inc.php +++ b/include/staff/dashboard.inc.php @@ -75,11 +75,11 @@ $plots = $report->getPlotData(); $date = str_ireplace('FROM_UNIXTIME(', '',$date); $date = str_ireplace(')', '',$date); $date = new DateTime('@'.$date); - if ($thisstaff->getTimezone()) - $date->setTimeZone(new DateTimeZone($thisstaff->getTimezone())); + $date->setTimeZone(new DateTimeZone($cfg->getTimezone())); + $timezone = $date->format('e'); $range[] = $date->format('F j, Y'); } - echo __($range[0] . ' - ' . $range[1]); + echo __($range[0] . ' - ' . $range[1] . ' (' . Format::timezone($timezone) . ')'); ?> <ul class="clean tabs"> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index daaa18a38ec823c22ca406e3e9b00161caa25e50..42d97994832a8aa01d4c415bf5b441de9c6b03e0 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -162,6 +162,9 @@ if ($_POST) <br/><span class="error"><?php echo $errors['ccs']; ?></span> </td> </tr> + <?php + if ($cfg->notifyONNewStaffTicket()) { + ?> <tr class="no_border"> <td> <?php echo __('Ticket Notice');?>: @@ -174,6 +177,7 @@ if ($_POST) </select> </td> </tr> + <?php } ?> </table> </td> </tr> diff --git a/include/upgrader/streams/core.sig b/include/upgrader/streams/core.sig index 5c4c675cad5ffbfde918a49029645fc955d772dd..fbebb45e63ee1f85f4388d1ead81fa6b7403dd4f 100644 --- a/include/upgrader/streams/core.sig +++ b/include/upgrader/streams/core.sig @@ -1 +1 @@ -70921d5c3920ab240b08bdd55bc894c8 +26fd79dc5443f37779f9d2c4108058f4 diff --git a/include/upgrader/streams/core/0ca85857-86707325.patch.sql b/include/upgrader/streams/core/0ca85857-86707325.patch.sql index f36be800d15931cf913362e085e51b27ab870f83..2962d23e40f284614bd877ee0317e1183f7a21bf 100644 --- a/include/upgrader/streams/core/0ca85857-86707325.patch.sql +++ b/include/upgrader/streams/core/0ca85857-86707325.patch.sql @@ -3,7 +3,7 @@ * @version v1.11.0 * @title Add ticket referral * - * This patch adds a table for thread referral as well as thread event states of reffered and deleted + * This patch adds a table for thread referral as well as thread event states of referred and deleted */ CREATE TABLE `%TABLE_PREFIX%thread_referral` ( @@ -18,7 +18,7 @@ CREATE TABLE `%TABLE_PREFIX%thread_referral` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `%TABLE_PREFIX%thread_event` - CHANGE `state` `state` enum('created','closed','reopened','assigned','transferred', 'reffered', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL; + CHANGE `state` `state` enum('created','closed','reopened','assigned','transferred', 'referred', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL; -- Finished with patch diff --git a/include/upgrader/streams/core/70921d5c-26fd79dc.patch.sql b/include/upgrader/streams/core/70921d5c-26fd79dc.patch.sql new file mode 100644 index 0000000000000000000000000000000000000000..ed631e92d16085eecee64e084327d78ab0f56be4 --- /dev/null +++ b/include/upgrader/streams/core/70921d5c-26fd79dc.patch.sql @@ -0,0 +1,31 @@ +/** +* @signature 26fd79dc5443f37779f9d2c4108058f4 +* @version v1.11.0 +* @title Final Revisions +* +* This patch is for final revisions needed for v1.11 +*/ + +ALTER TABLE `%TABLE_PREFIX%thread_event` + CHANGE `state` `state` enum('created','closed','reopened','assigned', 'released', 'transferred', 'referred', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL; + +ALTER TABLE `%TABLE_PREFIX%attachment` + ADD INDEX `file_object` (`file_id`,`object_id`); + +UPDATE `%TABLE_PREFIX%role` + SET `permissions` = REPLACE(`permissions`, '"ticket.transfer":1,', '"ticket.transfer":1,"ticket.refer":1,') + WHERE `permissions` IS NOT NULL; + +UPDATE `%TABLE_PREFIX%role` + SET `permissions` = REPLACE(`permissions`, '"ticket.assign":1,', '"ticket.assign":1,"ticket.release":1,') + WHERE `permissions` IS NOT NULL AND `permissions` LIKE '%"ticket.assign":1,%'; + +-- Ticket Notice Template +UPDATE `%TABLE_PREFIX%email_template` + SET `code_name` = REPLACE('ticket.notice', '%{message}', '%{message}<br><br>%{response}') + WHERE `code_name` = 'ticket.notice'; + + -- Finished with patch +UPDATE `%TABLE_PREFIX%config` + SET `value` = '26fd79dc5443f37779f9d2c4108058f4', `updated` = NOW() + WHERE `key` = 'schema_signature' AND `namespace` = 'core'; diff --git a/scp/tickets.php b/scp/tickets.php index ca0770817b558436d31691a035011e47abcfb3f4..a3b7103f3784a30b54b11b5666fcbda796fb4529 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -43,8 +43,11 @@ if (!$ticket) { $queue_id = null; // Search for user - if (isset($_GET['uid'])) - $user = User::lookup($_GET['uid']); + if (isset($_REQUEST['uid'])) + $user = User::lookup($_REQUEST['uid']); + + if (isset($_REQUEST['email'])) + $user = User::lookupByEmail($_REQUEST['email']); if ($user && $_GET['a'] !== 'open' @@ -398,7 +401,7 @@ if($_POST && !$errors): } else { $vars = $_POST; - if ($vars['uid'] && (!User::lookup($vars['uid']))) + if ($vars['uid'] && !($user=User::lookup($vars['uid']))) $vars['uid'] = 0; $vars['cannedattachments'] = $response_form->getField('attachments')->getClean(); diff --git a/setup/inc/streams/core/install-mysql.sql b/setup/inc/streams/core/install-mysql.sql index 5c1ddc7ea1a46c736dd7d05f2037925a1f75131f..fbbb6e45050facca4ad2c6390657073d14b23c96 100644 --- a/setup/inc/streams/core/install-mysql.sql +++ b/setup/inc/streams/core/install-mysql.sql @@ -25,7 +25,8 @@ CREATE TABLE `%TABLE_PREFIX%attachment` ( `inline` tinyint(1) unsigned NOT NULL DEFAULT '0', `lang` varchar(16), PRIMARY KEY (`id`), - UNIQUE KEY `file-type` (`object_id`,`file_id`,`type`) + UNIQUE KEY `file-type` (`object_id`,`file_id`,`type`), + UNIQUE KEY `file_object` (`file_id`,`object_id`) ) DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `%TABLE_PREFIX%faq`; @@ -718,7 +719,7 @@ CREATE TABLE `%TABLE_PREFIX%thread_event` ( `team_id` int(11) unsigned NOT NULL, `dept_id` int(11) unsigned NOT NULL, `topic_id` int(11) unsigned NOT NULL, - `state` enum('created','closed','reopened','assigned','transferred', 'reffered', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL, + `state` enum('created','closed','reopened','assigned','released','transferred', 'referred', 'overdue','edited','viewed','error','collab','resent', 'deleted') NOT NULL, `data` varchar(1024) DEFAULT NULL COMMENT 'Encoded differences', `username` varchar(128) NOT NULL default 'SYSTEM', `uid` int(11) unsigned DEFAULT NULL, diff --git a/tickets.php b/tickets.php index 5795925f4bdffdb051dabd64b2f033da0cbb2d4c..fa88e5e55775b4aeff32dda04841b35eed6fc178 100644 --- a/tickets.php +++ b/tickets.php @@ -62,8 +62,10 @@ if ($_POST && is_object($ticket) && $ticket->getId()) { $changes += $f->getChanges(); $f->save(); } - if ($changes) - $ticket->logEvent('edited', array('fields' => $changes)); + if ($changes) { + $user = User::lookup($thisclient->getId()); + $ticket->logEvent('edited', array('fields' => $changes), $user); + } $_REQUEST['a'] = null; //Clear edit action - going back to view. } break;