public $seqid; // int(11) not_null multiple_key
public $seqmax; // int(11) not_null multiple_key
public $display_name;
-
+ public $is_system_enum;
+
+
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
function lookupCreate($etype,$name, $display_name=false) {
+ static $cache = array();
+ $ckey = json_encode(array($etype, $name));
+ if (isset($cache[$ckey])) {
+ return $cache[$ckey];
+ }
+
// check
$ce = DB_DataObject::Factory('core_enum');
$ce->setFrom(array(
$ce->etype = $etype;
$ce->name = $name;
if ($ce->find(true)) {
+ $cache[$ckey] = $ce->id;
return $ce->id;
}
$ce->active = 1;
$ce->display_name = $display_name === false ? $ce->name : $display_name;
- return $ce->insert();
+ $ret = $ce->insert();
+ $cache[$ckey] = $ret;
+ return $ret;
}
return $x->fetchAll($fetchArg1, $fetchArg2, $fetchArg3);
}
+ function fetchAllByTypeOrderDisplay($etype, $fetchArg1=false, $fetchArg2=false, $fetchArg3=false)
+ {
+ $x = DB_DataObject::factory('core_enum');
+ $x->etype = $etype;
+ $x->active = 1;
+ $x->orderBy('display_name ASC');
+ return $x->fetchAll($fetchArg1, $fetchArg2, $fetchArg3);
+ }
+
function lookupObject($etype,$name, $create= false)
{
$seq_id = $t->seqid+1;
}
}
- print_R($data);exit;
+
foreach($data as $row) {
$t = DB_DAtaObject::Factory('core_enum');
if (empty($t->name) && $t->name != 0) {
print_R($data);
- die("ERROR: invalid name used for core_enum\n\n");
+ die("ERROR: invalid name used for core_enum\n\n" );
}
if (!$t->count()) {