Inventory not shown in left menu

fstuurman wrote on Wednesday, February 10, 2010:

I have specified:
$GLOBALS = true;
When I login as administrator I don’t see the “Inventory” menu item on the left side.

I had a look at script interface/main/left_nav.php and removed from line 885:

&& acl_check('admin', 'drugs')

and then it shows the menu item.
Line 885 has this coding:
 

<?php if ($GLOBALS['inhouse_pharmacy'] && acl_check('admin', 'drugs')) genMiscLink('RTop','adm','0',xl('Inventory'),'drugs/drug_inventory.php'); ?

>

I have a default installation , the acl_check meganism looks rather complicated.
I did print the queries from it and then I get this:

SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='admin' AND ac.value='calendar') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='acct' AND ac.value='rep') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='patients' AND ac.value='demo') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='encounters' AND ac.value='notes') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='encounters' AND ac.value='notes_a') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='patients' AND ac.value='med') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 
SELECT a.id,a.allow,a.return_value FROM gacl_acl a LEFT JOIN gacl_aco_map ac ON ac.acl_id=a.id LEFT JOIN gacl_aro_map ar ON ar.acl_id=a.id LEFT JOIN gacl_axo_map ax ON ax.acl_id=a.id LEFT JOIN gacl_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN gacl_aro_groups rg ON rg.id=arg.group_id LEFT JOIN gacl_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='patients' AND ac.value='med') AND ((ar.section_value='users' AND ar.value='admin') OR rg.id IN (10,11)) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (CASE WHEN ar.value IS NULL THEN 0 ELSE 1 END) DESC,(rg.rgt-rg.lft) ASC,a.updated_date DESC 

I don not see the the check for the “drug” in it.

Is this a bug?
Kind regards Fred Stuurman

fstuurman wrote on Wednesday, February 10, 2010:

Sorry for the mess in this post, it doesn’t seem to format it as I intended it!

bradymiller wrote on Wednesday, February 10, 2010:

hey,
Are you sure your user has admin privileges (belongs to the Administration acl group)? Log in as the admin user, and can place users into acl groups via the Adminstration->ACL screen (also can place users into acl groups when create or edit the users in the Adminitration->Users screen).
-brady

fstuurman wrote on Wednesday, February 10, 2010:

I am using the admin user deliverd at installation, I only changed the password. If I go to Adminstration->ACL->User Memberships
I see “Adminstrators” under the active column.

bradymiller wrote on Thursday, February 11, 2010:

hey,
Did you turn on this module on in interface/globals.php:
http://www.openmedsoftware.org/wiki/Pharmacy_Dispensary_Module_Configuration
-brady

fstuurman wrote on Thursday, February 11, 2010:

Hi ,
Yes my first posting was messed up. I specified

$GLOBALS = true;

I had a look at script interface/main/left_nav.php and removed from line 885:
&& acl_check(‘admin’, ‘drugs’)

and then it shows the menu item.
Something goes wrong for me in the acl_check function.

Kind regards Fred

fstuurman wrote on Thursday, February 11, 2010:

I don not what is going wrong with the formatting of these posts but I mean inhouse_pharmacy is set to true

bradymiller wrote on Thursday, February 11, 2010:

hey,
Very odd, considering that the acl checks are all throughout code and are working since you can see the amdinstration->ACL screen. Probably a recent bug nearby or something in the left_nav.php script. To help out, give us the following:
-openemr version
-oeprating system
-openemr package (XAMPP vs appliance vs ubuntu vs source)

-brady

fstuurman wrote on Thursday, February 11, 2010:

Brady,
I am using 3.20 dev but I had the same in 3.10. I am using the source versions
I have 2 installations only locally on Windows XP with apache , mysql and PHP and one on a linux server.
Both have the same problem.

Maybe this helps: I have place a print $query in the acl_check function and I do not see a query for the ‘drugs’ for the gacl_aco_map table. The complete queries where in my first post but messed up. I see an entry in the gacl_aco_map for ‘drugs’ and the section_value is ‘admin’.

Kind regards Fred Stuurman

bradymiller wrote on Friday, February 12, 2010:

hey,
This works fine on a new install of OpenEMR 3.2.0 cvs version in Mandriva 2008, php 5.2.4 and mysql 5.0.45.
questions:
1)  What are specifics on your two environments (oeprating system, php version and mysql version; in windows are you using the xampp packge and if so what is the version)
2)  Ensure your php settings in php.ini are(if change, then reset apache server): http://www.openmedsoftware.org/wiki/FAQ#What_are_the_correct_PHP_settings_.28can_be_found_in_the_php.ini_file.29_.3F
3)  Ensure the sql-mode parameter in your mysql configuration is set to “”
4)  Are you seeing anything show up in your php error log

-brady

fstuurman wrote on Monday, February 15, 2010:

Brady,
I must appologize, I have copied the original code for the acl_check and now it works.
I must have screwed up something when trying to solve it.
Sorry for the wasted time in helping me.

Thanks and kind regards Fred Stuurman