[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add field to parts



Hmmm I just checked something and there may be an easier way to do this for 1.3/1.4.  When we redo the parts bit this may be different.


Unfortunately, the bit you're trying to change is located in "old code": code that's still inherited from SQL Ledger, which means you probably need a few extra rounds to make it work in all cases. But from what I found out so far is that you're looking to change the query in IC.pm:435 to include your new column and the $dbh->execute() line right below to include the value of the column to be set. That value is held in $form->{<name-of-the-entry-field-in-the-form>}.

 
In general, this is probably a reasonable way to do this.    It ensures that you can later add appropriate constraints, etc. and the datatype can be whatever you like.  There is a second way to do it, which is *not* guaranteed to continue to work as-is after we redo the logic for the parts (though you can customize the logic easily enough to bring it back) which is:

1)  use the add_custom_field() stored procedure
2)  Customize the user interface to handle that

There are a couple things to keep in mind with this second approach:

1)  It is designed only for very light-weight customizations.  In other words it will *only* give you a field which is stored in/retrieved from the database

2)  It is only supported for text types.

To use this approach you;d run the following query in pgAdmin or psql:

SELECT * FROM add_custom_field('parts', 'my_field_name', 'text');

Then customize the screen (in bin/ic.pl's form_header and form_footer functions).

Best Wishes,
Chris Travers