Updated BankAccountField to allow setting it to blank without a notice-level error

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63552 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-10-02 22:41:17 +00:00
parent 7574120f15
commit 6694936cc8

View File

@ -60,14 +60,15 @@ class BankAccountField extends FormField {
public function setValue($value) {
$this->value = self::join_bank_number($value);
$this->valueArr = array();
list(
$this->valueArr['BankCode'],
$this->valueArr['BranchCode'],
$this->valueArr['AccountNumber'],
$this->valueArr['AccountSuffix']
) = explode(" ",$this->value);
if($this->value) {
$this->valueArr = array();
list(
$this->valueArr['BankCode'],
$this->valueArr['BranchCode'],
$this->valueArr['AccountNumber'],
$this->valueArr['AccountSuffix']
) = explode(" ",$this->value);
}
}
/**
@ -108,6 +109,7 @@ class BankAccountField extends FormField {
public static function join_bank_number($value) {
if(is_array($value)) {
$value = self::convert_format_nz($value);
$completeNumber = "";
if($value['BankCode']) {
$completeNumber .= $value['BankCode'] . " ";
}