Business hours can be added to the calendar

master
Mike Koch hace 6 años
padre 7c884582a2
commit 09b371036a
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 9BA5D7F8391455ED

@ -2220,85 +2220,88 @@ $modsForHesk_settings = mfh_getSettings();
</select>
</div>
</div>
<div class="form-group">
<label for="business-hours" class="col-sm-4 col-xs-12 control-label">
Business Hours
<?php /*echo $hesklang['business_hours']; */?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
<h4 class="bold">
<?php echo $hesklang['business_hours']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['business_hours']; ?>"
data-content="<?php echo $hesklang['business_hours_help']; ?>"></i>
data-content="<?php echo $hesklang['business_hours_help']; ?>"></i>
</h4>
<?php
$rs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
$business_hours = array();
while ($row = hesk_dbFetchAssoc($rs)) {
$business_hours[intval($row['day_of_week'])]['start'] = $row['start_time'];
$business_hours[intval($row['day_of_week'])]['end'] = $row['end_time'];
}
?>
<div class="form-group">
<label for="business-hours-sunday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d0']; ?>
</label>
<div class="col-sm-8 col-xs-12">
<div class="table-reponsive">
<table class="table table-striped">
<thead>
<tr>
<th>&nbsp;</th>
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>
</thead>
<tbody>
<tr>
<td>
From
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
</tr>
<tr>
<td>
To
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-sunday[0]" value="<?php echo $business_hours[0]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-sunday[1]" value="<?php echo $business_hours[0]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-monday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d1']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-monday[0]" value="<?php echo $business_hours[1]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-monday[1]" value="<?php echo $business_hours[1]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-tuesday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d2']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-tuesday[0]" value="<?php echo $business_hours[2]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-tuesday[1]" value="<?php echo $business_hours[2]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-wednesday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d3']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-wednesday[0]" value="<?php echo $business_hours[3]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-wednesday[1]" value="<?php echo $business_hours[3]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-thursday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d4']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-thursday[0]" value="<?php echo $business_hours[4]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-thursday[1]" value="<?php echo $business_hours[4]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-friday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d5']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-friday[0]" value="<?php echo $business_hours[5]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-friday[1]" value="<?php echo $business_hours[5]['end']; ?>">
</div>
</div>
<div class="form-group">
<label for="business-hours-saturday" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['d6']; ?>
</label>
<div class="col-sm-8 col-xs-12 form-inline">
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-saturday[0]" value="<?php echo $business_hours[6]['start']; ?>">
<?php echo $hesklang['to']; ?>
<input type="text" class="form-control clockpicker" data-autoclose="true" name="business-hours-saturday[1]" value="<?php echo $business_hours[6]['end']; ?>">
</div>
</div>
</div>

@ -514,6 +514,13 @@ $set['admin_sidebar_text_hover'] = hesk_input(hesk_POST('admin-sidebar-text-hove
$set['login_background_type'] = hesk_input(hesk_POST('login-background'));
$set['login_box_header'] = hesk_input(hesk_POST('login-box-header'));
$set['business_hours_sunday'] = hesk_POST_array('business-hours-sunday');
$set['business_hours_monday'] = hesk_POST_array('business-hours-monday');
$set['business_hours_tuesday'] = hesk_POST_array('business-hours-tuesday');
$set['business_hours_wednesday'] = hesk_POST_array('business-hours-wednesday');
$set['business_hours_thursday'] = hesk_POST_array('business-hours-thursday');
$set['business_hours_friday'] = hesk_POST_array('business-hours-friday');
$set['business_hours_saturday'] = hesk_POST_array('business-hours-saturday');
$changedBackground = false;
$loadedAttachmentFuncs = false;
@ -667,6 +674,29 @@ if ($changedLoginImage) {
mfh_updateSetting('login_box_header_image', $set['login_box_header_image'], true);
}
// Update business hours
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_sunday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_sunday'][1]) . "' WHERE `day_of_week` = " . intval(0));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_monday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_monday'][1]) . "' WHERE `day_of_week` = " . intval(1));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_tuesday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_tuesday'][1]) . "' WHERE `day_of_week` = " . intval(2));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_wednesday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_wednesday'][1]) . "' WHERE `day_of_week` = " . intval(3));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_thursday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_thursday'][1]) . "' WHERE `day_of_week` = " . intval(4));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_friday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_friday'][1]) . "' WHERE `day_of_week` = " . intval(5));
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
SET `start_time` = '" . hesk_dbEscape($set['business_hours_saturday'][0]) . "',
`end_time` = '" . hesk_dbEscape($set['business_hours_saturday'][1]) . "' WHERE `day_of_week` = " . intval(6));
// Prepare settings file and save it
$settings_file_content = '<?php
// Settings file for HESK ' . $set['hesk_version'] . '

