X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fui%2Fui_view.inc;h=6c246f53e9b0e7e04ba8632272fa02aae50b28cc;hb=69cb44aa7570e2ce26f540014cd682bc21c2ad1c;hp=ee24d8edd9a5c0b297529330e05cb186b9d7e19d;hpb=bc426821d8ae6319bd9394ac275bb700e6394fc3;p=fa-stable.git
diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc
index ee24d8ed..6c246f53 100644
--- a/includes/ui/ui_view.inc
+++ b/includes/ui/ui_view.inc
@@ -7,7 +7,7 @@ include_once($path_to_root . "/includes/types.inc");
function get_supplier_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
if ($type == systypes::po())
@@ -28,10 +28,8 @@ function get_supplier_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str = "$label";
- else
- $preview_str = "$label";
+ $pars = access_string($label);
+ $preview_str = "$pars[0]";
}
else
$preview_str = $label;
@@ -43,17 +41,15 @@ function get_supplier_trans_view_str($type, $trans_no, $label="")
function get_gl_view_str($type, $trans_no, $label="", $force=false)
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
if (!$force && !user_show_gl_info())
return "";
if ($label == "")
$label = _("GL");
- if ($use_popup_windows)
- $gl_view = "$label";
- else
- $gl_view = "$label";
+ $pars = access_string($label);
+ $gl_view = "$pars[0]";
return $gl_view;
}
@@ -71,7 +67,7 @@ function get_gl_view_str_cell($type, $trans_no, $label="")
function get_customer_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
if ($type == 10)
@@ -91,6 +87,7 @@ function get_customer_trans_view_str($type, $trans_no, $label="")
$lbl = $label;
$preview_str = '';
+
foreach($trans_no as $trans) {
if ($label == "")
$lbl = $trans;
@@ -99,10 +96,8 @@ function get_customer_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str .= "$lbl";
- else
- $preview_str .= "$lbl";
+ $pars = access_string($lbl);
+ $preview_str .= "$pars[0]";
}
else
$preview_str .= $lbl;
@@ -115,7 +110,7 @@ function get_customer_trans_view_str($type, $trans_no, $label="")
function get_banking_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
@@ -135,10 +130,8 @@ function get_banking_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str = "$label";
- else
- $preview_str = "$label";
+ $pars = access_string($label);
+ $preview_str = "$pars[0]";
}
else
$preview_str = $label;
@@ -150,7 +143,7 @@ function get_banking_trans_view_str($type, $trans_no, $label="")
function get_inventory_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
@@ -166,10 +159,8 @@ function get_inventory_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str = "$label";
- else
- $preview_str = "$label";
+ $pars = access_string($label);
+ $preview_str = "$pars[0]";
}
else
$preview_str = $label;
@@ -181,7 +172,7 @@ function get_inventory_trans_view_str($type, $trans_no, $label="")
function get_manufacturing_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
@@ -199,10 +190,8 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str = "$label";
- else
- $preview_str = "$label";
+ $pars = access_string($label);
+ $preview_str = "$pars[0]";
}
else
$preview_str = $label;
@@ -214,7 +203,7 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="")
function get_dimensions_trans_view_str($type, $trans_no, $label="")
{
- global $path_to_root, $use_popup_windows;
+ global $path_to_root;
$viewer = "";
@@ -228,10 +217,8 @@ function get_dimensions_trans_view_str($type, $trans_no, $label="")
if ($viewer != "")
{
- if ($use_popup_windows)
- $preview_str = "$label";
- else
- $preview_str = "$label";
+ $pars = access_string($label);
+ $preview_str = "$pars[0]";
}
else
$preview_str = $label;
@@ -271,37 +258,40 @@ function get_trans_view_str($type, $trans_no, $label="")
}
//--------------------------------------------------------------------------------------
-
-function exchange_rate_display($from_currency, $to_currency, $date_, $buttons=true)
+// Displays currency exchange rate for given date.
+// When there is no exrate for today,
+// gets it form ECB and stores in local database.
+//
+function exchange_rate_display($from_currency, $to_currency, $date_)
{
global $Ajax;
if ($from_currency != $to_currency)
{
- if ($buttons && isset($_POST['get_rate']))
- {
- $comp_currency = get_company_currency();
- if ($from_currency == $comp_currency)
- $currency = $to_currency;
- else
- $currency = $from_currency;
- $rate = get_ecb_rate($currency);
- if (get_date_exchange_rate($currency, $date_))
- update_exchange_rate($currency, $date_, $rate, $rate);
- else
- add_exchange_rate($currency, $date_, $rate, $rate);
- if ($from_currency == $comp_currency)
- $rate = 1 / $rate;
- $Ajax->activate('get_rate');
- }
+ $comp_currency = get_company_currency();
+ if ($from_currency == $comp_currency)
+ $currency = $to_currency;
else
+ $currency = $from_currency;
+ $rate = 0;
+ if ($date_ == Today()) {
+ $rate = get_date_exchange_rate($currency, $date_);
+ if (!$rate) {
+ $rate = get_ecb_rate($currency);
+ if ($rate)
+ add_exchange_rate($currency, $date_, $rate, $rate);
+ }
+ }
+ if (!$rate)
$rate = get_exchange_rate_from_to($to_currency, $from_currency, $date_);
+
+ if ($from_currency == $comp_currency)
+ $rate = 1 / $rate;
+
$rate = number_format2($rate, user_exrate_dec());
- label_row(_("Exchange Rate:"),"1 " . $from_currency . " = " . $rate . " " . $to_currency .
- ($buttons?" " . submit('get_rate',_("Get"), false, true):""));
- if($buttons) {
- $Ajax->addUpdate('get_rate','_ex_rate', $rate);
- }
+ label_row(_("Exchange Rate:"),"1 " . $from_currency
+ . " = " . $rate . " " . $to_currency );
+ $Ajax->addUpdate('_ex_rate','_ex_rate', $rate);
}
}
@@ -536,7 +526,7 @@ function get_js_open_window($width, $height)
. "{\n"
. " var left = (screen.width - $width) / 2;\n"
. " var top = (screen.height - $height) / 2;\n"
- . " window.open(url, title, 'width=$width,height=$height,left='+left+',top='+top+',screenX='+left+',screenY='+top+',status=no,scrollbars=yes');\n"
+ . " return window.open(url, title, 'width=$width,height=$height,left='+left+',top='+top+',screenX='+left+',screenY='+top+',status=no,scrollbars=yes');\n"
. "}\n"
. "-->\n"
. "\n";
@@ -548,6 +538,8 @@ function get_js_open_window($width, $height)
If $form<0 $name is element id.
*/
function set_focus($name, $form_no=0) {
+ global $Ajax;
+ $Ajax->addFocus(true, $name);
$_POST['_focus'] = $name;
}
//
@@ -555,7 +547,7 @@ function set_focus($name, $form_no=0) {
//
function default_focus($name, $form_no=0) {
if (!isset($_POST['_focus'])) {
- $_POST['_focus'] = $name;
+ set_focus($name);
}
}
@@ -588,19 +580,20 @@ function get_js_png_fix()
function get_js_date_picker()
{
- global $comp_path;
+ global $comp_path, $go_debug;
$fpath = $comp_path.'/'.user_company().'/js_cache/'.'date_picker.js';
$js = "