public function btnCreate_Click($strFormId, $strControlId, $strParameter)
 {
     // Create a new person.
     $objPerson = new Person();
     $objPerson->FirstName = $this->objRegistrant->FirstName;
     $objPerson->LastName = $this->objRegistrant->LastName;
     $objPerson->Gender = $this->objRegistrant->Gender;
     $objPerson->PrimaryAddressText = $this->objRegistrant->Address;
     $objPerson->PrimaryCityText = $this->objRegistrant->City;
     $objPerson->PrimaryZipCodeText = $this->objRegistrant->Zipcode;
     $objPerson->PrimaryPhoneText = $this->objRegistrant->Phone;
     $objPerson->MembershipStatusTypeId = MembershipStatusType::NonMember;
     $objPerson->MaritalStatusTypeId = MaritalStatusType::NotSpecified;
     $objPerson->DeceasedFlag = false;
     $intPersonId = $objPerson->Save();
     $objEmail = new Email();
     $objEmail->Address = $this->objRegistrant->Email;
     $objEmail->PersonId = $intPersonId;
     $objEmail->Save();
     $this->intPersonId = $intPersonId;
     $pnlProjectView = new CpGroup_RegistrationStep2Panel($this->nextPanel, $this->objRegistrant, $this->intPersonId, $this->strMethodCallBack);
 }
Beispiel #2
0
 protected static function GenerateAddressesAndPhonesForPerson(Person $objPerson)
 {
     $intAddressCount = rand(0, 5);
     for ($i = 0; $i < $intAddressCount; $i++) {
         $objAddress = new Address();
         $objAddress->AddressTypeId = QDataGen::GenerateFromArray(array_keys(AddressType::$NameArray));
         $objAddress->Person = $objPerson;
         $objAddress->Address1 = QDataGen::GenerateStreetAddress();
         if (rand(0, 1)) {
             $objAddress->Address2 = QDataGen::GenerateAddressLine2();
         }
         $objAddress->City = QDataGen::GenerateCity();
         $objAddress->State = QDataGen::GenerateUsState();
         $objAddress->ZipCode = rand(10000, 99999);
         $objAddress->Country = 'US';
         $objAddress->InvalidFlag = false;
         $objAddress->VerificationCheckedFlag = true;
         switch ($objAddress->AddressTypeId) {
             case AddressType::Temporary:
                 $objAddress->CurrentFlag = true;
                 $dttNextYear = QDateTime::Now();
                 $dttNextYear->Year++;
                 $objAddress->DateUntilWhen = QDataGen::GenerateDateTime(QDateTime::Now(), $dttNextYear);
                 break;
             default:
                 $objAddress->CurrentFlag = rand(0, 1);
                 break;
         }
         $objAddress->Save();
     }
     $intPhoneCount = rand(0, 5);
     $objPhoneArray = array();
     for ($i = 0; $i < $intPhoneCount; $i++) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = QDataGen::GenerateFromArray(array_keys(PhoneType::$NameArray));
         while ($objPhone->PhoneTypeId == PhoneType::Home) {
             $objPhone->PhoneTypeId = QDataGen::GenerateFromArray(array_keys(PhoneType::$NameArray));
         }
         $objPhone->Number = QDataGen::GeneratePhone();
         $objPhone->Person = $objPerson;
         $objPhone->Save();
         $objPhoneArray[] = $objPhone;
     }
     if ($intPhoneCount && !rand(0, 2)) {
         QDataGen::GenerateFromArray($objPhoneArray)->SetAsPrimary();
     }
     $intEmailCount = rand(0, 5);
     $objEmailArray = array();
     for ($i = 0; $i < $intEmailCount; $i++) {
         $objEmail = new Email();
         $objEmail->Address = QDataGen::GenerateEmail($objPerson->FirstName, $objPerson->LastName);
         $objEmail->Person = $objPerson;
         $objEmail->Save();
         $objEmailArray[] = $objEmail;
     }
     if ($intEmailCount && !rand(0, 2)) {
         QDataGen::GenerateFromArray($objEmailArray)->SetAsPrimary();
     }
     $intMaxId = OtherContactMethod::CountAll();
     for ($intOtherContactMethodId = 1; $intOtherContactMethodId <= $intMaxId; $intOtherContactMethodId++) {
         if (!rand(0, 2)) {
             $objContactInfo = new OtherContactInfo();
             $objContactInfo->Person = $objPerson;
             $objContactInfo->OtherContactMethodId = $intOtherContactMethodId;
             $objContactInfo->Value = QDataGen::GenerateUsername($objPerson->FirstName, $objPerson->LastName);
             $objContactInfo->Save();
         }
     }
 }
