Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2327

Přidáno uživatelem David Raška před více než 10 roky(ů)

Upravy:
- closes #837: Prirazeni neidentifikovatelne platby pod provozni ucet

Zobrazit rozdíly:

freenetis/branches/1.2/application/controllers/bank_transfers.php
if (!is_numeric($trans_id))
Controller::error(RECORD);
$concat = "CONCAT(
COALESCE(name, ''),
' - " . __('Account ID') . " ',
id,
' - " . __('Member ID') . " ',
COALESCE(member_id, '')
)";
$arr_accounts = ORM::factory('account')
->where('account_attribute_id', Account_attribute_Model::CREDIT)
->select_list('id', $concat);
$arr_accounts = array
(
NULL => '----- '.__('Select').' -----'
) + $arr_accounts;
$bt_model = new Bank_transfer_Model();
$bt = $bt_model->get_bank_transfer($trans_id);
if (!is_object($bt))
Controller::error(RECORD);
$oa = new Account_Model();
$dst_accounts = $oa->get_some_doubleentry_account_names_grouped($bt->origin_id);
// account attributes for types of accounts
$aa_model = new Account_attribute_Model();
$account_attributes = $aa_model->get_account_attributes();
foreach ($account_attributes as $aattr)
{
$arr_attributes[$aattr->id] = $aattr->id . ' ' . $aattr->name;
}
$arr_attributes = arr::merge(array
(
NULL => '----- ' . __('Select account type') . ' -----'
), $arr_attributes);
$dst_accounts = arr::merge(array
(
NULL => '----- ' . __('Select') . ' -----'
), $dst_accounts);
$fee_model = new Fee_Model();
// penalty
$fee1 = $fee_model->get_by_date_type($bt->datetime, 'penalty');
......
$form->group('Payment');
$form->dropdown('account_type')
->options($arr_attributes)
->style('width:450px');
$form->dropdown('name')
->label(__('Destination credit account').':')
->options($arr_accounts)
->selected(0);
->label('Destination account (account name, account ID)')
->options($dst_accounts)
->style('width:450px');
$form->input('correct_vs')
->label(__('Or enter correct variable symbol').':')
......
if ($dst_acc->id == 0)
{
// account has not been selected, trying to find member by correct variable symbol
/*$member = ORM::factory('member')
->where('variable_symbol', $form_data['correct_vs'])
->find();*/
$member = ORM::factory('variable_symbol')
->where('variable_symbol', $form_data['correct_vs'])
->find()->account->member;
freenetis/branches/1.2/application/controllers/js.php
$this->time_activity_rule();
}
private function _js_bank_transfers_assign_transfer($trans_id = NULL)
{
$bt_model = new Bank_transfer_Model();
$bt = $bt_model->get_bank_transfer($trans_id);
$this->views['bank_transfers_assign_transfer'] = View::factory('js/bank_transfers_assign_transfer');
$this->views['bank_transfers_assign_transfer']->origin_account_id = $bt->origin_id;
}
private function _js_device_templates_edit($device_template_id = NULL)
{
$dtm = new Device_template_Model($device_template_id);
freenetis/branches/1.2/application/views/js/bank_transfers_assign_transfer.php
<?php
/**
* Assign transfer javascript view.
*/
// IDE complementation
if (FALSE): ?><script type="text/javascript"><?php endif
?>
$("#account_type").change(function()
{
$("#name").html('<option value=""><?php echo __('Loading data, please wait') ?>...</option>');
$.getJSON("<?php echo url_lang::base() ?>json/get_accounts_by_type/<?php echo $origin_account_id ?>?id=" + urlencode($(this).val()), function(data)
{
var options = [];
$.each(data, function(key, val)
{
options.push('<optgroup label="');
options.push(key);
options.push('">');
$.each(val, function(key, val)
{
options.push('<option value="');
options.push(val);
options.push('">');
options.push(key);
options.push('</option>');
});
options.push('</optgroup>');
});
$("#name").html(options.join(''));
});
});

Také k dispozici: Unified diff