From ec98559a543b666f4824149e8522d0aa65818936 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 3 Jul 2019 13:42:12 +0200 Subject: [PATCH] Modifying Purchase Invoice: removed obsolete grn removal button. --- includes/access_levels.inc | 1 - purchasing/includes/db/invoice_db.inc | 46 --------------------------- purchasing/includes/ui/invoice_ui.inc | 13 -------- purchasing/supplier_invoice.php | 14 +------- 4 files changed, 1 insertion(+), 73 deletions(-) diff --git a/includes/access_levels.inc b/includes/access_levels.inc index 62a71cb6..a9fc84d8 100644 --- a/includes/access_levels.inc +++ b/includes/access_levels.inc @@ -168,7 +168,6 @@ $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")), diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index 0a7f360b..427b73dc 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -658,52 +658,6 @@ function is_reference_already_there($supplier_id, $supp_reference, $trans_no=0) return $myrow[0] > 0; } -function remove_not_invoice_item($id) -{ - begin_transaction(); - - $myrow = get_grn_item_detail($id); - - $grn = get_grn_batch($myrow['grn_batch_id']); - - $supp = get_supplier($grn["supplier_id"]); - - $sql = "UPDATE ".TB_PREF."purch_order_details - SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"]; - db_query($sql, "The quantity invoiced of the purchase order line could not be updated"); - - $sql = "UPDATE ".TB_PREF."grn_items - SET qty_recd = quantity_inv WHERE id = ".$myrow["id"]; - db_query($sql, "The quantity invoiced off the items received record could not be updated"); - - update_average_material_cost($grn["supplier_id"], $myrow["item_code"], - $myrow["unit_price"], -$myrow["QtyOstdg"], Today()); - - $price = $myrow['unit_price']; - if ($supp['tax_included']) - $price = get_tax_free_price_for_item($myrow['item_code'], $myrow['unit_price'], $supp['tax_group_id'], $supp['tax_included']); - - add_stock_move(ST_SUPPRECEIVE, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "", - -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $price); - - $clearing_act = get_company_pref('grn_clearing_act'); - if ($clearing_act) { // otherwise GRN clearing account is not used - if (is_inventory_item($myrow['item_code'])) - { - $total = 0; - $stock_gl_code = get_stock_gl_code($myrow['item_code']); - $date = sql2date($grn["delivery_date"]); - $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $myrow['grn_batch_id'], $date, $stock_gl_code["inventory_account"], - $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], - -$myrow['QtyOstdg'] * $price, $grn["supplier_id"], "", 0, _("GRN Removal")); - $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $myrow['grn_batch_id'], $date, $clearing_act, - 0, 0, -$total, null, "", 0, _("GRN Removal")); - } - } - - commit_transaction(); -} - function find_src_invoices($cart) { $invoices = $po_ids = array(); diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index 04a00879..39a4d5ba 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -420,11 +420,6 @@ 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->trans_type == ST_SUPPINVOICE) && $_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)); - } end_row(); } } @@ -453,11 +448,7 @@ function display_grn_items(&$supp_trans, $mode=0) if ($mode == 1) { if ($supp_trans->trans_type == ST_SUPPINVOICE) - { $heading = _("Items Received Yet to be Invoiced"); - 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 $heading = _("Delivery Item Selected For Adding To A Supplier Credit Note"); } @@ -501,8 +492,6 @@ function display_grn_items(&$supp_trans, $mode=0) _("Received On"), _("Quantity Received"), _("Quantity Invoiced"), _("Qty Yet To Invoice"), $supp_trans->tax_included ? _("Price after Tax") : _("Price before Tax"), _("Total"), ""); - if (($supp_trans->trans_type == ST_SUPPINVOICE) && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs - $th[] = ""; if ($supp_trans->trans_type == ST_SUPPCREDIT) { $th[7] = _("Qty Yet To Credit"); @@ -548,8 +537,6 @@ 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->trans_type == ST_SUPPINVOICE) && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) - label_cell(""); } end_row(); diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 0dc1a77a..e75ec45c 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -356,18 +356,6 @@ if ($id5 != -1) $Ajax->activate('gl_items'); } -$id2 = -1; -if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) -{ - $id2 = find_submit('void_item_id'); - if ($id2 != -1) - { - remove_not_invoice_item($id2); - display_notification(sprintf(_('All yet non-invoiced items on delivery line # %d has been removed.'), $id2)); - - } -} - if (isset($_POST['go'])) { $Ajax->activate('gl_items'); @@ -395,7 +383,7 @@ else { //----------------------------------------------------------------------------------------- -if ($id != -1 || $id2 != -1) +if ($id != -1) { $Ajax->activate('grn_items'); $Ajax->activate('inv_tot'); -- 2.30.2