<?php echo \Components\Tools\Helpers\Html::formSelect('tool[exec]', 't_exec', $execChoices, $this->defaults['exec'], 'groupchoices'); ?> </label> <p><?php echo Lang::txt('COM_TOOLS_SIDE_TIPS_TOOLACCESS'); ?> </p> <div id="groupname" <?php echo $this->defaults['exec'] == '@GROUP' ? 'style="display:block"' : 'style="display:none"'; ?> > <input type="text" name="tool[membergroups]" id="t_groups" value="<?php echo \Components\Tools\Helpers\Html::getGroups($this->defaults['membergroups'], $this->id); ?> " /> <p class="hint"><?php echo Lang::txt('COM_TOOLS_HINT_GROUPS'); ?> </p> </div> <label for="t_code"> <?php echo Lang::txt('COM_TOOLS_CODE_ACCESS'); ?> : <span class="required"><?php echo Lang::txt('JOPTION_REQUIRED'); ?>
/** * Update a support ticket * * @param integer $toolid Tool ID * @param array $oldstuff Information before any changes * @param array $newstuff Information after changes * @param string $comment Comments to add * @param integer $access Parameter description (if any) ... * @param integer $email Parameter description (if any) ... * @param integer $action Parameter description (if any) ... * @return boolean False if errors, True on success */ protected function _updateTicket($toolid, $oldstuff, $newstuff, $comment, $access = 0, $email = 0, $action = 1, $toolinfo = array()) { $obj = new \Components\Tools\Tables\Tool($this->database); $summary = ''; $rowc = new \Components\Support\Models\Comment(); $rowc->set('ticket', $obj->getTicketId($toolid)); // see what changed if ($oldstuff != $newstuff) { if ($oldstuff['toolname'] != $newstuff['toolname']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_TOOLNAME'), $oldstuff['toolname'], $newstuff['toolname']); } if ($oldstuff['title'] != $newstuff['title']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_TOOL') . ' ' . strtolower(Lang::txt('COM_TOOLS_TITLE')), $oldstuff['title'], $newstuff['title']); $summary .= strtolower(Lang::txt('COM_TOOLS_TITLE')); } if ($oldstuff['version'] != '' && $oldstuff['version'] != $newstuff['version']) { $rowc->changelog()->changed(strtolower(Lang::txt('COM_TOOLS_DEV_VERSION_LABEL')), $oldstuff['version'], $newstuff['version']); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_VERSION')); } else { if ($oldstuff['version'] == '' && $newstuff['version'] != '') { $rowc->changelog()->changed(strtolower(Lang::txt('COM_TOOLS_DEV_VERSION_LABEL')), '', $newstuff['version']); } } if ($oldstuff['description'] != $newstuff['description']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_TOOL') . ' ' . strtolower(Lang::txt('COM_TOOLS_DESCRIPTION')), $oldstuff['description'], $newstuff['description']); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_DESCRIPTION')); } if ($oldstuff['exec'] != $newstuff['exec']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_TOOL_ACCESS'), $oldstuff['exec'], $newstuff['exec']); if ($newstuff['exec'] == '@GROUP') { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_ALLOWED_GROUPS'), '', \Components\Tools\Helpers\Html::getGroups($newstuff['membergroups'])); } $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_TOOL_ACCESS')); } if ($oldstuff['code'] != $newstuff['code']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_CODE_ACCESS'), $oldstuff['code'], $newstuff['code']); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_CODE_ACCESS')); } if ($oldstuff['wiki'] != $newstuff['wiki']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_WIKI_ACCESS'), $oldstuff['wiki'], $newstuff['wiki']); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_WIKI_ACCESS')); } if ($oldstuff['vncGeometry'] != $newstuff['vncGeometry']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_VNC_GEOMETRY'), $oldstuff['vncGeometry'], $newstuff['vncGeometry']); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_VNC_GEOMETRY')); } if ($oldstuff['developers'] != $newstuff['developers']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_DEVELOPMENT_TEAM'), \Components\Tools\Helpers\Html::getDevTeam($oldstuff['developers']), \Components\Tools\Helpers\Html::getDevTeam($newstuff['developers'])); $summary .= $summary == '' ? '' : ', '; $summary .= strtolower(Lang::txt('COM_TOOLS_DEVELOPMENT_TEAM')); } // end of tool information changes if ($summary) { $summary .= ' ' . Lang::txt('COM_TOOLS_INFO_CHANGED'); $action = 1; } // tool status/priority changes if ($oldstuff['priority'] != $newstuff['priority']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_PRIORITY'), \Components\Tools\Helpers\Html::getPriority($oldstuff['priority']), \Components\Tools\Helpers\Html::getPriority($newstuff['priority'])); $email = 0; // do not send email about priority changes } if ($oldstuff['state'] != $newstuff['state']) { $rowc->changelog()->changed(Lang::txt('COM_TOOLS_TICKET_CHANGED_FROM'), \Components\Tools\Helpers\Html::getStatusName($oldstuff['state'], $oldstate), \Components\Tools\Helpers\Html::getStatusName($newstuff['state'], $newstate)); $summary = Lang::txt('COM_TOOLS_STATUS') . ' ' . Lang::txt('COM_TOOLS_TICKET_CHANGED_FROM') . ' ' . $oldstate . ' ' . Lang::txt('COM_TOOLS_TO') . ' ' . $newstate; $email = 1; // send email about status changes $action = 2; } } if ($comment) { //$action = $action==2 ? $action : 3; $email = 1; $rowc->set('comment', nl2br($comment)); } $rowc->set('created', Date::toSql()); $rowc->set('created_by', User::get('id')); $rowc->set('access', $access); if (!$rowc->store()) { $this->setError($rowc->getError()); return false; } if ($email) { // send notification emails $summary = $summary ? $summary : $comment; $this->_email($toolid, $summary, $comment, $access, $action, $toolinfo); } return true; }