Beispiel #3
0
 /**
  * Given a string-based email address, this will see if this email is already associated with this person
  * and if so, it will upgrade that email record to be "Primary".  If not, it will delete the current primary (if applicable)
  * and create a new record for the passed-in string.
  * @param string $strEmailAddress
  * @param boolean $blnDeleteCurrentPrimary (default is true) whether or not to delete the current primary
  */
 public function ChangePrimaryEmailTo($strEmailAddress, $blnDeleteCurrentPrimary = true)
 {
     $strEmailAddress = trim(strtolower($strEmailAddress));
     // If what was passed in is already primary, then do nothing
     if ($this->PrimaryEmail && $this->PrimaryEmail->Address == $strEmailAddress) {
         return;
     }
     // If what was passed in already exists as non-primary, upgrade it to primary and downgrade current primary to not so (if applicable)
     foreach ($this->GetEmailArray() as $objEmail) {
         if ($objEmail->Address == $strEmailAddress) {
             $this->PrimaryEmail = $objEmail;
             $this->Save();
             return;
         }
     }
     // If we are here, then we *know* we need to create a new email address
     // first, delete the current primary, if applicable
     if ($this->PrimaryEmail && $blnDeleteCurrentPrimary) {
         $this->PrimaryEmail->Delete();
         $this->PrimaryEmail = null;
     }
     $objEmail = new Email();
     $objEmail->Address = $strEmailAddress;
     $objEmail->Person = $this;
     $objEmail->Save();
     $this->PrimaryEmail = $objEmail;
     $this->Save();
 }
