projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed edition of purchase order (bug #0000001)
[fa-stable.git]
/
gl
/
gl_deposit.php
diff --git
a/gl/gl_deposit.php
b/gl/gl_deposit.php
index 019e36a4cace9f77342654e3207cc76a6a7250f2..cdc4910bede9554a6b4c5be5eaa86f30ec2fdb7d 100644
(file)
--- a/
gl/gl_deposit.php
+++ b/
gl/gl_deposit.php
@@
-12,11
+12,13
@@
include_once($path_to_root . "/gl/includes/ui/gl_deposit_ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/gl_ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/gl_ui.inc");
-$js =
get_js_form_entry("CodeID2", "code_id", "amount")
;
+$js =
''
;
if ($use_popup_windows)
$js .= get_js_open_window(800, 500);
if ($use_popup_windows)
$js .= get_js_open_window(800, 500);
-$js .= get_js_set_focus('CodeID2');
-page(_("Bank Account Deposit Entry"), false, false, "setFocus()", $js);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+
+page(_("Bank Account Deposit Entry"), false, false, '', $js);
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
@@
-26,7
+28,7
@@
check_db_has_bank_trans_types(_("There are no bank payment types defined in the
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
-if (isset($_GET['AddedID']))
+if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
$trans_type = systypes::bank_deposit();
{
$trans_no = $_GET['AddedID'];
$trans_type = systypes::bank_deposit();
@@
-49,7
+51,7
@@
function copy_to_py()
$_SESSION['deposit_items']->transfer_type = $_POST['type'];
$_SESSION['deposit_items']->increase = $_POST['PayType'];
if (!isset($_POST['person_id']))
$_SESSION['deposit_items']->transfer_type = $_POST['type'];
$_SESSION['deposit_items']->increase = $_POST['PayType'];
if (!isset($_POST['person_id']))
- $_POST['person_id'] = "";
+ $_POST['person_id'] = "";
$_SESSION['deposit_items']->person_id = $_POST['person_id'];
if (!isset($_POST['PersonDetailID']))
$_POST['PersonDetailID'] = "";
$_SESSION['deposit_items']->person_id = $_POST['person_id'];
if (!isset($_POST['PersonDetailID']))
$_POST['PersonDetailID'] = "";
@@
-86,7
+88,7
@@
function handle_new_order()
$_POST['date_'] = Today();
if (!is_date_in_fiscalyear($_POST['date_']))
$_POST['date_'] = end_fiscalyear();
$_POST['date_'] = Today();
if (!is_date_in_fiscalyear($_POST['date_']))
$_POST['date_'] = end_fiscalyear();
- $_SESSION['deposit_items']->tran_date = $_POST['date_'];
+ $_SESSION['deposit_items']->tran_date = $_POST['date_'];
}
//-----------------------------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------------------------
@@
-96,26
+98,30
@@
if (isset($_POST['Process']))
$input_error = 0;
$input_error = 0;
- if (!references::is_valid($_POST['ref']))
+ if (!references::is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
{
display_error( _("You must enter a reference."));
+ set_focus('ref');
$input_error = 1;
$input_error = 1;
- }
- elseif (!is_new_reference($_POST['ref'], systypes::bank_deposit()))
+ }
+ elseif (!is_new_reference($_POST['ref'], systypes::bank_deposit()))
{
display_error( _("The entered reference is already in use."));
{
display_error( _("The entered reference is already in use."));
+ set_focus('ref');
$input_error = 1;
}
$input_error = 1;
}
- if (!is_date($_POST['date_']))
+ if (!is_date($_POST['date_']))
{
display_error(_("The entered date for the deposit is invalid."));
{
display_error(_("The entered date for the deposit is invalid."));
+ set_focus('date_');
$input_error = 1;
}
if (!is_date_in_fiscalyear($_POST['date_']))
{
display_error(_("The entered date is not in fiscal year."));
$input_error = 1;
}
if (!is_date_in_fiscalyear($_POST['date_']))
{
display_error(_("The entered date is not in fiscal year."));
+ set_focus('date_');
$input_error = 1;
}
$input_error = 1;
}
@@
-147,27
+153,24
@@
if (isset($_POST['Process']))
function check_item_data()
{
function check_item_data()
{
- if (!is_numeric($_POST['amount']))
- {
- display_error( _("The amount entered is not a valid number."));
- return false;
- }
-
- if ($_POST['amount'] <= 0)
+ if (!check_num('amount', 0))
{
{
- display_error( _("The amount entered must be a postitive number."));
+ display_error( _("The amount entered is not a valid number or is less than zero."));
+ set_focus('amount');
return false;
}
return false;
}
- if ($_POST['code_id'] == $_POST['bank_account'])
+ if ($_POST['code_id'] == $_POST['bank_account'])
{
display_error( _("The source and destination accouts cannot be the same."));
{
display_error( _("The source and destination accouts cannot be the same."));
+ set_focus('code_id');
return false;
}
return false;
}
- if (is_bank_account($_POST['code_id']))
+ if (is_bank_account($_POST['code_id']))
{
display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this."));
{
display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this."));
+ set_focus('code_id');
return false;
}
return false;
}
@@
-180,7
+183,8
@@
function handle_update_item()
{
if($_POST['UpdateItem'] != "" && check_item_data())
{
{
if($_POST['UpdateItem'] != "" && check_item_data())
{
- $_SESSION['deposit_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], $_POST['dimension2_id'], -$_POST['amount'], $_POST['LineMemo']);
+ $_SESSION['deposit_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
+ $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']);
}
}
}
}
@@
-198,25
+202,35
@@
function handle_new_item()
if (!check_item_data())
return;
if (!check_item_data())
return;
- $_SESSION['deposit_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'], $_POST['dimension2_id'], -$_POST['amount'], $_POST['LineMemo']);
+ $_SESSION['deposit_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
+ $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']);
}
//-----------------------------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------------------------
-
-if (isset($_GET['Delete']) || isset($_GET['Edit']))
+if (isset($_GET['Edit'])) {
+ copy_from_py();
+ set_focus('dimension_id');
+}
+if (isset($_GET['Delete'])) {
copy_from_py();
copy_from_py();
-
-if (isset($_GET['Delete']))
handle_delete_item();
handle_delete_item();
-
-if (isset($_POST['AddItem']) || isset($_POST['UpdateItem']))
+ set_focus('_code_id_edit');
+}
+if (isset($_POST['AddItem'])) {
copy_to_py();
copy_to_py();
-
-if (isset($_POST['AddItem']))
handle_new_item();
handle_new_item();
-
-if (isset($_POST['UpdateItem']))
+ set_focus('_code_id_edit');
+}
+if (isset($_POST['UpdateItem'])) {
+ copy_to_py();
handle_update_item();
handle_update_item();
+ set_focus('_code_id_edit');
+}
+if (isset($_POST['CancelItemChanges']))
+ set_focus('_code_id_edit');
+
+if (isset($_POST['EditItem']))
+ set_focus('dimension_id');
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
@@
-242,9
+256,13
@@
end_table(1);
if (!isset($_POST['Process']))
{
if (!isset($_POST['Process']))
{
- submit_center_first('Update', _("Update"));
if ($_SESSION['deposit_items']->count_gl_items() >= 1)
if ($_SESSION['deposit_items']->count_gl_items() >= 1)
+ {
+ submit_center_first('Update', _("Update"));
submit_center_last('Process', _("Process Deposit"));
submit_center_last('Process', _("Process Deposit"));
+ }
+ else
+ submit_center('Update', _("Update"));
}
end_form();
}
end_form();