Source of file BankAccount.php
Size: 1,697 Bytes - Last Modified: 2021-12-24T06:43:41+00:00
/var/www/docs.ssmods.com/process/src/src/model/BankAccount.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | <?php /** * Created by PhpStorm. * User: marcokernler * Date: 30.01.18 * Time: 12:35 */ namespace Dnkfbrknme\SiteInfo\Model; use \SilverStripe\ORM\DataObject; class BankAccount extends DataObject { /** * @var string */ private static $table_name = "BankAccount"; /** * @var array */ private static $db = array( "BankName" => "Varchar(100)", "IBAN" => "Varchar(50)", "BIC" => "Varchar()" ); /** * @var array */ private static $has_one = array( "SiteConfig" => "SilverStripe\SiteConfig\SiteConfig" ); // - - - /** * @return \SilverStripe\ORM\ValidationResult */ public function validate() { $result = parent::validate(); // validate the iban if (!verify_iban($this->IBAN)) { // $message = _t("BankAccount.IBAN_CHECK_YOUR_INPUT","Please check your input. The IBAN doesn't meant to be correct."); // try getting some suggestions $suggestions = iban_mistranscription_suggestions($this->IBAN); if(count($suggestions) == 1) { // $message .= " " . _t("BankAccount.IBAN_DID_YOU_MEAN", "Did you mean {suggestion} ?", "", array("suggestion" => $suggestions[0])); } $result->error($message); } return $result; } /** * @return null|string|string[] */ public function ToMachineFormat() { return iban_to_machine_format($this->IBAN); } /** * @return null|string|string[] */ public function ToHumanFormat() { return iban_to_human_format($this->IBAN); } } |