@ -605,6 +605,13 @@ echo mfh_get_hidden_fields_for_language(array('error_loading_events',
echo $view_array[$_SESSION['default_calendar_view']];
?>
</p>
<?php
$businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
while ($row = hesk_dbFetchAssoc($businessHoursRs)):
?>
<p id="business_hours_<?php echo $row['day_of_week']; ?>_start"><?php echo $row['start_time']; ?></p>
<p id="business_hours_<?php echo $row['day_of_week']; ?>_end"><?php echo $row['end_time']; ?></p>
<?php endwhile; ?>
</div>
<script type="text/html" id="audit-trail-template">
<tr>

@ -119,4 +119,11 @@ echo mfh_get_hidden_fields_for_language(array(
<div style="display: none">
<p id="setting_default_view"><?php echo $modsForHesk_settings['default_calendar_view']; ?></p>
<p id="setting_first_day_of_week"><?php echo $modsForHesk_settings['first_day_of_week']; ?></p>
</div>
</div>
<?php
$businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
while ($row = hesk_dbFetchAssoc($businessHoursRs)):
?>
<p id="business_hours_<?php echo $row['day_of_week']; ?>_start"><?php echo $row['start_time']; ?></p>
<p id="business_hours_<?php echo $row['day_of_week']; ?>_end"><?php echo $row['end_time']; ?></p>
<?php endwhile; ?>

@ -12,6 +12,43 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
businessHours: [
{
dow: [0],
start: $('#business_hours_0_start').text(),
end: $('#business_hours_0_end').text()
},
{
dow: [1],
start: $('#business_hours_1_start').text(),
end: $('#business_hours_1_end').text()
},
{
dow: [2],
start: $('#business_hours_2_start').text(),
end: $('#business_hours_2_end').text()
},
{
dow: [3],
start: $('#business_hours_3_start').text(),
end: $('#business_hours_3_end').text()
},
{
dow: [4],
start: $('#business_hours_4_start').text(),
end: $('#business_hours_4_end').text()
},
{
dow: [5],
start: $('#business_hours_5_start').text(),
end: $('#business_hours_5_end').text()
},
{
dow: [6],
start: $('#business_hours_6_start').text(),
end: $('#business_hours_6_end').text()
}
],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {

@ -12,6 +12,43 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
businessHours: [
{
dow: [0],
start: $('#business_hours_0_start').text(),
end: $('#business_hours_0_end').text()
},
{
dow: [1],
start: $('#business_hours_1_start').text(),
end: $('#business_hours_1_end').text()
},
{
dow: [2],
start: $('#business_hours_2_start').text(),
end: $('#business_hours_2_end').text()
},
{
dow: [3],
start: $('#business_hours_3_start').text(),
end: $('#business_hours_3_end').text()
},
{
dow: [4],
start: $('#business_hours_4_start').text(),
end: $('#business_hours_4_end').text()
},
{
dow: [5],
start: $('#business_hours_5_start').text(),
end: $('#business_hours_5_end').text()
},
{
dow: [6],
start: $('#business_hours_6_start').text(),
end: $('#business_hours_6_end').text()
}
],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {

@ -12,6 +12,43 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
businessHours: [
{
dow: [0],
start: $('#business_hours_0_start').text(),
end: $('#business_hours_0_end').text()
},
{
dow: [1],
start: $('#business_hours_1_start').text(),
end: $('#business_hours_1_end').text()
},
{
dow: [2],
start: $('#business_hours_2_start').text(),
end: $('#business_hours_2_end').text()
},
{
dow: [3],
start: $('#business_hours_3_start').text(),
end: $('#business_hours_3_end').text()
},
{
dow: [4],
start: $('#business_hours_4_start').text(),
end: $('#business_hours_4_end').text()
},
{
dow: [5],
start: $('#business_hours_5_start').text(),
end: $('#business_hours_5_end').text()
},
{
dow: [6],
start: $('#business_hours_6_start').text(),
end: $('#business_hours_6_end').text()
}
],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {

@ -2230,6 +2230,9 @@ $hesklang['sm_view_kb_article'] = 'View Knowledgebase Article';
$hesklang['sm_submit_ticket'] = 'Submit Ticket';
$hesklang['sm_view_ticket'] = 'View Ticket';
$hesklang['sm_login_page'] = 'Login Page';
$hesklang['business_hours'] = 'Business Hours';
$hesklang['business_hours_help'] = 'Set business hours for the calendar. There is no functional change by setting this,
but times outside of the defined business hours will have a darker gray background for increased visibility.';
// DO NOT CHANGE BELOW
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');

Cargando…
Cancelar
Guardar