public function addUsageRegularDonation(Donator_Model_RegularDonation $obj) { try { $usage = Billing_Controller_BankAccountUsage::getInstance()->getByContextAndPurpose('DONATOR', 'APPRECORDONLY', $this->getId(), $obj->getId()); $usage->__set('bank_account_id', $this->getId()); $usage->setUsageRegularDonation($obj); } catch (Exception $e) { $usage = Billing_Controller_BankAccountUsage::getInstance()->getEmptyBankAccountUsage(null, true); $usage->__set('bank_account_id', $this->getId()); $usage->setUsageRegularDonation($obj); $usage = Billing_Controller_BankAccountUsage::getInstance()->create($usage); } return $usage; }
public static function getFromRegularDonation(Donator_Model_RegularDonation $regDon) { $obj = new self($regDon->__get('bank_account_nr'), $regDon->__get('account_name'), $regDon->__get('bank_name'), $regDon->__get('bank_code'), $regDon->getForeignId('donation_payment_method')); $fundMaster = $regDon->getForeignRecord('fundmaster_id', Donator_Controller_FundMaster::getInstance()); $obj->setContactId($fundMaster->getForeignId('contact_id')); $contact = $fundMaster->getForeignRecord('contact_id', Addressbook_Controller_Contact::getInstance()); $countryCode = $contact->getLetterDrawee()->getPostalAddress()->getCountryCode('DE'); $obj->setCountryCode($countryCode); if (trim($obj->getName()) == '') { $obj->setName($contact->__get('n_fileas')); } return $obj; }
public function setUsageRegularDonation(Donator_Model_RegularDonation $obj) { $this->__set('context_id', 'DONATOR'); $this->__set('regular_donation_id', $obj->getId()); $this->__set('usage_type', 'APPRECORDONLY'); }