Topic: Sort Chart of Accounts by name

When we are installing Charts of Accounts, as the list is long and many non standard custom ones with numerical indices will be available in the array of charts details that countries with a set of charts will be far apart making searching difficult.

Unlike languages which must start with the lang code, the charts can pretty much be anything, the name comes in handy when it denotes the country primarily though some start with number of digits in the account code.

Re: Sort Chart of Accounts by name

The following fixes it:

--- admin/inst_chart.php    Thu Nov 12 03:19:51 2015
+++ admin/inst_chart.php    Sun Nov 19 12:15:49 2017
@@ -42,6 +42,10 @@
     install_extension($id);
 
 //---------------------------------------------------------------------------------------------
+function sortByOption($a, $b) {
+    return strcmp($a['name'], $b['name']);
+}
+
 start_form(true);
 
     div_start('ext_tbl');
@@ -52,6 +56,8 @@
         display_note(_("No optional chart of accounts is currently available."));
     else
     {
+        uasort($mods, 'sortByOption');
+
         $th = array(_("Chart"),  _("Installed"), _("Available"), _("Encoding"), "", "");
         $k = 0;
 

@joe: would you like to commit it?

Post's attachments

Chart_Order.zip 31.9 kb, 1 downloads since 2017-11-19 

You don't have the permssions to download the attachments of this post.

Re: Sort Chart of Accounts by name

Committed.

Joe