Topic: Custom feild Addition

hi,

Can any one tell me how to add custom field date in tracmor i am able to add the custom field and show it to the user but unable to save it in database

Thanks in Advance

Re: Custom feild Addition

Can you provide more information about the problem you're having? Are you getting any errors?

Justin Sinclair

Got Inventory? Get Tracmor.

Re: Custom feild Addition

i have added  custom Field date and showed it,similar to previously present custom fields like text, textarea, select ,i have added code to show in custom field class, in CustomFieldControlsCreate(), similarly

i have change UpdateControls fucntion like :

/*if ($objCustomFieldArray[$i]->CustomFieldSelection != null) {
                        $arrCustomFields[$i]['input']->DateTime = $objCustomFieldArray[$i]->CustomFieldDateTime->CustomFieldValueId;
                    }
                elseif ($objCustomFieldArray[$i]->RequiredFlag && $objCustomFieldArray[$i]->DefaultCustomFieldDateTime) {
                        $arrCustomFields[$i]['input']->DateTime = $objCustomFieldArray[$i]->DefaultCustomFieldDateTime;
                    }
                    else {
                        $arrCustomFields[$i]['input']->DateTime = "0000-00-00";
                    }*/

and in save control i have coded like:

if (!$blnEditMode || !$objCustomFieldArray[$i]->CustomFieldSelection) {
                        $objCustomFieldArray[$i]->CustomFieldSelection->newCustomFieldValue = new CustomFieldValue;
                        $objCustomFieldArray[$i]->CustomFieldSelection->newCustomFieldValue->CustomFieldId = $arrCustomFields[$i]['CustomFieldId'];
                        //$objCustomFieldArray[$i]->CustomFieldSelection->newCustomFieldValue->ShortDescription = CustomFieldQtype::ToString($arrCustomFields[$i]['input']->DateTime);
                        $objCustomFieldArray[$i]->CustomFieldSelection->newCustomFieldValue->CustomFieldValueId = 0;
                        $objCustomFieldArray[$i]->CustomFieldSelection->EntityId = $intEntityId;
                        $objCustomFieldArray[$i]->CustomFieldSelection->EntityQtypeId = $intEntityQtypeId;
                        $objCustomFieldArray[$i]->CustomFieldSelection->CustomFieldValueId = 0;
                        $objCustomFieldArray[$i]->CustomFieldSelection->Save();

i am getting error call to undefined function stdobj::Save()

help me to resolve issue......Thanks

Re: Custom feild Addition

Hi,

I want to add some custom fields directly to the asset table, and present them on the edit_asset.php page.  What would be the correct steps on doing this?

For example:
1) Add field to asset table
2) Modify the following .php files (in this particular order), etc.

Thanks for all the help.

Antonio