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

Re: hacking on scripts/setup.pl this weekend



Hi;

On Mon, Sep 3, 2012 at 12:52 PM, Hugh Esco <..hidden..> wrote:
I want to do some work with the API,
but first I have to complete an upgrade
of my own company's books from 1.2 to 1.3.

I've been working my way through the scripts/setup.pl.
I already have a patch to automate the resolution of
duplicate keys which previously required user intervention.
I'm curious to know who I might send that to for consideration.
There is a copy below.

Sure, I can look at it.

I am a bit stuck though not knowing the author's intent with this script.

Installing 1.3.22, downloaded from sourceforge yesterday . . .

I see where my old data is moved aside as an lsmb12 schema;
and where the functions and the 1.3.22 ddl are pre-processed and run.
But I have found nothing in the script which seems interested
in importing my legacy data from the lsmb12 schema to the new
public schema.

This is a bit complicated.  We have a script:  sql/upgrade/1.2-1.3.sql

Or rather it is a template for a script.  It is preprocessed with Template Toolkit and run against the database.  this happens in lines 837-846.

Nor any design documents which would explain the thinking behind
this tool.

I encountered issues in the person__save function defined in:
        sql/modules/Person.sql

I'm advising that the setup.pl form which asks for a default country,
use that to set a row in the public.defaults table,
which can then be queried by the person__save function
to provide a default in the case of an undefined country_id.

Right now in branches/1.2 (and I think it should be in 1.3.22, but I could be wrong), it uses the chart of accounts country selected as a default there.

With some guidance, like load order, DDL changes which ought
to inform the effort and such, I'd be willing to take a crack
at writing the code for scripts/setup.pl to automate the process
for the next poor sap who faces this upgrade path.

I'd love to hear from anyone familiar with how this script
is put together on how they'd advise I proceed.

The setup.pl script could really use some refactoring going forward.   I have started on this to some extent in 1.4, but it needs a lot more work and help.  Certainly feedback and collaboration is appreciated.

See below for preliminary patch.  I promised that I would
note the source of the change in the invoice numbers
in a private notes field, but that change has not been written yet,
and is not reflected below.

Any guidance would be appreciated.  As I normally read this list
in digest, please consider bcc:'ing me directly in your response.

Could you email me the patch as an attachment?  I have trouble copyring/pasting from web mail without patch throwing errors.

Best Wishes,
Chris Travers