Exemplo n.º 1
0
Arquivo: batch.php Projeto: alcf/chms
 protected function btnDialogSave_Click()
 {
     // GJS Save according to radio button selection
     switch ($this->rbtnUpdateFundSelection->SelectedValue) {
         case 1:
             if ($this->objEditing instanceof OnlineDonationLineItem) {
                 if ($this->lstDialogFund->SelectedValue == -1) {
                     $this->objEditing->DonationFlag = false;
                     $this->objEditing->StewardshipFundId = null;
                     $this->objEditing->Other = trim($this->txtDialogOther->Text);
                 } else {
                     $this->objEditing->DonationFlag = true;
                     $this->objEditing->StewardshipFundId = $this->lstDialogFund->SelectedValue;
                     $this->objEditing->Other = null;
                 }
                 $this->objEditing->Save();
             } else {
                 if ($this->strEditingCode == 'd') {
                     $this->objEditing->DonationStewardshipFundId = $this->lstDialogFund->SelectedValue;
                     $this->objEditing->Save();
                 } else {
                     $this->objEditing->StewardshipFundId = $this->lstDialogFund->SelectedValue;
                     $this->objEditing->Save();
                 }
             }
             break;
         case 2:
             // Save existing line Item
             if ($this->objEditing instanceof OnlineDonationLineItem) {
                 if ($this->lstDialogSplitFund[0]->SelectedValue == -1) {
                     $this->objEditing->DonationFlag = false;
                     $this->objEditing->StewardshipFundId = null;
                     $this->objEditing->Other = trim($this->txtDialogSplitOther[0]->Text);
                 } else {
                     $this->objEditing->DonationFlag = true;
                     $this->objEditing->StewardshipFundId = $this->lstDialogSplitFund[0]->SelectedValue;
                     $this->objEditing->Other = null;
                 }
                 $this->objEditing->Amount = $this->txtDialogSplitAmount[0]->Text;
                 $this->objEditing->Save();
             } else {
                 if ($this->strEditingCode == 'd') {
                     $this->objEditing->DonationStewardshipFundId = $this->lstDialogSplitFund[0]->SelectedValue;
                     $this->objEditing->Amount = $this->txtDialogSplitAmount[0]->Text;
                     $this->objEditing->Save();
                 } else {
                     $this->objEditing->StewardshipFundId = $this->lstDialogSplitFund->SelectedValue;
                     $this->objEditing->Amount = $this->txtDialogSplitAmount[0]->Text;
                     $this->objEditing->Save();
                 }
             }
             // Create a new line item - Lets just make it an online donation for now
             $objNewLineItem = new OnlineDonationLineItem();
             $objNewLineItem->Amount = $this->txtDialogSplitAmount[1]->Text;
             if ($this->lstDialogSplitFund[1]->SelectedValue == -1) {
                 $objNewLineItem->DonationFlag = false;
                 ${$objNewLineItem}->StewardshipFundId = null;
                 $objNewLineItem->Other = trim($this->txtDialogSplitOther[1]->Text);
             } else {
                 $objNewLineItem->DonationFlag = true;
                 $objNewLineItem->StewardshipFundId = $this->lstDialogSplitFund[1]->SelectedValue;
                 $objNewLineItem->Other = null;
             }
             $objNewLineItem->OnlineDonationId = $this->objEditing->OnlineDonationId;
             $objNewLineItem->Save();
             break;
     }
     $this->dlgEditFund->HideDialogBox();
     $this->Transactions_Refresh();
 }