Merged all main trunk bugfixes up to release 2.0.5
[fa-stable.git] / admin / view_print_transaction.php
index 70c5ca51620b9cd048d7fde52173c6c9b7368938..dbae9f3467628618b52118c4a2acbecc1a516042 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU Affero General Public License,
+       AGPL, as published by the Free Software Foundation, either version 
+       3 of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+***********************************************************************/
 $path_to_root="..";
 $page_security = 5;
 
@@ -36,7 +45,7 @@ function viewing_controls()
 
     ref_cells(_("to #:"), 'ToTransNo');
 
-    submit_cells('ProcessSearch', _("Search"));
+    submit_cells('ProcessSearch', _("Search"), '', '', true);
 
        end_row();
     end_table(1);
@@ -50,16 +59,16 @@ function check_valid_entries()
 {
        if (!is_numeric($_POST['FromTransNo']) OR $_POST['FromTransNo'] <= 0)
        {
-               display_note(_("The starting transaction number is expected to be numeric and greater than zero."));
+               display_error(_("The starting transaction number is expected to be numeric and greater than zero."));
                return false;
        }
 
        if (!is_numeric($_POST['ToTransNo']) OR $_POST['ToTransNo'] <= 0)
        {
-               echo _("The ending transaction number is expected to be numeric and greater than zero.");
+               display_error(_("The ending transaction number is expected to be numeric and greater than zero."));
                return false;
        }
-       if ($_POST['filterType'] == "")
+       if (!isset($_POST['filterType']) || $_POST['filterType'] == "")
                return false;
 
        return true;
@@ -100,7 +109,7 @@ function handle_search()
 
                if (db_num_rows($result) == 0)
                {
-                       echo _("There are no transactions for the given parameters.");
+                       display_notification(_("There are no transactions for the given parameters."));
                        return;
                }
                $print_type = $_POST['filterType'];
@@ -108,7 +117,6 @@ function handle_search()
                        $print_type == systypes::po() || $print_type == systypes::sales_order());
                if ($print_out)
                {
-                       print_hidden_script($print_type);
                        if ($trans_ref)
                                $th = array(_("#"), _("Reference"), _("View"), _("Print"), _("GL"));
                        else
@@ -121,6 +129,7 @@ function handle_search()
                        else
                                $th = array(_("#"), _("View"), _("GL"));
                }
+               div_start('transactions');
                start_table($table_style);
                table_header($th);
                $k = 0;
@@ -132,16 +141,17 @@ function handle_search()
                        label_cell($line[$trans_no_name]);
                        if ($trans_ref)
                                label_cell($line[$trans_ref]);
-                       label_cell(get_trans_view_str($_POST['filterType'],$line[$trans_no_name], _("View")));
+                       label_cell(get_trans_view_str($_POST['filterType'],$line[$trans_no_name], _("View"), ICON_VIEW));
                        if ($print_out)
-                               label_cell(print_document_link($line[$trans_no_name], _("Print"), true, $print_type));
-               label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], _("View GL")));
+                               label_cell(print_document_link($line[$trans_no_name], _("Print"), true, $print_type, ICON_PRINT));
+               label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name]));
 
                end_row();
 
                }
 
                end_table();
+               div_end();
        }
 }
 
@@ -151,6 +161,7 @@ if (isset($_POST['ProcessSearch']))
 {
        if (!check_valid_entries())
                unset($_POST['ProcessSearch']);
+       $Ajax->activate('transactions');
 }
 
 //----------------------------------------------------------------------------------------