Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 3d07030e

Přidáno uživatelem Ondřej Fibich před téměř 9 roky(ů)

refs #967: Removal of account type select box from add from account transfer form because this functionality is now handled by destination account filter

Zobrazit rozdíly:

application/controllers/js.php
{
$this->views['sms_send'] = View::factory('js/__pieces/sms_message_counter');
}
private function _js_transfers_add_from_account($origin_account_id = NULL)
{
$this->views['transfers_add_from_account'] = View::factory('js/transfers_add_from_account');
$this->views['transfers_add_from_account']->origin_account_id = $origin_account_id;
}
private function _js_transfers_payment_calculator($account_id = NULL)
{
application/controllers/transfers.php
// array with only one origin account
$arr_orig_accounts[$oa->id] = $oa->name . ' (' . $oa->id . ', '
. $oa->account_attribute_id . ', ' . $oa->member_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);
// form
$form = new Forge('transfers/add_from_account/' . $origin_account_id);
......
// destination account
$form->group('Destination account');
$form->dropdown('account_type')
->options($arr_attributes)
->style('width:450px');
$form->dropdown('aname')
->label('Destination account (name, ID, type, member ID)')
->options($dst_accounts)
application/views/js/transfers_add_from_account.php
<?php
/**
* Add transfer from account javascript view.
*/
// IDE complementation
if (FALSE): ?><script type="text/javascript"><?php endif
?>
$("#account_type").change(function()
{
$("#aname").html('<option value=""><?php echo __('Loading data, please wait') ?>...</option>');
$.getJSON("<?php echo url_lang::base() ?>json/get_accounts_by_type<?php echo (isset($origin_account_id) ? "/$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>');
});
$("#aname").html(options.join(''));
});
});

Také k dispozici: Unified diff