SyncRule: do not allow to sync unless some...

...properties have been defined.

fixes #383
This commit is contained in:
Thomas Gelf 2017-05-03 11:24:22 +02:00
parent f91dd5fa0e
commit 2237272b6b
2 changed files with 16 additions and 0 deletions

View File

@ -4,6 +4,16 @@
</div>
<div class="content">
<?php if (! $rule->hasSyncProperties()): ?>
<p class="warning">
<?= sprintf(
$this->translate('You need must define some %s before you can run this Sync rule'),
$this->qlink('Sync Properties', 'director/syncrule/property', array('rule_id' => $rule->id))
)
?>
</p>
</div>
<?php return; endif ?>
<?php if (! $this->run): ?>
<p class="warning">
<?= $this->translate('This Sync Rule has never been run before.') ?>

View File

@ -345,6 +345,12 @@ class SyncRule extends DbObject
return $this->hasCombinedKey;
}
public function hasSyncProperties()
{
$properties = $this->getSyncProperties();
return ! empty($properties);
}
public function getSyncProperties()
{
if (! $this->hasBeenLoadedFromDb()) {