fix: [sharingGroup:captureSharingGroup] Fix failing capture in case of

roaming mode

- The server list check was incorrect
- When capturing, roaming mode was always defaulted to false
- The logs could not be written due to non-initialized class
pull/6084/head
mokaddem 2020-07-02 15:31:47 +02:00
parent e52b001c7c
commit 60a9707808
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 4 additions and 2 deletions

View File

@ -269,7 +269,7 @@ class SharingGroup extends AppModel
}
}
}
if (isset($sg['SharingGroupServer'])) {
if (!empty($sg['SharingGroupServer'])) {
foreach ($sg['SharingGroupServer'] as $server) {
if (isset($server['Server'][0])) {
$server['Server'] = $server['Server'][0];
@ -496,6 +496,7 @@ class SharingGroup extends AppModel
public function captureSG($sg, $user, $syncLocal=false)
{
$this->Log = ClassRegistry::init('Log');
$existingSG = !isset($sg['uuid']) ? null : $this->find('first', array(
'recursive' => -1,
'conditions' => array('SharingGroup.uuid' => $sg['uuid']),
@ -548,7 +549,8 @@ class SharingGroup extends AppModel
'organisation_uuid' => array('default' => $user['Organisation']['uuid']),
'created' => array('default' => $date = date('Y-m-d H:i:s')),
'modified' => array('default' => $date = date('Y-m-d H:i:s')),
'active' => array('default' => 1)
'active' => array('default' => 1),
'roaming' => array('default' => false),
);
foreach (array_keys($attributes) as $a) {
if (isset($sg[$a])) {