Password reset mail could take several hours. After fix only a couple of seconds...
[fa-stable.git] / dimensions / dimension_entry.php
index 626d8466914e5ca6a1b393c9b4c85542dfd952d1..3a11e6656a156fc4141ec047e44a9bce2112ffc2 100644 (file)
@@ -14,7 +14,6 @@ $path_to_root = "..";
 include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/includes/date_functions.inc");
-include_once($path_to_root . "/includes/manufacturing.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 
 include_once($path_to_root . "/admin/db/tags_db.inc");
@@ -22,9 +21,9 @@ include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
 include_once($path_to_root . "/dimensions/includes/dimensions_ui.inc");
 
 $js = "";
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
-page(_("Dimension Entry"), false, false, "", $js);
+page(_($help_context = "Dimension Entry"), false, false, "", $js);
 
 //---------------------------------------------------------------------------------------
 
@@ -93,11 +92,11 @@ if (isset($_GET['ReopenedID']))
 
 function safe_exit()
 {
-       global $path_to_root;
+       global $path_to_root, $id;
 
        hyperlink_no_params("", _("Enter a &new dimension"));
-       echo "<br>";
        hyperlink_no_params($path_to_root . "/dimensions/inquiry/search_dimensions.php", _("&Select an existing dimension"));
+    hyperlink_no_params($path_to_root . "/admin/attachments.php?filterType=40&trans_no=$id", _("&Add Attachment"));
 
        display_footer_exit();
 }
@@ -110,17 +109,8 @@ function can_process()
 
        if ($selected_id == -1) 
        {
-
-       if (!$Refs->is_valid($_POST['ref'])) 
-       {
-               display_error( _("The dimension reference must be entered."));
-                       set_focus('ref');
-               return false;
-       }
-
-       if (!is_new_reference($_POST['ref'], ST_DIMENSION)) 
+       if (!check_reference($_POST['ref'], ST_DIMENSION))
        {
-               display_error(_("The entered reference is already in use."));
                        set_focus('ref');
                return false;
        }
@@ -154,16 +144,16 @@ function can_process()
 
 if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM'])) 
 {
-
+       if (!isset($_POST['dimension_tags']))
+               $_POST['dimension_tags'] = array();
+               
        if (can_process()) 
        {
 
                if ($selected_id == -1) 
                {
-
                        $id = add_dimension($_POST['ref'], $_POST['name'], $_POST['type_'], $_POST['date_'], $_POST['due_date'], $_POST['memo_']);
                        add_tag_associations($id, $_POST['dimension_tags']);
-
                        meta_forward($_SERVER['PHP_SELF'], "AddedID=$id");
                } 
                else 
@@ -223,13 +213,13 @@ if (isset($_POST['reopen']))
 
 start_form();
 
-start_table($table_style2);
+start_table(TABLESTYLE2);
 
 if ($selected_id != -1)
 {
-       $myrow = get_dimension($selected_id);
+       $myrow = get_dimension($selected_id, true);
 
-       if (strlen($myrow[0]) == 0
+       if ($myrow === false
        {
                display_error(_("The dimension sent is not valid."));
                display_footer_exit();
@@ -265,7 +255,7 @@ if ($selected_id != -1)
 else 
 {
        $_POST['dimension_tags'] = array();
-       ref_row(_("Dimension Reference:"), 'ref', '', $Refs->get_next(ST_DIMENSION));
+       ref_row(_("Dimension Reference:"), 'ref', '', $Refs->get_next(ST_DIMENSION), false, ST_DIMENSION);
 }
 
 text_row_ex(_("Name") . ":", 'name', 50, 75);
@@ -290,7 +280,7 @@ if (isset($_POST['closed']) && $_POST['closed'] == 1)
 if ($selected_id != -1) 
 {
        echo "<br>";
-       submit_center_first('UPDATE_ITEM', _("Update"), _('Save changes to dimension'), false);
+       submit_center_first('UPDATE_ITEM', _("Update"), _('Save changes to dimension'), 'default');
        if ($_POST['closed'] == 1)
                submit('reopen', _("Re-open This Dimension"), true, _('Mark this dimension as re-opened'), true);
        else    
@@ -299,7 +289,7 @@ if ($selected_id != -1)
 }
 else
 {
-       submit_center('ADD_ITEM', _("Add"), true, '', false);
+       submit_center('ADD_ITEM', _("Add"), true, '', 'default');
 }
 end_form();
 
@@ -307,4 +297,3 @@ end_form();
 
 end_page();
 
-?>