Stable merged into unstable again (due to failure on binary file during previous...
[fa-stable.git] / gl / inquiry / journal_inquiry.php
index 0297073c59f3c57c07d69eaa42cf81c502ab98df..2d9eaabc93e32715f000b502fe905132bf526a1c 100644 (file)
@@ -107,7 +107,14 @@ 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) : '';
@@ -118,7 +125,7 @@ $sql = get_sql_for_journal_inquiry(get_post('filterType', -1), get_post('FromDat
 
 $cols = array(
        _("#") => array('fun'=>'journal_pos', 'align'=>'center'), 
-       _("Date") =>array('name'=>'tran_date','type'=>'date', 'ord' => check_value('AlsoClosed') ? 'asc' : 'desc'),
+       _("Date") =>array('name'=>'tran_date','type'=>'date','ord'=>'desc'),
        _("Type") => array('fun'=>'systype_name'), 
        _("Trans #") => array('fun'=>'view_link'), 
        _("Reference"),