distribution

let pull behave same way as a push in regard to distribution.
pull/63/head
noud 2012-11-05 10:24:50 +01:00
parent d17d5b6b8a
commit 29c966810e
1 changed files with 10 additions and 6 deletions

View File

@ -190,16 +190,20 @@ class ServersController extends AppController {
$event['Event']['distribution'] = 'Community';
}
if (is_array($event['Event']['Attribute'])) {
foreach ($event['Event']['Attribute'] as &$attribute) {
// Distribution, correct Community to Org only in Attribute
if ($attribute['distribution'] == 'Community') {
foreach ($event['Event']['Attribute'] as $key => &$attribute) {
switch($attribute['distribution']) {
case 'Org':
unset($event['Event']['Attribute'][$key]);
break;
case 'Community':
$attribute['distribution'] = 'Org';
}
// Distribution, correct All to Community in Attribute
if ($attribute['distribution'] == 'All') {
break;
case 'All':
$attribute['distribution'] = 'Community';
break;
}
}
$event['Event']['Attribute'] = array_values($event['Event']['Attribute']);
}
// Distribution, set reporter of the event, being the admin that initiated the pull
$event['Event']['user_id'] = $this->Auth->user('id');