Merged latest changes from stable branch.
[fa-stable.git] / includes / ui / ui_input.inc
index 9ae512b5910ed2111eef9d4fef0f1fdcecdf99fc..d9140d51d53655b10e6237ba3c884cad79cad676 100644 (file)
@@ -114,6 +114,7 @@ function hidden($name, $value=null, $echo=true)
                'cancel'  - cancel form entry on Escape press; dflt ICON_CANCEL
                'process' - displays progress bar during call; optional icon
                'nonajax' - ditto, non-ajax submit
+
        $atype can contain also multiply type selectors separated by space, 
        however make sense only combination of 'process' and one of defualt/selector/cancel
 */
@@ -942,10 +943,30 @@ function supplier_credit_row($supplier, $credit, $parms='')
                ."</a>", $parms);
 }
 
+/*
+       Edit transaction link to be used in transaction inquires
+*/
+function edit_trans_link($trans_type, $trans_no, $url='')
+{
+       global $path_to_root, $trans_editors;
+
+       if (!$url) $url = @$trans_editors[$trans_type];
+
+       if (!$trans_no || !$url)
+               return '';
+
+       if (is_closed_trans($trans_type, $trans_no)) {
+               return set_icon(ICON_CLOSED, _('Closed'));
+       } else {
+               $link_text = user_graphic_links() ? set_icon(ICON_EDIT, _('Edit')) : _('Edit');
+               return "<a href='".$path_to_root . sprintf($url, $trans_no, $trans_type)."'>$link_text</a>";
+       }
+}
+
 function bank_balance_row($bank_acc, $parms='')
 {
        global $path_to_root;
-       
+
        $to = add_days(Today(), 1);
        $bal = get_balance_before_for_bank_account($bank_acc, $to);
        label_row( _("Bank Balance:"),