Topic: Creating modules 2.34

Hi Guys
Think I lost the last post I tried to make on this: apologies if it's a duplicate)

I have updated/extended the import_multijournalentries module and it also now works in 2.34

I'm trying to work out how to package it up as a module.

Do I need to :
- create/complete _init directory
- manually edit installed_modules (/modules directory)
- create a hooks.php file

Is there a description anywhere, or can you recommend a complete module that does what's required for me to copy?
Thanks
Pete

Re: Creating modules 2.34

If you want use the module only locally, there is no need for _init directory at all. If extension is of type theme, chart, language, or it contains only additional reports there is even no need for hooks.php file. For any more complex extension module you have to create hooks.php file containing class definition 'hooks_name_of_the_package' derived from hooks class found in includes/hooks.php. Methods of this class (if defined) are used for module integration with various FrontAccounting parts. Most important hooks are:
* install_tabs() - adds new tabs in FA menu;
* install_options() - adds option to various FA menus;
* install_access() - allow additional permission levels to be defined for module's pages;
* install_extension() - called on extension installation;
* activate_extension() - called when extension is activated for selected company.

All the available hook methods are described in includes/hooks.inc file, and the hook files bundled with extensions in FA central repo can be used as examples.

If you create extension which you want to be placed in central FrontAccounting repository, you should create only single additional _init/config file containing following information used during install/preview:

Package: single_word_package_name
Version: 2.3.4
Name: One line description  of the package
Description: Longer description of the package content. Can be 
 continued on following lines providing the first char in line is space.
Author: name and <email of the author>
Maintenance: name and email of current maintainer (or the author)
Homepage: address of related www page
Type: extension or chart or language or theme
InstallPath: modules/folder_name

That's all. Before the package is placed in repository we make some rough code audit and create all the other needed auxiliary files, so you can don't care about them.

Janusz

Re: Creating modules 2.34

Thanks Janusz.

I've create hook.php, the import_transactions.php file and a config text file as you describe.
I can install the module OK, but found that that to see the new menu item I had to manually edit

company/0/installed_extensions.php
to set

active=>'true'

How do I make sure this is set during the install process?
Thanks
Pete

Re: Creating modules 2.34

This is not set automatically on module installation, as often installed module is no needed in some companies. This should be changed when you activate module on per company basis after installation.
Janusz

Re: Creating modules 2.34

Janusz do you mean when running 'Access Setup'?
I did that, but it doesn't appear to change the variable (to false or true when selected).

Re: Creating modules 2.34

You have to go back to Install/Activate extensions, select your company in the selector at top of page, and turn the extension on for the company. If your extension provides any new permittion areas, the Access Setup fixes are  also necessary as you stated of course.
Janusz