Пример #1
0
 function is_owner()
 {
     $tf = new tf();
     $tf->set_id($this->get_value("tfID"));
     $tf->select();
     return $tf->is_owner();
 }
Пример #2
0
function add_inactive_tf($tfID, $options)
{
    // add a tf to the array of options, if it's not already there
    global $TPL;
    if ($tfID && !array_key_exists($tfID, $options)) {
        $tf = new tf();
        $tf->set_id($tfID);
        $tf->select();
        $options[$tfID] = $tf->get_value("tfName");
    }
    return $options;
}
Пример #3
0
function add_tf($tfID, $options, $warningKey, $warningValue)
{
    // add a tf to the array of options, if it's not already there
    global $TPL;
    if ($tfID && !array_key_exists($tfID, $options)) {
        $tf = new tf();
        $tf->set_id($tfID);
        $tf->select();
        $options[$tfID] = $tf->get_value("tfName");
        $TPL[$warningKey] = sprintf($warningValue, $tf->get_value("tfName"));
    }
    return $options;
}
Пример #4
0
function show_all_exp($template)
{
    global $TPL;
    global $expenseForm;
    global $db;
    global $transaction_to_edit;
    if ($expenseForm->get_id()) {
        if ($_POST["transactionID"] && ($_POST["edit"] || is_object($transaction_to_edit) && $transaction_to_edit->get_id())) {
            // if edit is clicked OR if we've rejected changes made to something so are still editing it
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d AND transactionID<>%d ORDER BY transactionID DESC", $expenseForm->get_id(), $_POST["transactionID"]);
        } else {
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d ORDER BY transactionID DESC", $expenseForm->get_id());
        }
        $db->query($query);
        while ($db->next_record()) {
            $transaction = new transaction();
            $transaction->read_db_record($db);
            $transaction->set_values();
            $transaction->get_value("quantity") and $TPL["amount"] = $transaction->get_value("amount") / $transaction->get_value("quantity");
            $TPL["lineTotal"] = $TPL["amount"] * $transaction->get_value("quantity");
            $tf = new tf();
            $tf->set_id($transaction->get_value("fromTfID"));
            $tf->select();
            $TPL["fromTfIDLink"] = $tf->get_link();
            $tf = new tf();
            $tf->set_id($transaction->get_value("tfID"));
            $tf->select();
            $TPL["tfIDLink"] = $tf->get_link();
            $projectID = $transaction->get_value("projectID");
            if ($projectID) {
                $project = new project();
                $project->set_id($transaction->get_value("projectID"));
                $project->select();
                $TPL["projectName"] = $project->get_value("projectName");
            }
            if ($transaction->get_value("fromTfID") == config::get_config_item("expenseFormTfID")) {
                $TPL['expense_class'] = "loud";
            } else {
                $TPL['expense_class'] = "";
            }
            include_template($template);
        }
    }
}
Пример #5
0
    if (have_entity_perm("tf", PERM_READ, $current_user, true)) {
        // Person can only read TF records that they own
        $q = prepare("SELECT tf.tfID AS value, tf.tfName AS label\n                  FROM tf, tfPerson \n                 WHERE tfPerson.personID=%d \n                   AND tf.tfID=tfPerson.tfID \n                   AND (tf.tfActive = 1 OR tf.tfID = %d OR tf.tfID = %d)\n              ORDER BY tfName", $current_user->get_id(), $transactionRepeat->get_value("tfID"), $transactionRepeat->get_value("fromTfID"));
    } else {
        alloc_error("No permissions to generate TF list");
    }
}
//special case for disabled TF. Include it in the list, but also add a warning message.
$tf = new tf();
$tf->set_id($transactionRepeat->get_value("tfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is allocated to an inactive TF. It will not create transactions.";
}
$tf = new tf();
$tf->set_id($transactionRepeat->get_value("fromTfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is sourced from an inactive TF. It will not create transactions.";
}
$m = new meta("currencyType");
$currencyOps = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
$TPL["currencyTypeOptions"] = page::select_options($currencyOps, $transactionRepeat->get_value("currencyTypeID"));
$TPL["tfOptions"] = page::select_options($q, $transactionRepeat->get_value("tfID"));
$TPL["fromTfOptions"] = page::select_options($q, $transactionRepeat->get_value("fromTfID"));
$TPL["basisOptions"] = page::select_options(array("weekly" => "weekly", "fortnightly" => "fortnightly", "monthly" => "monthly", "quarterly" => "quarterly", "yearly" => "yearly"), $transactionRepeat->get_value("paymentBasis"));
$TPL["transactionTypeOptions"] = page::select_options(transaction::get_transactionTypes(), $transactionRepeat->get_value("transactionType"));
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $current_user->have_role("admin")) {
    $TPL["adminButtons"] .= '
  <select name="changeTransactionStatus"><option value="">Transaction Status<option value="approved">Approve<option value="rejected">Reject<option value="pending">Pending</select>
  ';
}
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $transactionRepeat->get_value("status") == "pending") {
Пример #6
0
        $not_quoted and $TPL["count_not_quoted_tasks"] = "(" . sprintf("%d", $not_quoted) . " tasks not included in estimate)";
    }
    $TPL["invoice_links"] .= "<a href=\"" . $TPL["url_alloc_invoice"] . "clientID=" . $clientID . "&projectID=" . $project->get_id() . "\">New Invoice</a>";
}
$TPL["navigation_links"] = $project->get_navigation_links();
$query = prepare("SELECT tfID AS value, tfName AS label \n                    FROM tf \n                   WHERE tfActive = 1\n                ORDER BY tfName");
$TPL["commission_tf_options"] = page::select_options($query, $TPL["commission_tfID"]);
$TPL["cost_centre_tfID_options"] = page::select_options($query, $TPL["project_cost_centre_tfID"]);
$db->query($query);
while ($db->row()) {
    $tf_array[$db->f("value")] = $db->f("label");
}
if ($TPL["project_cost_centre_tfID"]) {
    $tf = new tf();
    $tf->set_id($TPL["project_cost_centre_tfID"]);
    $tf->select();
    $TPL["cost_centre_tfID_label"] = $tf->get_link();
}
$query = prepare("SELECT roleName,roleID FROM role WHERE roleLevel = 'project' ORDER BY roleSequence");
$db->query($query);
#$project_person_role_array[] = "";
while ($db->next_record()) {
    $project_person_role_array[$db->f("roleID")] = $db->f("roleName");
}
$email_type_array = array("None" => "None", "Assigned Tasks" => "Assigned Tasks", "All Tasks" => "All Tasks");
$t = new meta("currencyType");
$currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
$projectType_array = project::get_project_type_array();
$m = new meta("projectStatus");
$projectStatus_array = $m->get_assoc_array("projectStatusID", "projectStatusID");
$timeUnit = new timeUnit();
Пример #7
0
 function is_owner($person = "")
 {
     $current_user =& singleton("current_user");
     if ($person == "") {
         $person = $current_user;
     }
     if ($this->get_value("expenseFormID")) {
         $expenseForm = $this->get_foreign_object("expenseForm");
         return $expenseForm->is_owner($person);
     }
     if ($this->get_value("timeSheetID")) {
         $timeSheet = $this->get_foreign_object("timeSheet");
         return $timeSheet->is_owner($person);
     }
     if ($this->get_value("productSaleItemID")) {
         $productSaleItem = $this->get_foreign_object("productSaleItem");
         return $productSaleItem->is_owner();
     }
     $toTf = new tf();
     $toTf->set_id($this->get_value('tfID'));
     $toTf->select();
     $fromTf = new tf();
     $fromTf->set_id($this->get_value('fromTfID'));
     $fromTf->select();
     return $toTf->is_owner($person) || $fromTf->is_owner($person);
 }