1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Miglioramento dati FE per righe di fattura

This commit is contained in:
Thomas Zilio
2019-07-15 16:53:18 +02:00
parent c4695e6b71
commit b40e56dbdb
12 changed files with 338 additions and 80 deletions

View File

@@ -45,6 +45,42 @@ if (!function_exists('array_clean')) {
}
}
if (!function_exists('array_deep_clean')) {
/**
* Pulisce i contenuti vuoti di un array.
*
* @param $array
*
* @since 2.4.11
*
* @return array
*/
function array_deep_clean($input)
{
// If it is an element, then just return it
if (!is_array($input)) {
return $input;
}
$non_empty_items = [];
foreach ($input as $key => $value) {
// Ignore empty cells
if ($value) {
$cleaned = array_deep_clean($value);
// Use recursion to evaluate cells
if (!empty($cleaned)) {
$non_empty_items[$key] = $cleaned;
}
}
}
// Finally return the array without empty items
return $non_empty_items;
}
}
if (!function_exists('starts_with')) {
/**
* Check if a string starts with the given string.