Merging version 2.1 RC to main trunk.
[fa-stable.git] / manufacturing / work_order_release.php
index 6b4effc264d70040a9439286b7cdbbbd94e57ae3..9cb8e22ed0c068605ba2f436b18c6e02f8e5e18c 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 = 10;
 $path_to_root="..";
 include_once($path_to_root . "/includes/session.inc");
@@ -18,12 +27,12 @@ page(_("Work Order Release to Manufacturing"), false, false, "", $js);
 if (isset($_GET["trans_no"]))
 {
        $selected_id = $_GET["trans_no"];
-} 
+}
 elseif (isset($_POST["selected_id"]))
 {
        $selected_id = $_POST["selected_id"];
-} 
-else 
+}
+else
 {
        display_note("This page must be called with a work order reference");
        exit;
@@ -33,35 +42,36 @@ else
 
 function can_process($myrow)
 {
-       if ($myrow['released']) 
+       if ($myrow['released'])
        {
                display_error(_("This work order has already been released."));
+               set_focus('released');
                return false;
        }
-       
+
        // make sure item has components
-       if (!has_bom($myrow['stock_id'])) 
+       if (!has_bom($myrow['stock_id']))
        {
                display_error(_("This Work Order cannot be released. The selected item to manufacture does not have a bom."));
+               set_focus('stock_id');
                return false;
-       }               
-       
+       }
+
        return true;
 }
 
 //------------------------------------------------------------------------------------
-
-if (isset($_POST['release'])) 
+if (isset($_POST['release']))
 {
        release_work_order($selected_id, $_POST['released_date'], $_POST['memo_']);
-       
+
        display_note(_("The work order has been released to manufacturing."));
-       
-       hyperlink_no_params("search_work_orders.php", _("Select another work order"));
 
-       end_page();     
-       
-       exit;  
+       hyperlink_no_params("search_work_orders.php", _("Select another &work order"));
+
+       $Ajax->activate('_page_body');
+       end_page();
+       exit;
 }
 
 //------------------------------------------------------------------------------------
@@ -73,21 +83,21 @@ $myrow = get_work_order($selected_id);
 $_POST['released'] = $myrow["released"];
 $_POST['memo_'] = "";
 
-if (can_process($myrow)) 
+if (can_process($myrow))
 {
        start_table($table_style2);
-               
+
     label_row(_("Work Order #:"), $selected_id);
     label_row(_("Work Order Reference:"), $myrow["wo_ref"]);
-    
+
     date_row(_("Released Date") . ":", 'released_date');
-    
+
     textarea_row(_("Memo:"), 'memo_', $_POST['memo_'], 40, 5);
-    
+
     end_table(1);
-    
-    submit_center('release', _("Release Work Order"));
-    
+
+    submit_center('release', _("Release Work Order"), true, '', true);
+
     hidden('selected_id', $selected_id);
     hidden('stock_id', $myrow['stock_id']);