$Contact->SetDiscloseList($PendingOperation->ObjectBefore->GetDiscloseList()); DBContact::GetInstance()->Save($Contact); $okmsg = _("Contact update rejected"); } else { if ($PendingOperation->Type == Registry::OP_CREATE_APPROVE) { DBContact::GetInstance()->Delete($Contact); $okmsg = _("Contact create rejected"); } } } EmailToRegistrantObserver::OnCompleteChangeContactRequest($Contact, $PendingOperation->Type, $req_approve, true); CoreUtils::Redirect("contacts_change_requests.php"); break; } catch (Exception $e) { $err[] = $e->getMessage(); EmailToRegistrantObserver::OnCompleteChangeContactRequest($Contact, $PendingOperation->Type, $req_approve, false, $e->getMessage()); // Restore data to previous state if ($PendingOperation->Type == Registry::OP_UPDATE_APPROVE) { $fields = array(); foreach ($Contact->GetEditableNames() as $n) { $fields[$n] = $PendingOperation->ObjectBefore->GetField($n); } $Contact->SetFieldList($fields); $Contact->SetDiscloseList($PendingOperation->ObjectBefore->GetDiscloseList()); DBContact::GetInstance()->Save($Contact); } else { if ($PendingOperation->Type == Registry::OP_CREATE_APPROVE) { DBContact::GetInstance()->Delete($Contact); } } }
} if (!$err) { $Contact->UserID = $_SESSION['userid']; try { $ContactConfig = $Contact->GetConfig(); $need_approval = $ContactConfig->policy->approveChangesPolicy && $ContactConfig->policy->approveChangesPolicy->getName(); if ($need_approval) { DBContact::GetInstance()->Save($Contact); $Registry->AddPendingOperation($Contact, Registry::OP_CREATE_APPROVE); EmailToRegistrantObserver::OnNewChangeContactRequest($Contact, Registry::OP_CREATE_APPROVE); } else { $Contact = $Registry->CreateContact($Contact); } $res = true; $data = array( 'title' => $Contact->GetTitle(), "id" => $Contact->CLID, "groupname" => $groupname ); } catch (Exception $e)