Skip to content

Commit

Permalink
Fix restoring director job from snapshot for import source and sync r…
Browse files Browse the repository at this point in the history
…ule.
  • Loading branch information
raviks789 committed Apr 27, 2022
1 parent 4692b28 commit 4218178
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/Director/Objects/DirectorJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,21 @@ public static function import($plain, Db $db, $replace = false)
$object = static::create([], $db);
}

$settings = (array) $properties['settings'];

if (array_key_exists('source',$settings) && ! (array_key_exists('source_id',$settings))) {
$val = ImportSource::load($settings['source'], $db)->get('id');
$settings['source_id'] = $val;
}

if (array_key_exists('rule',$settings) && ! (array_key_exists('rule_id',$settings))) {
$settings['apply_changes'] = (int) $settings['apply_changes'] === 1 ? 'y' : 'n';
$val = SyncRule::load($settings['rule'], $db)->get('id');
$settings['rule_id'] = $val;
}

$properties['settings'] = (object) $settings;

$object->setProperties($properties);
if ($id !== null) {
$object->reallySet($idCol, $id);
Expand Down

0 comments on commit 4218178

Please sign in to comment.