MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/banking.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/banking.inc");
{
update_currency($_POST['Abbreviation'], $_POST['Symbol'], $_POST['CurrencyName'],
{
update_currency($_POST['Abbreviation'], $_POST['Symbol'], $_POST['CurrencyName'],
display_notification(_('Selected currency settings has been updated'));
}
else
{
add_currency($_POST['Abbreviation'], $_POST['Symbol'], $_POST['CurrencyName'],
display_notification(_('Selected currency settings has been updated'));
}
else
{
add_currency($_POST['Abbreviation'], $_POST['Symbol'], $_POST['CurrencyName'],
- $sql= "SELECT COUNT(*) FROM ".TB_PREF."debtors_master WHERE curr_code = '$selected_id'";
- $result = db_query($sql);
- $myrow = db_fetch_row($result);
- if ($myrow[0] > 0)
+ if (key_in_foreign_table($curr, 'debtors_master', 'curr_code', true))
- $sql= "SELECT COUNT(*) FROM ".TB_PREF."suppliers WHERE curr_code = '$selected_id'";
- $result = db_query($sql);
- $myrow = db_fetch_row($result);
- if ($myrow[0] > 0)
+ if (key_in_foreign_table($curr, 'suppliers', 'curr_code', true))
{
display_error(_("Cannot delete this currency, because the company preferences uses this currency."));
return false;
}
// see if there are any bank accounts that use this currency
{
display_error(_("Cannot delete this currency, because the company preferences uses this currency."));
return false;
}
// see if there are any bank accounts that use this currency
- $sql= "SELECT COUNT(*) FROM ".TB_PREF."bank_accounts WHERE bank_curr_code = '$selected_id'";
- $result = db_query($sql);
- $myrow = db_fetch_row($result);
- if ($myrow[0] > 0)
+ if (key_in_foreign_table($curr, 'bank_accounts', 'bank_curr_code', true))
$th = array(_("Abbreviation"), _("Symbol"), _("Currency Name"),
$th = array(_("Abbreviation"), _("Symbol"), _("Currency Name"),
- _("Hundredths name"), _("Country"), "", "");
+ _("Hundredths name"), _("Country"), _("Auto update"), "", "");
label_cell($myrow["currency"]);
label_cell($myrow["hundreds_name"]);
label_cell($myrow["country"]);
label_cell($myrow["currency"]);
label_cell($myrow["hundreds_name"]);
label_cell($myrow["country"]);
inactive_control_cell($myrow["curr_abrev"], $myrow["inactive"], 'currencies', 'curr_abrev');
edit_button_cell("Edit".$myrow["curr_abrev"], _("Edit"));
if ($myrow["curr_abrev"] != $company_currency)
inactive_control_cell($myrow["curr_abrev"], $myrow["inactive"], 'currencies', 'curr_abrev');
edit_button_cell("Edit".$myrow["curr_abrev"], _("Edit"));
if ($myrow["curr_abrev"] != $company_currency)
$_POST['CurrencyName'] = $myrow["currency"];
$_POST['country'] = $myrow["country"];
$_POST['hundreds_name'] = $myrow["hundreds_name"];
$_POST['CurrencyName'] = $myrow["currency"];
$_POST['country'] = $myrow["country"];
$_POST['hundreds_name'] = $myrow["hundreds_name"];
- text_row_ex(_("Currency Abbreviation:"), 'Abbreviation', 4, 3);
+ $_POST['auto_update'] = 1;
+ text_row_ex(_("Currency Abbreviation:"), 'Abbreviation', 4, 3);
}
text_row_ex(_("Currency Symbol:"), 'Symbol', 10);
text_row_ex(_("Currency Name:"), 'CurrencyName', 20);
text_row_ex(_("Hundredths Name:"), 'hundreds_name', 15);
text_row_ex(_("Country:"), 'country', 40);
}
text_row_ex(_("Currency Symbol:"), 'Symbol', 10);
text_row_ex(_("Currency Name:"), 'CurrencyName', 20);
text_row_ex(_("Hundredths Name:"), 'hundreds_name', 15);
text_row_ex(_("Country:"), 'country', 40);