Skip to content

Commit

Permalink
Fix #66 required field scopes now correctly work
Browse files Browse the repository at this point in the history
  • Loading branch information
creecros committed Feb 16, 2021
1 parent 43f3a86 commit 1dc83bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Model/MetadataTypeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ public function getScope($id)
->findAllByColumn('attached_to');
}

public function getReqs()
public function getReqs($scope)
{
return $this->db->table(self::TABLE)
->beginOr()
->eq('attached_to', 0)
->eq('attached_to', $scope)
->closeOr()
->eq('is_required', true)
->findAllByColumn('human_name');
}
Expand Down
2 changes: 1 addition & 1 deletion Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getPluginAuthor()

public function getPluginVersion()
{
return '1.4.11';
return '1.4.12';
}

public function getPluginHomepage()
Expand Down
2 changes: 1 addition & 1 deletion Validator/NewTaskValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function validateCreation(array $values)
new Validators\Required('title', t('The title is required')),
);

$metaReqs = $this->metadataTypeModel->getReqs();
$metaReqs = $this->metadataTypeModel->getReqs($values['project_id']);

foreach ($metaReqs as $req) {
$rules = array_merge($rules, array(
Expand Down

0 comments on commit 1dc83bc

Please sign in to comment.