Better color in data picker
[fa-stable.git] / manufacturing / manage / bom_edit.php
index 8b978c7d8c4a57ec16ff496cacae2fca8ad4cd39..84f60733f7d2a1b4e84874414efeb8b516abc525 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
 $page_security = 9;
 $path_to_root="../..";
 include_once($path_to_root . "/includes/session.inc");
@@ -108,7 +117,7 @@ div_start('bom');
         qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
         label_cell($myrow["units"]);
                edit_button_cell("Edit".$myrow['id'], _("Edit"));
-               edit_button_cell("Delete".$myrow['id'], _("Delete"));
+               delete_button_cell("Delete".$myrow['id'], _("Delete"));
         end_row();
 
        } //END WHILE LIST LOOP
@@ -189,7 +198,7 @@ function on_submit($selected_parent, $selected_component=-1)
 
 if ($Mode == 'Delete')
 {
-       $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $selected_component. "'";
+       $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $selected_id. "'";
        db_query($sql,"Could not delete this bom components");
 
        display_notification(_("The component item has been deleted from this bom"));
@@ -198,7 +207,7 @@ if ($Mode == 'Delete')
 
 if ($Mode == 'RESET')
 {
-       $selected_component = -1;
+       $selected_id = -1;
        unset($_POST['quantity']);
 }
 
@@ -219,7 +228,7 @@ if (get_post('stock_id') != '')
 { //Parent Item selected so display bom or edit component
        $selected_parent = $_POST['stock_id'];
        if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
-               on_submit($selected_parent, $selected_component);
+               on_submit($selected_parent, $selected_id);
        //--------------------------------------------------------------------------------------
 
 start_form();
@@ -231,12 +240,12 @@ start_form();
 
        start_table($table_style2);
 
-       if ($selected_component != -1)
+       if ($selected_id != -1)
        {
                if ($Mode == 'Edit') {
                        //editing a selected component from the link to the line item
                        $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description FROM ".TB_PREF."bom,".TB_PREF."stock_master
-                               WHERE id='$selected_component'
+                               WHERE id='$selected_id'
                                AND ".TB_PREF."stock_master.stock_id=".TB_PREF."bom.component";
 
                        $result = db_query($sql, "could not get bom");
@@ -245,9 +254,9 @@ start_form();
                        $_POST['loc_code'] = $myrow["loc_code"];
                        $_POST['workcentre_added']  = $myrow["workcentre_added"];
                        $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"]));
-               }
-               hidden('component', $selected_component);
                label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]);
+               }
+               hidden('selected_id', $selected_id);
        }
        else
        {
@@ -272,7 +281,7 @@ start_form();
        qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
 
        end_table(1);
-       submit_add_or_update_center($selected_component == -1, '', true);
+       submit_add_or_update_center($selected_id == -1, '', true);
        end_form();
 }
 // ----------------------------------------------------------------------------------