« Return to Thread: Custom edit handler for extended dmProfile - error. FC 5.1.5

Re: Custom edit handler for extended dmProfile - error. FC 5.1.5

by Blair McKenzie-2 :: Rate this Message:

Reply to Author | View in Thread

It looks like the section where the username is edited for a new user isn't being included in the form. You should check the various parts of that logic to see if something is screwing it up. e.g. if stUser is somehow returning a non-empty struct.

Blair

On Thu, Jun 25, 2009 at 2:29 AM, Chris Roth <chris.roth@...> wrote:

Hi.

I have extended dmprofile (via a plugin) to accept some additional
properties.

in myplugin/packages/types/dmprofile.cfc I have...

<cfcomponent extends="farcry.core.packages.types.dmProfile"
displayName="User Profile" hint="Every user in the system has their
own profile from staff to community members. You can create new users,
edit existing ones or change the group they belong to.">

... my new properites...

The dmprofile type has been deployed...

In myplugin/customadmin/customlists/dmProfile.cfm I tweaked the
ftt:objectadmin to include some additional fields for listing and
sorting and filtering. I modified the customadmin.xml in the plugin to
overridethe webtop

in myplugin/webskin/dmprifole/edit.cfc

I have copied it exactly from core, but edited the view to be:

<ft:form>

       <ft:object objectid="#stObj.objectid#" typename="dmProfile"
lfields="company,address1,address2,city,state,region,country,postalcode,firstname,lastname,emailaddress,breceiveemail,phone,phone2,fax,url,overviewHome"
lhiddenFields="userdirectory,position,department,locale" legend="User
details" />


       <cfif stObj.userdirectory eq "CLIENTUD" or stObj.userdirectory eq "">

               <cfset userID = application.factory.oUtils.listSlice(stObj.username,
1,-2,"_") />
               <cfset stUser = oUser.getByUserID(userID) />

               <cfif structIsEmpty(stUser)>
                       <skin:view key="newprofileuser" typename="farUser"
webskin="editProfileUser" />
               <cfelse>
                       <ft:object stObject="#stUser#" typename="farUser"
lfields="userstatus,aGroups" legend="Security" />
               </cfif>

       </cfif>

<ft:object objectid="#stObj.objectid#" typename="dmProfile"
lfields="publicnotes,onWeb,territories,productlines,pricelists"
legend="Sales Rep details" />


       <ft:farcryButtonPanel>
               <ft:button value="Save" color="orange" />
               <ft:button value="Cancel" validate="false" />
       </ft:farcryButtonPanel>
</ft:form>
At this pouint everything seems to work as expected, however, when I
go to edit an existing user (clientud) and save, an error is thrown
"username is undefined in stProperties" on line 31 of the extended
edit handler (this is the "action" section. If I remove my custom
handler it works fine (but ofcouse my fields are not there)

<!-----------------------------
ACTION
------------------------------>
<ft:serverSideValidation />

<ft:processform action="Save" exit="true">
       <ft:processformobjects typename="farUser"
lArrayListGenerate="lgroups" />

       <!--- track whether we have saved a farUser record--->
       <cfset savedUserID = lsavedobjectids />

       <ft:processformobjects typename="dmProfile">

               <!--- We only check the profile/faruser relationship if we saved a
CLIENTUD user --->
               <cfif len(savedUserID)>
                       <cfset stUser = oUser.getData(objectid=savedUserID) />

                       <!--- If the current username is not the same one we saved (ie. new
user) --->
                       <cfif stProperties.username NEQ "#stUser.userid#_CLIENTUD"><!---
New user --->
                               <cfset stProperties.username = "#stUser.userid#_CLIENTUD" />
                               <cfset stProperties.userdirectory = "CLIENTUD" />
                       </cfif>
               </cfif>

       </ft:processformobjects>
</ft:processform>


Ideas?





--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: Custom edit handler for extended dmProfile - error. FC 5.1.5