Revize 2179
Přidáno uživatelem Ondřej Fibich před asi 11 roky(ů)
freenetis/branches/1.1/application/controllers/json.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Function to return accounts belong to account type
|
||
* Function to return accounts belong to account type. Returned array has
|
||
* name of account as key and its ID as a value due to JSON eval order bug.
|
||
*
|
||
* @author Michal Kliment
|
||
* @param number $origin_account_id
|
||
... | ... | |
$arr_accounts = array();
|
||
foreach ($accounts as $account)
|
||
{ // convert the object into array (used for HTML select list)
|
||
$arr_accounts[$account->id] =
|
||
$account->name . ' ' . $account->id . ' (' . $account->addr . ')';
|
||
$name = $account->name . ' ' . $account->id . ' (' . $account->addr . ')';
|
||
$arr_accounts[$name] = $account->id;
|
||
}
|
||
asort($arr_accounts, SORT_LOCALE_STRING);
|
||
|
||
echo json_encode($arr_accounts);
|
||
}
|
freenetis/branches/1.1/application/views/js/transfers_add_from_account.php | ||
---|---|---|
$("#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 = '';
|
||
var options = [];
|
||
$.each(data, function(key, val)
|
||
{
|
||
options += '<option value="' + key + '">' + val + '</option>';
|
||
{ // val is ID and key is name of account
|
||
options.push('<option value="');
|
||
options.push(val);
|
||
options.push('">');
|
||
options.push(key);
|
||
options.push('</option>');
|
||
});
|
||
$("#aname").html(options);
|
||
})
|
||
})
|
||
$("#aname").html(options.join(''));
|
||
});
|
||
});
|
||
|
Také k dispozici: Unified diff
Oprava:
- oprava razeni formulare s cilovym uctem v pridani noveho prevodu z uctu (standartni hack zameny hodnoty a klice v assoc. JSON poli)