Commit b662cc93 authored by istos's avatar istos

Take prefixes into account

parent d837a605
......@@ -557,6 +557,8 @@ function bat_api_services_edit_unit($unit_id, $bat_unit_data) {
* @param $event_types
*/
function bat_api_services_events_index($target_ids, $target_types, $target_entity_type, $start_date, $end_date, $event_types) {
global $databases;
$return = new stdClass();
$return->sessid = session_id();
......@@ -567,7 +569,8 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit
$events_json = array();
foreach ($types as $type) {
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT);
$prefix = $databases['default']['default']['prefix'];
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, $prefix);
$start_date_object = new DateTime($start_date);
$end_date_object = new DateTime($end_date);
......@@ -635,6 +638,8 @@ function bat_api_services_events_index($target_ids, $target_types, $target_entit
* @param $event_types
*/
function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_date, $end_date, $event_types, $background) {
global $databases;
if ($unit_types == 'all') {
$unit_types = array();
foreach (bat_unit_get_types() as $type => $info) {
......@@ -671,7 +676,8 @@ function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_d
$controller = entity_get_controller($target_entity_type);
// For each type of event create a state store and an event store
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT);
$prefix = $databases['default']['default']['prefix'];
$event_store = new DrupalDBStore($type, DrupalDBStore::BAT_EVENT, $prefix);
$start_date_object = new DateTime($start_date);
$end_date_object = new DateTime($end_date);
......
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