Exemple #1
0
 public function __construct($rules = false)
 {
     // if querybuilder is used response-time will increase -> set_key_property hast to be removed
     $this->_result_mc = org_openpsa_contacts_person_dba::new_collector('metadata.deleted', false);
     if ($rules) {
         return $this->resolve($rules);
     }
 }
Exemple #2
0
 /**
  * Find duplicates for given all org_openpsa_contacts_person_dba objects in database
  *
  * @return array array of persons with their possible duplicates
  */
 function check_all_persons($threshold = 1)
 {
     midcom::get()->disable_limits();
     // PONDER: Can we do this in smaller batches using find_duplicated_person
     /*
       IDEA: Make an AT method for checking single persons duplicates, then another to batch
       register a check for every person in batches of say 500.
     */
     $ret = array();
     $ret['objects'] = array();
     $ret['p_map'] = array();
     $ret['threshold'] =& $threshold;
     $persons = array();
     $mc = org_openpsa_contacts_person_dba::new_collector('metadata.deleted', false);
     $mc->add_value_property('firstname');
     $mc->add_value_property('id');
     $mc->add_value_property('lastname');
     $mc->add_value_property('email');
     $mc->add_value_property('handphone');
     $mc->add_value_property('homephone');
     $mc->add_value_property('city');
     $mc->add_value_property('street');
     $mc->execute();
     $results = $mc->list_keys();
     if (empty($results)) {
         return $ret;
     }
     foreach ($results as $guid => $result) {
         $person = $mc->get($guid);
         $persons[] = self::_normalize_person_fields($person, $guid);
     }
     $params = array();
     $params['ret'] =& $ret;
     $params['finder'] =& $this;
     $params['objects'] =& $persons;
     $params['mode'] = 'person';
     array_walk($persons, array('self', '_check_all_arraywalk'), $params);
     return $ret;
 }