1 (edited by poncho1234 12/22/2018 04:37:30 pm)

Topic: Additional Fields Extension

This is my first full extension, so it’s a learning process for me.

I originally created this for myself to satisfy the demands of my local tax authority, but realised with changes that it could be useful for other FA users. I’m willing to make changes should anyone have suggestions that would benefit a reasonable number of users.

I’ve added additional fields for customers/suppliers and items (CIS), which other users may find beneficial; also adding four ‘custom fields’ to each.  The custom fields can also be used for ‘niche’ users who wish to add info that is fairly specific for their business. Eg. A book seller could add ‘Author’, ‘Publisher’, etc. in items.

Currently the extra fields are integrated into the existing CIS pages, the maintenance links are in their own module and the reports are in their relevant reports pages.

The ext is currently work in progress so therefore is not ready for production and I would welcome any help, suggestions or comments.

ThreeFour reports so far:-
1.    Item stock check plus bin number
2.    Full customer listing with additional field info – excel download only
3.    Full supplier listing with additional field info – excel download only
4.    Full item listing with additional field info – excel download only

Todo:-
1.    Bug as referenced in this post(Should this be irrevocable, then I will rewrite ext. as a separate module.) This now works thanks to @notrinos's fix in same post
2.    Security codes: For development I used notrinos's codes from his HRM module, but when I changed to my own codes, I had no access?? - using existing security codes - Done
3.    Report - full item listing with additional field info – excel download only Done
4.    Code review.
5.    Check text strings are enabled for translation - Done
6.    Put custom fields in separate columns for customer/supplier reports - Done
7.    Change Spanish labels to English Done
8.    Update sql & Remove sql notworking - Possible fix below Done
9.    Dates not being saved - Done, added date2sql to update item function

Possible discussion points for future development
1.    Inquiry report X 3 for each of CIS
2.    Additional fields for customer branches.
3.    Additional integration with FA core
4.    Countries, departments, and cities. This data is unlikely to change once the user has entered their locale, should this be included in the database or as a lookup file? Bulk upload? Is this info necessary given the existing Address text box? I included as needed for myself
5.    Manage custom field names (Instead of using a translation) Done

Demo is here
Username: demouser
Password: 12345678

Code is here

Post's attachments

AddlFields_Screenshots.zip 144.8 kb, 62 downloads since 2018-10-10 

You don't have the permssions to download the attachments of this post.
The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

2 (edited by poncho1234 10/11/2018 10:46:39 pm)

Re: Additional Fields Extension

I may have solution to my number 8 bug

I noticed when installing/uninstalling that the path for 'module name' was /add_fields_item/. I then noticed that I didn't actually have a module called additional_fields.

So I have added a module additional_fields and moved the maintenance pages to there, my abbreviated updated hooks.php is now as follows:-

<?php

define('SS_ADDFLD_C',141<<8); // configuration
define('SS_ADDFLD',  142<<8); // transactions
define('SS_ADDFLD_A',143<<8); // analytic functions/reports/inquires

class add_fields_sales_app extends application {
    
    function __construct() {
        global $path_to_root;
        
        parent::__construct('orders', _($this->help_context = '&Sales'));
        
        //All Sales functions as per core with the following changed for Add and Manage &Customers

        $this->add_lapp_function(2, _("Add and Manage &Customers"),
            "/modules/additional_fields/manage/add_customers.php?", 'SA_CUSTOMER', MENU_ENTRY);
        
    }
}

class add_fields_supp_app extends application {
    
    function __construct() {
        global $path_to_root;
        
        parent::__construct('AP', _($this->help_context = '&Purchases'));
        
        //All Purchases functions as per core with the following changed for Suppliers ie Removed add fields maintenance

            $this->add_lapp_function(2, _("&Suppliers"),
            "/modules/additional_fields/manage/add_suppliers.php?", 'SA_SUPPLIER', MENU_ENTRY);
    }
}

class add_fields_item_app extends application {
    
    function __construct() {
        global $path_to_root;
        
        parent::__construct('stock', _($this->help_context = '&Items and Inventory'));
        
        //All Items & Inventory functions as per core with the following changed for Items

        $this->add_lapp_function(2, _("&Items"),
            "/modules/additional_fields/manage/add_items.php?", 'SA_ITEM', MENU_ENTRY);
        
    }
}
// New module added
class additional_fields_app extends application {
    
