Skip to content

Commit

Permalink
Make build button available to Matchgrid Admins (CO-1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Nov 17, 2019
1 parent 683b763 commit efbc622
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions app/src/Controller/MatchgridsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MatchgridsController extends StandardController {
public function beforeFilter(\Cake\Event\Event $event) {
// Only certain actions require a matchgrid ID
if(in_array($this->request->getParam('action'),
['manage', 'pending', 'reconcile'])) {
['build', 'manage', 'pending', 'reconcile'])) {
$this->Matchgrids->setRequiresMatchgrid(true);
}

Expand All @@ -72,7 +72,7 @@ public function build(int $id) {
$this->Flash->error(__('match.er.build', [$e->getMessage()]));
}

return $this->redirect(['action' => 'index']);
return $this->redirect(['action' => 'manage', $id]);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions app/src/Locale/en_US/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ msgstr "Invalid character found"
msgid "match.er.mgid"
msgstr "Could not find Matchgrid ID in request"

msgid "match.er.notfound"
msgstr "{0} \"{1}\" not found"

msgid "match.er.pagenum.exceeded"
msgstr "Page number may not be larger than {0}"

Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/MatchgridsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function initialize(array $config) {
]
]);

$this->setAllowLookupPrimaryLink(['manage', 'pending', 'reconcile']);
$this->setAllowLookupPrimaryLink(['build', 'manage', 'pending', 'reconcile']);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions app/src/Template/Matchgrids/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,5 @@ $indexActions = [
[
'action' => 'manage',
'class' => 'configurebutton'
],
[
'action' => 'build',
'class' => 'buildbutton'
]
];
15 changes: 14 additions & 1 deletion app/src/Template/Matchgrids/manage.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ declare(strict_types = 1);
<!-- Matchgrid Management Menu -->
<section class="inner-content">
<ul id="configuration-menu" class="three-col">
<?php if($vv_permissions['build']): ?>
<li>
<em class="material-icons" aria-hidden="true">check_circle</em>
<?= $this->Html->link(__('match.op.build'),
['controller' => 'Matchgrids',
'action' => 'build',
$vv_cur_mg->id],
['confirm' => __('match.op.build.confirm')]);
?>
</li>
<?php endif; // $vv_permissions['build'] ?>
<?php if($vv_permissions['reconcile']): ?>
<li>
<em class="material-icons" aria-hidden="true">check_circle</em>
<?= $this->Html->link(__('match.op.reconcile'),
Expand All @@ -44,5 +56,6 @@ declare(strict_types = 1);
$vv_cur_mg->id]);
?>
</li>
<?php endif; // $vv_permissions['reconcile'] ?>
</ul>
</section>
</section>
12 changes: 0 additions & 12 deletions app/src/Template/Matchgrids/select.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,6 @@ use \App\Lib\Enum\PermissionEnum;
$id],
['class' => 'configurebutton']);
}

// Can reconcile this matchgrid?
if((isset($vv_menu_permissions['gridroles'][$id][PermissionEnum::ReconciliationManager])
&& $vv_menu_permissions['gridroles'][$id][PermissionEnum::ReconciliationManager])
// Proxy for platform admin
|| $vv_menu_permissions['matchgrids']) {
print $this->Html->link(__('match.op.reconcile'),
['controller' => 'Matchgrids',
'action' => 'pending',
$id],
['class' => 'reconcilebutton']);
}
?>
</div>
</div>
Expand Down

0 comments on commit efbc622

Please sign in to comment.