Example #1
0
 public function normalize($phoneString)
 {
     $phone = new self();
     if (preg_match("#(\\+[0-9])#ims", $phoneString, $subs)) {
         // +7 950-556-27-20
         // country full
     }
     if (preg_match("#([0-9])#ims", $phoneString, $subs)) {
         $f = $subs[1];
         if ($f == '8') {
             // country call
             // 11 digits
             // 8 950-556-27-20
             // 8 10 country ... - international call (russia)
             $ds = preg_replace("#([^0-9])#ims", '', $phoneString);
             if (substr($ds, 1, 2) == '10') {
                 // international call (810)
                 $phone->setCountryCode(substr());
                 $phone->setNumber(substr($ds, 1));
             } else {
                 $phone->setCountryCode(self::$_defaultCountryCode);
                 $phone->setNumber(substr($ds, 1));
             }
             return $phone;
         }
     }
     return false;
 }
Example #2
0
 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;
 }