How do we add custom fields in Infor syteline - erp

I have a new requirement to add a custom field called document number in the item form which should be editable.

We should use the following steps to create a custom fields.
Creating a user class - The user class definition is the highest level to extend an application database table.
Creating user fields - User fields are generic and can be a part of many classes. If the user changes any property of a user field, all user classes inherit the change.
Associating the user field with a user class - The UET tools look for this association to place the user fields in the form that belongs to the user class.
Linking an application database table with the user class - The association between a table and a class provides the information that UET needs to retrieve, arrange, and display the user fields that belong to a user class. To link the table with the class, define a rule that determines if the record accessed has a valid user class associated with it. If valid data is entered in existing fields to make the rule expression true, the new user field displays.
Impacting the schema - Use the UET Impact Schema form to apply the changes you made in the previous steps to all affected databases.

Related

Create a Attribute programmatically, Core Data [duplicate]

i have a simple iphone project which contains a simple xcdatamodel that has a single entity
with roughly 3 attributes..
i want to know if there is a way to programmatically add an attribute to an entity..
i.e. if the user presses an "add" button of some kind, a simple string attribute is added to the entity and saved..
If this is not possible could someone point me in the right direction..
You can programmatically alter entities but you can't alter a managed object model after it has been assigned to a managed object context so that makes it useless for any user defined alterations. In any case, you wouldn't want to add entities programmatically because that would make your previously created persistent store file useless.
If you want to create a more free-form , user extensible data model, you have to back out and make your entities more flexible by adding an optional relationship to another entity or entity inheritance group that can model additional data.
For example: Suppose you have a contact list and you want to add free form fields to each contact. You would set up your entities like this.
Contact{
name:string
phone:string
userDefinedFields<-->>UserDefined.contact
}
UserDefined{
name:string
contact<<-->Contact.userDefinedFields
}
Whenever the user adds a new field, you create a new UserDefined object and add it the Contact.userDefinedFeilds relationship. You can flesh that out as needed. If you need more than one type of user defined field you should set it up like this:
Contact{
name:string
phone:string
userDefinedFields<-->>UserDefined.contact
}
UserDefined{
name:string
contact<<-->Contact.userDefinedFields
}
TextField:UserDefined{
text:string
}
NumberField:UserDefined{
numValue:Number
}
You can then drop in a TextField or NumberField object into the Contact.userDefinedFields as needed.
i am not so sure if you can add an attribute with code, but maybe you can consider using one to many relationship?

Spring: Object stored and used in Sitemesh decorator

This is probably a newbie question.
I have a table USER which contains info about login, pass and authorities. Depending on authority or role, detail information about each user can be found in one of following: Teacher, Student, Parent. When the User logs in, the information stored in USER table can be easly taken from security context.
I want to display first name and last name all the time in the header after log in - these can be fetched from the other tables.
My question is this: how do I handle storing one of these objects in session all the time? Or is it okay just to store User (its stored by spring) and then fetch particular table every time I need detail information?
I use spring security 3, hibernate, jsp, sitemash.
For more clarification:
I know how to deal with logged user and to restrict some content. Login details (id, pass, role) are stored in USER table and this is ok - I can fetch it and show whereever I want. The problem is that the details about a particular user (address, name, email, etc) are stored in in another table (STUDENT, TEACHER, PARENT - depending on the role in USER table). This is what I want to know on every page - for example to show his/her name.
TO cut it short -
1. you need to extend spring User to provide additional fields.
2. you need to implement UserDetailsService interface and reference it in the security context.
3. Now you can fetch your object in a controller like this: authentication.getPrincipal() - rememebr to cast to your type.
Additionaly - personally i always have AbstracController which is a base for every controller in my project. There, among others, I have method which returns current principal.

How to add a temporary field to my devise form to use later?

