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

Re: Inderesting Postgres/LSMB issue?



On Wed, 2009-07-08 at 18:48 -0400, Hugh Esco wrote:
> Richard:
> 
> Inserting a part involves considerably more than a simple
> interaction with the parts table.  Take a look at the perl
> module, LedgerSMB::API, for some indication of how to interact
> with the LedgerSMB code base itself, which could avoid some
> wheel re-invention.  See particularly: t/13-lsmb-api-ic-part.t
> for a minimal record necessary to populate a row of your
> parts table.
> 
> It includes:
> 
> %fields = (
>                      item => 'part',
>                  orphaned => 1,
>               taxaccounts => '2150',
>            selectcurrency => 'USD',
>                partnumber => $partnumber,
>               description => 'Widget, single',
>                 IC_income => '4410--General Sales',
>                IC_expense => '5020--Purchases',
>              IC_inventory => '1520--Inventory',
>               IC_tax_2150 => 1,
>   IC_tax_2150_description => '2150--Sales Tax',
>               priceupdate => $date,
>                 sellprice => '0.25',
>                 listprice => '',
>                  lastcost => '0.098',
>                    markup => '',
>                weightunit => 'lbs',
>             customer_rows => 1,
>            makemodel_rows => 1,
>             assembly_rows => 1,
>                     login => 'lsmb_api_test',
>                      path => 'bin/mozilla',
>                 );
> 
> To get a clear sense of what all happens when a new part is
> inserted through the web interface, use pg_dump to take before
> and after snapshots of your dataset sandwiched around your
> create a part interaction in the browser.  Then diff those
> two data dumps and study what changed.
> 
> You might also grep one of those dumps for the table name
> 'parts' and find out how often some referential integrity rule
> from the other tables mentions it.
> 
> As for extracting that data from one dataset and using it to
> seed an new dataset:
> 
> The chart table is a fairly atomic unit with more depending
> on it, than it depends on.  I have before taken a snapshot of
> chart to accomplish this purpose.
> 
> But the parts table is hard to segregate from the payables to
> vendors which put those parts into your database.  And the
> chart of accounts and the entries that make their way into
> partscustomer, partsgroup, partstax, partsvendor, pricegroup
> and perhaps other tables.
> 
> LedgerSMB::API is not yet complete.  Others who have a similar
> itch to scratch are invited to join the effort.  But it is
> successfully handling parts already.  It will provide some
> (but not complete) guidance in addressing your issue.
> 
> -- Hugh Esco
> 
> P.S.  I am currently seeking gainful employment: short
> term projects, contract work or full time positions are all
> considered.  I have strong Perl / SQL development skills,
> as well as systems administration experience.  I am willing
> to relocate and welcome any leads folks might share with me.
> 
> --
> Hugh Esco
> 770-250-5192 x21

Hi Hugh,
yes - I've been "injecting" data for a while, but "part" has to be the
starting point to get the "id" that others tables use - basically any
that start with Partnnnnn. From Chris's reply at least I know how to
"inject" a service now!

Cheers
Richard