Пример #1
0
 /**
   Get account using newer tables
 */
 private static function getAccount($dbc, $id)
 {
     if ($id == 0) {
         return self::getAllAccounts($dbc);
     }
     $account = new \CustomerAccountsModel($dbc);
     $customers = new \CustomersModel($dbc);
     $account->cardNo($id);
     if (!$account->load()) {
         // migrate already at this point?
         return false;
     }
     $customers->customerAccountID($account->customerAccountID());
     $ret = $account->toJSON();
     $ret['customers'] = array();
     foreach ($customers->find('accountHolder', true) as $c) {
         $ret['customers'][] = $c->toJSON();
     }
     $type = new \MemtypeModel($dbc);
     $type->memtype($account->customerTypeID());
     $type->load();
     $ret['customerType'] = $type->memDesc();
     return $ret;
 }