Fixed #87 Incorrect results on download check Admin

<a href='#crh-start'></a><a href='#crh-data-%7B%22processed%22%3A%20%5B%22https%3A//github.com/zencart/zc-v1-series/pull/88%23issuecomment-48825797%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/88%23issuecomment-48825942%22%2C%20%22https%3A//github.com/zencart/zc-v1-series/pull/88%23discussion_r14855613%22%5D%2C%20%22comments%22%3A%20%7B%22General%20Comment%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zencart/zc-v1-series/pull/88%23issuecomment-48825797%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222014-07-12T22%3A29%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/227354%3F%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/zcwilt%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%3Ashipit%3A%20%5Cr%5Cn%5Cr%5CnNo%2C%20refactoring%20should%20not%20be%20done%20at%20the%20same%20time%20as%20a%20bugfix.%5Cr%5CnRefactoring%20should%20be%20a%20separate%20ticket.%20It%20might%20be%20different%20if%20there%20were%20test%20coverage%20for%20the%20code%20being%20changed%2C%20but%20at%20this%20time%20that%27s%20not%20a%20luxury%20available%20to%20us.%20%5Cr%5CnAgreed%20that%20it%20pays%20to%20take%20the%20time%20to%20refactor%20for%20performance%20and%20readability%2C%20but%20let%27s%20treat%20those%20as%20separate%20issues.%20For%20example%2C%20if%20you%20think%20you%20have%20a%20better%20way%20of%20doing%20the%20same%20thing%2C%20feel%20free%20to%20submit%20it%20as%20a%20PR.%20And%2C%20if%20you%20can%20write%20a%20test%20for%20it%2C%20include%20it%20with%20your%20PR.%22%2C%20%22created_at%22%3A%20%222014-07-12T22%3A36%3A41Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/404472%3F%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/drbyte%22%7D%7D%5D%2C%20%22title%22%3A%20%22General%20Comment%22%7D%2C%20%22Pull%20b7b00bccd7b147b3579fb681eeba5552f7903057%20admin/includes/functions/general.php%209%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zencart/zc-v1-series/pull/88%23discussion_r14855613%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Please%20simplify%3A%5Cr%5Cn%60%60%60php%5Cr%5Cnfunction%20zen_has_product_attributes_downloads_status%28%24products_id%29%20%7B%5Cr%5Cn%20%20if%20%28DOWNLOAD_ENABLED%20%21%3D%20%27true%27%29%20%7B%5Cr%5Cn%20%20%20%20return%20false%3B%5Cr%5Cn%20%20%7D%5Cr%5Cn%20%20global%20%24db%3B%5Cr%5Cn%20%20%24query%20%3D%20%5C%22...%20snip%20...%5C%22%3B%5Cr%5Cn%20%20%24result%20%3D%20%24db-%3EExecute%28%24query%29%3B%5Cr%5Cn%20%20return%20%28%24result-%3ERecordCount%28%29%20%3E%200%29%3B%5Cr%5Cn%7D%5Cr%5Cn%60%60%60%5Cr%5CnEven%20when%20just%20fixing%20bugs%2C%20it%20pays%20to%20take%20the%20extra%20time%20and%20effort%20to%20tidy%20things%20up%20with%20some%20incremental%20refactoring.%5Cr%5Cn%28see%20%5BArrow%20Anti-Pattern%5D%28http%3A//c2.com/cgi/wiki%3FArrowAntiPattern%29%20and%20%5BGuard%20Clause%5D%28http%3A//c2.com/cgi/wiki%3FGuardClause%29%29%22%2C%20%22created_at%22%3A%20%222014-07-12T22%3A08%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1590605%3F%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/texdc%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20admin/includes/functions/general.php%3AL2572-2581%22%7D%7D%2C%20%22approved%22%3A%20%7B%22https%3A//github.com/drbyte%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/404472%3F%22%7D%7D%7D'></a>
<a href='https://www.codereviewhub.com/'><img src='http://www.codereviewhub.com/site/github-bar.png' height=40></a>

<img src='http://www.codereviewhub.com/site/github-approved-avatar.png'><a href='https://github.com/drbyte'><img src='https://avatars.githubusercontent.com/u/404472?size=34' width=34 height=34></a>

- [ ] <a href='#crh-comment-Pull b7b00bccd7b147b3579fb681eeba5552f7903057 admin/includes/functions/general.php 9'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zencart/zc-v1-series/pull/88#discussion_r14855613'>File: admin/includes/functions/general.php:L2572-2581</a></b>
- <a href='https://github.com/texdc'><img border=0 src='https://avatars.githubusercontent.com/u/1590605?size=16' height=16 width=16'></a> Please simplify:
```php
function zen_has_product_attributes_downloads_status($products_id) {
if (DOWNLOAD_ENABLED != 'true') {
return false;
}
global $db;
$query = "... snip ...";
$result = $db->Execute($query);
return ($result->RecordCount() > 0);
}
```
Even when just fixing bugs, it pays to take the extra time and effort to tidy things up with some incremental refactoring.
(see [Arrow Anti-Pattern](http://c2.com/cgi/wiki?ArrowAntiPattern) and [Guard Clause](http://c2.com/cgi/wiki?GuardClause))
- [x] <a href='#crh-comment-General Comment'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zencart/zc-v1-series/pull/88#issuecomment-48825797'>General Comment</a></b>
- <a href='https://github.com/zcwilt'><img border=0 src='https://avatars.githubusercontent.com/u/227354?size=16' height=16 width=16'></a> :+1:
- <a href='https://github.com/drbyte'><img border=0 src='https://avatars.githubusercontent.com/u/404472?size=16' height=16 width=16'></a> :+1: :shipit:
No, refactoring should not be done at the same time as a bugfix.
Refactoring should be a separate ticket. It might be different if there were test coverage for the code being changed, but at this time that's not a luxury available to us.
Agreed that it pays to take the time to refactor for performance and readability, but let's treat those as separate issues. For example, if you think you have a better way of doing the same thing, feel free to submit it as a PR. And, if you can write a test for it, include it with your PR.


<a href='https://www.codereviewhub.com/zencart/zc-v1-series/pull/88?mark_as_completed=1'><img src='http://www.codereviewhub.com/site/github-mark-as-completed.png' height=26></a>&nbsp;<a href='https://www.codereviewhub.com/zencart/zc-v1-series/pull/88?approve=1'><img src='http://www.codereviewhub.com/site/github-approve.png' height=26></a>&nbsp;<a href='https://www.codereviewhub.com/zencart/zc-v1-series/pull/88?approve=0'><img src='http://www.codereviewhub.com/site/github-undo-approve.png' height=26></a>&nbsp;<a href='https://github.com/zencart/zc-v1-series/pull/88'><img src='http://www.codereviewhub.com/site/github-refresh.png' height=26></a>
<a href='#crh-end'></a>