function save($type, $id, $reference)
{
update_reference($type, $id, $reference); // store in refs table
- if ($reference == $this->get_next($type)) { // if reference was not changed from default
+ if ($reference == $this->get_next($type)) { // if reference was bigger or not changed from default
$next = $this->_increment($reference); // increment default
save_next_reference($type, $next);
}
$type = db_escape($type);
if ($db_ref == null) { // journal or bank trans store references in refs table
- $db_ref = TB_PREF."refs";
+ $db_name = TB_PREF."refs";
$db_type = 'type';
$db_trans = 'id';
- $rb_ref = 'reference';
+ $db_ref = 'reference';
}
if ($db_type != null) {