# HG changeset patch # User casties # Date 1442593598 -7200 # Node ID 7b6b064afe5d214d0cf9268dbe7278fc143e711f # Parent bdf91a4a40ff6465b242b046f53618e51342bd32 add function openmindattribute_addIsmiBibIDs() to copy EndNote IDs to field_ismi_bibid. diff -r bdf91a4a40ff -r 7b6b064afe5d openmindattribute/openmindattribute.module --- a/openmindattribute/openmindattribute.module Fri Sep 18 18:25:10 2015 +0200 +++ b/openmindattribute/openmindattribute.module Fri Sep 18 18:26:38 2015 +0200 @@ -1465,6 +1465,37 @@ } +function openmindattribute_addIsmiBibIDs() { + # adds the EndNote identifier to the ismi_bibid field of the Biblio objects + $query = new EntityFieldQuery(); + + $query->entityCondition('entity_type', 'node') + ->entityCondition('bundle', 'biblio'); + + $result = $query->execute(); + + if (isset($result['node'])) { + $nids = array_keys($result['node']); + $biblios = entity_load('node', $nids); + } else { + return; + } + + foreach ($biblios as $bib) { + + $endnote_id = $bib->biblio_custom3; + if (isset($endnote_id)) { + $bib->field_ismi_bibid = ['und' => [['value' => $endnote_id]]]; + node_save($bib); + } + //dpm($endnote_id); + //dpm($bib->field_ismi_bibid); + + } + print "Updated field_ismi_bibid for " . count($biblios) . " bibliography entries.\n"; +} + + function openmindattribute_addIDbibliographieID(){ #adds the add bibliographie $query = new EntityFieldQuery();