excel export duration
This commit is contained in:
@@ -434,6 +434,36 @@ class Xlsx extends \Espo\Core\Injectable
|
||||
$value .= $row[$name.'Country'];
|
||||
}
|
||||
$sheet->setCellValue("$col$rowNumber", $value);
|
||||
} else if ($type == 'duration') {
|
||||
if (!empty($row[$name])) {
|
||||
$seconds = intval($row[$name]);
|
||||
|
||||
$days = intval(floor($seconds / 86400));
|
||||
$seconds = $seconds - $days * 86400;
|
||||
$hours = intval(floor($seconds / 3600));
|
||||
$seconds = $seconds - $hours * 3600;
|
||||
$minutes = intval(floor($seconds / 60));
|
||||
|
||||
$value = '';
|
||||
if ($days) {
|
||||
$value .= (string) $days . $this->getInjection('language')->translate('d', 'durationUnits');
|
||||
if ($minutes || $hours) {
|
||||
$value .= ' ';
|
||||
}
|
||||
}
|
||||
if ($hours) {
|
||||
$value .= (string) $hours . $this->getInjection('language')->translate('h', 'durationUnits');
|
||||
if ($minutes) {
|
||||
$value .= ' ';
|
||||
}
|
||||
}
|
||||
if ($minutes) {
|
||||
$value .= (string) $minutes . $this->getInjection('language')->translate('m', 'durationUnits');
|
||||
}
|
||||
|
||||
$sheet->setCellValue("$col$rowNumber", $value);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (array_key_exists($name, $row)) {
|
||||
$sheet->setCellValue("$col$rowNumber", $row[$name]);
|
||||
|
||||
@@ -437,6 +437,12 @@
|
||||
"dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
||||
"dayNamesMin": ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
||||
},
|
||||
"durationUnits": {
|
||||
"d": "d",
|
||||
"h": "h",
|
||||
"m": "m",
|
||||
"s": "s"
|
||||
},
|
||||
"options": {
|
||||
"salutationName": {
|
||||
"Mr.": "Mr.",
|
||||
|
||||
@@ -112,13 +112,13 @@ Espo.define('views/fields/duration', 'views/fields/enum', function (Dep) {
|
||||
|
||||
var parts = [];
|
||||
if (days) {
|
||||
parts.push(days + '' + this.getLanguage().translate('d'));
|
||||
parts.push(days + '' + this.getLanguage().translate('d', 'durationUnits'));
|
||||
}
|
||||
if (hours) {
|
||||
parts.push(hours + '' + this.getLanguage().translate('h'));
|
||||
parts.push(hours + '' + this.getLanguage().translate('h', 'durationUnits'));
|
||||
}
|
||||
if (minutes) {
|
||||
parts.push(minutes + '' + this.getLanguage().translate('m'));
|
||||
parts.push(minutes + '' + this.getLanguage().translate('m', 'durationUnits'));
|
||||
}
|
||||
return parts.join(' ');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user