Skip to Content.
Sympa Menu

comanage-dev - Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co

Subject: COmanage Developers List

List archive

Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co


Chronological Thread 
  • From: Scott Koranda <>
  • To: Benn Oshrin <>
  • Cc: comanage-dev <>
  • Subject: Re: [comanage-dev] Fwd: [JIRA] (CO-242) Error in inviting a person to a co
  • Date: Thu, 16 Feb 2012 15:23:11 -0600

> I thought I sent email about this but I can't find it. This is
> almost certainly because $model->validates is set up wrong.

I am not so sure.

The validation error is

2012-02-16 15:06:04 Error: Array
(
[CoOrgIdentityLink] => Array
(
[0] => Array
(
[co_person_id] => Array
(
[0] => This field cannot be left blank
)

)

)

)

Some sample data that comes from the form is

2012-02-16 15:06:04 Error: data = Array
(
[CoPerson] => Array
(
[co_id] => 2
[status] => P
)

[CoOrgIdentityLink] => Array
(
[0] => Array
(
[id] =>
[org_identity_id] => 3
)

)

[Name] => Array
(
[id] =>
[type] => P
[honorific] =>
[given] => Brian
[middle] =>
[family] => Moe
[suffix] =>
)

)

So it is co_person_id in cm_co_org_identity_links that is not
being set and I believe the error is accurate--you do want
that to be set.

I think the problem is that the line

$model->saveAll($data)

in the add() method of the StandardController is really a
saveAssociate() call and for that call the default is to
validate *all* records before any are saved. See

http://book.cakephp.org/2.0/en/models/saving-your-data.html

But since the CoPerson object has not been saved there is no
co_person_id that can go into cm_co_org_identity_links.

If you agree that my analysis is correct, then how do you want
to unwind this?

There is an option to saveAssociated() so that validation
happens table by table (validate = 'true' instead of the
default validate = 'false'), but do we want that to be applied
for every call to add() of the StandardController?

Scott



> It
> probably needs "allowEmpty" = true for whatever fields are failing
> to validate. (You can dump $this to find the error.)
>
> Annoyingly, "required" is not the same thing as "allowEmpty".
> "required" just means it needs to be present in
> $this->request->data, basically.

>
> You don't need add() because StandardController::add() will do
> everything needed.
>
> >Error in inviting a person to a co
> >----------------------------------
> >
> > Key: CO-242
> > URL: https://bugs.internet2.edu/jira/browse/CO-242
> > Project: COmanage
> > Issue Type: Bug
> > Components: Registry
> > Reporter: Marie Huynh
> > Assignee: Benn Oshrin
> > Fix For: COmanage Registry 0.4 (Reshaped Cake)
> >
> > Attachments: screenshot-1.jpg
> >
> >
> >Error message is not useful and there is only one required field.
>
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA
> administrators:
> https://bugs.internet2.edu/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>



Archive powered by MHonArc 2.6.16.

Top of Page