Dolibarr ERP CRM is a popular open source LAMP based web software. You may know more about Dolibarry from there official website. As a developer you may come to the point to develop custom Dolibarr module. Developing custom module is not complex as you think. You can get details about module development at Dolibarr wiki website. Currently I am developing a module for Dolibarr and following the tutorial at https://wiki.dolibarr.org/index.php/Module_development. After following step step method I got stuck at the point Generate the PHP DAO class. I search all over the Internet regarding this issue and found nothing about it. I found one forum regrading the issue at https://www.dolibarr.org/forum/511-creation-of-a-new-module/27044-how-to-configure-my-new-module, but the solution is not given there. After that I spent few hours and luckily I got the solution. I am posting this article here to help other guys who need this solution. To solve this problem follow these steps........
Â
When I am developing the module, current stable Dolibarr version is 6.0.3. This current version does not include the required class file, build_class_from_table.php. You need to download the file from https://github.com/thehawk970/dolibarr. After downloading the zip file called, dolibarr-master.zip unzip into your computer. Now copy the dev directory into your Dolibarr root directory. The screenshot is attached.
Now open your command line in Linux or Windows system. If you are on Linux system then you can easily run PHP command using command line. But running PHP from Windows system is slightly complex. If you find any difficulty you may refer to this https://stackoverflow.com/questions/15597067/how-to-run-php-from-windows-command-line/47555616#47555616. The screenshot is attached. You may got the warning PHP Warning: require_once(C:\xampp\htdocs\dolibarr\dev\skeletons/../../htdocs/master.inc.php): failed to open stream: No such file or directory while you typing the command. Don't worry this is an simple warning. Open the file build_class_from_table.php in your favorite editor and go to line number 36. From there remove htdocs from the path. Now run the command and it should work now.
Â
Â
***** build_class_from_table.php (3.2) *****
Tablename=llx_aldictionary_configuration
Current dir is C:\xampp\htdocs\dolibarr\dev\skeletons
Error: Failed to get description for table 'llx_aldictionary_configuration'.
Â
Â
Â
Â
Â
You may find the above problem while running the command again. This is because you have not enabled your Dolibarr module from module management section. Just go to Dolibarr module setup enable your development module. Now run the command and you are done. If everything goes successful you will see the following output.
Â
***** build_class_from_table.php (3.2) *****
Tablename=llx_aldictionary_configuration
Current dir is C:\xampp\htdocs\dolibarr\dev\skeletons
File 'out.aldictionaryconfiguration.class.php' has been built in current directory.
File 'out.aldictionaryconfiguration_script.php' has been built in current directory.
File 'out.aldictionaryconfiguration_page.php' has been built in current directory.
You can now rename generated files by removing the 'out.' prefix in their name and store them in a directory of your choice.
c:\xampp\htdocs\dolibarr\dev\skeletons>
Â
Â
Note: Still if you face any problem make sure the database table is created within Dolibarr database. To need help you can contact us.
Â
There are zero sub-categories in this parent category.
There are zero sub-categories in this parent category.
There are zero sub-categories in this parent category.