示例#1
0
 function get_transaction_type_link()
 {
     global $TPL;
     $type = $this->get_value("transactionType");
     $transactionTypes = transaction::get_transactionTypes();
     // Transaction stems from an invoice
     if ($type == "invoice") {
         $invoice = $this->get_foreign_object("invoice");
         if (!$invoice->get_id()) {
             $invoiceItem = $this->get_foreign_object("invoiceItem");
             $invoice = $invoiceItem->get_foreign_object("invoice");
         }
         $invoice->get_id() and $str = "<a href=\"" . $invoice->get_url() . "\">" . $transactionTypes[$type] . " " . $invoice->get_value("invoiceNum") . "</a>";
         // Transaction is from an expenseform
     } else {
         if ($type == "expense") {
             $expenseForm = $this->get_foreign_object("expenseForm");
             if ($expenseForm->get_id() && $expenseForm->have_perm(PERM_READ_WRITE)) {
                 $str = "<a href=\"" . $expenseForm->get_url() . "\">" . $transactionTypes[$type] . " " . $this->get_value("expenseFormID") . "</a>";
             }
             // Had to rewrite this so that people who had transactions on other peoples timesheets
             // could see their own transactions, but not the other persons timesheet.
         } else {
             if ($type == "timesheet" && $this->get_value("timeSheetID")) {
                 $timeSheet = new timeSheet();
                 $timeSheet->set_id($this->get_value("timeSheetID"));
                 $str = "<a href=\"" . $timeSheet->get_url() . "\">" . $transactionTypes[$type] . " " . $this->get_value("timeSheetID") . "</a>";
             } else {
                 if (($type == "commission" || $type == "tax") && $this->get_value("timeSheetID")) {
                     $timeSheet = new timeSheet();
                     $timeSheet->set_id($this->get_value("timeSheetID"));
                     $str = "<a href=\"" . $timeSheet->get_url() . "\">" . $transactionTypes[$type] . " (Time Sheet " . $this->get_value("timeSheetID") . ")</a>";
                 } else {
                     $str = $transactionTypes[$type];
                 }
             }
         }
     }
     if ($this->get_value("transactionGroupID")) {
         $str .= " <a href=\"" . $TPL["url_alloc_transactionGroup"] . "transactionGroupID=" . $this->get_value("transactionGroupID") . "\">Group " . $this->get_value("transactionGroupID") . "</a>";
     }
     return $str;
 }