public function sendDeleteNotification(IDupeMemberDeleteRequest $request) { $dupe = $request->getDupeAccount(); $email_to = $dupe->getEmail(); $email = EmailFactory::getInstance()->buildEmail(DUPE_EMAIL_FROM, $email_to, "You Have Requested to Delete Openstack Duplicated Account"); $template_data = array('FirstName' => $dupe->getFirstName(), 'LastName' => $dupe->getLastName(), 'DupeAccount' => $email_to); $email->setTemplate('DupeMembers_DeleteAccountEmail'); do { $token = $request->generateConfirmationHash(); } while ($this->delete_request_repository->existsConfirmationToken($token)); $template_data['ConfirmationLink'] = sprintf('%s/dupes-members/%s/delete', Director::protocolAndHost(), $token); $email->populateTemplate($template_data); $email->send(); }
public function getDupes(ICommunityMember $member) { list($res, $count) = $this->member_repository->getAllByName($member->getFirstName(), $member->getLastName()); $unset = array(); for ($i = 0; $i < count($res); $i++) { if ($res[$i]->getIdentifier() == $member->getIdentifier()) { array_push($unset, $i); continue; } //check merge request $merge_request = $this->merge_request_repository->findByDupeAccount($res[$i]->getEmail()); if (!is_null($merge_request)) { array_push($unset, $i); } // check delete request $delete_request = $this->delete_request_repository->findByDupeAccount($res[$i]->getEmail()); if (!is_null($delete_request)) { array_push($unset, $i); } // check not my account action $query = new QueryObject(); $query->addAndCondition(QueryCriteria::equal('PrimaryAccountID', $member->getIdentifier())); $query->addAndCondition(QueryCriteria::equal('ForeignAccountID', $res[$i]->getIdentifier())); $action = $this->not_my_account_repository->getBy($query); if (!is_null($action)) { array_push($unset, $i); } } for ($j = 0; $j < count($unset); $j++) { $index = $unset[$j]; unset($res[$index]); } return $res; }