Merge branch 'master' of https://git.code.sf.net/p/frontaccounting/git
[fa-stable.git] / includes / current_user.inc
index 9a0ceddeec9969d2d0ca75ba82f0b458019895f0..431cfefe2546cd90dbc56968a16578f4898208ea 100644 (file)
@@ -302,7 +302,7 @@ function round2($number, $decimals=0)
 function number_format2($number, $decimals=0)
 {
        global $SysPrefs;
-       $tsep = $SysPrefs->thoseps[user_dec_sep()];
+       $tsep = $SysPrefs->thoseps[user_tho_sep()];
        $dsep = $SysPrefs->decseps[user_dec_sep()];
 
        if($decimals==='max')
@@ -683,10 +683,12 @@ function array_append(&$array, $elements)
 //
 function array_search_value($needle, $haystack, $valuekey=null)
 {
-       foreach($haystack as $key => $value) {
-               $val = isset($valuekey) ? @$value[$valuekey] : $value;
-               if ($needle == $val){
-                       return $value;
+       if (is_array($haystack)) {
+               foreach($haystack as $key => $value) {
+                       $val = isset($valuekey) ? @$value[$valuekey] : $value;
+                       if ($needle == $val){
+                               return $value;
+                       }
                }
        }
        return null;
@@ -698,13 +700,14 @@ function array_search_value($needle, $haystack, $valuekey=null)
 function array_search_keys($needle, $haystack, $valuekey=null)
 {
        $keys = array();
-       if($haystack)
+       if (is_array($haystack)) {
                foreach($haystack as $key => $value) {
                        $val = isset($valuekey) ? @$value[$valuekey] : $value;
                        if ($needle == $val){
                                $keys[] = $key;
                        }
                }
+       }       
        return $keys;
 }
 //