Skip to content

Commit

Permalink
Fix: #2439 undefined index error in batch update
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Roach committed May 15, 2019
1 parent e60d403 commit c368f77
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/Module/BatchUpdateModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace Fisharebest\Webtrees\Module;

use function array_key_exists;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Contracts\UserInterface;
use Fisharebest\Webtrees\Family;
Expand Down Expand Up @@ -337,7 +338,7 @@ public function postAdminAction(ServerRequestInterface $request, UserInterface $
}

$plugin = $request->getQueryParams()['plugin'] ?? '';
$xref = $request->getQueryParams()['xref'] ?? '';
$xref = $request->getParsedBody()['xref'] ?? '';
$update = $request->getParsedBody()['update'] ?? '';

$plugins = $this->getPluginList();
Expand All @@ -355,10 +356,12 @@ public function postAdminAction(ServerRequestInterface $request, UserInterface $

switch ($update) {
case 'one':
$record = $this->getRecord($all_data[$xref], $tree);
if ($plugin->doesRecordNeedUpdate($record)) {
$new_gedcom = $plugin->updateRecord($record);
$record->updateRecord($new_gedcom, false);
if (array_key_exists($xref, $all_data)) {
$record = $this->getRecord($all_data[$xref], $tree);
if ($plugin->doesRecordNeedUpdate($record)) {
$new_gedcom = $plugin->updateRecord($record);
$record->updateRecord($new_gedcom, false);
}
}

$parameters['xref'] = $this->findNextXref($plugin, $xref, $all_data, $tree);
Expand Down

0 comments on commit c368f77

Please sign in to comment.