delcroip/dolibarr_project_timesheet

Problem with including main when symlinking module

Closed this issue · 3 comments

I am not sure how to describe this, but I will try.

The way that includeMain.lib.php finds its current path will fail if the module folder is located outside the dolibarr directory.

According to the Dolibarr README file in the Custom Module folder (https://github.com/Dolibarr/dolibarr/tree/develop/htdocs/custom#readme) it is suggested to put custom modules in a separate location and then create a symlink in the dolibarr custom folder to the htdocs folder of the module.

I did this, but the timesheet module does not see the symlink and therefore fails to find main.inc.php giving the "Include of main fails" error on line 42.

Is there a way to change line 25 to get the default directory of dolibarr from somewhere else? What options are available to the module before loading the main inc that might help. Are there environmental variables that can be accessed to locate the root directory?

I see that there is commented out $_SERVER["CONTEXT_DOCUMENT_ROOT"] which according to debug mode looks like it might be available as a a Server var to the module. Can this be used rather than the current method of using dirname(FILE)?

I can see that this issue was addressed here: #243 but I am not sure how to take advantage of the solution.

I will have to check, the include is includeMain.lib.php just updating this should do the tric