    function __construct() {
        global $path_to_root;
        
        parent::__construct('AddFields', _($this->help_context = 'Additional Fields'));
        
        $this->add_module(_('Maintenance'));
        $this->add_rapp_function(2, _('Manage Document Types'), $path_to_root.'/modules/additional_fields/manage/document_types.php?', 'SA_SUPPLIER', MENU_MAINTENANCE);
        $this->add_rapp_function(2, _('Manage Beneficiary Classes'), $path_to_root.'/modules/additional_fields/manage/customer_class.php?', 'SA_SUPPLIER', MENU_MAINTENANCE);
        $this->add_rapp_function(2, _('Manage Countries'), '/modules/additional_fields/manage/country.php?', 'SA_AFSETUP', MENU_MAINTENANCE);
        $this->add_rapp_function(2, _('Manage Departments'), $path_to_root.'/modules/additional_fields/manage/department_add_info.php?', 'SA_SUPPLIER', MENU_MAINTENANCE);
        $this->add_rapp_function(2, _('Manage Cities'), $path_to_root.'/modules/additional_fields/manage/city_add_info.php?', 'SA_SUPPLIER', MENU_MAINTENANCE);
        $this->add_rapp_function(2, _('Manage Sectors'), $path_to_root.'/modules/additional_fields/manage/sectors_add_info.php?', 'SA_SUPPLIER', MENU_MAINTENANCE);
        $this->add_extensions();
    }
}

class hooks_additional_fields extends hooks {
    function __construct() {
     $this->module_name = 'add_fields_sales';
        $this->module_name = 'add_fields_supp';
        $this->module_name = 'add_fields_item';
        $this->module_name = 'additional_fields';//NEW
     }
    
    function install_tabs($app) {
        $app->add_application(new add_fields_sales_app);
        $app->add_application(new add_fields_supp_app);
        $app->add_application(new add_fields_item_app);
        $app->add_application(new additional_fields_app);//NEW
    }
    
    function install_access() {
        $security_sections[SS_ADDFLD_C] =  _("Additional Fields Configuration");
        $security_sections[SS_ADDFLD] =  _("Additional Transactions");
        $security_sections[SS_ADDFLD_A] =  _("Additional Fields Analytics");
        $security_areas['SA_XFLD'] = array(SS_ADDFLD|1, _("AddFields entry"));
        $security_areas['SA_AFSETUP'] = array(SS_ADDFLD_C|2, _("AddFields setup3"));
        // $security_areas['SA_AFSETUP'] = array(SS_PURCH|9, _("AddFields setup2"));
        return array($security_areas, $security_sections);
    }

    function activate_extension($company, $check_only=true) {
        global $db_connections;
        
        $updates = array( 'update.sql' => array('frontadd'));
 
        return $this->update_databases($company, $updates, $check_only);
    }
    
