function save($df) { $this->ext1 = 'parent_type_display'; $this->name = 'parent_name'; $this->default_value = ''; parent::save($df); // always save because we may have updates //save parent_type $parent_type = new TemplateParentType(); $parent_type->name = 'parent_type'; $parent_type->vname = 'LBL_PARENT_TYPE'; $parent_type->label = $parent_type->vname; $parent_type->len = 255; $parent_type->importable = $this->importable; $parent_type->save($df); //save parent_name $parent_id = new TemplateId(); $parent_id->name = 'parent_id'; $parent_id->vname = 'LBL_PARENT_ID'; $parent_id->label = $parent_id->vname; $parent_id->len = 36; $parent_id->importable = $this->importable; $parent_id->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); }
function save($df) { if (!$df->fieldExists($this->name)) { parent::save($df); } }