Code Duplication    Length = 22-22 lines in 2 locations

edit_interface.php 2 locations

@@ 2299-2320 (lines=22) @@
2296
		$new_children[] = Individual::getInstance($child, $controller->tree());
2297
	}
2298
2299
	if ($old_father !== $new_father) {
2300
		if ($old_father) {
2301
			// Remove old FAMS link
2302
			foreach ($old_father->getFacts('FAMS') as $fact) {
2303
				if ($fact->getTarget() === $family) {
2304
					$old_father->deleteFact($fact->getFactId(), !$keep_chan);
2305
				}
2306
			}
2307
			// Remove old HUSB link
2308
			foreach ($family->getFacts('HUSB|WIFE') as $fact) {
2309
				if ($fact->getTarget() === $old_father) {
2310
					$family->deleteFact($fact->getFactId(), !$keep_chan);
2311
				}
2312
			}
2313
		}
2314
		if ($new_father) {
2315
			// Add new FAMS link
2316
			$new_father->createFact('1 FAMS @' . $family->getXref() . '@', !$keep_chan);
2317
			// Add new HUSB link
2318
			$family->createFact('1 HUSB @' . $new_father->getXref() . '@', !$keep_chan);
2319
		}
2320
	}
2321
2322
	if ($old_mother !== $new_mother) {
2323
		if ($old_mother) {
@@ 2322-2343 (lines=22) @@
2319
		}
2320
	}
2321
2322
	if ($old_mother !== $new_mother) {
2323
		if ($old_mother) {
2324
			// Remove old FAMS link
2325
			foreach ($old_mother->getFacts('FAMS') as $fact) {
2326
				if ($fact->getTarget() === $family) {
2327
					$old_mother->deleteFact($fact->getFactId(), !$keep_chan);
2328
				}
2329
			}
2330
			// Remove old WIFE link
2331
			foreach ($family->getFacts('HUSB|WIFE') as $fact) {
2332
				if ($fact->getTarget() === $old_mother) {
2333
					$family->deleteFact($fact->getFactId(), !$keep_chan);
2334
				}
2335
			}
2336
		}
2337
		if ($new_mother) {
2338
			// Add new FAMS link
2339
			$new_mother->createFact('1 FAMS @' . $family->getXref() . '@', !$keep_chan);
2340
			// Add new WIFE link
2341
			$family->createFact('1 WIFE @' . $new_mother->getXref() . '@', !$keep_chan);
2342
		}
2343
	}
2344
2345
	foreach ($old_children as $old_child) {
2346
		if ($old_child && !in_array($old_child, $new_children)) {