Warning: strpos() [function.strpos]: needle is not a string or an integer in /home/beardedd/public_html/home/comments.php on line 34
hOme.beardedDonkey - HOWTO Make Expense Manager Show Expense Categories in Ascending Order
HOWTO Make Expense Manager Show Expense Categories in Ascending Order 
This post shows how to modify the code in Expense Manager so that the Expense Categories in the Add Expense window are listed alphabetically in the drop down selection menu. By default they are listed by their category number, which is the order that they are added to the software's database.

The Add Expense window element is called in the application/modules/expenses/views/add_update.php file. This file doesn't need editing, but if you are interested, it is the selectBoxDynamic function that creates the Add Expense window. That function is defined in application/helpers/my_helper.php file. This is the file we want to edit.

- Open application/helpers/my_helper.php
- Scroll down the file to find where the selectBoxDynamic function is defined:
function selectBoxDynamic($field_name='', $tableName='setting',$colom='value',$selected='',$attr='')
- Insert a new line after line 150 which looks like:
$CI = get_instance();
$CI->db->from($tableName); <-- this is line 150
$query = $CI->db->get();

- Add the following code on line 151:
- I recommend adding a comment to show that the code has been modified from the default. The new code should look like:
CI = get_instance();
# edited by cafish 20171023 - line below was added in

$query = $CI->db->get();

- Save the file and upload to your host if required.
- Refresh your Expense Manager page and click the Add Expense button, you should now have a category list that is in alphabetical order.

This post can also be found in my Evernote HOWTOs folder

Comments are not available for this entry.