Re: Additional Fields Extension

poncho1234 wrote:

@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


Thanks. & Done it,

well its giving an error in Report Section

banking & general ledger -> general ledger reports -> customer -> ERROR IN ALL REPORTS (NOT GENERATING REPORTS) EXPECT CUSTOMER INFORMATION LISTING....

image -> https://imgur.com/a/4I2CKoo

Regards

Re: Additional Fields Extension

Looks like you may have pdf debugging on...

Open your config.php file around line 37 you will see:-

File:\config.php
37:     $pdf_debug         = 0;    // display pdf source instead reports for debugging when $go_debug!=0

If it is set to one change it back to zero

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

28 (edited by poncho1234 11/08/2018 10:16:55 pm)

Re: Additional Fields Extension

@notrinos

Deep in the bowels of ui_controls.inc I found this..

File: \includes\ui\ui_controls.inc

611: /*
612:     Redirector for selector F4 calls.
613:     $sel_editors is array of selname=>editor_page
614: */
615: function editor_redirect($sel_editors, $save_fun='') {
616:     foreach ($sel_editors as $selname=>$editor)
617:         if (isset($_POST['_'.$selname.'_editor'])) {
618:             if (function_exists($save_fun))
619:                 $save_fun();
620:             unset($_POST['_'.$selname.'_editor']);
621:             context_call($editor, array_keys($_POST));
622:         }
623: }
624: /*
625:     Return procedure for selector F4 calls
626: */
627: function editor_return($vars, $restore_fun='') {
628:     if (function_exists($restore_fun))
629:         $restore_fun();
630: 
631:     if ($ret = context_restore()) {
632:         foreach ($vars as $postname=>$retname)
633:             if (isset($ret[$retname])) {
634:                 $_POST[$postname] = $ret[$retname];
635:                 set_focus($postname);
636:             }
637:     }
638: }

I think this is it?...Please confirm.
Not so sure how to use though?

editor_redirect($popup_editors, '$new_popup_editors');

????

Edit or is this fr renaming the function set_editor??????

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

Re: Additional Fields Extension

After trying to completely over complicate it I found that:-

$popup_editors = $add_field_popup_editors;

Replaces the contents of the arrray $popup_editors with the contents of my new array with changed url's

I added this my new array to the top of sales_order_entry.php and it worked!

Now I have the problem of where (and how) to put it to the ext.

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

30 (edited by poncho1234 11/09/2018 09:16:31 pm)

Re: Additional Fields Extension

Using existing FA functions this works:-

editor_redirect($popup_editors, 'set');
$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/manage/suppliers.php?supplier_id=', 
        113, _("Suppliers"), 900, 700),
    'item' => array('/modules/additional_fields/manage/items.php?stock_id=', 
        115, _("Items"), 800, 600),
    'fa_item' => array('/modules/additional_fields/manage/items.php?FixedAsset=1&stock_id=', 
        115, _("Items"), 800, 600)
);
editor_return($popup_editors, 'set');

but this only works in the page loaded.

So do I need to load this into current session somehow?

but context restore is loading it into session.. so why isn't it loading???

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

Re: Additional Fields Extension

@notrinos, as I understand so far

ajax 'var editors' array is set on each page, so either:-

$popup_editors needs to be set before the ajax function callEditor by calling the function in post 30 above, this it seems would have to be by ajax?

or

an ajax function to change the var editors array

But FA seems to have made provision for this by including the editor_redirect function which is otherwise redundant

I would appreciate any help you can give on this please

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

Re: Additional Fields Extension

@poncho -  If you are really interested to bring the custom fields. We have to make changes in the core to allow it to add additional fields.  Instead of making it as extension.  Try to make it within core. and get the difference of file with help of git difference. So it would be added to the core in next release of FA2.5.

Hope it sounds good. Also @joe waiting to hear your thoughts before he start working inside core.

we are ready to make this one.

Subscription service based on FA
HRM CRM POS batch Themes

33 (edited by poncho1234 12/22/2018 06:35:33 pm)

Re: Additional Fields Extension

Due to the number of conflicts created with the integrated version I have revised the ext so that it is non-integrated.
It was not as user friendly - now CSI additional info entry is now a two-step operation (eg Enter new customer data in FA core as std, then go to customer additional info (You can see FA core CSI details, but you cannot edit them... see screenshots below)) but the ext now has no conflicts with FA core. No changes to database.

Demo is here
Username: demouser
Password: 12345678

Code is here

New screenshots here:-

https://imgur.com/a/OV0R4nQ
https://imgur.com/a/PATDJRz
https://imgur.com/a/3DsSyev
https://imgur.com/a/UOtXCkI


If you have already installed additional fields then you are advised to change to this latest version as FA will not fully work with the old version. To do this:-

Method one:-
1. Make a backup of your database (Just in case)
2. Delete all files in /modules/additional_fields/
3. Down load the new version and unpack the contents to /modules/additional_fields/
4. Check access permissions change if necessary then log out and log in

Or

Method two:-
1. Make a backup of your database
2. Deactivate and delete the additional_fields ext
3. Down load the new version and unpack the contents to /modules/additional_fields/
4. Install and activate the additional_fields ext.
5. Restore the backup you created in step one
6. Check access permissions change if necessary then log out and log in

Please note: There are a number of file deletions, therefore a differences pack will not work

Post's attachments

Additional_Fields_Screenshots.zip 129.1 kb, 6 downloads since 2018-12-22 

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/

Re: Additional Fields Extension

Included in my unofficial repo for FA 2.4.x extensions.

Cut down on the number of extra tables. Keep just one table for all lookup value tables. Can also use json stored in single field for it as well.

35 (edited by poncho1234 12/22/2018 06:53:25 pm)

Re: Additional Fields Extension

kvvaradha wrote:

@poncho -  If you are really interested to bring the custom fields. We have to make changes in the core to allow it to add additional fields.  Instead of making it as extension.  Try to make it within core. and get the difference of file with help of git difference. So it would be added to the core in next release of FA2.5.

Hope it sounds good. Also @joe waiting to hear your thoughts before he start working inside core.

we are ready to make this one.

@kvvaradha @joe My apoligies for my late reply; I mis-read kvvaradha's post (or it was changed?) and was mulling over a response

Can you please clarify if: You want me to modify core files to incorporate custom fields as it was into the core for release FA2.5 (I think this is what you mean)

So a few thoughts:-

1. Use existing FA db tables where possible or db structure as is in additional fields ext.(which makes upgrading easier?)
2. Address options

  1. Keep the existing address field as FA core and have additional address fields as extra info?

  2. Use the existing FA core address field as the first 1/2/3/4 lines of the address then add extra fields for city, department, etc? This is quite a large change; customers, customer branches, suppliers, locations, company setup etc and all relevant reports

  3. Separate fields for all lines of address? ie Address Line 1, Address Line 2 - 4 and then city, department, etc

  4. Or another way not listed here?

3. Use dropdown lists for city, etc or empty box? Or a combo box that allow select from list or manual entry) Also I think its possible to use a flat file for a list of cities etc and then only store the value in the db. Users can then add their own 'locale'

4. Option in company setup to turn on/off custom fields?
5. Create a detail query for each CSI (I'm fairly sure I need help with this)

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

36 (edited by poncho1234 12/22/2018 06:26:43 pm)

Re: Additional Fields Extension

@apmuthu not quite sure what you mean or how this is possible, can you please clarify? Example/s would also help me?

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

Re: Additional Fields Extension

The following is all you will need:

CREATE TABLE `0_addlflds` (
  `FldName` varchar(30) NOT NULL,
  `TblName` enum('Customers','Suppliers','Items') NOT NULL,
  `FldType` enum('Text','Number','Date','DateTime','TimeStamp','Bool') NOT NULL,
  `FldSize` varchar(255) NOT NULL,
  `FldUIType` enum('EditBox','SelectBox','TextArea','Password','CheckBox','Radio','MultiSelect') NOT NULL,
  `FldUIChoices` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`FldName`)
) ENGINE=InnoDB;

CREATE TABLE `0_addlfld_values` (
  `TblPKid` int(10) unsigned NOT NULL,
  `FldName` varchar(30) NOT NULL,
  `FldVal` varchar(255) NOT NULL,
  PRIMARY KEY (`TblPKid`,`FldName`)
) ENGINE=InnoDB;

Re: Additional Fields Extension

@apmuthu ah ok, initial thoughts are I can do that with customers & suppliers as they are the same, but not so sure with items as whilst similar are not the same, will have a look next week. Thank you.

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

Re: Additional Fields Extension

The id field of the 0_item_codes table is the Primary Key that can be used instead of the stock_id or the item_code field for linking into the additional fields extension's tables.

Re: Additional Fields Extension

FYI, I played with a different approach: defining additional fields as xml inside a text field.  There are no database changes and no changes to the items, suppliers, or customers pages.

Gist

Screenshots:

Customers
Items

Post's attachments

Test_AddlFields_Screenshots.zip 114.5 kb, 7 downloads since 2019-01-14 

You don't have the permssions to download the attachments of this post.

Re: Additional Fields Extension

Can please explain how i can use this code ? I'm not into programming

Re: Additional Fields Extension

@poncho1234, What i tried to explain you is to get the custom fields inside the respective pages. Usually its hard to remember and work in separate page for the custom fields. So we have to put the custom fields within the existing page itself. Here i have created a demo for understanding it.

Kvcodes Demo for Custom Fields
Username : custom
Password : 123456

This is my very initial version.  We will enhance and develop it to bring more possible custom fields to custom pages.  Looking for users and developers feedback to enhance it better.

Subscription service based on FA
HRM CRM POS batch Themes

43 (edited by poncho1234 04/28/2020 04:54:04 pm)

Re: Additional Fields Extension

@kvvaradha - It has been made clear by Joe/Janus that there will be no more DB changes in 2.4, i.e, Any modifications requiring DB changes will not be considered for V2.4 only for 2.5 and if they consider the modifications are right for FA.

Its relatively easy to add extra fields to the core, not so easy to include them in FA functionality, but including them now brings all the disadvantages of modifying core files - upgrades, management, etc.

Given the above a module seemed to be the only viable solution. The module I wrote is quite 'bulky' as I tried to incorporate as many additional fields as I thought users would want. (Each user/business would want there own fields) The original 'integrated' version did not work, which leads to the current version using extra pages: The remains bearing not much resemblance to the initial idea :-(

So my thoughts on your mod are - I'd think I'd leave just the custom fields from my module in, 4 for each of customers, Items and suppliers, that way users can label the fields to what they want. You can use any code from the module.

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

Re: Additional Fields Extension

This program we wrote it for 2.5 it's not for 2.4 those who wish to customize the core they can give it a try with this module. Other than that this code will be used inside 2.5 the next major update.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Additional Fields Extension

@kvvaradha - OK, Bit busy at the moment, but I'll have a think and post something.

Also, it seems 'Bin Number' is a definite inclusion in Items.

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

Re: Additional Fields Extension

Hello @kvvaradha and @poncho1234

I am trying to follow you guys in your wishes.
Let us try to focus on 2.5. Which fields do we need? I will put it on the developer site for 2.5.

Joe

47 (edited by kvvaradha 04/29/2020 02:26:17 pm)

Re: Additional Fields Extension

We have to add two tables for custom fields. One for the field definition and another one to store data of custom fields.

Actually I am thinking to extend this to sales invoice  and purchase invoice.

@poncho1234 - we have to focus on next major release. I can understand.  Let's try to contribute something to next release.

@Joe  users are eagerly waiting for the next major update. So let's focus on it.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Additional Fields Extension

Alternatively, can keep a JSON field in each such table that needs extra field data and define all such data definitions in a single table.

Yet another alternative: Keep an XML file for extra fields definition in each application - suppliers, items, customers, invoices, etc and keep all such data in a single table with an application name/type field to segregate them.

Re: Additional Fields Extension

Yes. But for more  customization get only one value from that minified string. We have to decode all the custom fields. May be a choice to do that.suppose if we have to bring hsn code for items. And we have to take tax reports based on hsn code. It might be complex to get and process the results.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Additional Fields Extension

PHP has a json_encode and json_decode functions to convert to/from array.

Sample Code