parent::__construct('account_names', $id, 'blz_kto');
}
-}
+ public function getAccounts($currency, $display=false)
+ {
+ if ($currency == "eur")
+ $table = "account";
+ else
+ $table = "account_dm";
-?>
+ $sql = sprintf("SELECT DISTINCT %s.blz_kto,name FROM %s JOIN account_names using(blz_kto)%s ORDER BY name",
+ $table, $table,
+ $display === false ? '' : ' WHERE display = '.$display);
+ return $this->db->fetchObjectList($sql);
+ }
+
+ public function name()
+ {
+ if (!$this->data)
+ return 'Unbekannt';
+
+ $both = explode (":", $this->data->blz_kto);
+ if (count($both) > 1)
+ return sprintf ("%s (BLZ %s, Konto %s)", $this->data->name, $both[0], $both[1]);
+ else
+ return sprintf ("%s (%s)", $this->data->name, $this->data->blz_kto);
+ }
+
+}