X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=dimensions%2Fdimension_entry.php;h=3a11e6656a156fc4141ec047e44a9bce2112ffc2;hb=1c257d9ff0bfe6452423acdb8358e26bd3ce7f43;hp=91904b53034a90d738630c021a69d9655ffe597d;hpb=c1ab12ce9d688466f26ac4ca3b0e11ddc0c4b8e2;p=fa-stable.git diff --git a/dimensions/dimension_entry.php b/dimensions/dimension_entry.php index 91904b53..3a11e665 100644 --- a/dimensions/dimension_entry.php +++ b/dimensions/dimension_entry.php @@ -14,16 +14,16 @@ $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"); 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); //--------------------------------------------------------------------------------------- @@ -92,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 "
"; 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(); } @@ -105,21 +105,12 @@ function safe_exit() function can_process() { - global $selected_id; + global $selected_id, $Refs; if ($selected_id == -1) { - - if (!references::is_valid($_POST['ref'])) + if (!check_reference($_POST['ref'], ST_DIMENSION)) { - display_error( _("The dimension reference must be entered.")); - set_focus('ref'); - return false; - } - - if (!is_new_reference($_POST['ref'], systypes::dimension())) - { - display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } @@ -153,21 +144,23 @@ 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 { update_dimension($selected_id, $_POST['name'], $_POST['type_'], $_POST['date_'], $_POST['due_date'], $_POST['memo_']); + update_tag_associations(TAG_DIMENSION, $selected_id, $_POST['dimension_tags']); meta_forward($_SERVER['PHP_SELF'], "UpdatedID=$selected_id"); } @@ -194,6 +187,7 @@ if (isset($_POST['delete'])) // delete delete_dimension($selected_id); + delete_tag_associations(TAG_DIMENSION,$selected_id, true); meta_forward($_SERVER['PHP_SELF'], "DeletedID=$selected_id"); } } @@ -219,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(); @@ -244,7 +238,13 @@ if ($selected_id != -1) $_POST['type_'] = $myrow["type_"]; $_POST['date_'] = sql2date($myrow["date_"]); $_POST['due_date'] = sql2date($myrow["due_date"]); - $_POST['memo_'] = get_comments_string(systypes::dimension(), $selected_id); + $_POST['memo_'] = get_comments_string(ST_DIMENSION, $selected_id); + + $tags_result = get_tags_associated_with_record(TAG_DIMENSION, $selected_id); + $tagids = array(); + while ($tag = db_fetch($tags_result)) + $tagids[] = $tag['id']; + $_POST['dimension_tags'] = $tagids; hidden('ref', $_POST['ref']); @@ -254,7 +254,8 @@ if ($selected_id != -1) } else { - ref_row(_("Dimension Reference:"), 'ref', '', references::get_next(systypes::dimension())); + $_POST['dimension_tags'] = array(); + ref_row(_("Dimension Reference:"), 'ref', '', $Refs->get_next(ST_DIMENSION), false, ST_DIMENSION); } text_row_ex(_("Name") . ":", 'name', 50, 75); @@ -265,7 +266,9 @@ number_list_row(_("Type"), 'type_', null, 1, $dim); date_row(_("Start Date") . ":", 'date_'); -date_row(_("Date Required By") . ":", 'due_date', '', null, sys_prefs::default_dimension_required_by()); +date_row(_("Date Required By") . ":", 'due_date', '', null, $SysPrefs->default_dimension_required_by()); + +tag_list_row(_("Tags:"), 'dimension_tags', 5, TAG_DIMENSION, true); textarea_row(_("Memo:"), 'memo_', null, 40, 5); @@ -294,4 +297,3 @@ end_form(); end_page(); -?>