-
Notifications
You must be signed in to change notification settings - Fork 1
/
do_holiday_settings_aed.php
69 lines (66 loc) · 2.29 KB
/
do_holiday_settings_aed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php /* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$holiday_manual = (int)w2PgetParam($_POST, "holiday_manual", 0);
$holiday_auto = (int)w2PgetParam($_POST, "holiday_auto", 0);
$holiday_driver = (int)w2PgetParam($_POST, "holiday_driver", -1);
$holiday_filter = (int)w2PgetParam($_POST, "holiday_filter", -1);
$q = new w2p_Database_Query();
$q->addTable('holiday_settings');
$q->addUpdate('holiday_manual', $holiday_manual);
$q->addUpdate('holiday_auto', $holiday_auto);
$q->addUpdate('holiday_driver', $holiday_driver);
$q->addUpdate('holiday_filter', $holiday_filter);
$q->exec();
$q->clear();
$cal_working_days = w2PgetConfig("cal_working_days");
$newcal_working_days = w2PgetParam($_POST, "cal_working_days", $cal_working_days);
if ($newcal_working_days != $cal_working_days) {
$q->addTable('config');
$q->addQuery("config_id");
$q->addWhere("config_name = 'cal_working_days'");
$id = $q->loadResult();
$q->clear();
$obj = new w2p_Core_Config();
$obj->load($id);
$obj->config_value = $newcal_working_days;
if (($msg = $obj->store($AppUI))) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
}
$cal_day_start = w2PgetConfig("cal_day_start");
$newcal_day_start = w2PgetParam($_POST, "cal_day_start", $cal_day_start);
if ($newcal_day_start != $cal_day_start) {
$q->addTable('config');
$q->addQuery("config_id");
$q->addWhere("config_name = 'cal_day_start'");
$id = $q->loadResult();
$q->clear();
$obj = new w2p_Core_Config();
$obj->load($id);
$obj->config_value = $newcal_day_start;
if (($msg = $obj->store($AppUI))) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
}
$cal_day_end = w2PgetConfig("cal_day_end");
$newcal_day_end = w2PgetParam($_POST, "cal_day_end", $cal_day_end);
if ($newcal_day_end != $cal_day_end) {
$q->addTable('config');
$q->addQuery("config_id");
$q->addWhere("config_name = 'cal_day_end'");
$id = $q->loadResult();
$q->clear();
$obj = new w2p_Core_Config();
$obj->load($id);
$obj->config_value = $newcal_day_end;
if (($msg = $obj->store($AppUI))) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
}
$AppUI->setMsg( "Settings updated" );
$AppUI->redirect();