Beispiel #1
0
<?php
/**
 * update.php - works up with single ticket or ticket group
 * you can reply or add comment to the ticket here
 * allow to use answer templates
 * also allows to change status, owner and queue (via group_operations)
 * include validator.php
 */
include "validator.php";
$uri=$_SERVER['REQUEST_URI'];
$xtpl->assign("URI",$uri);
$manager_info=get_manager_info($_SESSION["uid"]);

 

//getting ticket(s) info from Session and post
if(array_key_exists("selected_tickets", $_SESSION))
{
    $group_of_tickets = 1;
    $ticket_id = 0;
    $tmp = new group_operations($act, 1);
}
elseif(array_key_exists("selected_ticket_id", $_SESSION))
{
    $ticket_id = $_SESSION["selected_ticket_id"];
    $group_of_tickets = 0;
    $xtpl->assign("TICKET_ID", "<input type=\"hidden\" name=\"ta_id\" value=\"" . $ticket_id . "\">");
}
else $ticket_id = 0;

$xtpl->assign("SECTION_NAME", "Write the message");
function bpminbox_process_advanced_actions(&$focus, $field, $meta_array, &$rel_this)
{
    ////////////Later expand to be able to also extract from the rel_this as the choice of returning dynamic values
    global $current_user;
    if ($meta_array['adv_type'] == 'exist_user') {
        if ($meta_array['value'] == 'current_user') {
            if (!empty($current_user)) {
                if ($meta_array['ext1'] == "Self") {
                    //kbrill bug #14923
                    return $current_user->id;
                }
                if ($meta_array['ext1'] == "Manager") {
                    //kbrill bug #14923
                    return get_manager_info($current_user->id);
                }
            } else {
                return 1;
            }
            //if value is current_user
        }
        if ($meta_array['ext1'] == "Self") {
            return $focus->{$meta_array}['value'];
        }
        if ($meta_array['ext1'] == "Manager") {
            return get_manager_info($focus->{$meta_array}['value']);
        }
    }
    if ($meta_array['adv_type'] == 'exist_team') {
        if ($meta_array['value'] == 'current_team') {
            if (!empty($current_user)) {
                return $current_user->default_team;
            } else {
                return 1;
            }
            //if value is current_team
        }
        return $focus->{$meta_array}['value'];
    }
    if ($meta_array['adv_type'] == 'value_calc') {
        $jang = get_expression($meta_array['ext1'], $rel_this->{$field}, $meta_array['value']);
        //echo $jang;
        return $jang;
    }
    if ($meta_array['adv_type'] == 'enum_step') {
        global $app_list_strings;
        $options_name = $rel_this->field_defs[$field]['options'];
        $target_array = $app_list_strings[$options_name];
        bpminbox_find_start_position($target_array, $rel_this->{$field});
        if ($meta_array['ext1'] == 'retreat') {
            for ($i = 0; $i < $meta_array['value']; $i++) {
                prev($target_array);
            }
        }
        if ($meta_array['ext1'] == 'advance') {
            for ($i = 0; $i < $meta_array['value']; $i++) {
                next($target_array);
            }
        }
        $new_option = key($target_array);
        if (!empty($new_option) && $new_option != "") {
            return $new_option;
        } else {
            return $rel_this->{$field};
        }
    }
}
Beispiel #3
0
function compile_rel_user_info($target_object, $user_meta_array, &$address_array)
{
    //compile user address info based on target object
    if ($user_meta_array['rel_email_value'] == "") {
        $target_user_id = $target_object->{$user_meta_array}['field_value'];
        //Get user's manager id?
        if ($user_meta_array['relate_type'] != "Self") {
            $target_user_id = get_manager_info($target_user_id);
            //end if we need to get the user's manager id
        }
        $user_array = get_alert_recipient($target_user_id);
    } else {
        //use the custom fields
        if ($target_object->{$user_meta_array}['rel_email_value'] == "") {
            //no address;
            return;
        } else {
            $notify_address = $target_object->{$user_meta_array}['rel_email_value'];
        }
        $notify_name = check_special_fields($user_meta_array['field_value'], $target_object);
        $user_array['address'] = $notify_address;
        $user_array['name'] = $notify_name;
        $user_array['type'] = "external";
        $user_array['id'] = $target_object->id;
        $user_array['external_type'] = $target_object->module_dir;
        $user_array['notify_user'] = $target_object;
        //end if else use custom fields or not
    }
    //add user info to main address bucket
    $address_type = $user_meta_array['address_type'];
    //array_push($address_array[$address_type][], $user_array);
    $address_array[$address_type][] = $user_array;
    //end function compile_rel_user_info
}