Exemplo n.º 1
0
 function log_status_changes()
 {
     global $ist, $ict, $ics, $ios, $iap, $ipr, $isv, $ist, $isa, $field_event_map, $AppUI;
     if (dPgetParam($_POST, "item_id")) {
         $hditem = new CHelpDeskItem();
         $hditem->load(dPgetParam($_POST, "item_id"));
         foreach ($field_event_map as $key => $value) {
             if (!eval("return \$hditem->{$value} == \$this->{$value};")) {
                 $old = $new = "";
                 switch ($value) {
                     // Create the comments here
                     case 'item_assigned_to':
                         $sql = "\n                SELECT \n                  user_id, concat(contact_first_name,' ',contact_last_name) as user_name\n                FROM \n                  users\n               LEFT JOIN contacts ON user_contact = contact_id\n                WHERE \n                  user_id in (" . ($hditem->{$value} ? $hditem->{$value} : "") . ($this->{$value} && $hditem->{$value} ? ", " : "") . ($this->{$value} ? $this->{$value} : "") . ")\n              ";
                         $ids = db_loadList($sql);
                         foreach ($ids as $row) {
                             if ($row["user_id"] == $this->{$value}) {
                                 $new = $row["user_name"];
                             } else {
                                 if ($row["user_id"] == $hditem->{$value}) {
                                     $old = $row["user_name"];
                                 }
                             }
                         }
                         break;
                     case 'item_company_id':
                         $sql = "\n                SELECT \n                  company_id, company_name\n                FROM \n                  companies\n                WHERE \n                  company_id in (" . ($hditem->{$value} ? $hditem->{$value} : "") . ($this->{$value} && $hditem->{$value} ? ", " : "") . ($this->{$value} ? $this->{$value} : "") . ")\n              ";
                         $ids = db_loadList($sql);
                         foreach ($ids as $row) {
                             if ($row["company_id"] == $this->{$value}) {
                                 $new = $row["company_name"];
                             } else {
                                 if ($row["company_id"] == $hditem->{$value}) {
                                     $old = $row["company_name"];
                                 }
                             }
                         }
                         break;
                     case 'item_project_id':
                         $sql = "\n                SELECT \n                  project_id, project_name\n                FROM \n                  projects\n                WHERE \n                  project_id in (" . ($hditem->{$value} ? $hditem->{$value} : "") . ($this->{$value} && $hditem->{$value} ? ", " : "") . ($this->{$value} ? $this->{$value} : "") . ")\n              ";
                         $ids = db_loadList($sql);
                         foreach ($ids as $row) {
                             if ($row["project_id"] == $this->{$value}) {
                                 $new = $row["project_name"];
                             } else {
                                 if ($row["project_id"] == $hditem->{$value}) {
                                     $old = $row["project_name"];
                                 }
                             }
                         }
                         break;
                     case 'item_calltype':
                         $old = $AppUI->_($ict[$hditem->{$value}]);
                         $new = $AppUI->_($ict[$this->{$value}]);
                         break;
                     case 'item_source':
                         $old = $AppUI->_($ics[$hditem->{$value}]);
                         $new = $AppUI->_($ics[$this->{$value}]);
                         break;
                     case 'item_status':
                         $old = $AppUI->_($ist[$hditem->{$value}]);
                         $new = $AppUI->_($ist[$this->{$value}]);
                         break;
                     case 'item_priority':
                         $old = $AppUI->_($ipr[$hditem->{$value}]);
                         $new = $AppUI->_($ipr[$this->{$value}]);
                         break;
                     case 'item_severity':
                         $old = $AppUI->_($isv[$hditem->{$value}]);
                         $new = $AppUI->_($isv[$this->{$value}]);
                         break;
                     case 'item_os':
                         $old = $AppUI->_($ios[$hditem->{$value}]);
                         $new = $AppUI->_($ios[$this->{$value}]);
                         break;
                     case 'item_application':
                         $old = $AppUI->_($iap[$hditem->{$value}]);
                         $new = $AppUI->_($iap[$this->{$value}]);
                         break;
                     case 'item_notify':
                         $old = $hditem->{$value} ? $AppUI->_('On') : $AppUI->_('Off');
                         $new = $this->{$value} ? $AppUI->_('On') : $AppUI->_('Off');
                         break;
                     default:
                         $old = $hditem->{$value};
                         $new = $this->{$value};
                         break;
                 }
                 $last_status_log_id = $this->log_status($key, $AppUI->_('changed from') . " \"" . addslashes($old) . "\" " . $AppUI->_('to') . " \"" . addslashes($new) . "\"");
             }
         }
         return $last_status_log_id;
     }
 }