Beispiel #4
0
Datei: new.php Projekt: alcf/chms
 protected function SaveSpouse()
 {
     // Fixup Middle
     $this->txtSpouseMiddleName->Text = trim($this->txtSpouseMiddleName->Text);
     if (strlen($this->txtSpouseMiddleName->Text) == 1) {
         $this->txtSpouseMiddleName->Text = strtoupper($this->txtSpouseMiddleName->Text);
     } else {
         if (strlen($this->txtSpouseMiddleName->Text) == 2 && $this->txtSpouseMiddleName->Text[1] == '.') {
             $this->txtSpouseMiddleName->Text = strtoupper($this->txtSpouseMiddleName->Text[0]);
         }
     }
     // Update Gender and Types and Save
     $this->mctSpouse->Person->Gender = $this->lstSpouseGender->SelectedValue;
     $this->mctSpouse->Person->MembershipStatusTypeId = MembershipStatusType::NonMember;
     $this->mctSpouse->Person->MaritalStatusTypeId = MaritalStatusType::NotSpecified;
     $this->mctSpouse->Person->DeceasedFlag = false;
     $this->mctSpouse->SavePerson();
     $this->mctSpouse->Person->RefreshNameItemAssociations();
     // Is there a home address?
     if ($objHousehold = Household::LoadByHeadPersonId($this->mctPerson->Person->Id)) {
         $objHousehold->AssociatePerson($this->mctSpouse->Person);
     }
     // Email
     if (trim($this->txtSpouseEmail->Text)) {
         $objEmail = new Email();
         $objEmail->Person = $this->mctSpouse->Person;
         $objEmail->Address = trim($this->txtSpouseEmail->Text);
         $objEmail->Save();
         $this->mctSpouse->Person->PrimaryEmail = $objEmail;
     }
     // Phones
     if (trim($this->txtSpouseCellPhone->Text)) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = PhoneType::Mobile;
         $objPhone->Person = $this->mctSpouse->Person;
         $objPhone->Number = trim($this->txtSpouseCellPhone->Text);
         $objPhone->MobileProviderId = $this->lstSpouseMobileProvider->SelectedValue;
         $objPhone->Save();
         $this->mctSpouse->Person->PrimaryPhone = $objPhone;
     }
     if (trim($this->txtSpouseHomePhone->Text)) {
         if ($this->txtSpouseHomePhone->Text != $this->txtPersonHomePhone->Text) {
             $objPhone = new Phone();
             $objPhone->PhoneTypeId = PhoneType::Home;
             $objPhone->Number = trim($this->txtSpouseHomePhone->Text);
             if ($objHousehold) {
                 $objPhone->Address = $this->mctAddress->Address;
             } else {
                 $objPhone->Person = $this->mctSpouse->Person;
             }
             $objPhone->Save();
         } else {
             $objPhone = $this->objHomePhone;
         }
         if (!$this->mctSpouse->Person->PrimaryPhone) {
             $this->mctSpouse->Person->PrimaryPhone = $objPhone;
         }
         if ($this->mctAddress->Address->Id && !$this->mctAddress->Address->PrimaryPhone) {
             $this->mctAddress->Address->PrimaryPhone = $objPhone;
             $this->mctAddress->Address->Save();
         }
     }
     if (trim($this->txtSpouseWorkPhone->Text)) {
         $objPhone = new Phone();
         $objPhone->PhoneTypeId = PhoneType::Work;
         $objPhone->Person = $this->mctSpouse->Person;
         $objPhone->Number = trim($this->txtSpouseWorkPhone->Text);
         $objPhone->Save();
         if (!$this->mctSpouse->Person->PrimaryPhone) {
             $this->mctSpouse->Person->PrimaryPhone = $objPhone;
         }
     }
 }
Beispiel #5
0
 /**
  * Called back from PaymentPanel to perform final tasks after we know
  * the payment has been submitted successfully.
  */
 public function PaymentPanel_Success(OnlineDonation $objPaymentObject)
 {
     $strEmailAddress = trim(strtolower($this->txtEmail->Text));
     // If there is a "address in waiting" for this OnlineDonation
     // Then it was a newly-created Person object
     // Let's create the household for this person
     if ($objPaymentObject->Address) {
         $objPerson = $objPaymentObject->Person;
         $objHousehold = Household::CreateHousehold($objPerson);
         $objAddress = $objPaymentObject->Address;
         $objAddress->AddressTypeId = AddressType::Home;
         $objAddress->CurrentFlag = true;
         $objAddress->Household = $objHousehold;
         $objAddress->Save();
         $objHousehold->SetAsCurrentAddress($objAddress);
         // Add Email Address
         if ($strEmailAddress) {
             $objEmail = new Email();
             $objEmail->Address = $strEmailAddress;
             $objEmail->Person = $objPerson;
             $objEmail->Save();
             $objEmail->SetAsPrimary();
         }
     }
     if (QApplication::$PublicLogin) {
         $objPaymentObject->SendConfirmationEmail();
     } else {
         if ($strEmailAddress) {
             $objPaymentObject->SendConfirmationEmail($strEmailAddress);
             $_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id] = $strEmailAddress;
         } else {
             $_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id] = null;
             unset($_SESSION['onlineDonationEmailAddress' . $objPaymentObject->Id]);
         }
     }
     QApplication::Redirect($objPaymentObject->ConfirmationUrl);
 }
