Esempio n. 1
0
function recordTimeWorked($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $issue_id = XML_RPC_decode($p->getParam(2));
    $cat_id = XML_RPC_decode($p->getParam(3));
    $summary = XML_RPC_decode($p->getParam(4));
    $time_spent = XML_RPC_decode($p->getParam(5));
    $usr_id = User::getUserIDByEmail($email);
    $res = Time_Tracking::recordRemoteEntry($issue_id, $usr_id, $cat_id, $summary, $time_spent);
    if ($res == -1) {
        return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Could not record the time tracking entry");
    } else {
        return new XML_RPC_Response(XML_RPC_Encode('OK'));
    }
}