I want to give users the option of registering as a specified kind of user. The user type field however is in a separate table (for security reasons) so when I create a new account I also create a new record in the other table for that account.
So as far as I can tell, I can either create a new field in my devise created user table and then after_create have my model check for that field and then add it to my associated user permissions table. But that seems redundant, so is there a way to add some sort of temporary variable to the form and use that to create the user type?
When you want to create/edit two or more objects in the same form then you should user nested forms. You will find all necessery information in this two railscasts: http://railscasts.com/episodes/196-nested-model-form-part-1 and http://railscasts.com/episodes/197-nested-model-form-part-2

How does the Rails' single table inheritance works?

I have a user table, and a teacher that I newly created. The teacher is sub class of user, so, I use scaffold generator to generate the teacher table, than, I modify the model to do teacher is subclass of user. After all that, I did a db:migrate. Then, I go to
http://localhost:3000/teachers/new
It shows an error:
undefined method `teacherSalary' for #<Teacher:0x103331900>
So, my question is what did I do wrong? I want to create a page for doing user register, the user can ONLY be a teacher / student. But I can't add a teacher record ... ... Moreover, I go to
http://localhost:3000/users/new
I want to have a combo box that allow user register their user to be a "teacher" or a "student". But everything seems not work like I expected. What I need to do? Thank you very very much for your help.
Within your database you should have a single table called users. This table should have a string column which by default is called type. If you use another name for this column then you will have to set the inheritance column name manually using self.inheritance_column = "column_name"
Within your application you have three models, User, Student and Teacher. User inherits from ActiveRecord::Base as usual, Student and Teacher both inherit from User.
You should then be able to instantiate new Teacher and Student objects. Internally this works by writing the model name to the type field on the user tables and then when you use Student.find it adds a clause to the SQL to only return rows where the type = 'Student'
You can add shared behaviour to the User class, e.g. validations etc then add additional behaviour to the inherited classes.
A fuller description of how STI works can be found in Martin Fowlers Book(Patterns of Enterprise Application Architecture).
I found this definition really handy:
STI means one table contains the data of more than one model, usually differentiated by the "type" column. ("users" table contains data for the models "Teacher", ""Pupil", "Employee", "Assistant", etc.)
Keeps similar models in the same table instead of creating new ones.
A Polymorphic Association means that one model can be associated with more than one other model(Comment can belong to post, image, file, user_type...)
To prevent foreign key conflicts, the association is reperesented with the *_id and *_type columns instead of only *_id.
For what you have here , I am not sure if STI is the best way go . STI should generally be used when there is a OO like inheritance and the Models have the same Attribute but different behaviour . In your case Teacher and Student can sure have a few shared attributed , but they are also bound to have different ones as well .
You might want to experiment with a polymorphic association as well .

Setting default values across multiple children in a multi model form (Rails 2.3 )

Am trying to simplify the create / edit view for a multi-model controller.
User can dymically add / remove child input fields from the form. (Have followed Eloy's complex form example)
I want to limit the user's ability to set certain attributes across multilpe children..
Suppose I have a child attribute with and I want the user to only input the date once.. eg the date will be the same across all children..
I would like present a single date entry box and then multiple Adults | Seniors boxes depending on the number of children the user wants to submit.
using accepts_nested_attributes_for my form is showing multiple date boxes..
(Since I want to retain the ability to do this as an admin I don't want to move the date attribute to the parent.)
How should I go about adapting the form without having to extend the controller logic too much?
If you have business logic that states that all of your children models have the same date, then I see this working a couple different ways.
First of all, maybe you have your data in the wrong place. If the date is always going to be the same for all of the children models, then why not make it an attribute on your parent model instead? You can always use the delegate method in your children model to fetch the date from the parent.
Another way I see of handling this is with a virtual attribute and a callback on your parent model. Use attr_accessor to create a virtual attribute on your parent model. Then in your form, add a field for the date to the parent model with the name you used to define the attr_accessor. Finally, add in a before_save callback (or whichever callback is appropriate for your case) in the parent model that saves the date to all of the children.

Resources