summaryrefslogtreecommitdiff
path: root/library/WT/Controller/GedcomRecord.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-11-29 22:18:19 +0000
committerGreg Roach <fisharebest@gmail.com>2013-11-29 22:18:19 +0000
commita909b56030b8052ac5e62216ebb8d8af66c77832 (patch)
tree4fd0260e1c1505cd539b2190118a4a3b876b4a76 /library/WT/Controller/GedcomRecord.php
parent938cf28f38ea24f59c60e45eacd92d67c4c307a5 (diff)
downloadwebtrees-a909b56030b8052ac5e62216ebb8d8af66c77832.tar.gz
webtrees-a909b56030b8052ac5e62216ebb8d8af66c77832.tar.bz2
webtrees-a909b56030b8052ac5e62216ebb8d8af66c77832.zip
#1256328 - Level 1, inline, source citations are deleted
Diffstat (limited to 'library/WT/Controller/GedcomRecord.php')
-rw-r--r--library/WT/Controller/GedcomRecord.php10
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());