Changes in db scheme: gl_trans.type_no optimized to int, changed lock_stock.reorder_l...
[fa-stable.git] / gl / gl_journal.php
index 5cc96652d562c1d4ce3f4e043040b996d367ca83..a6f264075719fa08f0913f8517828f8f832da285 100644 (file)
@@ -21,11 +21,12 @@ include_once($path_to_root . "/includes/data_checks.inc");
 include_once($path_to_root . "/gl/includes/ui/gl_journal_ui.inc");
 include_once($path_to_root . "/gl/includes/gl_db.inc");
 include_once($path_to_root . "/gl/includes/gl_ui.inc");
+include_once($path_to_root . "/taxes/db/tax_types_db.inc");
 
 $js = '';
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(800, 500);
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
 
 if (isset($_GET['ModifyGL'])) {
@@ -36,6 +37,7 @@ if (isset($_GET['ModifyGL'])) {
        $_SESSION['page_title'] = _($help_context = "Journal Entry");
 
 page($_SESSION['page_title'], false, false,'', $js);
+
 //--------------------------------------------------------------------------------------------------
 
 function line_start_focus() {
@@ -59,6 +61,8 @@ if (isset($_GET['AddedID']))
        reset_focus();
        hyperlink_params($_SERVER['PHP_SELF'], _("Enter &New Journal Entry"), "NewJournal=Yes");
 
+       hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$trans_type&trans_no=$trans_no");
+
        display_footer_exit();
 } elseif (isset($_GET['UpdatedID'])) 
 {
@@ -78,14 +82,17 @@ if (isset($_GET['AddedID']))
 if (isset($_GET['NewJournal']))
 {
        create_cart(0,0);
-} 
+}
 elseif (isset($_GET['ModifyGL']))
 {
+       check_is_editable($_GET['trans_type'], $_GET['trans_no']);
+
        if (!isset($_GET['trans_type']) || $_GET['trans_type']!= 0) {
                display_error(_("You can edit directly only journal entries created via Journal Entry page."));
                hyperlink_params("$path_to_root/gl/gl_journal.php", _("Entry &New Journal Entry"), "NewJournal=Yes");
                display_footer_exit();
        }
+
        create_cart($_GET['trans_type'], $_GET['trans_no']);
 }
 
@@ -98,7 +105,6 @@ function create_cart($type=0, $trans_no=0)
                unset ($_SESSION['journal_items']);
        }
 
-       check_is_closed($type, $trans_no);
        $cart = new items_cart($type);
     $cart->order_id = $trans_no;
 
@@ -313,7 +319,7 @@ if (isset($_POST['CancelItemChanges']))
 
 if (isset($_POST['go']))
 {
-       display_quick_entries($_SESSION['journal_items'], $_POST['quick'], input_num('totamount'), QE_JOURNAL);
+       display_quick_entries($_SESSION['journal_items'], $_POST['person_id'], input_num('totamount'), QE_JOURNAL);
        $_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
        line_start_focus();
 }      
@@ -340,4 +346,3 @@ end_form();
 
 end_page();
 
-?>