From a909b56030b8052ac5e62216ebb8d8af66c77832 Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Fri, 29 Nov 2013 22:18:19 +0000 Subject: #1256328 - Level 1, inline, source citations are deleted --- library/WT/Controller/GedcomRecord.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'library/WT/Controller/GedcomRecord.php') 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()); -- cgit v1.3