Stable merged into unstable again (due to failure on binary file during previous...
[fa-stable.git] / gl / inquiry / journal_inquiry.php
index 54dfa1c0549d2473022c0111d8c7fcddebc09170..2d9eaabc93e32715f000b502fe905132bf526a1c 100644 (file)
@@ -80,9 +80,9 @@ function gl_link($row)
 }
 
 $editors = array(
-       0 => "/gl/gl_journal.php?ModifyGL=Yes&trans_no=%d&trans_type=%d",
-//     1=> Bank Payment,
-//     2=> Bank Deposit,
+       ST_JOURNAL => "/gl/gl_journal.php?ModifyGL=Yes&trans_no=%d&trans_type=%d",
+       ST_BANKPAYMENT => "/gl/gl_bank.php?ModifyPayment=Yes&trans_no=%d&trans_type=%d",
+       ST_BANKDEPOSIT => "/gl/gl_bank.php?ModifyDeposit=Yes&trans_no=%d&trans_type=%d",
 //     4=> Funds Transfer,
    ST_SALESINVOICE => "/sales/customer_invoice.php?ModifyInvoice=%d",
 //   11=>
@@ -107,13 +107,21 @@ function edit_link($row)
 {
        global $editors;
 
-       return isset($editors[$row["type"]]) && !is_closed_trans($row["type"], $row["type_no"]) ? 
+       $ok = true;
+       if ($row['type'] == ST_SALESINVOICE)
+       {
+               $myrow = get_customer_trans($row["type_no"], $row["type"]);
+               if ($myrow['alloc'] != 0 || get_voided_entry(ST_SALESINVOICE, $row["type_no"]) !== false)
+                       $ok = false;
+       }               
+       return isset($editors[$row["type"]]) && !is_closed_trans($row["type"], $row["type_no"]) && $ok ? 
                pager_link(_("Edit"), 
                        sprintf($editors[$row["type"]], $row["type_no"], $row["type"]),
                        ICON_EDIT) : '';
 }
 
-$sql = get_sql_for_journal_inquiry();
+$sql = get_sql_for_journal_inquiry(get_post('filterType', -1), get_post('FromDate'),
+       get_post('ToDate'), get_post('Ref'), get_post('Memo'), check_value('AlsoClosed'));
 
 $cols = array(
        _("#") => array('fun'=>'journal_pos', 'align'=>'center'),