How to Create Modules for Frontaccounting |
X

Congrats, You are Subscribed to Receive Updates.

How to Create Modules for Frontaccounting


Every framework have some unique way of working mechanism and special way to create its extendable functions. Here I am going to create a module for Frontaccounting . Its simple and creative way, You need to understand several factors while coding your module.

 fa-mofule

Let’s come to the topic, We are going to write a module for dashboard. I am not going to show you the complete procedure , but a simple introduction to understand the concept behind the module creation.

create folder under modules and name it based on your area. than again create folder name it “_init”  and create two files under the folder.

  • config
  • files

and open config file and copy paste the following codes to specify your theme name and description as like the following code.

Package: Kvdashboard
Version: 1.0
Name: Kv Dashboard
Description: Write your module description here.
Author: Kv Varadha <varadharajv@kvcodes.com>
Homepage: kvcodes.com
Depends: dashboard_theme
InstallPath: modules/dashboard
Type: extension
Filename: dashboard-1.0

than open file and write  path to all your module files. as like the following structure.

/hooks.php: d87dd0c84e3c3efd45cfaf2e9ff34e9eb51513f9
/dashboard.php: d52650a62ca84c2695bbe8790904b703ea1dba63

After that, create the following php files inside it.

  • index.php
  • hooks.php
  • dashboard.php

These are the important files while creating a dashboard module, than open your index.php and copy paste the following code into it.

<?php
header("Location: ../index.php");
?>

Than, open hooks.php and we are going to create necessary things for module initialization , We need to define a page security word to manage permissions, as like the following line.

<?php
// ----------------------------------------------------------------
// Module name: Dashboard
// Author: Kv Varadha
// Free software under GNU GPL
// ----------------------------------------------------------------

define ('SS_DASHBOARD', 150<<8);

Here we set to SS_DASHBOARD as the page security to manage permissions. and start writing a hooks class by extending hooks class.

class hooks_dashboard extends hooks {
	var $module_name = 'dashboard';

/* This method is called on extension activation for company.   */
    function activate_extension($company, $check_only=true)
    {
        global $db_connections;

        $updates = array(
            'update_dashboard_db.sql' => array('dashboard_widgets')
        );

        return $this->update_databases($company, $updates, $check_only);
    }

    function deactivate_extension($company, $check_only=true)
    {
        global $db_connections;

        $updates = array(
            'drop_dashboard_db.sql' => array('ugly_hack') // FIXME: just an ugly hack to clean database on deactivation
        );

        return $this->update_databases($company, $updates, $check_only);
    }
}

?>

The above class will take care of initiating a module to hook it on frontaccounting, Once you did the steps, just login to your frontaccounting, goto setup, -> Install/Activate Extensions. Now you can see your module name there.  This is how you can  create your modules.

 Than , you need to write your module operations on dashboard.php and include it on hooks.php.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

5 comments

  1. commenter

    What is the structure of writing path of module files
    such as
    /hooks.php: d87dd0c84e3c3efd45cfaf2e9ff34e9eb51513f9
    how can i get “d87dd0c84e3c3efd45cfaf2e9ff34e9eb51513f9”

  2. commenter

    I do not real get the steps you specified, it seems you don’t want to explain things plainly so that people can easily understand. Based on your topic, it sounds like you’re hidding something. Prove me wrong by explaining things in plain and clear steps.

Reply to Varadharaj V Cancel reply

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar