Fix to a bug that caused taxonomies to create duplicates instead of updating an older version

pull/856/head
Iglocska 2016-01-15 11:05:17 +01:00
parent ee9107cc1f
commit 3b22997240
1 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ class Taxonomy extends AppModel{
$current = $this->find('first', array(
'conditions' => array('namespace' => $vocab['namespace']),
'recursive' => -1,
'fields' => array('version', 'enabled')
'fields' => array('version', 'enabled', 'namespace')
));
if (empty($current) || $vocab['version'] > $current['Taxonomy']['version']) {
$result = $this->__updateVocab($vocab, $current, array('colour'));
@ -65,7 +65,7 @@ class Taxonomy extends AppModel{
$taxonomy = array();
if (!empty($current)) {
if ($current['Taxonomy']['enabled']) $enabled = true;
$this->delete($current['Taxonomy']['id']);
$this->deleteAll(array('Taxonomy.namespace' => $current['Taxonomy']['namespace']));
}
$taxonomy['Taxonomy'] = array('namespace' => $vocab['namespace'], 'description' => $vocab['description'], 'version' => $vocab['version'], 'enabled' => $enabled);
$predicateLookup = array();