Commit 72317c0af5d0159b77d3dec20f8ce40a93ab2895

Authored by Adhidarma Hadiwinoto
1 parent 18fccb501b
Exists in master

term save

Showing 1 changed file with 9 additions and 4 deletions Side-by-side Diff

moongate2kantorterms.php
... ... @@ -61,6 +61,8 @@ $offices = mg2kt_moongate_offices();
61 61 while ($office = $offices->fetchAssoc()) {
62 62 drush_log($office['kd_kantor'] . " " . $office['nm_kantor'], "info");
63 63  
  64 + $modified = false;
  65 +
64 66 $term = mg2kt_load_term($office['kd_kantor']);
65 67 if (!$term) {
66 68 drush_log("Missing term detected on " . $office['kd_kantor'] . " " . $office['nm_kantor'], "warning");
... ... @@ -83,11 +85,14 @@ while ($office = $offices->fetchAssoc()) {
83 85 drush_log('Old name: "' . $term->name . '"', "notice");
84 86 drush_log('New name: "' . $office["nm_kantor"] . '"', "notice");
85 87  
86   - drush_log("Replacing old name");
  88 + drush_log("Replacing old name", "notice");
  89 +
87 90 $term->name = $office['nm_kantor'];
  91 + $modified = true;
88 92 }
89 93  
90   -
91   -
92   -
  94 + if ($modified) {
  95 + drush_log("Saving modified data", "ok");
  96 + taxonomy_term_save($term);
  97 + }
93 98 }