Syntax typo.
[fa-stable.git] / gl / gl_journal.php
index ee4f05932e310c42073e60d4ebfb8c946539d9b3..33431822af054efd0163e5657033bf339fc0909d 100644 (file)
@@ -9,8 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 3;
-$path_to_root="..";
+$page_security = 'SA_JOURNALENTRY';
+$path_to_root = "..";
 include_once($path_to_root . "/includes/ui/items_cart.inc");
 
 include_once($path_to_root . "/includes/session.inc");
@@ -55,7 +55,8 @@ if (isset($_GET['AddedID']))
 
     display_note(get_gl_view_str($trans_type, $trans_no, _("&View this Journal Entry")));
 
-       hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Journal Entry"));
+       reset_focus();
+       hyperlink_params($_SERVER['PHP_SELF'], _("Entry &New Journal Entry"), "NewJournal=Yes");
 
        display_footer_exit();
 } elseif (isset($_GET['UpdatedID'])) 
@@ -184,7 +185,7 @@ if (isset($_POST['Process']))
        $cart->memo_ = $_POST['memo_'];
        $cart->tran_date = $_POST['date_'];
 
-       $trans_no = write_journal_entries($cart);
+       $trans_no = write_journal_entries($cart, check_value('Reverse'));
 
        $cart->clear_items();
        new_doc_date($_POST['date_']);
@@ -231,9 +232,14 @@ function check_item_data()
                set_focus('AmountCredit');
                return false;
        }
+       
+       if (!is_tax_gl_unique(get_post('code_id'))) {
+               display_error(_("Cannot post to GL account used by more than one tax type."));
+               set_focus('code_id');
+               return false;
+       }
 
-
-       if ($_SESSION["wa_current_user"]->access != 2 && is_bank_account($_POST['code_id'])) 
+       if (!$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL') && is_bank_account($_POST['code_id'])) 
        {
                display_error(_("You cannot make a journal entry for a bank account. Please use one of the banking functions for bank transactions."));
                set_focus('code_id');