From 38fca3234d8c6571e2169ed9b77d9c9182908f23 Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 11 Feb 2015 15:59:07 +0800 Subject: [PATCH] Import/Core_notify.php --- Import/Core_notify.php | 54 ++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/Import/Core_notify.php b/Import/Core_notify.php index eeffb055..5c7a91a2 100644 --- a/Import/Core_notify.php +++ b/Import/Core_notify.php @@ -35,24 +35,24 @@ class Pman_Core_Import_Core_notify extends Pman_Roo $this->etype(); -// $this->defaults(); -// -// foreach ($this->defaults as $k => $v){ -// $enum = DB_DataObject::factory('core_enum'); -// $enum->setFrom(array( -// 'etype' => $this->etype->name, -// 'name' => $k, -// 'active' => 1 -// )); -// -// if($enum->find(true)){ -// continue; -// } -// -// $enum->display_name = $v; -// $enum->insert(); -// } -// + $this->defaults(); + + foreach ($this->defaults as $k => $v){ + $enum = DB_DataObject::factory('core_enum'); + $enum->setFrom(array( + 'etype' => $this->etype->name, + 'name' => $k, + 'active' => 1 + )); + + if($enum->find(true)){ + continue; + } + + $enum->display_name = $v; + $enum->insert(); + } + $notify = DB_DataObject::factory('core_notify'); $notify->selectAdd(); $notify->selectAdd(" @@ -61,9 +61,23 @@ class Pman_Core_Import_Core_notify extends Pman_Roo $types = $notify->fetchAll(); - print_r($types);exit; - + foreach ($types as $t){ + $enum = DB_DataObject::factory('core_enum'); + $enum->setFrom(array( + 'etype' => $this->etype->name, + 'name' => $t, + 'active' => 1 + )); + + if($enum->find(true)){ + continue; + } + + $enum->display_name = $t; + $enum->insert(); + } + $this->jok('DONE'); } -- 2.39.2