Beispiel #6
0
 public function SetUp()
 {
     $this->objMinistry = Ministry::LoadByToken('ert');
     if (!$this->objMinistry) {
         $this->objMinistry = new Ministry();
         $this->objMinistry->Token = 'ert';
     }
     $this->objMinistry->Name = 'Test Ministry';
     $this->objMinistry->ActiveFlag = true;
     $this->objMinistry->Save();
     if ($objGroupRoleArray = $this->objMinistry->GetGroupRoleArray()) {
         $this->objGroupRole = $objGroupRoleArray[0];
     } else {
         $this->objGroupRole = new GroupRole();
         $this->objGroupRole->Ministry = $this->objMinistry;
         $this->objGroupRole->Name = 'ERT';
         $this->objGroupRole->GroupRoleTypeId = GroupRoleType::Participant;
         $this->objGroupRole->Save();
     }
     $this->objLoginLeader = Login::LoadByUsername('ert1');
     if (!$this->objLoginLeader) {
         $this->objLoginLeader = new Login();
         $this->objLoginLeader->Username = '******';
     } else {
         $this->objLoginLeader->UnassociateAllMinistries();
     }
     $this->objLoginLeader->RoleTypeId = RoleType::StaffMember;
     $this->objLoginLeader->Email = '*****@*****.**';
     $this->objLoginLeader->Save();
     $this->objLoginLeader->AssociateMinistry($this->objMinistry);
     $this->objLoginNonLeader = Login::LoadByUsername('ert2');
     if (!$this->objLoginNonLeader) {
         $this->objLoginNonLeader = new Login();
         $this->objLoginNonLeader->Username = '******';
     } else {
         $this->objLoginNonLeader->UnassociateAllMinistries();
     }
     $this->objLoginNonLeader->RoleTypeId = RoleType::StaffMember;
     $this->objLoginNonLeader->Email = '*****@*****.**';
     $this->objLoginNonLeader->Save();
     $this->objPersonArray = array();
     $this->objPersonArray['ert1'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $this->objPersonArray['ert2'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $this->objPersonArray['ert3'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null);
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $this->objPersonArray['ert4'] = $objPerson;
     $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null);
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $this->objPersonArray['ert5'] = $objPerson;
     $this->objGroup1 = Group::LoadByToken('ert1');
     if (!$this->objGroup1) {
         $this->objGroup1 = new Group();
         $this->objGroup1->Token = 'ert1';
     }
     $this->objGroup1->GroupTypeId = GroupType::RegularGroup;
     $this->objGroup1->Ministry = $this->objMinistry;
     $this->objGroup1->EmailBroadcastTypeId = EmailBroadcastType::PrivateList;
     $this->objGroup1->Name = 'ERT Test Group 1';
     $this->objGroup1->Save();
     $this->objGroup2 = Group::LoadByToken('ert2');
     if (!$this->objGroup2) {
         $this->objGroup2 = new Group();
         $this->objGroup2->Token = 'ert2';
     }
     $this->objGroup2->GroupTypeId = GroupType::RegularGroup;
     $this->objGroup2->Ministry = $this->objMinistry;
     $this->objGroup2->EmailBroadcastTypeId = EmailBroadcastType::AnnouncementOnly;
     $this->objGroup2->Name = 'ERT Test Group 2';
     $this->objGroup2->Save();
     $this->objGroup1->DeleteAllGroupParticipations();
     $this->objGroup2->DeleteAllGroupParticipations();
     $objParticipation = new GroupParticipation();
     $objParticipation->Person = $this->objPersonArray['ert1'];
     $objParticipation->Group = $this->objGroup1;
     $objParticipation->GroupRole = $this->objGroupRole;
     $objParticipation->DateStart = new QDateTime('2005-01-01');
     $objParticipation->Save();
     $objParticipation = new GroupParticipation();
     $objParticipation->Person = $this->objPersonArray['ert1'];
     $objParticipation->Group = $this->objGroup2;
     $objParticipation->GroupRole = $this->objGroupRole;
     $objParticipation->DateStart = new QDateTime('2005-01-01');
     $objParticipation->Save();
 }