Skip to content
Snippets Groups Projects
Commit c19e9d5e authored by Jared Hancock's avatar Jared Hancock
Browse files

dept: Fix crash rendering list if no default email set

parent b5e6d4e4
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ $showing = $pageNav->showing().' '._N('department', 'departments', $count); ...@@ -91,7 +91,7 @@ $showing = $pageNav->showing().' '._N('department', 'departments', $count);
->limit($pageNav->getLimit()) ->limit($pageNav->getLimit())
->offset($pageNav->getStart()); ->offset($pageNav->getStart());
$defaultId=$cfg->getDefaultDeptId(); $defaultId=$cfg->getDefaultDeptId();
$defaultEmailId = $cfg->getDefaultEmail()->getId(); $defaultEmailId = $cfg->getDefaultEmailId();
$defaultEmailAddress = (string) $cfg->getDefaultEmail(); $defaultEmailAddress = (string) $cfg->getDefaultEmail();
foreach ($depts as $dept) { foreach ($depts as $dept) {
$id = $dept->getId(); $id = $dept->getId();
......
...@@ -89,7 +89,7 @@ $def_priority = $cfg->getDefaultPriority()->getDesc(); ...@@ -89,7 +89,7 @@ $def_priority = $cfg->getDefaultPriority()->getDesc();
foreach ($emails as $email) { foreach ($emails as $email) {
$id = $email->getId(); $id = $email->getId();
$sel=false; $sel=false;
if ($ids && in_array($email, $ids)) if ($ids && in_array($id, $ids))
$sel=true; $sel=true;
$default=($id==$defaultId); $default=($id==$defaultId);
?> ?>
...@@ -97,11 +97,13 @@ $def_priority = $cfg->getDefaultPriority()->getDesc(); ...@@ -97,11 +97,13 @@ $def_priority = $cfg->getDefaultPriority()->getDesc();
<td width=7px> <td width=7px>
<input type="checkbox" class="ckb" name="ids[]" <input type="checkbox" class="ckb" name="ids[]"
value="<?php echo $id; ?>" value="<?php echo $id; ?>"
<?php echo $sel ? 'checked="checked"' : ''; ?> <?php echo $sel ? 'checked="checked" ' : ''; ?>
<?php echo $default?'disabled="disabled"':''; ?>> <?php echo $default?'disabled="disabled" ':''; ?>>
</td> </td>
<td><span class="ltr"><a href="emails.php?id=<?php echo $id; ?>"><?php <td><span class="ltr"><a href="emails.php?id=<?php echo $id; ?>"><?php
echo Format::htmlchars((string) $email); ?></a></span></td> echo Format::htmlchars((string) $email); ?></a></span>
<?php echo ($default) ?' <small>'.__('(Default)').'</small>' : ''; ?>
</td>
<td><?php echo $email->priority ?: $def_priority; ?></td> <td><?php echo $email->priority ?: $def_priority; ?></td>
<td><a href="departments.php?id=<?php $email->dept_id ?: $def_dept_id; ?>"><?php <td><a href="departments.php?id=<?php $email->dept_id ?: $def_dept_id; ?>"><?php
echo $email->dept ?: $def_dept_name; ?></a></td> echo $email->dept ?: $def_dept_name; ?></a></td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment