Password reset mail could take several hours. After fix only a couple of seconds...
[fa-stable.git] / gl / manage / revaluate_currencies.php
index 78c5cbbbf8a65653adc0625dc718a94b960969c9..1dae7eeda932ef74c57889866f7b394691ff2f4c 100644 (file)
@@ -18,13 +18,14 @@ include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/banking.inc");
 
 $js = "";
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
 page(_($help_context = "Revaluation of Currency Accounts"), false, false, "", $js);
 
 if (isset($_GET['AddedID'])) 
 {
        $trans_no = $_GET['AddedID'];
+       $JE = $_GET['JE'];
        $trans_type = ST_JOURNAL;
 
        if ($trans_no == 0)
@@ -35,6 +36,8 @@ if (isset($_GET['AddedID']))
 
                display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Journal Entries for this Transfer")));
        }
+       if ($JE > 0)
+               display_notification_centered(sprintf(_("%d Journal Entries for AR/AP accounts have been added"), $JE));
 
        //display_footer_exit();
 }
@@ -43,8 +46,6 @@ if (isset($_GET['AddedID']))
 //---------------------------------------------------------------------------------------------
 function check_data()
 {
-       global $Refs;
-       
        if (!is_date($_POST['date']))
        {
                display_error( _("The entered date is invalid."));
@@ -53,20 +54,12 @@ function check_data()
        }
        if (!is_date_in_fiscalyear($_POST['date']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date');
                return false;
        }
-       if (!$Refs->is_valid($_POST['ref'])) 
-       {
-               display_error(_("You must enter a reference."));
-               set_focus('ref');
-               return false;
-       }
-
-       if (!is_new_reference($_POST['ref'], ST_JOURNAL)) 
+       if (!check_reference($_POST['ref'], ST_JOURNAL))
        {
-               display_error(_("The entered reference is already in use."));
                set_focus('ref');
                return false;
        }
@@ -81,9 +74,9 @@ function handle_submit()
        if (!check_data())
                return;
 
-       $trans_no = add_exchange_variation_all($_POST['date'], $_POST['ref'], $_POST['memo_']);
+       $trans = add_exchange_variation_all($_POST['date'], $_POST['ref'], $_POST['memo_']);
 
-       meta_forward($_SERVER['PHP_SELF'], "AddedID=$trans_no");
+       meta_forward($_SERVER['PHP_SELF'], "AddedID=".$trans[0]."&JE=".$trans[1]);
        //clear_data();
 }
 
@@ -99,7 +92,7 @@ function display_reval()
        if (!isset($_POST['date']))
                $_POST['date'] = Today();
     date_row(_("Date for Revaluation:"), 'date', '', null, 0, 0, 0, null, true);
-    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_JOURNAL));
+    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_JOURNAL, null, $_POST['date']), false, ST_JOURNAL);
     textarea_row(_("Memo:"), 'memo_', null, 40,4);
        end_table(1);
 
@@ -126,4 +119,3 @@ display_reval();
 
 end_page();
 
-?>