Fixes: metadata duplication on son collection (issue #79)

This commit is contained in:
weryques 2018-07-12 12:52:06 -03:00
parent e2bff2942d
commit 2e6d4c567b
3 changed files with 117 additions and 301 deletions

402
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@
"v-mask": "^1.3.2",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.16",
"node-sass": "^4.9.2",
"vue-router": "^3.0.1",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1"
@ -35,7 +36,6 @@
"eslint-loader": "^2.0.0",
"eslint-plugin-vue": "^4.5.0",
"file-loader": "^1.1.11",
"node-sass": "^4.9.2",
"postcss-loader": "^2.1.6",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",

View File

@ -531,7 +531,19 @@ class Metadata extends Repository {
]
];
if( $collection->get_parent() !== 0 ){
if( $collection->get_parent() != 0 ){
if(!empty($metadata)){
foreach ( $data_core_metadata as $index => $data_core_metadatum ) {
foreach ( $metadata as $metadatum ){
if ( $metadatum->get_metadata_type() === $data_core_metadatum['metadata_type'] ) {
update_post_meta($metadatum->get_id(), 'metadata_type', 'to_delete', $data_core_metadatum['metadata_type']);
wp_delete_post($metadatum->get_id(), true);
}
}
}
}
return false;
}