From ca1c889e6681f2f146504286d798671bab0f855a Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Thu, 11 Dec 2014 23:36:34 +0000 Subject: [PATCH] bugs: QA fixes --- include/class.list.php | 6 +-- include/client/register.inc.php | 2 +- .../client/templates/dynamic-form.tmpl.php | 2 +- include/staff/category.inc.php | 2 +- include/staff/profile.inc.php | 2 +- include/staff/settings-system.inc.php | 2 +- include/staff/staff.inc.php | 50 +++++++++++-------- scp/tickets.php | 2 +- setup/inc/class.installer.php | 2 +- 9 files changed, 39 insertions(+), 31 deletions(-) diff --git a/include/class.list.php b/include/class.list.php index fb6a2d45a..df431b9ef 100644 --- a/include/class.list.php +++ b/include/class.list.php @@ -1003,7 +1003,7 @@ class TicketStatus extends VerySimpleModel implements CustomListItem { return $this->getName(); } function getLocalName() { - return $this->getLocal('value'); + return $this->getLocal('value', $this->getName()); } function getAbbrev() { @@ -1030,10 +1030,10 @@ class TicketStatus extends VerySimpleModel implements CustomListItem { function getTranslateTag($subtag) { return _H(sprintf('status.%s.%s', $subtag, $this->id)); } - function getLocal($subtag) { + function getLocal($subtag, $default) { $tag = $this->getTranslateTag($subtag); $T = CustomDataTranslation::translate($tag); - return $T != $tag ? $T : $this->get($subtag); + return $T != $tag ? $T : $default; } static function getLocalById($id, $subtag, $default) { $tag = _H(sprintf('status.%s.%s', $subtag, $id)); diff --git a/include/client/register.inc.php b/include/client/register.inc.php index deb3c5d97..6ac754b8a 100644 --- a/include/client/register.inc.php +++ b/include/client/register.inc.php @@ -111,7 +111,7 @@ $('#timezone-dropdown').chosen({ </script> <?php if (!isset($info['timezone'])) { ?> <!-- Auto detect client's timezone where possible --> -<script type="text/javascript" src="<?php echo ROOT_PATH; ?>/js/jstz.min.js"></script> +<script type="text/javascript" src="<?php echo ROOT_PATH; ?>js/jstz.min.js"></script> <script type="text/javascript"> $(function() { var zone = jstz.determine(); diff --git a/include/client/templates/dynamic-form.tmpl.php b/include/client/templates/dynamic-form.tmpl.php index 14bcf5432..a333ac2ee 100644 --- a/include/client/templates/dynamic-form.tmpl.php +++ b/include/client/templates/dynamic-form.tmpl.php @@ -16,7 +16,7 @@ // 'private' are not included in the output for clients global $thisclient; foreach ($form->getFields() as $field) { - if (!$field->isEditableToUsers()) + if (!$field->isVisibleToUsers() && !$field->isEditableToUsers()) continue; ?> <tr> diff --git a/include/staff/category.inc.php b/include/staff/category.inc.php index dc0eaf086..0aa2bbf99 100644 --- a/include/staff/category.inc.php +++ b/include/staff/category.inc.php @@ -97,7 +97,7 @@ if (count($langs) > 1) { ?> $cname = "trans[$code][$cname]"; $dname = "trans[$code][$dname]"; } ?> - <div class="tab_content" style="margin:0 45px" style="<?php + <div class="tab_content" style="margin:0 48px;<?php if ($code != $cfg->getPrimaryLanguage()) echo "display:none;"; ?>" id="lang-<?php echo $tag; ?>" <?php if ($i['direction'] == 'rtl') echo 'dir="rtl" class="rtl"'; ?> diff --git a/include/staff/profile.inc.php b/include/staff/profile.inc.php index 665cf53d5..55e13a475 100644 --- a/include/staff/profile.inc.php +++ b/include/staff/profile.inc.php @@ -97,7 +97,7 @@ $info['id']=$staff->getId(); </select> <button class="action-button" onclick="javascript: $('head').append($('<script>').attr('src', '<?php - echo ROOT_PATH; ?>/js/jstz.min.js')); + echo ROOT_PATH; ?>js/jstz.min.js')); var recheck = setInterval(function() { if (window.jstz !== undefined) { clearInterval(recheck); diff --git a/include/staff/settings-system.inc.php b/include/staff/settings-system.inc.php index 175a4de25..c1b573bd7 100644 --- a/include/staff/settings-system.inc.php +++ b/include/staff/settings-system.inc.php @@ -157,7 +157,7 @@ $gmtime = Misc::gmtime(); </select> <button class="action-button" onclick="javascript: $('head').append($('<script>').attr('src', '<?php - echo ROOT_PATH; ?>/js/jstz.min.js')); + echo ROOT_PATH; ?>js/jstz.min.js')); var recheck = setInterval(function() { if (window.jstz !== undefined) { clearInterval(recheck); diff --git a/include/staff/staff.inc.php b/include/staff/staff.inc.php index 7a9c01eee..f1ac113c7 100644 --- a/include/staff/staff.inc.php +++ b/include/staff/staff.inc.php @@ -226,24 +226,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <span class="error"> <?php echo $errors['isactive']; ?></span> <i class="help-tip icon-question-sign" href="#account_status"></i> </td> </tr> - <tr> - <td width="180" class="required"> - <?php echo __('Assigned Group');?>: - </td> - <td> - <select name="group_id" id="group_id"> - <option value="0">— <?php echo __('Select Group');?> —</option> - <?php - foreach (Group::getGroups() as $id=>$name) { - $sel=($info['group_id']==$id)?'selected="selected"':''; - echo sprintf('<option value="%d" %s>%s</option>', - $id, $sel, $name); - } - ?> - </select> - <span class="error">* <?php echo $errors['group_id']; ?></span> <i class="help-tip icon-question-sign" href="#assigned_group"></i> - </td> - </tr> <tr> <td width="180" class="required"> <?php echo __('Primary Department');?>: @@ -258,7 +240,16 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } ?> </select> - + <span class="error">*</span> + <i class="help-tip icon-question-sign" href="#primary_department"></i> + <div class="error"><?php echo $errors['dept_id']; ?></div> + </td> + </tr> + <tr> + <td width="180" class="required"> + <?php echo __('Primary Role');?>: + </td> + <td> <select name="role_id"> <option value="0">— <?php echo __('Select Role');?> —</option> <?php @@ -269,11 +260,28 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ?> </select> <span class="error">*</span> - <i class="help-tip icon-question-sign" href="#primary_department"></i> - <div class="error"><?php echo $errors['dept_id']; ?></div> + <i class="help-tip icon-question-sign" href="#primary_role"></i> <div class="error"><?php echo $errors['role_id']; ?></div> </td> </tr> + <tr> + <td width="180" class="required"> + <?php echo __('Assigned Group');?>: + </td> + <td> + <select name="group_id" id="group_id"> + <option value="0">— <?php echo __('Select Group');?> —</option> + <?php + foreach (Group::getGroups() as $id=>$name) { + $sel=($info['group_id']==$id)?'selected="selected"':''; + echo sprintf('<option value="%d" %s>%s</option>', + $id, $sel, $name); + } + ?> + </select> + <span class="error">* <?php echo $errors['group_id']; ?></span> <i class="help-tip icon-question-sign" href="#assigned_group"></i> + </td> + </tr> <tr> <td width="180"> <?php echo __('Time Zone');?>: diff --git a/scp/tickets.php b/scp/tickets.php index 2db8701c1..d79a299bd 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -61,7 +61,7 @@ if($_POST && !$errors): $role = $thisstaff->getRole($ticket->getDeptId()); switch(strtolower($_POST['a'])): case 'reply': - if(!$role || !$role->canPostReply()) + if(!$role || !$role->canPostTicketReply()) $errors['err'] = __('Action denied. Contact admin for access'); else { diff --git a/setup/inc/class.installer.php b/setup/inc/class.installer.php index 296a081db..321d64ae4 100644 --- a/setup/inc/class.installer.php +++ b/setup/inc/class.installer.php @@ -209,7 +209,7 @@ class Installer extends SetupWizard { 'alert_email_id'=>$alert_email_id, 'default_dept_id'=>$dept_id_1, 'default_sla_id'=>$sla_id_1, 'default_template_id'=>$template_id_1, - 'default_timezone' => date_default_timezone_get() + 'default_timezone' => date_default_timezone_get(), 'admin_email'=>$vars['admin_email'], 'schema_signature'=>$streams['core'], 'helpdesk_url'=>URL, -- GitLab