X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fgl_journal.php;h=9cfc933295e1bc2b2d7f83da92d8e9589e6f9bf8;hb=2a42ffb56ef6651b8a136cd89271e65d397d7677;hp=5bff91650ebf1dbb2f76297d16f3764acf54e3ec;hpb=263d7084b71b0cae4d5781defcd08a6f2a7c841e;p=fa-stable.git diff --git a/gl/gl_journal.php b/gl/gl_journal.php index 5bff9165..9cfc9332 100644 --- a/gl/gl_journal.php +++ b/gl/gl_journal.php @@ -9,8 +9,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$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"); @@ -49,7 +49,7 @@ function line_start_focus() { if (isset($_GET['AddedID'])) { $trans_no = $_GET['AddedID']; - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; display_notification_centered( _("Journal entry has been entered") . " #$trans_no"); @@ -62,7 +62,7 @@ if (isset($_GET['AddedID'])) } elseif (isset($_GET['UpdatedID'])) { $trans_no = $_GET['UpdatedID']; - $trans_type = systypes::journal_entry(); + $trans_type = ST_JOURNAL; display_notification_centered( _("Journal entry has been updated") . " #$trans_no"); @@ -90,6 +90,8 @@ elseif (isset($_GET['ModifyGL'])) function create_cart($type=0, $trans_no=0) { + global $Refs; + if (isset($_SESSION['journal_items'])) { unset ($_SESSION['journal_items']); @@ -111,9 +113,9 @@ function create_cart($type=0, $trans_no=0) } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); - $cart->reference = references::get($type, $trans_no); + $cart->reference = $Refs->get($type, $trans_no); } else { - $cart->reference = references::get_next(0); + $cart->reference = $Refs->get_next(0); $cart->tran_date = new_doc_date(); } if (!is_date_in_fiscalyear($cart->tran_date)) @@ -158,13 +160,13 @@ if (isset($_POST['Process'])) $input_error = 1; } if ($_SESSION['journal_items']->order_id == 0) { - if (!references::is_valid($_POST['ref'])) + if (!$Refs->is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); set_focus('ref'); $input_error = 1; } - elseif (references::exists(systypes::journal_entry(), $_POST['ref'])) + elseif ($Refs->exists(ST_JOURNAL, $_POST['ref'])) { display_error( _("The entered reference is already in use.")); set_focus('ref'); @@ -232,9 +234,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');