Stable merged into unstable again (due to failure on binary file during previous...
[fa-stable.git] / purchasing / inquiry / supplier_inquiry.php
index ffb264b523420876cef4ae6fe3ca936e884faa09..af6c2216623c06cd168d7d8cd735143f5dfdfaca 100644 (file)
@@ -17,15 +17,13 @@ include_once($path_to_root . "/includes/session.inc");
 include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 include_once($path_to_root . "/reporting/includes/reporting.inc");
 
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(900, 500);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
+
 if (isset($_GET['supplier_id'])){
        $_POST['supplier_id'] = $_GET['supplier_id'];
 }
@@ -38,8 +36,7 @@ if (isset($_GET['ToDate'])){
 
 //------------------------------------------------------------------------------------------------
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 if (!isset($_POST['supplier_id']))
        $_POST['supplier_id'] = get_global_supplier();
@@ -47,8 +44,8 @@ if (!isset($_POST['supplier_id']))
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 
-if (!@$_GET['popup'])
-       supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, !@$_GET['popup']);
+if (!$page_nested)
+       supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, true);
 
 date_cells(_("From:"), 'TransAfterDate', '', null, -30);
 date_cells(_("To:"), 'TransToDate');
@@ -109,6 +106,7 @@ function systype_name($dummy, $type)
        global $systypes_array;
        return $systypes_array[$type];
 }
+div_end();
 
 function trans_view($trans)
 {
@@ -127,7 +125,9 @@ function gl_view($row)
 
 function credit_link($row)
 {
-       if (@$_GET['popup'])
+       global $page_nested;
+
+       if ($page_nested)
                return '';
        return $row['type'] == ST_SUPPINVOICE && $row["TotalAmount"] - $row["Allocated"] > 0 ?
                pager_link(_("Credit This"),
@@ -160,6 +160,11 @@ function check_overdue($row)
        return $row['OverDue'] == 1
                && (abs($row["TotalAmount"]) - $row["Allocated"] != 0);
 }
+
+function edit_link($row)
+{
+       return edit_trans_link($row['type'], $row['trans_no']);
+}
 //------------------------------------------------------------------------------------------------
 
 $sql = get_sql_for_supplier_inquiry();
@@ -177,7 +182,8 @@ $cols = array(
                        _("Credit") => array('align'=>'right', 'insert'=>true,'fun'=>'fmt_credit'), 
                        array('insert'=>true, 'fun'=>'gl_view'),
                        array('insert'=>true, 'fun'=>'credit_link'),
-                       array('insert'=>true, 'fun'=>'prt_link')
+                       array('insert'=>true, 'fun'=>'prt_link'),
+                       array('insert'=>true, 'fun'=>'edit_link')
                        );
 
 if ($_POST['supplier_id'] != ALL_TEXT)
@@ -185,8 +191,6 @@ if ($_POST['supplier_id'] != ALL_TEXT)
        $cols[_("Supplier")] = 'skip';
        $cols[_("Currency")] = 'skip';
 }
-//------------------------------------------------------------------------------------------------
-
 
 /*show a table of the transactions returned by the sql */
 $table =& new_db_pager('trans_tbl', $sql, $cols);
@@ -196,9 +200,7 @@ $table->width = "85%";
 
 display_db_pager($table);
 
-if (!@$_GET['popup'])
-{
-       end_form();
-       end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
+
 ?>