Example #1
0
function new_statuses_fetch($conn, $tc, $sin_id)
{
    $page = 1;
    $count = 100;
    //Max
    $max_id = 0;
    do {
        $sts = $tc->home_timeline($page, $count, $sin_id);
        while (!is_array($sts['statuses'])) {
            $sts = $tc->home_timeline($page);
        }
        foreach ($sts['statuses'] as $st) {
            if (!$max_id) {
                $max_id = $st['id'];
            }
            if (!insert_new_status($conn, $st)) {
                goto expired;
            }
        }
        $page++;
    } while ($sts['next_cursor'] != 0);
    expired:
    if ($max_id) {
        return $max_id;
    } else {
        //There's no new status
        return $sin_id;
    }
}
Example #2
0
function close_work_order_no_invoice($db, $VAR)
{
    //Remove Extra Slashes caused by Magic Quotes
    $resolution_string = $VAR['resolution'];
    $resolution_string = stripslashes($resolution_string);
    /* Insert resolution and close information */
    $sql = "UPDATE " . PRFX . "TABLE_WORK_ORDER SET\n\t\t\t WORK_ORDER_STATUS        ='6',\n\t\t\t WORK_ORDER_CLOSE_DATE    = " . $db->qstr(time()) . ",\n\t\t\t WORK_ORDER_RESOLUTION    = " . $db->qstr($resolution_string) . ",\n\t\t\t WORK_ORDER_CLOSE_BY      = " . $db->qstr($_SESSION['login_id']) . ",\n\t\t\t WORK_ORDER_ASSIGN_TO      = " . $db->qstr($_SESSION['login_id']) . ",\n\t\t\t WORK_ORDER_CURRENT_STATUS ='6' \n\t\t\t WHERE WORK_ORDER_ID      = " . $db->qstr($VAR['wo_id']);
    if (!($result = $db->Execute($sql))) {
        force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
        exit;
    }
    /* Update status notes */
    $arr = array('wo_id' => $VAR["wo_id"], 'work_order_status_notes' => 'Work Order has been closed and No Invoice Required');
    insert_new_status($db, $arr);
    return true;
}