vardef_map['autoinc_next'] = 'autoinc_next'; $this->vardef_map['autoinc_start'] = 'autoinc_start'; $this->vardef_map['auto_increment'] = 'auto_increment'; } function get_html_edit(){ $this->prepare(); return ""; } function populateFromPost(){ parent::populateFromPost(); if (isset($this->auto_increment)) { $this->auto_increment = $this->auto_increment == "true" || $this->auto_increment === true; } } function get_field_def(){ $vardef = parent::get_field_def(); $vardef['disable_num_format'] = isset($this->disable_num_format) ? $this->disable_num_format : $this->ext3;//40005 if(!empty($this->ext2)){ $min = (!empty($this->ext1))?$this->ext1:0; $max = $this->ext2; $vardef['validation'] = array('type' => 'range', 'min' => $min, 'max' => $max); } if(!empty($this->auto_increment)) { $vardef['auto_increment'] = $this->auto_increment; if ((empty($this->autoinc_next)) && isset($this->module) && isset($this->module->table_name)) { global $db; $helper = $db->gethelper(); $auto = $helper->getAutoIncrement($this->module->table_name, $this->name); $this->autoinc_next = $vardef['autoinc_next'] = $auto; } } return $vardef; } function save($df){ $next = false; if (!empty($this->auto_increment) && (!empty($this->autoinc_next) || !empty($this->autoinc_start)) && isset($this->module)) { if (!empty($this->autoinc_start) && $this->autoinc_start > $this->autoinc_next) { $this->autoinc_next = $this->autoinc_start; } if(isset($this->module->table_name)){ global $db; $helper = $db->gethelper(); //Check that the new value is greater than the old value $oldNext = $helper->getAutoIncrement($this->module->table_name, $this->name); if ($this->autoinc_next > $oldNext) { $helper->setAutoIncrementStart($this->module->table_name, $this->name, $this->autoinc_next); } } $next = $this->autoinc_next; $this->autoinc_next = false; } parent::save($df); if ($next) $this->autoinc_next = $next; } } ?>