Exemplo n.º 2
0
function file_show_attr()
{
    global $AppUI, $obj, $ci, $canAdmin, $projects, $file_project, $file_task, $task_name, $preserve, $file_helpdesk_item;
    if ($ci) {
        $str_out = '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Minor Revision') . '</td><td><input type="Radio" name="revision_type" value="minor" checked />' . '</td><tr><td align="right" nowrap="nowrap">' . $AppUI->_('Major Revision') . '</td><td><input type="Radio" name="revision_type" value="major" /></td>';
    } else {
        $str_out = '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Version') . ':</td>';
    }
    $str_out .= '<td align="left">';
    if ($ci || $canAdmin && $obj->file_checkout == 'final') {
        $str_out .= '<input type="hidden" name="file_checkout" value="" /><input type="hidden" name="file_co_reason" value="" />';
    }
    if ($ci) {
        $the_value = strlen($obj->file_version) > 0 ? $obj->file_version + 0.01 : '1';
        $str_out .= '<input type="hidden" name="file_version" value="' . $the_value . '" />';
    } else {
        $the_value = strlen($obj->file_version) > 0 ? $obj->file_version : '1';
        $str_out .= '<input type="text" name="file_version" maxlength="10" size="5" value="' . $the_value . '" />';
    }
    $str_out .= '</td>';
    $select_disabled = ' ';
    $onclick_task = ' onclick="popTask()" ';
    if ($ci && $preserve) {
        $select_disabled = ' disabled="disabled" ';
        $onclick_task = ' ';
        // need because when a html is disabled, it's value it's not sent in submit
        $str_out .= '<input type="hidden" name="file_project" value="' . $file_project . '" />';
        $str_out .= '<input type="hidden" name="file_category" value="' . $obj->file_category . '" />';
    }
    // Category
    $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Category') . ':</td>';
    $str_out .= '<td align="left">' . arraySelect(w2PgetSysVal('FileType'), 'file_category', '' . $select_disabled, $obj->file_category, true) . '<td>';
    // ---------------------------------------------------------------------------------
    if ($file_helpdesk_item) {
        $hd_item = new CHelpDeskItem();
        $hd_item->load($file_helpdesk_item);
        //Helpdesk Item
        $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Helpdesk Item') . ':</td>';
        $str_out .= '<td align="left"><strong>' . $hd_item->item_id . ' - ' . $hd_item->item_title . '</strong></td></tr>';
        // Project
        $str_out .= '<input type="hidden" name="file_project" value="' . $file_project . '" />';
        // Task
        $str_out .= '<input type="hidden" name="file_task" value="0" />';
    } else {
        // Project
        $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Project') . ':</td>';
        $str_out .= '<td align="left">' . projectSelectWithOptGroup($AppUI->user_id, 'file_project', 'size="1" class="text" style="width:270px"' . $select_disabled, $file_project) . '</td></tr>';
        // ---------------------------------------------------------------------------------
        // Task
        $str_out .= '<tr><td align="right" nowrap="nowrap">' . $AppUI->_('Task') . ':</td><td align="left" colspan="2" valign="top"><input type="hidden" name="file_task" value="' . $file_task . '" /><input type="text" class="text" name="task_name" value="' . $task_name . '" size="40" disabled /><input type="button" class="button" value="' . $AppUI->_('select task') . '..."' . $onclick_task . '/></td></tr>';
    }
    return $str_out;
}
Exemplo n.º 3
0
    if ($obj->task_log_date) {
        $date = new CDate($obj->task_log_date);
        $obj->task_log_date = $date->format(FMT_DATETIME_MYSQL);
    }
    $AppUI->setMsg('Task Log');
    $obj->task_log_costcode = $obj->task_log_costcode;
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $hditem->notify(TASK_LOG, $obj->task_log_id);
        $AppUI->setMsg(@$_POST['task_log_id'] ? 'updated' : 'added', UI_MSG_OK, true);
    }
    $AppUI->redirect("m=helpdesk&a=view&item_id={$item_id}&tab=0");
} else {
    $hditem = new CHelpDeskItem();
    if (!$hditem->bind($_POST)) {
        $AppUI->setMsg($hditem->error, UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $AppUI->setMsg('Help Desk Item', UI_MSG_OK);
    if ($del) {
        //	if (($msg = $hditem->delete())) {
        //		$AppUI->setMsg( $msg, UI_MSG_ERROR );
        //	} else {
        //		$AppUI->setMsg( 'deleted', UI_MSG_OK, true );
        //		$hditem->log_status(17);
        //		$AppUI->redirect('m=helpdesk&a=list');
        //	}
        //if ($del) {
        //	if (($msg = $hditem->delete())) {