diff options
| -rw-r--r-- | library/WT/Controller/GedcomRecord.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/library/WT/Controller/GedcomRecord.php b/library/WT/Controller/GedcomRecord.php index 8a8b3c9e22..ceefa594e0 100644 --- a/library/WT/Controller/GedcomRecord.php +++ b/library/WT/Controller/GedcomRecord.php @@ -30,13 +30,21 @@ class WT_Controller_GedcomRecord extends WT_Controller_Page { // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links=0; - foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|SOUR|REPO|OBJE') as $fact) { // Not NOTE! + foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isOld() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); WT_FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } + foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) { + // These can be links or inline. Only delete links. + if (!$fact->isOld() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) { + $this->record->deleteFact($fact->getFactId(), false); + WT_FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); + $broken_links = true; + } + } if ($broken_links) { // Reload the updated family $this->record = WT_GedcomRecord::getInstance($this->record->getXref()); |