    function deactivate_extension($company, $check_only=true) {
        global $db_connections;

        $updates = array('remove.sql' => array('frontadd'));

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

Update sql & Remove sql now work

I've not updated the demo or repro yet as would like to wait for any comments or alternative solution where an additional tab is not necessary

No solution to security issues even with above changes and a clean install.

@apmuthu I'm guessing it was you who added the screenshots - Thank you

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

I think you are asking access role problem here. I don't think to go separate role for extra fields. Just keep them as of custom types page security. And for creation of customer fields. You can use settings roles.

Hope it helps to reduce your security access problem

Subscription service based on FA
HRM CRM POS batch Themes

Re: Additional Fields Extension

Updated so that an extra tab 'Additional Fields' is included, with all the maintenance functions.

@kvvaradha can you be more specific as far as 'custom types' and 'setting roles' please

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

Added 'delete item additional field info' functionality

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

You should look at this to fix Bug #1 in Todo section :
https://frontaccounting.com/punbb/viewtopic.php?id=7622

Phuong

Re: Additional Fields Extension

@notrinos - done... thank you

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

Added custom field labeling for custom fields in customers, suppliers and items, this resolves the issue of using translations to rename custom fields and multiple companies requiring different custom field names. Demo updated

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

Rebuilt hooks.php to use a different method to replace existing menu items stolen from sgw_sales ext.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

when we will got this module?

Re: Additional Fields Extension

Fixed security areas/ sections - missing add access ext

So you're welcome to try it

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

How can I do that? I am unable to understand...

Re: Additional Fields Extension

That’s two separate statements:-

I have fixed the security / access issue – I was missing the add access ext

And

So yes you are welcome to use it now.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

Hey, thanks for responding to me. I am completely unable to understand because I have not found this module anywhere in your web as well as in my install/active extension too.

Re: Additional Fields Extension

Download it here.

16 (edited by emiangel839 11/07/2018 05:12:26 pm)

Re: Additional Fields Extension

Thank you so much, gonna take a look right now!

any documentation of this, i have installed it but i am nothing found in backend,
what i do;

1. upload it into modules/folder
2. goto install/active extension install this module
3. not found in access area..
4. not found in any other area..

?

17 (edited by poncho1234 11/07/2018 08:16:04 pm)

Re: Additional Fields Extension

Install as any other module - You need to read the wiki - Install and Activate Extensions

Just to be clear please notice the word in bold above

The instructions are very clear and include images please, please, please read them.

With regards to your post number 14, 'where can you download the ext?' This is clearly stated in the 1st post.

I understand english may not be your 1st lang. but doesn't that make it even more important to read carefully?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

@apmuthu The extension is ready, shall I fork your FA24extensions and add 'Additional Fields'? Or just leave on mine as interest seems minimal?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

@emiangel839 can you send a photo of your /modules directory please, or list the directories here

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

hey,

thanks for respond to me, yes sure i am uploaded a some snapshoot for you for checking it, & i am clearly read wiki and do follow the same steps always but i dont know why i am failed. well images are given below

1. directory / Install / Active Section -> https://imgur.com/a/BYmPRvr
2. Activation Setup area -> https://imgur.com/a/jRgHPLb
3. not found in access setup -> https://imgur.com/a/EeHq4Cg

anything else do you want from me let me know.

regards

21 (edited by notrinos 11/08/2018 07:22:01 am)

Re: Additional Fields Extension

@poncho1234

Would be great if this module can works on fly item entry.
Example when creating Direct Sales Invoice press F4 for opening Items page, module now can't work here
Similar for Suppliers, Customers.
That would be a truly challenge.

Thank you

Phuong

22 (edited by poncho1234 11/08/2018 01:10:37 pm)

Re: Additional Fields Extension

@emiangel839 Look in your first photo... the directory is called 'additional_fields_master'.

So your current path is:-
/modules/additional_fields_master/additional_fields...

It should be:-
/modules/additional_fields...

You have to unzip the contents of the zip file, not use the outer folder/package... So unzip it somewhere else, copy the directory 'additional_fields' and its contents to your installations /modules dir.

1st deactivate and uninstall 'additional_fields_master', delete folder if necessary

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

@notrinos - Hi,

I still consider the only option is to remove the interface integration and have as a separate page, though this would mean data entry would be a two stage operation...add customer then add customer additional field info: In much the same way that sales pricing and reorder levels are now.

So that would mean altering the array $popup_editors

File: \includes\ui\ui_controls.inc

504: $popup_editors = array(
505:     'customer' => array('/sales/manage/customers.php?debtor_no=', 
506:         113,    _("Customers"), 900, 600),
507:     'branch' => array('/sales/manage/customer_branches.php?SelectedBranch=', 
508:         114, _("Branches"), 900, 700),
509:     'supplier' => array('/purchasing/manage/suppliers.php?supplier_id=', 
510:         113, _("Suppliers"), 900, 700),
511:     'item' => array('/inventory/manage/items.php?stock_id=', 
512:         115, _("Items"), 800, 600),
513:     'fa_item' => array('/inventory/manage/items.php?FixedAsset=1&stock_id=', 
514:         115, _("Items"), 800, 600)
515: );
The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Additional Fields Extension

Yes, we can have solutions for infinite needs if mod the FA core.
Would be better to make no change in the core, that's why it is a big challenge

Phuong

25 (edited by poncho1234 11/08/2018 04:57:53 pm)

Re: Additional Fields Extension

Not tested
So something like:-

$add_field_popup_editors = array(
    'customer' => array('/modules/additional_fields/manage/customers.php?debtor_no=', 
        113,    _("Customers"), 900, 600),
    'branch' => array('/sales/manage/customer_branches.php?SelectedBranch=', 
        114, _("Branches"), 900, 700),
    'supplier' => array('/modules/additional_fields/suppliers.php?supplier_id=', 
        113, _("Suppliers"), 900, 700),
    'item' => array('/modules/additional_fields/items.php?stock_id=', 
        115, _("Items"), 800, 600),
    'fa_item' => array('/modules/additional_fields/items.php?FixedAsset=1&stock_id=', 
        115, _("Items"), 800, 600)
);
$What_do_I_call_this = array_replace($popup_editors, $add_field_popup_editors);


And where would I call it? Beginning of customers.php??? In hooks?

or change function set_editor to reflect new name

Or would array_fill be the way to go?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/