[OGo-Developer] accessing telephone numbers of team members in OGOGroupsPage

Sebastian Reitenbach developer@opengroupware.org
Tue, 06 Mar 2007 09:09:12 +0100


Hi Helge,
> 
> Well, I suppose the telephones are not fetched into the mentioned  
> records. "session.teams" isn't really a recommended way to access  
> teams anyways.

in OGoGroupsPage.m it fetches the members like this:
  /* fetch members */
  members = [cmdctx runCommand:@"team::members",
                    @"teams",      self->groupList,
                    @"returnType", intObj(LSDBReturnType_ManyObjects),
                    nil];

team::members is defined in LSGetMemberForTeamCommand.m, in method
- (void)_fetchMembersOfTeam:(id)team inContext:(id)_context {
...
  LSRunCommandV(_context, @"person", @"get-extattrs",
                @"objects", m,
                @"relationKey", @"companyValue", nil);

  /* get telephones */
  LSRunCommandV(_context, @"person", @"get-telephones",
                @"objects", m,
                @"relationKey", @"telephones", nil);

this is called, and get-telephones is defined in LSFetchTelsForPersonCommand.m
and looks like 
this (including my NSLog statements):

- (void)_setTels {
  int i, cnt = [[self object] count];
NSLog(@"in %@, setting telephones", [self description]);
  for (i = 0; i < cnt; i++) {
    id  obj         = [[self object] objectAtIndex:i];
    NSArray *tels   = [obj valueForKey:@"telephones"];
    int     j, cnt2 = [tels count];
NSLog(@"tels arrary: %@", tels);
    for (j = 0; j < cnt2; j++) {
      id tel = [tels objectAtIndex:j];

      [obj takeValue:[tel valueForKey:@"number"]
           forKey:[tel valueForKey:@"type"]];
    }
NSLog(@"Telephones object: obj: %@", obj);
  }
}

I see, because of the NSLog statements,  the telephone information is fetchted
from the 
database, but If it is not used, I wonder why it is done in the first place. I
wonder how I 
could the already fetched values up into the member record?


another question, what are the differences between calling a command like this:
  /* get telephones */
  LSRunCommandV(_context, @"person", @"get-telephones",
                @"objects", m,
                @"relationKey", @"telephones", nil);

and like this:
  members = [cmdctx runCommand:@"team::members",
                    @"teams",      self->groupList,
                    @"returnType", intObj(LSDBReturnType_ManyObjects),
                    nil];



> 
> I think the best bet is too look at the Appointment-Viewer "view  
> details" button and what it does.
maybe I should do this, but I thought it would be cleaner to use what is there
in the 
OGoGroupsPage, but if nothing helps, I'll need to take a look there.

Sebastian