Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c478920d

Přidáno uživatelem Ondřej Fibich před asi 9 roky(ů)

Undo my stupid mistake (I have pushed issue-957 to master instead of develop). Do I have copied files from GitHub master and push them back..

Zobrazit rozdíly:

application/models/bank_account.php
/*
* This file is part of open source system FreenetIS
* and it is release under GPLv3 licence.
*
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
*
* More info about project can be found:
* http://www.freenetis.org/
*
*
*/
/**
* Bank accounts
*
*
* @package Model
*
*
* @property integer $id
* @property string $name
* @property integer $member_id
......
const TYPE_UNICREDIT = 2;
/** Raiffeisenbank */
const TYPE_RAIFFEISENBANK = 3;
/**
/**
* Type message names
*
* @var array
......
self::TYPE_UNICREDIT => 'UniCredit',
self::TYPE_RAIFFEISENBANK => 'Raiffeisebank'
);
// db relations
protected $belongs_to = array('member');
protected $has_and_belongs_to_many = array('accounts');
/**
* Get settings driver for managing of bank account settings.
*
*
* @return BankAccountSettings
* @throws InvalidArgumentException On unsuported type of bank account
*/
......
/**
* Contruct of app, shutdown action logs by default
* @param type $id
* @param type $id
*/
public function __construct($id = NULL)
{
......
// disable action log
$this->set_logger(FALSE);
}
/**
* Types of bank account (key is type, value is name).
*
*
* @return array
*/
public static function get_type_names()
{
return self::$type_name;
}
/**
* Type of bank account type name.
*
*
* @return string|null
*/
public static function get_type_name($type)
......
{
return self::$type_name[$type];
}
return NULL;
}
/**
* Creates bank account.
*
* @author Tomas Dulik, Ondrej Fibich
* @author Tomas Dulik
* @param string $name - name of the bank account
* @param integer $account_nr - bank account number
* @param integer $bank_nr - bank number
* @param integer $member_id - id of the owner [optional]
* @param integer $bank_nr - bank number
* @param integer $member_id - id of the owner
* @return Bank_account_Model new object containing the new record model
*/
public static function create($name, $account_nr, $bank_nr, $member_id = NULL)
public static function create($name, $account_nr, $bank_nr, $member_id)
{
$member_id_int = intval($member_id);
$member_id = intval($member_id);
$bank_acc = new Bank_account_model();
$bank_acc->member_id = ($member_id_int) ? $member_id_int : NULL;
$bank_acc->member_id = ($member_id) ? $member_id : NULL;
$bank_acc->name = $name;
$bank_acc->account_nr = $account_nr;
$bank_acc->bank_nr = $bank_nr;
$bank_acc->save_throwable();
$bank_acc->bank_nr = $bank_acc;
$bank_acc->save();
return $bank_acc;
}
/**
* It gets all bank accounts of association.
*
*
* @author Jiri Svitak
* @return Mysql_Result
*/
public function get_assoc_bank_accounts()
{
{
return $this->db->query("
SELECT ba.id, ba.name AS baname, m.name AS mname,
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
......
$where
ORDER BY ".$this->db->escape_column($order_by)." $order_by_direction
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
");
");
}
/**
* It counts bank accounts except bank accounts of association.
* @return integer
......
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL)
) ba
$where"
)->current()->total;
}
)->current()->total;
}
/**
* Function gets bank accounts except bank account with origin_id.
* @param $origin_id
......
return $this->db->query("
SELECT *
FROM bank_accounts
WHERE id <> ?
WHERE id <> ?
", array($origin_id));
}
/**
* @author Tomas Dulik
* @param $attribute_id - a value from accounts.account_attribute_id
* @return object containing first related account from the account table having the $type
* @return object containing first related account from the account table having the $type
*/
public function get_related_account_by_attribute_id($attribute_id)
{
......
{
return FALSE;
}
$result = $this->db->query("
SELECT accounts.* FROM accounts
JOIN accounts_bank_accounts AS pivot
JOIN accounts_bank_accounts AS pivot
ON accounts.id=pivot.account_id AND pivot.bank_account_id=?
AND accounts.account_attribute_id=?
", array($this->id, $attribute_id));
return ($result && $result->count()) ? $result->current() : FALSE;
}
}

Také k dispozici: Unified diff