revert from develop

This commit is contained in:
Maciej Domanski 2022-03-17 12:22:37 +01:00
parent e09516d69b
commit 41e89123e1
2 changed files with 19 additions and 14 deletions

8
app/Console/Commands/LdapSync.php Executable file → Normal file
View file

@ -49,7 +49,7 @@ class LdapSync extends Command
$ldap_result_last_name = Setting::getSettings()->ldap_lname_field; $ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
$ldap_result_first_name = Setting::getSettings()->ldap_fname_field; $ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
$ldap_result_active_flag = Setting::getSettings()->ldap_active_flag; $ldap_result_active_flag = Setting::getSettings()->ldap_active_flag_field;
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num; $ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
$ldap_result_email = Setting::getSettings()->ldap_email; $ldap_result_email = Setting::getSettings()->ldap_email;
$ldap_result_phone = Setting::getSettings()->ldap_phone_field; $ldap_result_phone = Setting::getSettings()->ldap_phone_field;
@ -253,8 +253,8 @@ class LdapSync extends Command
if ($item['ldap_location_override'] == true) { if ($item['ldap_location_override'] == true) {
$user->location_id = $item['location_id']; $user->location_id = $item['location_id'];
} elseif ((isset($location))) { } elseif ((isset($location)) && (! empty($location))) {
if ((array_key_exists('id', $location))) { if ((is_array($location)) && (array_key_exists('id', $location))) {
$user->location_id = $location['id']; $user->location_id = $location['id'];
} elseif (is_object($location)) { } elseif (is_object($location)) {
$user->location_id = $location->id; $user->location_id = $location->id;
@ -276,7 +276,7 @@ class LdapSync extends Command
$item['status'] = 'error'; $item['status'] = 'error';
} }
$summary[] = $item; array_push($summary, $item);
} }
} }

View file

@ -60,7 +60,7 @@ class Helper
* *
* @author [A. Gianotto] [<snipe@snipe.net>] * @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v3.3] * @since [v3.3]
* @return string * @return array
*/ */
public static function defaultChartColors($index = 0) public static function defaultChartColors($index = 0)
{ {
@ -333,6 +333,8 @@ class Helper
'#92896B', '#92896B',
]; ];
return $colors[$index]; return $colors[$index];
} }
@ -414,7 +416,8 @@ class Helper
* *
*/ */
$LocaleInfo = localeconv(); $LocaleInfo = localeconv();
$floatString = str_replace(array(',', $LocaleInfo['decimal_point']), array('', '.'), $floatString); $floatString = str_replace(',', '', $floatString);
$floatString = str_replace($LocaleInfo['decimal_point'], '.', $floatString);
// Strip Currency symbol // Strip Currency symbol
// If no currency symbol is set, default to $ because Murica // If no currency symbol is set, default to $ because Murica
$currencySymbol = $LocaleInfo['currency_symbol']; $currencySymbol = $LocaleInfo['currency_symbol'];
@ -424,7 +427,7 @@ class Helper
$floatString = str_replace($currencySymbol, '', $floatString); $floatString = str_replace($currencySymbol, '', $floatString);
return (float)$floatString; return floatval($floatString);
} }
/** /**
@ -432,7 +435,7 @@ class Helper
* *
* @author [B. Wetherington] [<bwetherington@grokability.com>] * @author [B. Wetherington] [<bwetherington@grokability.com>]
* @since [v5.2] * @since [v5.2]
* @return float * @return Float
*/ */
public static function ParseCurrency($currencyString) { public static function ParseCurrency($currencyString) {
$without_currency = str_replace(Setting::getSettings()->default_currency, '', $currencyString); //generally shouldn't come up, since we don't do this in fields, but just in case it does... $without_currency = str_replace(Setting::getSettings()->default_currency, '', $currencyString); //generally shouldn't come up, since we don't do this in fields, but just in case it does...
@ -592,11 +595,10 @@ class Helper
/** /**
* Generates a random string * Generates a random string
* This function does not generate cryptographically secure values, and should not be used for cryptographic purposes
* *
* @author [A. Gianotto] [<snipe@snipe.net>] * @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v3.0] * @since [v3.0]
* @return string * @return array
*/ */
public static function generateRandomString($length = 10) public static function generateRandomString($length = 10)
{ {
@ -604,7 +606,7 @@ class Helper
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[random_int(0, $charactersLength - 1)]; $randomString .= $characters[rand(0, $charactersLength - 1)];
} }
return $randomString; return $randomString;
@ -780,15 +782,17 @@ class Helper
/** /**
* Check to see if the given key exists in the array, and trim excess white space before returning it * Check to see if the given key exists in the array, and trim excess white space before returning it
* *
* @author Daniel Melzter
* @since 3.0
* @param $array array * @param $array array
* @param $key string * @param $key string
* @param $default string * @param $default string
* @return string * @return string
*@author Daniel Melzter
* @since 3.0
*/ */
public static function array_smart_fetch(array $array, string $key, string $default = '') public static function array_smart_fetch(array $array, $key, $default = '')
{ {
array_change_key_case($array, CASE_LOWER);
return array_key_exists(strtolower($key), array_change_key_case($array)) ? e(trim($array[$key])) : $default; return array_key_exists(strtolower($key), array_change_key_case($array)) ? e(trim($array[$key])) : $default;
} }
@ -969,6 +973,7 @@ class Helper
case 'gif': case 'gif':
case 'png': case 'png':
return true; return true;
break;
default: default:
return false; return false;
} }