Beispiel #1
0
    def getContactInfos(self, context, uniq_id):
        """search within sugarcrm contacts"""

        urltool = getToolByName(context, 'portal_url')
        sugarcrm = interfaces.ISugarCRM(context)
        c = sugarcrm.get_entry(module="Contacts",id=uniq_id)

        if not c:
            return {'fullname': '',
                'phonenumber': '',
                'mail': '',
                'employeetype': '',
                'uid': uniq_id,
                'photourl': ''}

        jpegurl = urltool() + '/@@ldapJpegPhoto?uid='+uniq_id

        fullname = ' '.join((c.get('first_name','') or '',
                             c.get('last_name','') or '')).strip()

        return {'fullname': fullname,
                'phonenumber': c.get('phone_work',''),
                'mail': encode_email(c.get('email1',''), c.get('email1','')),
                'employeetype': c.get('title',''),
                'uid': uniq_id,
                'photourl': ''}
 def getContactInfos(self, uniq_id):
     # Used by the portlet
     if uniq_id != 'uniq_id':
         return None
     self.update()
     props = self.properties
     return {'fullname': props.dummy_fullname,
             'phonenumber': props.dummy_phone,
             'mail': encode_email(props.dummy_mail,
                                  props.dummy_mail),
             'employeetype': props.dummy_employee_type,
             'photourl': props.dummy_photo_url}
 def getContactInfos(self, uniq_id):
     context = self.context
     # Used by the portlet
     urltool = getToolByName(context, 'portal_url')
     contacts = self._search(search_on='uid',
                             query=uniq_id,
                             attrs=['uid', 'cn', 'mail', 'telephoneNumber',
                                    'employeeType'],
                             limit=1)
     if contacts:
         c = contacts[0]
         uid = c['datas']['uid']
         path = '/@@collective_portlet_contact_photo?uid=' + uid
         jpegurl = urltool() + path
         return {'fullname': c['datas']['cn'],
                 'phonenumber': c['datas']['telephoneNumber'],
                 'mail': encode_email(c['datas']['mail'],
                                      c['datas']['mail']),
                 'employeetype': c['datas']['employeeType'],
                 'uid': c['datas']['uid'],
                 'photourl': jpegurl}
     else:
         return None