Skip to content

Commit

Permalink
Replaced 'deleted' by DEFINE
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefferson49 committed Nov 19, 2023
1 parent 66dcfec commit 97e3310
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions XmlExportSettingsModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public static function updatePreferenes(Tree $tree, string $repository_xref, int
$repository_hierarchy = $module_service->findByName(RepositoryHierarchy::activeModuleName());

$replaces_list = [
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_TITLE, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_TITLE],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_IDENTIFIER, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_IDENTIFIER],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_URL, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_URL],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_PUBLISHER, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_PUBLISHER],
['search' => RepositoryHierarchy::OLD_PREF_MAIN_AGENCY_CODE, 'replace' => RepositoryHierarchy::PREF_MAIN_AGENCY_CODE],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_TITLE, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_TITLE],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_IDENTIFIER, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_IDENTIFIER],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_URL, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_URL],
['search' => RepositoryHierarchy::OLD_PREF_FINDING_AID_PUBLISHER, 'replace' => RepositoryHierarchy::PREF_FINDING_AID_PUBLISHER],
['search' => RepositoryHierarchy::OLD_PREF_MAIN_AGENCY_CODE, 'replace' => RepositoryHierarchy::PREF_MAIN_AGENCY_CODE],
];

foreach ($replaces_list as $replace_pair) {
Expand All @@ -87,7 +87,7 @@ public static function updatePreferenes(Tree $tree, string $repository_xref, int
$old_setting = $repository_hierarchy->getPreference($replace_pair['search'] . $tree->id() . '_' . $repository_xref . '_' . $user_id_in_pref, '');
$new_setting = $repository_hierarchy->getPreference($replace_pair['replace'] . $tree->id() . '_' . $repository_xref . '_' . $user_id_in_pref, '');

if ($old_setting !== '' && $old_setting !== 'deleted') {
if ($old_setting !== '' && $old_setting !== RepositoryHierarchy::PREF_DELETED) {

//If new preference does not already exist
if ($new_setting === '') {
Expand All @@ -101,8 +101,8 @@ public static function updatePreferenes(Tree $tree, string $repository_xref, int
$repository_hierarchy->setPreference($replace_pair['replace'] . $tree->id() . '_' . $repository_xref . '_' . $user_id_in_pref, $old_setting);
}

//Delete old setting (i.e. set to 'deleted')
$repository_hierarchy->setPreference($replace_pair['search'] . $tree->id() . '_' . $repository_xref . '_' . $user_id_in_pref, 'deleted');
//Delete old setting (i.e. set to deleted)
$repository_hierarchy->setPreference($replace_pair['search'] . $tree->id() . '_' . $repository_xref . '_' . $user_id_in_pref, RepositoryHierarchy::PREF_DELETED);
}

}
Expand Down

0 comments on commit 97e3310

Please sign in to comment.