public function addUsageMembership(Membership_Model_SoMember $obj) { try { $usage = Billing_Controller_BankAccountUsage::getInstance()->getByContextAndPurpose('MEMBERSHIP', 'APPRECORDONLY', $this->getId(), $obj->getId()); $usage->__set('bank_account_id', $this->getId()); $usage->setUsageMembership($obj); } catch (Exception $e) { $usage = Billing_Controller_BankAccountUsage::getInstance()->getEmptyBankAccountUsage(null, true); $usage->__set('bank_account_id', $this->getId()); $usage->setUsageMembership($obj); $usage = Billing_Controller_BankAccountUsage::getInstance()->create($usage); } return $usage; }
public static function getFromSoMember(Membership_Model_SoMember $member) { $obj = new self($member->__get('bank_account_nr'), $member->__get('account_holder'), $member->__get('bank_name'), $member->__get('bank_code'), $member->getForeignId('fee_payment_method')); $obj->setContactId($member->getForeignId('contact_id')); $contact = $member->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 setUsageMembership(Membership_Model_SoMember $obj) { $this->__set('context_id', 'MEMBERSHIP'); $this->__set('membership_id', $obj->getId()); $this->__set('usage_type', 'APPRECORDONLY'); }