Added two special access areas for bank gl postings and GRN removal.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 9 Sep 2009 09:24:01 +0000 (09:24 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 9 Sep 2009 09:24:01 +0000 (09:24 +0000)
gl/gl_journal.php
gl/includes/ui/gl_journal_ui.inc
includes/access_levels.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/supplier_invoice.php

index 4e23d2f74179890e7fc46e1e72da487a0be1503b..33431822af054efd0163e5657033bf339fc0909d 100644 (file)
@@ -239,7 +239,7 @@ function check_item_data()
                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');
index 4c724229afaf3f78bd18e87da9b4065509c4b198..db92a7bb04660e09836078a881a047fdc88b7e33 100644 (file)
@@ -192,7 +192,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                            $Ajax->activate('code_id');
                }
                
-               $skip_bank = ($_SESSION["wa_current_user"]->access != 2);
+               $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
                gl_all_accounts_list('code_id', null, $skip_bank, true);
                if ($dim >= 1)
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
index f1ccc7f697b4b011ef149f867ae2f9ae3098c6f7..d884e741d76bbd363b65f53250559639230e9a8b 100644 (file)
@@ -154,6 +154,7 @@ $security_areas =array(
        'SA_PURCHASEORDER' => array(SS_PURCH|3, _("Purchase order entry")),
        'SA_GRN' => array(SS_PURCH|4, _("Purchase receive")),
        'SA_SUPPLIERINVOICE' => array(SS_PURCH|5, _("Supplier invoices")),
+       'SA_GRNDELETE' => array(SS_PURCH|9, _("Deleting GRN items during invoice entry")),
        'SA_SUPPLIERCREDIT' => array(SS_PURCH|6, _("Supplier credit notes")),
        'SA_SUPPLIERPAYMNT' => array(SS_PURCH|7, _("Supplier payments")),
        'SA_SUPPLIERALLOC' => array(SS_PURCH|8, _("Supplier payments allocations")),
@@ -225,6 +226,7 @@ $security_areas =array(
        'SA_BANKTRANSFER' => array(SS_GL|6, _("Bank account transfers")),
        'SA_RECONCILE' => array(SS_GL|7, _("Bank reconciliation")),
        'SA_JOURNALENTRY' => array(SS_GL|8, _("Manual journal entries")),
+       'SA_BANKJOURNAL' => array(SS_GL|11, _("Journal entries to bank related accounts")),
        'SA_BUDGETENTRY' => array(SS_GL|9, _("Budget edition")),
        'SA_STANDARDCOST' => array(SS_GL|10, _("Item standard costs")),
 
index cee5abbda36d252205c39a506ad9fae1adae828a..a3a599cb81cdbe889f66ad43a7b32adf7a2181f1 100644 (file)
@@ -390,7 +390,7 @@ function display_grn_items_for_selection(&$supp_trans, $k)
                        submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Invoice"), true);
                else    
                        submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Credit Note"), true);
-               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2) {     // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) {      // Added 2008-10-18 by Joe Hunt. Special access rights needed.
                        submit_cells('void_item_id'.$n, _("Remove"), '', _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), true);
                                submit_js_confirm('void_item_id'.$n,
                                        sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $n));
@@ -425,7 +425,7 @@ function display_grn_items(&$supp_trans, $mode=0)
                if ($supp_trans->is_invoice)
                {
                        $heading = _("Items Received Yet to be Invoiced");
-               if ($_SESSION["wa_current_user"]->access == 2)  // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+               if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))   // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
                                $heading2 = _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!");
                }
                else
@@ -472,7 +472,7 @@ function display_grn_items(&$supp_trans, $mode=0)
        $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"),
                _("Received On"), _("Quantity Received"), _("Quantity Invoiced"),
                _("Qty Yet To Invoice"), _("Order Price"), _("Total"), "");
-       if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2)       // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+       if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))        // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
                $th[] = "";
                if (!$supp_trans->is_invoice)
                {
@@ -518,7 +518,7 @@ function display_grn_items(&$supp_trans, $mode=0)
                        if ($mode == 1)
                        {
                                delete_button_cell("Delete" . $entered_grn->id, _("Edit"), _('Edit document line'));
-                               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2)         
+                               if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))          
                                        label_cell("");
                        }       
                        end_row();
index 11cd376a9af97ad124208afa5ccda84d65c5cbf9..5302ee670e774011182c69145e0670d2f8304802 100644 (file)
@@ -334,7 +334,7 @@ if ($id4 != -1)
 }
 
 $id2 = -1;
-if ($_SESSION["wa_current_user"]->access == 2)
+if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
 {
        $id2 = find_submit('void_item_id');
        if ($id2 != -1)