die; } $note = $DB->GetRow('SELECT id AS ticketid, state, cause, queueid, owner FROM rttickets WHERE id = ?', array($note['ticketid'])); if (ConfigHelper::checkConfig('phpui.helpdesk_notify')) { $note['notify'] = TRUE; } } elseif (isset($_POST['note'])) { $note = $_POST['note']; $ticket = $DB->GetRow('SELECT id AS ticketid, state, cause, queueid, owner FROM rttickets WHERE id = ?', array($note['ticketid'])); if ($note['body'] == '') { $error['body'] = trans('Note body not specified!'); } if (!isset($note['ticketid']) || !intval($note['ticketid'])) { $SESSION->redirect('?m=rtqueuelist'); } $result = handle_file_uploads('files', $error); extract($result); $SMARTY->assign('fileupload', $fileupload); if (!$error) { $DB->Execute('INSERT INTO rtmessages (userid, ticketid, body, createtime, type) VALUES(?, ?, ?, ?NOW?, ?)', array($AUTH->id, $note['ticketid'], $note['body'], RTMESSAGE_NOTE)); $mail_dir = ConfigHelper::getConfig('rt.mail_dir'); if (!empty($files) && !empty($mail_dir)) { $id = $DB->GetLastInsertId('rtmessages'); $dir = $mail_dir . sprintf('/%06d/%06d', $note['ticketid'], $id); @mkdir($mail_dir . sprintf('/%06d', $note['ticketid']), 0700); @mkdir($dir, 0700); foreach ($files as $file) { $newfile = $dir . '/' . $file['name']; if (@rename($tmppath . DIRECTORY_SEPARATOR . $file['name'], $newfile)) { $DB->Execute('INSERT INTO rtattachments (messageid, filename, contenttype)
case -1: if ($customerlist = $LMS->GetCustomerList(compact("customergroup"))) { foreach ($customerlist as $idx => $row) { if (!$row['account']) { $ncustomerlist[] = $customerlist[$idx]; } } $customerlist = $ncustomerlist; } break; } if (!isset($customerlist) || $customerlist['total'] == 0) { $error['customer'] = trans('Customers list is empty!'); } $SMARTY->assign(array('filter' => $state, 'network' => $network, 'customergroup' => $customergroup)); $result = handle_file_uploads('attachments', $error); extract($result); $SMARTY->assign('fileupload', $fileupload); $globalfiles = array(); if (!$error && !empty($attachments)) { foreach ($attachments as $attachment) { $attachment['tmpname'] = $tmppath . DIRECTORY_SEPARATOR . $attachment['name']; $attachment['md5sum'] = md5_file($attachment['tmpname']); $attachment['main'] = false; $globalfiles[] = $attachment; } } if (empty($globalfiles) && empty($document['templ'])) { $error['files'] = trans('You must to specify file for upload or select document template!'); } if (!$error) {