Skip to content

Commit

Permalink
Fix error on delete of matchgrid row (CO-2125)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Apr 19, 2021
1 parent 9e1113e commit 1cb2f0b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ protected function getPrimaryLink(bool $lookup=false) {
$this->cur_pl['linkvalue'] = $this->request->getData($this->cur_pl['linkattr']);
} elseif(!empty($this->request->getData($modelName . "." . $this->cur_pl['linkattr']))) {
$this->cur_pl['linkvalue'] = $this->request->getData($modelName . "." . $this->cur_pl['linkattr']);
} elseif($this->$modelsName->allowUnkeyedPrimaryLink($this->request->getParam('action'))
&& $this->request->getQuery($this->cur_pl['linkattr'])) {
// If this action allows unkeyed, asserted primary link IDs, check the query
// string (eg: 'add' or 'index' allow matchgrid_id to be passed in). Note we
// do this even though we're in post/put.
$this->cur_pl['linkvalue'] = $this->request->getQuery($this->cur_pl['linkattr']);
} elseif($this->$modelsName->allowLookupPrimaryLink($this->request->getParam('action'))) {
// Try to map the requested object ID (this is probably a delete, so no attribute in post body)
$param = (int)$this->request->getParam('pass.0');
Expand Down Expand Up @@ -265,6 +271,12 @@ protected function setMatchgrid() {
$mgid = $this->request->getData('matchgrid_id');
} elseif(!empty($this->request->getData($modelName . ".matchgrid_id"))) {
$mgid = $this->request->getData($modelName . ".matchgrid_id");
} elseif($this->name == 'MatchgridRecords'
&& !empty($this->request->getQuery('matchgrid_id'))) {
// As a special case for MatchgridRecords, we accept the matchgrid_id
// as a get parameter even though the action is post/put, since this
// is how it is provided for a delete action.
$mgid = $this->request->getQuery('matchgrid_id');
}
}
} else {
Expand Down

0 comments on commit 1cb2f0b

Please sign in to comment.