Пример #1
0
 public static function user_settings()
 {
     if (Acl::is_user()) {
         $info = '%D - ' . __('Date') . '<br>%T - ' . __('Time') . '<br>%U - ' . __('User');
         $help = ' <img src="' . Base_ThemeCommon::get_icon('info') . '" ' . Utils_TooltipCommon::open_tag_attrs($info, false) . '/>';
         return array(__('Notes') => array(array('name' => 'editor', 'label' => __('Editor'), 'type' => 'select', 'default' => 0, 'values' => array(__('Simple'), __('Advanced'))), array('name' => 'edited_on_format', 'label' => __('Edited on format') . $help, 'type' => 'text', 'default' => '%D<br><br>%T<br><br>%U')));
     }
     return array();
 }
Пример #2
0
 public function register_form($data = null)
 {
     if ($this->is_back()) {
         return false;
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $f = $this->init_module(Libs_QuickForm::module_name());
     $admin_email_tooltip = '<img ' . Utils_TooltipCommon::open_tag_attrs(__('This email will be used to send registation link and to contact Administator directly.'), false) . ' src="' . Base_ThemeCommon::get_icon('info') . '"/> ';
     $tax_id_tooltip = '<img ' . Utils_TooltipCommon::open_tag_attrs(__('Your company Tax ID for invoices.'), false) . ' src="' . Base_ThemeCommon::get_icon('info') . '"/> ';
     $f->addElement('text', 'company_name', __('Company Name'), array('maxlength' => 128));
     $f->addRule('company_name', __('Field required'), 'required');
     $f->addRule('company_name', __('Max length exceeded'), 'maxlength', 128);
     $f->addElement('text', 'short_name', __('Short Name'), array('maxlength' => 64));
     $f->addRule('short_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'phone', __('Phone'), array('maxlength' => 64));
     $f->addRule('phone', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'fax', __('Fax'), array('maxlength' => 64));
     $f->addRule('fax', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'email', __('Company email'), array('maxlength' => 128));
     $f->addRule('email', __('Max length exceeded'), 'maxlength', 128);
     $f->addRule('email', __('Invalid e-mail address'), 'email');
     $f->addElement('text', 'web_address', __('Web address'), array('maxlength' => 64));
     $f->addRule('web_address', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'address_1', __('Address 1'), array('maxlength' => 64));
     $f->addRule('address_1', __('Field required'), 'required');
     $f->addRule('address_1', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'address_2', __('Address 2'), array('maxlength' => 64));
     $f->addRule('address_2', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'city', __('City'), array('maxlength' => 64));
     $f->addRule('city', __('Field required'), 'required');
     $f->addRule('city', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('commondata', 'country', __('Country'), 'Countries');
     $f->addRule('country', __('Field required'), 'required');
     $f->addElement('commondata', 'zone', __('Zone'), array('Countries', 'country'), array('empty_option' => true));
     $f->addElement('text', 'postal_code', __('Postal Code'), array('maxlength' => 64));
     $f->addRule('postal_code', __('Field required'), 'required');
     $f->addRule('postal_code', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'tax_id', $tax_id_tooltip . __('Tax ID'), array('maxlength' => 64));
     $f->addRule('admin_email', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_first_name', __('Administrator\'s first name'), array('maxlength' => 64));
     $f->addRule('admin_first_name', __('Field required'), 'required');
     $f->addRule('admin_first_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_last_name', __('Administrator\'s last name'), array('maxlength' => 64));
     $f->addRule('admin_last_name', __('Field required'), 'required');
     $f->addRule('admin_last_name', __('Max length exceeded'), 'maxlength', 64);
     $f->addElement('text', 'admin_email', $admin_email_tooltip . __('Administrator\'s email'), array('maxlength' => 128));
     $f->addRule('admin_email', __('Field required'), 'required');
     $f->addRule('admin_email', __('Max length exceeded'), 'maxlength', 128);
     $f->addRule('admin_email', __('Invalid e-mail address'), 'email');
     if ($f->validate()) {
         $ret = $f->exportValues();
         $ret = Base_EssClientCommon::server()->register_installation_request($ret);
         if ($ret) {
             if (is_string($ret)) {
                 Base_EssClientCommon::set_license_key($ret);
             }
             location(array());
             return false;
         }
     }
     // set defaults
     print '<div class="important_notice">';
     print __('Enter Company and Administrator details. This data will be sent to EPESI Store Server to provide us with contact information. The data sent to EPESI Store Server is limited only to the data you enter using this form and what modules are being purchased and downloaded.');
     print '<br>';
     if ($data) {
         $f->setDefaults($data);
     } else {
         if (ModuleManager::is_installed('CRM_Contacts') > -1) {
             print '<span style="color:gray;font-size:10px;">' . __('Data below was auto-filled based on Main Company and first Super administrator. Make sure that the data is correct and change it if necessary.') . '</span>';
             $defaults = Base_EssClientCommon::get_possible_admin();
             $mc = CRM_ContactsCommon::get_main_company();
             if ($mc > 0) {
                 $company = CRM_ContactsCommon::get_company($mc);
                 if ($company) {
                     $defaults = array_merge($company, $defaults);
                 }
             }
             $f->setDefaults($defaults);
         }
     }
     if ($data) {
         if (isset($data['status']) && strcasecmp($data['status'], 'Confirmed') == 0) {
             print '<div style="color:gray;font-size:10px;">' . __('Updating Company data will require re-validation by our representative.') . '</div>';
         }
         print '<div style="color:red;font-size:10px;">' . __('Changing Administrator e-mail address will require e-mail confirmation.') . '</div>';
     }
     print '<center>';
     $f->addElement('submit', 'submit', $data ? __('Update') : __('Register'));
     $f->display_as_column();
     print '</center>';
     print '</div>';
     return true;
 }
Пример #3
0
 public function view_field($action = 'add', $field = null)
 {
     if (!$action) {
         $action = 'add';
     }
     if ($this->is_back()) {
         return false;
     }
     if ($this->check_for_jump()) {
         return;
     }
     $data_type = array('autonumber' => __('Autonumber'), 'currency' => __('Currency'), 'checkbox' => __('Checkbox'), 'date' => __('Date'), 'time' => __('Time'), 'timestamp' => __('Timestamp'), 'integer' => __('Integer'), 'float' => __('Float'), 'text' => __('Text'), 'long text' => __('Long text'), 'select' => __('Select field'), 'calculated' => __('Calculated'));
     natcasesort($data_type);
     load_js('modules/Utils/RecordBrowser/js/field_admin.js');
     $form = $this->init_module(Libs_QuickForm::module_name());
     switch ($action) {
         case 'add':
             $form->addElement('header', null, __('Add new field'));
             break;
         case 'edit':
             $form->addElement('header', null, __('Edit field properties'));
             break;
     }
     $form->addElement('text', 'field', __('Field'), array('maxlength' => 32));
     $form->registerRule('check_if_column_exists', 'callback', 'check_if_column_exists', $this);
     $this->current_field = $field;
     $form->registerRule('check_if_no_id', 'callback', 'check_if_no_id', $this);
     $form->addRule('field', __('Field required'), 'required');
     $form->addRule('field', __('Field with this name already exists.'), 'check_if_column_exists');
     $form->addRule('field', __('Field length cannot be over 32 characters.'), 'maxlength', 32);
     $form->addRule('field', __('Invalid field name.'), 'regex', '/^[a-zA-Z][a-zA-Z \\(\\)\\%0-9]*$/');
     $form->addRule('field', __('Invalid field name.'), 'check_if_no_id');
     $form->addElement('text', 'caption', __('Caption'), array('maxlength' => 255, 'placeholder' => __('Leave empty to use default label')));
     if ($action == 'edit') {
         $row = DB::GetRow('SELECT field, caption, type, visible, required, param, filter, export, tooltip, extra, position FROM ' . $this->tab . '_field WHERE field=%s', array($field));
         switch ($row['type']) {
             case 'select':
                 $row['select_data_type'] = 'select';
                 $row['select_type'] = 'select';
                 $row['data_source'] = 'rset';
                 $ref = explode(';', $row['param']);
                 $refe = explode('::', $ref[0]);
                 $row['rset'] = array_filter(explode(',', $refe[0]));
                 $row['label_field'] = isset($refe[1]) ? str_replace('|', ',', $refe[1]) : '';
                 break;
             case 'multiselect':
                 $row['select_data_type'] = 'select';
                 $row['select_type'] = 'multiselect';
                 $ref = explode(';', $row['param']);
                 $refe = explode('::', $ref[0]);
                 $tab = $refe[0];
                 if ($tab == '__COMMON__') {
                     $row['data_source'] = 'commondata';
                     $order = isset($refe[2]) ? $refe[2] : 'value';
                     if (strlen($order) <= 1) {
                         $order = $order ? 'key' : 'value';
                     }
                     $row['order_by'] = $order;
                     $row['commondata_table'] = $refe[1];
                 } else {
                     $row['label_field'] = '';
                     if (isset($refe[1])) {
                         $row['label_field'] = str_replace('|', ',', $refe[1]);
                     }
                     $row['data_source'] = 'rset';
                     $row['rset'] = array_filter(explode(',', $tab));
                 }
                 break;
             case 'commondata':
                 $row['select_data_type'] = 'select';
                 $row['select_type'] = 'select';
                 $row['data_source'] = 'commondata';
                 $param = Utils_RecordBrowserCommon::decode_commondata_param($row['param']);
                 $form->setDefaults(array('order_by' => $param['order_by_key'], 'commondata_table' => $param['array_id']));
                 break;
             case 'autonumber':
                 $row['select_data_type'] = 'autonumber';
                 Utils_RecordBrowserCommon::decode_autonumber_param($row['param'], $autonumber_prefix, $autonumber_pad_length, $autonumber_pad_mask);
                 $row['autonumber_prefix'] = $autonumber_prefix;
                 $row['autonumber_pad_length'] = $autonumber_pad_length;
                 $row['autonumber_pad_mask'] = $autonumber_pad_mask;
                 break;
             case 'text':
                 $row['select_data_type'] = $row['type'];
                 $row['text_length'] = $row['param'];
                 break;
             case 'time':
             case 'timestamp':
                 $row['select_data_type'] = $row['type'];
                 $row['minute_increment'] = $row['param'];
                 break;
             default:
                 $row['select_data_type'] = $row['type'];
                 if (!isset($data_type[$row['type']])) {
                     $data_type[$row['type']] = _V(ucfirst($row['type']));
                 }
                 // ****** - field type
         }
         if (!isset($row['rset'])) {
             $row['rset'] = array('contact');
         }
         if (!isset($row['data_source'])) {
             $row['data_source'] = 'commondata';
         }
         $form->setDefaults($row);
         $selected_data = $row['type'];
         $this->admin_field_type = $row['select_data_type'];
         $this->admin_field = $row;
     } else {
         $selected_data = $form->exportValue('select_data_type');
         $form->setDefaults(array('visible' => 1, 'autonumber_prefix' => '#', 'autonumber_pad_length' => '6', 'autonumber_pad_mask' => '0'));
     }
     $this->admin_field_mode = $action;
     $this->admin_field_name = $field;
     $form->addElement('select', 'select_data_type', __('Data Type'), $data_type, array('id' => 'select_data_type', 'onchange' => 'RB_hide_form_fields()'));
     $form->addElement('text', 'text_length', __('Maximum Length'), array('id' => 'length'));
     $minute_increment_values = array(1 => 1, 2 => 2, 5 => 5, 10 => 10, 15 => 15, 20 => 20, 30 => 30, 60 => __('Full hours'));
     $form->addElement('select', 'minute_increment', __('Minutes Interval'), $minute_increment_values, array('id' => 'minute_increment'));
     $form->addElement('select', 'data_source', __('Source of Data'), array('rset' => __('Recordset'), 'commondata' => __('CommonData')), array('id' => 'data_source', 'onchange' => 'RB_hide_form_fields()'));
     $form->addElement('select', 'select_type', __('Type'), array('select' => __('Single value selection'), 'multiselect' => __('Multiple values selection')), array('id' => 'select_type'));
     $form->addElement('select', 'order_by', __('Order by'), array('key' => __('Key'), 'value' => __('Value'), 'position' => __('Position')), array('id' => 'order_by'));
     $form->addElement('text', 'commondata_table', __('CommonData table'), array('id' => 'commondata_table'));
     $tables = Utils_RecordBrowserCommon::list_installed_recordsets();
     asort($tables);
     $form->addElement('multiselect', 'rset', '<span id="rset_label">' . __('Recordset') . '</span>', $tables, array('id' => 'rset'));
     $form->addElement('text', 'label_field', __('Related field(s)'), array('id' => 'label_field'));
     $form->addFormRule(array($this, 'check_field_definitions'));
     $form->addElement('checkbox', 'visible', __('Table view'));
     $form->addElement('checkbox', 'tooltip', __('Tooltip view'));
     $form->addElement('checkbox', 'required', __('Required'), null, array('id' => 'required'));
     $form->addElement('checkbox', 'filter', __('Filter enabled'), null, array('id' => 'filter'));
     $form->addElement('checkbox', 'export', __('Export'));
     $form->addElement('text', 'autonumber_prefix', __('Prefix string'), array('id' => 'autonumber_prefix'));
     $form->addRule('autonumber_prefix', __('Double underscore is not allowed'), 'callback', array('Utils_RecordBrowser', 'qf_rule_without_double_underscore'));
     $form->addElement('text', 'autonumber_pad_length', __('Pad length'), array('id' => 'autonumber_pad_length'));
     $form->addRule('autonumber_pad_length', __('Only integer numbers are allowed.'), 'regex', '/^[0-9]*$/');
     $form->addElement('text', 'autonumber_pad_mask', __('Pad character'), array('id' => 'autonumber_pad_mask'));
     $form->addRule('autonumber_pad_mask', __('Double underscore is not allowed'), 'callback', array('Utils_RecordBrowser', 'qf_rule_without_double_underscore'));
     $form->addElement('checkbox', 'advanced', __('Edit advanced properties'), null, array('onchange' => 'RB_advanced_settings()', 'id' => 'advanced'));
     $icon = '<img src="' . Base_ThemeCommon::get_icon('info') . '" alt="info">';
     $txt = '<ul><li>&lt;Class name&gt;::&ltmethod name&gt</li><li>&ltfunction name&gt</li><li>PHP:<br />- $record (array)<br />- $links_not_recommended (bool)<br />- $field (array)<br />return "value to display";</li></ul>';
     $form->addElement('textarea', 'display_callback', __('Value display function') . Utils_TooltipCommon::create($icon, $txt, false), array('maxlength' => 255, 'style' => 'width:97%', 'id' => 'display_callback'));
     $txt = '<ul><li>&lt;Class name&gt;::&ltmethod name&gt</li><li>&ltfunction name&gt</li><li>PHP:<br />- $form (QuickForm object)<br />- $field (string)<br />- $label (string)<br />- $mode (string)<br />- $default (mixed)<br />- $desc (array)<br />- $rb_obj (RB object)<br />- $display_callback_table (array)</li></ul>';
     $form->addElement('textarea', 'QFfield_callback', __('Field generator function') . Utils_TooltipCommon::create($icon, $txt, false), array('maxlength' => 255, 'style' => 'width:97%', 'id' => 'QFfield_callback'));
     if ($action == 'edit') {
         $form->freeze('field');
         $form->freeze('select_data_type');
         $form->freeze('data_source');
         $form->freeze('rset');
     }
     if ($action == 'edit') {
         $display_callbacback = DB::GetOne('SELECT callback FROM ' . $this->tab . '_callback WHERE freezed=1 AND field=%s', array($field));
         $QFfield_callbacback = DB::GetOne('SELECT callback FROM ' . $this->tab . '_callback WHERE freezed=0 AND field=%s', array($field));
         $form->setDefaults(array('display_callback' => $display_callbacback));
         $form->setDefaults(array('QFfield_callback' => $QFfield_callbacback));
     }
     if ($form->validate()) {
         $data = $form->exportValues();
         $data['caption'] = trim($data['caption']);
         $data['field'] = trim($data['field']);
         $type = DB::GetOne('SELECT type FROM ' . $this->tab . '_field WHERE field=%s', array($field));
         if (!isset($data['select_data_type'])) {
             $data['select_data_type'] = $type;
         }
         if ($action == 'add') {
             $field = $data['field'];
         }
         $id = preg_replace('/[^a-z0-9]/', '_', strtolower($field));
         $new_id = preg_replace('/[^a-z0-9]/', '_', strtolower($data['field']));
         if (preg_match('/^[a-z0-9_]*$/', $id) == 0) {
             trigger_error('Invalid column name: ' . $field);
         }
         if (preg_match('/^[a-z0-9_]*$/', $new_id) == 0) {
             trigger_error('Invalid new column name: ' . $data['field']);
         }
         $param = '';
         switch ($data['select_data_type']) {
             case 'autonumber':
                 $data['required'] = false;
                 $data['filter'] = false;
                 $param = Utils_RecordBrowserCommon::encode_autonumber_param($data['autonumber_prefix'], $data['autonumber_pad_length'], $data['autonumber_pad_mask']);
                 // delete field and add again later to generate values
                 if ($action != 'add') {
                     Utils_RecordBrowserCommon::delete_record_field($this->tab, $field);
                     $action = 'add';
                     $field = $data['field'];
                 }
                 break;
             case 'checkbox':
             case 'calculated':
                 $data['required'] = false;
                 break;
             case 'text':
                 if ($action == 'add') {
                     $param = $data['text_length'];
                 } else {
                     if ($data['text_length'] < $row['param']) {
                         trigger_error('Invalid field length', E_USER_ERROR);
                     }
                     $param = $data['text_length'];
                     if ($data['text_length'] != $row['param']) {
                         if (DB::is_postgresql()) {
                             DB::Execute('ALTER TABLE ' . $this->tab . '_data_1 ALTER COLUMN f_' . $id . ' TYPE VARCHAR(' . $param . ')');
                         } else {
                             DB::Execute('ALTER TABLE ' . $this->tab . '_data_1 MODIFY f_' . $id . ' VARCHAR(' . $param . ')');
                         }
                     }
                 }
                 break;
             case 'select':
                 if ($data['data_source'] == 'commondata') {
                     if ($data['select_type'] == 'select') {
                         $param = Utils_RecordBrowserCommon::encode_commondata_param(array('order_by_key' => $data['order_by'], 'array_id' => $data['commondata_table']));
                         $data['select_data_type'] = 'commondata';
                     } else {
                         $param = '__COMMON__::' . $data['commondata_table'] . '::' . $data['order_by'];
                         $data['select_data_type'] = 'multiselect';
                     }
                 } else {
                     $data['select_data_type'] = $data['select_type'];
                     if (!isset($row) || !isset($row['param'])) {
                         $row['param'] = ';::';
                     }
                     $props = explode(';', $row['param']);
                     $change_param = false;
                     if ($data['rset']) {
                         $fs = explode(',', $data['label_field']);
                         if ($data['label_field']) {
                             foreach ($data['rset'] as $rset) {
                                 $ret = $this->detranslate_field_names($rset, $fs);
                                 if (!empty($ret)) {
                                     trigger_error('Invalid fields: ' . implode(',', $fs));
                                 }
                             }
                         }
                         $data['rset'] = implode(',', $data['rset']);
                         $data['label_field'] = implode('|', $fs);
                         $change_param = true;
                     } else {
                         if ($action == 'add') {
                             $data['rset'] = '__RECORDSETS__';
                             $data['label_field'] = '';
                             $change_param = true;
                         }
                     }
                     if ($change_param) {
                         $props[0] = $data['rset'] . '::' . $data['label_field'];
                         $param = implode(';', $props);
                     } else {
                         $param = $row['param'];
                     }
                 }
                 if (isset($row) && isset($row['type']) && $row['type'] == 'multiselect' && $data['select_type'] == 'select') {
                     $ret = DB::Execute('SELECT id, f_' . $id . ' AS v FROM ' . $this->tab . '_data_1 WHERE f_' . $id . ' IS NOT NULL');
                     while ($rr = $ret->FetchRow()) {
                         $v = Utils_RecordBrowserCommon::decode_multi($rr['v']);
                         $v = array_pop($v);
                         DB::Execute('UPDATE ' . $this->tab . '_data_1 SET f_' . $id . '=%s WHERE id=%d', array($v, $rr['id']));
                     }
                 }
                 if (isset($row) && isset($row['type']) && $row['type'] != 'multiselect' && $data['select_type'] == 'multiselect') {
                     if (DB::is_postgresql()) {
                         DB::Execute('ALTER TABLE ' . $this->tab . '_data_1 ALTER COLUMN f_' . $id . ' TYPE TEXT');
                     } else {
                         DB::Execute('ALTER TABLE ' . $this->tab . '_data_1 MODIFY f_' . $id . ' TEXT');
                     }
                     $ret = DB::Execute('SELECT id, f_' . $id . ' AS v FROM ' . $this->tab . '_data_1 WHERE f_' . $id . ' IS NOT NULL');
                     while ($rr = $ret->FetchRow()) {
                         $v = Utils_RecordBrowserCommon::encode_multi($rr['v']);
                         DB::Execute('UPDATE ' . $this->tab . '_data_1 SET f_' . $id . '=%s WHERE id=%d', array($v, $rr['id']));
                     }
                 }
                 break;
             case 'time':
             case 'timestamp':
                 $param = $data['minute_increment'];
                 break;
             default:
                 if (isset($row) && isset($row['param'])) {
                     $param = $row['param'];
                 }
                 break;
         }
         if ($action == 'add') {
             $id = $new_id;
             if (in_array($data['select_data_type'], array('time', 'timestamp', 'currency', 'integer'))) {
                 $style = $data['select_data_type'];
             } else {
                 $style = '';
             }
             $new_field_data = array('name' => $data['field'], 'type' => $data['select_data_type'], 'param' => $param, 'style' => $style);
             if (isset($this->admin_field['position']) && $this->admin_field['position']) {
                 $new_field_data['position'] = (int) $this->admin_field['position'];
             }
             Utils_RecordBrowserCommon::new_record_field($this->tab, $new_field_data);
         }
         if (!isset($data['visible']) || $data['visible'] == '') {
             $data['visible'] = 0;
         }
         if (!isset($data['required']) || $data['required'] == '') {
             $data['required'] = 0;
         }
         if (!isset($data['filter']) || $data['filter'] == '') {
             $data['filter'] = 0;
         }
         if (!isset($data['export']) || $data['export'] == '') {
             $data['export'] = 0;
         }
         if (!isset($data['tooltip']) || $data['tooltip'] == '') {
             $data['tooltip'] = 0;
         }
         foreach ($data as $key => $val) {
             if (is_string($val)) {
                 $data[$key] = htmlspecialchars($val);
             }
         }
         /*            DB::StartTrans();
                     if ($id!=$new_id) {
                         Utils_RecordBrowserCommon::check_table_name($this->tab);
                         if(DB::is_postgresql())
                             DB::Execute('ALTER TABLE '.$this->tab.'_data_1 RENAME COLUMN f_'.$id.' TO f_'.$new_id);
                         else {
                             $old_param = DB::GetOne('SELECT param FROM '.$this->tab.'_field WHERE field=%s', array($field));
                             DB::RenameColumn($this->tab.'_data_1', 'f_'.$id, 'f_'.$new_id, Utils_RecordBrowserCommon::actual_db_type($type, $old_param));
                         }
                     }*/
         DB::Execute('UPDATE ' . $this->tab . '_field SET caption=%s, param=%s, type=%s, field=%s, visible=%d, required=%d, filter=%d, export=%d, tooltip=%d WHERE field=%s', array($data['caption'], $param, $data['select_data_type'], $data['field'], $data['visible'], $data['required'], $data['filter'], $data['export'], $data['tooltip'], $field));
         /*            DB::Execute('UPDATE '.$this->tab.'_edit_history_data SET field=%s WHERE field=%s',
                                 array($new_id, $id));
                     DB::CompleteTrans();*/
         DB::Execute('DELETE FROM ' . $this->tab . '_callback WHERE freezed=1 AND field=%s', array($field));
         if ($data['display_callback']) {
             DB::Execute('INSERT INTO ' . $this->tab . '_callback (callback,freezed,field) VALUES (%s,1,%s)', array($data['display_callback'], $data['field']));
         }
         DB::Execute('DELETE FROM ' . $this->tab . '_callback WHERE freezed=0 AND field=%s', array($field));
         if ($data['QFfield_callback']) {
             DB::Execute('INSERT INTO ' . $this->tab . '_callback (callback,freezed,field) VALUES (%s,0,%s)', array($data['QFfield_callback'], $data['field']));
         }
         $this->init(true, true);
         return false;
     }
     $form->display_as_column();
     eval_js('RB_hide_form_fields();');
     eval_js('RB_advanced_confirmation = "' . Epesi::escapeJS(__('Changing these settings may often cause system unstability. Are you sure you want to see advanced settings?')) . '";');
     eval_js('RB_advanced_settings();');
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     Base_ActionBarCommon::add('back', __('Cancel'), $this->create_back_href());
     return true;
 }