Example #1
0
 function save($df)
 {
     //the currency field
     $this->default = unformat_number($this->default);
     $this->default_value = $this->default;
     parent::save($df);
     //currency id
     $currency_id = new TemplateCurrencyId();
     $currency_id->name = 'currency_id';
     $currency_id->vname = 'LBL_CURRENCY';
     $currency_id->label = $currency_id->vname;
     $currency_id->save($df);
     //$df->addLabel($currency_id->vname);
 }
Example #2
0
 function save($df)
 {
     if (!empty($this->default_value) && is_array($this->default_value)) {
         $this->default_value = $this->default_value[0];
     }
     if (!empty($this->default) && is_array($this->default)) {
         $this->default = $this->default[0];
     }
     if (!empty($this->visibility_grid) && is_string($this->visibility_grid)) {
         $this->visibility_grid = json_decode($this->visibility_grid, true);
     }
     parent::save($df);
 }
 function save($df)
 {
     // create the new ID field associated with this relate field - this will hold the id of the related record
     // this field must have a unique name as the name is used when constructing quicksearches and when saving the field
     //Check if we have not saved this field so we don't create two ID fields.
     //Users should not be able to switch the module after having saved it once.
     if (!$df->fieldExists($this->name)) {
         $id = new TemplateId();
         $id->len = 36;
         $id->label = strtoupper("LBL_{$this->name}_" . BeanFactory::getBeanName($this->ext2) . "_ID");
         $id->vname = $id->label;
         $this->saveIdLabel($id->label, $df);
         $count = 0;
         $basename = strtolower(get_singular_bean_name($this->ext2)) . '_id';
         $idName = $basename . '_c';
         while ($df->fieldExists($idName, 'id')) {
             $idName = $basename . ++$count . '_c';
         }
         $id->name = $idName;
         $id->reportable = false;
         $id->save($df);
         // record the id field's name, and save
         $this->ext3 = $id->name;
         $this->id_name = $id->name;
     }
     parent::save($df);
 }
Example #4
0
 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;
     }
 }
 function save($df)
 {
     if (!empty($this->default_value) && is_array($this->default_value)) {
         $this->default_value = $this->default_value[0];
     }
     if (!empty($this->default) && is_array($this->default)) {
         $this->default = $this->default[0];
     }
     parent::save($df);
 }
 function save($df)
 {
     parent::save($df);
 }
Example #7
0
 function save($df)
 {
     if (!empty($this->default_value) && is_array($this->default_value)) {
         $this->default_value = $this->default_value[0];
     }
     if (!empty($this->default) && is_array($this->default)) {
         $this->default = $this->default[0];
     }
     if (get_class($this) == 'TemplateEnum' && isset($this->dependency)) {
         $this->ext4 = serialize($this->dependency);
     }
     parent::save($df);
 }