prashants / webzash

Easy to use web based double entry accounting software in PHP - MySQL under MIT License
http://webzash.org
Other
207 stars 109 forks source link

Chart of Accounts has hard coding!! #128

Closed fr0z3nfyr closed 6 years ago

fr0z3nfyr commented 6 years ago

Hi,

This is an excellent plugin and I'm working on incorporating this project as module in one of my projects. Unfortunately, I cannot use the plugin as is because my project already has it's own themes and also has an auth and acl system in place. So, I decided to move this plugin bit by bit into my project.

In the pursuit, I discovered that print_account_chart() on View/Accounts/show.ctp has hard coding in the way of if ($account->id <= 4) while printing groups (~ L62) which can be easily replaced with if ($account->g_parent_id === null) to make it dynamic and immune to any changes to id in DB. This new comparison simply checks for the null parent_id attribute on the AccountList object to show action links.

prashants commented 6 years ago

There are still places where the hard-coded id is used and the app requires it so it won't make much of a difference until it is replaced throughout the app.