/**
  * removeRecord
  *
  * Removes HR data a person/group of people.  PZBLOAD must be fully populated
  * prior to group removal
  *
  * @since		version 1.0.0
  * @param   int $pidm Person identifier
  * @return  boolean
  * @access	public
  */
 function removeRecords($pidm = false)
 {
     if ($this->_ADOdb->GetOne("SELECT count(*) FROM pzbload WHERE pzbload_pidm IS NOT NULL") <= 0) {
         throw new HRException(HRException::HR_VIEW);
     }
     //end if
     $sql = "SELECT a.pidm,l.id\n\t\t\t\t\t\tFROM psu_identity.person_attribute a,\n\t\t\t\t\t\t\t\t psu_identity.attribute_meta m,\n\t\t\t\t\t\t\t\t psu_identity.attribute_type at,\n\t\t\t\t\t\t\t\t psu_identity.person_attribute_log l\n\t\t\t\t\t WHERE a.type_id = at.id\n\t\t\t\t\t\t AND at.name = 'role'\n\t\t\t\t\t\t AND NOT EXISTS(SELECT 1 FROM pzbload WHERE pzbload_pidm=a.pidm)\n\t\t\t\t\t\t AND m.type_id = a.type_id \n\t\t\t\t\t\t AND m.attribute = a.attribute \n\t\t\t\t\t\t AND m.meta = 'classification'\n\t\t\t\t\t\t AND a.pidm = l.pidm\n\t\t\t\t\t\t AND l.source = 'hr'\n\t\t\t\t\t\t AND l.origin_id IS NULL\n\t\t\t\t\t\t " . ($pidm ? "AND a.pidm = " . $pidm : "") . "\n\t\t\t\t\t ORDER BY a.pidm,l.id";
     if ($results = $this->_ADOdb->Execute($sql)) {
         $pidm = 0;
         while ($row = $results->FetchRow()) {
             $row = psu::cleanKeys('', '', $row);
             if ($pidm != $row['pidm']) {
                 //pidm is switching to a new person
                 $active_faculty = $this->idm->db->GetOne("SELECT 1 FROM v_faculty WHERE pidm = :pidm", array('pidm' => $row['pidm']));
                 //inactivate the person's ID Card if needed
                 if ($pidm) {
                     $this->inactivateIDCardIfNeeded($pidm);
                 }
                 //switch to the new person
                 $pidm = $row['pidm'];
             }
             //end if
             if (!$active_faculty) {
                 $this->idm->removeAttribute($row['pidm'], $row['id']);
             }
         }
         //end while
         //inactivate the ID Card of the last person we checked
         if ($pidm) {
             $this->inactivateIDCardIfNeeded($pidm);
         }
     }
     //end if
     return true;
 }
 /**
  * _load_phone
  * 
  * loads phone info for the person
  *
  * @access		protected
  */
 public function _load_phone()
 {
     $phone_data = array();
     $sql = "BEGIN :c_cursor := gb_telephone.f_query_all(:pidm); END;";
     if ($results = PSU::get('banner')->ExecuteCursor($sql, 'c_cursor', array('pidm' => $this->person->pidm))) {
         foreach ($results as $phone) {
             $phone = psu::cleanKeys('sprtele_', '', $phone);
             if ($phone['status_ind'] != 'I') {
                 $phone_data[$phone['tele_code']][] = new PSUPhone($phone);
             }
             //end if
         }
         //end foreach
     }
     //end if
     $this->person->phone = $phone_data;
 }