Commit d11bc0f2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

setup.php: fix inserting of initial data.

parent ed8c95d9
...@@ -197,16 +197,23 @@ class CSetupTimesheet extends w2p_System_Setup ...@@ -197,16 +197,23 @@ class CSetupTimesheet extends w2p_System_Setup
} }
private function _insertConfigurationData() { private function _insertConfigurationData() {
$data = array(
'timesheet_approval_by' => '0',
'timesheet_book_year' => '2014',
'timesheet_sort_order' => 'Ascending'
);
$q = new w2p_Database_Query(); $q = new w2p_Database_Query();
foreach($data as $key=>$value) {
$q->addTable('timesheet_config'); $q->addTable('timesheet_config');
$q->addInsert('timesheet_config', 'timesheet_approval_by'); $q->addInsert('timesheet_config', $key);
$q->addInsert('timesheet_value', '0'); $q->addInsert('timesheet_value', $value);
$q->addInsert('timesheet_config', 'timesheet_book_year'); if (!$q->exec()) {
$q->addInsert('timesheet_value', '2014'); db_error();
$q->addInsert('timesheet_config', 'timesheet_sort_order'); return false;
$q->addInsert('timesheet_value', 'Ascending'); }
$result = $q->exec(); $q->clear();
return $result; }
return true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment