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

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??????

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.

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???

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

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.

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, 3 downloads since 2018-12-22 

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

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)

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?

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 are the same, but not so sure with items as whilst similar are not the same, will have a look next week. Thank you.

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, 2 downloads since 2019-01-14 

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