my question consists of two parts:
1, I'm developing small ticketing software for technical support. I have model and views for Workorder (type of ticket). I would like to include another model's
field/input
into this model. This model
is called WorkorderJournalUpdate
. It's basicly just table with 3 rows:
*id, workorder_id, text*
. In this case, "workorder_id"
is in HAS_MANY
relation with "workorder_id
" in Workorder model/table
.
The reason why I want to include this field/model
is to create unique journal record after each Workorder update, so it looks like this:
http://luzer.eu/pu_files/27844_RelationsTC.jpg
//Edit: It would be great, if I could add new journal entry on each page update and as well read all previous records.
2, this part of my question is simple. I would like to make rule in model to make certain fields required, but only if other field is filled in. For example:
Order ID:
Ordered by:
If Order ID
is not filled in, Ordered by should not be required. If Ordered by is filled in and Order ID
is not, Order ID
should be required
. Is this possible with "required
on" rule
?
This is all, hopefully, somebody will be able to help me. Thank you in advance!
May be this like can help you
http://www.yiiframework.com/wiki/19/how-to-use-a-single-form-to-collect-data-for-two-or-more-models/