Export uses YYYY-MM-DD

This commit is contained in:
Mike Koch 2016-11-16 16:32:07 -05:00
parent f559979b33
commit 988f0e9a0f

View File

@ -38,6 +38,7 @@ require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/reporting_functions.inc.php'); require(HESK_PATH . 'inc/reporting_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php');
require(HESK_PATH . 'inc/mail_functions.inc.php'); require(HESK_PATH . 'inc/mail_functions.inc.php');
require(HESK_PATH . 'inc/custom_fields.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
@ -69,23 +70,23 @@ $is_all_time = 0;
// Default this month to date // Default this month to date
$date_from = date('Y-m-d', mktime(0, 0, 0, date("m"), 1, date("Y"))); $date_from = date('Y-m-d', mktime(0, 0, 0, date("m"), 1, date("Y")));
$date_to = date('Y-m-d'); $date_to = date('Y-m-d');
$input_datefrom = date('m/d/Y', strtotime('last month')); $input_datefrom = date('Y-m-d', strtotime('last month'));
$input_dateto = date('m/d/Y'); $input_dateto = date('Y-m-d');
/* Date */ /* Date */
if (!empty($_GET['w'])) { if (!empty($_GET['w'])) {
$df = preg_replace('/[^0-9]/', '', hesk_GET('datefrom')); $df = preg_replace('/[^0-9]/', '', hesk_GET('datefrom'));
if (strlen($df) == 8) { if (strlen($df) == 8) {
$date_from = substr($df, 4, 4) . '-' . substr($df, 0, 2) . '-' . substr($df, 2, 2); $date_from = substr($df, 0, 4) . '-' . substr($df, 4, 2) . '-' . substr($df, 6, 2);
$input_datefrom = substr($df, 0, 2) . '/' . substr($df, 2, 2) . '/' . substr($df, 4, 4); $input_datefrom = $date_from;
} else { } else {
$date_from = date('Y-m-d', strtotime('last month')); $date_from = date('Y-m-d', strtotime('last month'));
} }
$dt = preg_replace('/[^0-9]/', '', hesk_GET('dateto')); $dt = preg_replace('/[^0-9]/', '', hesk_GET('dateto'));
if (strlen($dt) == 8) { if (strlen($dt) == 8) {
$date_to = substr($dt, 4, 4) . '-' . substr($dt, 0, 2) . '-' . substr($dt, 2, 2); $date_to = substr($dt, 0, 4) . '-' . substr($dt, 4, 2) . '-' . substr($dt, 6, 2);
$input_dateto = substr($dt, 0, 2) . '/' . substr($dt, 2, 2) . '/' . substr($dt, 4, 4); $input_dateto = $date_to;
} else { } else {
$date_to = date('Y-m-d'); $date_to = date('Y-m-d');
} }
@ -422,15 +423,7 @@ if (isset($_GET['w'])) {
foreach ($hesk_settings['custom_fields'] as $k => $v) { foreach ($hesk_settings['custom_fields'] as $k => $v) {
if ($v['use']) { if ($v['use']) {
switch ($v['type']) { $tmp .= '<Column ss:AutoFitWidth="0" ss:Width="80"/>' . "\n";
case 'date':
$tmp_dt = hesk_custom_date_display_format($ticket[$k], 'Y-m-d\T00:00:00.000');
$tmp .= strlen($tmp_dt) ? '<Cell ss:StyleID="s63"><Data ss:Type="DateTime">'.$tmp_dt : '<Cell><Data ss:Type="String">';
$tmp .= "</Data></Cell> \n";
break;
default:
$tmp .= '<Cell><Data ss:Type="String"><![CDATA['.hesk_msgToPlain($ticket[$k], 1, 0).']]></Data></Cell> ' . "\n";
}
} }
} }
@ -454,10 +447,6 @@ if (isset($_GET['w'])) {
foreach ($hesk_settings['custom_fields'] as $k => $v) { foreach ($hesk_settings['custom_fields'] as $k => $v) {
if ($v['use']) { if ($v['use']) {
if ($modsForHesk_settings['custom_field_setting']) {
$v['name'] = $hesklang[$v['name']];
}
$tmp .= '<Cell><Data ss:Type="String">' . $v['name'] . '</Data></Cell>' . "\n"; $tmp .= '<Cell><Data ss:Type="String">' . $v['name'] . '</Data></Cell>' . "\n";
} }
} }
@ -522,12 +511,15 @@ if (isset($_GET['w'])) {
// Add custom fields // Add custom fields
foreach ($hesk_settings['custom_fields'] as $k=>$v) { foreach ($hesk_settings['custom_fields'] as $k=>$v) {
if ($v['use']) { if ($v['use']) {
$output = $ticket[$k]; switch ($v['type']) {
if ($v['type'] == 'date' && !empty($ticket[$k])) { case 'date':
$dt = date('Y-m-d', $ticket[$k]); $tmp_dt = hesk_custom_date_display_format($ticket[$k], 'Y-m-d\T00:00:00.000');
$output = hesk_dateToString($dt, 0); $tmp .= strlen($tmp_dt) ? '<Cell ss:StyleID="s63"><Data ss:Type="DateTime">'.$tmp_dt : '<Cell><Data ss:Type="String">';
$tmp .= "</Data></Cell> \n";
break;
default:
$tmp .= '<Cell><Data ss:Type="String"><![CDATA['.hesk_msgToPlain($ticket[$k], 1, 0).']]></Data></Cell> ' . "\n";
} }
$tmp .= '<Cell><Data ss:Type="String"><![CDATA[' . hesk_msgToPlain($output, 1, 0) . ']]></Data></Cell> ' . "\n";
} }
} }
@ -702,10 +694,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<div class="form-group"> <div class="form-group">
<label for="time" class="control-label col-sm-2"><?php echo $hesklang['dtrg']; ?>:</label> <label for="time" class="control-label col-sm-2"><?php echo $hesklang['dtrg']; ?>:</label>
<div class="col-sm-10"> <div class="col-sm-10 form-inline">
<!-- START DATE --> <!-- START DATE -->
<input type="radio" name="w" value="0" id="w0" <?php echo $selected['w'][0]; ?> /> <input type="radio" name="w" value="0" id="w0" <?php echo $selected['w'][0]; ?> />
<select name="time" onclick="document.getElementById('w0').checked = true" <select name="time" onclick="document.getElementById('w0').checked = true"
class="form-control"
onfocus="document.getElementById('w0').checked = true" onfocus="document.getElementById('w0').checked = true"
style="margin-top:5px;margin-bottom:5px;"> style="margin-top:5px;margin-bottom:5px;">
<option value="1" <?php echo $selected['time'][1]; ?>><?php echo $hesklang['r1']; ?> <option value="1" <?php echo $selected['time'][1]; ?>><?php echo $hesklang['r1']; ?>
@ -736,16 +729,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<option value="12" <?php echo $selected['time'][12]; ?>><?php echo $hesklang['r12']; ?></option> <option value="12" <?php echo $selected['time'][12]; ?>><?php echo $hesklang['r12']; ?></option>
</select> </select>
<br/> <br>
<input type="radio" name="w" value="1" id="w1" <?php echo $selected['w'][1]; ?> /> <input type="radio" name="w" value="1" id="w1" <?php echo $selected['w'][1]; ?> />
<?php echo $hesklang['from']; ?> <input type="text" name="datefrom" <?php echo $hesklang['from']; ?> <input type="text" name="datefrom"
value="<?php echo $input_datefrom; ?>" id="datefrom" value="<?php echo $input_datefrom; ?>" id="datefrom"
class="tcal" size="10" class="datepicker form-control" size="10"
onclick="document.getElementById('w1').checked = true" onclick="document.getElementById('w1').checked = true"
onfocus="document.getElementById('w1').checked = true;this.focus;"/> onfocus="document.getElementById('w1').checked = true;this.focus;"/>
<?php echo $hesklang['to']; ?> <input type="text" name="dateto" value="<?php echo $input_dateto; ?>" <?php echo $hesklang['to']; ?> <input type="text" name="dateto" value="<?php echo $input_dateto; ?>"
id="dateto" class="tcal" size="10" id="dateto" class="datepicker form-control" size="10"
onclick="document.getElementById('w1').checked = true" onclick="document.getElementById('w1').checked = true"
onfocus="document.getElementById('w1').checked = true; this.focus;"/> onfocus="document.getElementById('w1').checked = true; this.focus;"/>
<!-- END DATE --> <!-- END DATE -->