// DB_DataObject::debugLevel(1);
if (!empty($q['query']['empty_etype'])) {
- $this->whereAdd("etype = ''");
+ $this->whereAdd("core_enum.etype = ''");
}
// this should be handled by roo... using '!name[0]' ....
$tn = $this->tableName();
$x = $this->factory($tn);
- if(!($old->etype == $request['etype'] && $old->name == $request['name'])){
+ // check if record exists?
+ if(isset($request['etype']) && !($old->etype == $request['etype'] && $old->name == $request['name'])){
$x->whereAdd("etype = '{$this->escape($request['etype'])}' AND name = '{$this->escape($request['name'])}'");
$x->find(true);
if($x->count() > 0){
- $roo->jerr('is exsiting');
+ $roo->jerr('record already exists');
}
}
}
}
- function merge($to, $roo)
+ function merge($merge_to, $roo)
{
$affects = array();
$affects[$tbl .'.' . $col] = true;
}
}
- print_R($affects);exit;
+
foreach($affects as $k => $true) {
$ka = explode('.', $k);
foreach ($chk->fetchAll() as $c){
$cc = clone ($c);
- $c->{$ka[1]} = $to;
+ $c->{$ka[1]} = $merge_to;
$c->update($cc);
}
}