[Ledger-smb-devel] Where to put the PHP interop classes

2012-07-29 Thread Chris Travers
Hi all;

I am trying to decide where to put the PHP interop classes.  It seems
we have a few possibilities:

1)  In /addons/ maybe a new directory like /addons/languages/
2)  In a separate open source project like ledgersmb-php on
Sourceforge or Google Code

I am leaning towards the latter because we could do additional
releases on Freecode and hopefully get more interest that way.
However, I would like to get feedback from others first.  Maybe I am
missing something.  Maybe the other way is better, etc.  So let me
know what you think and have your say.

Best Wishes,
Chris Travers

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel


[Ledger-smb-devel] G/L Procedure

2012-07-29 Thread M Lubratt
Good morning!

In order to integrate LSMB into another business workflow application I've
developed, I've written a stored procedure that can be called to insert GL
transactions into the LSMB database instead of trying to use HTTP calls to
the web based system.  I know that Chris is starting to move to bindings
for other languages; so, I don't know if this would be useful for everyone,
or not.  There's probably more work that could be done here.  I only did
some rudimentary error checking and I'm not terribly familiar with the
schema.  I attempted to do something similar for AR and AP as well, but I
ran out of development time before I was able to get them working.

Anyway, here it is...

Best regards,
Mark

--
-- Function: gl__transaction_create(date, text, text, text, boolean,
integer, text[], numeric[], numeric[], text[], text[])

-- DROP FUNCTION gl__transaction_create(date, text, text, text, boolean,
integer, text[], numeric[], numeric[], text[], text[]);

CREATE OR REPLACE FUNCTION gl__transaction_create(trans_date date, ref
text, description text, notes text, approved boolean, department_id
integer, chart_id text[], debit numeric[], credit numeric[], source text[],
memo text[])
  RETURNS boolean AS
$BODY$
declare
array_size INTEGER;
array_size2 INTEGER;
trans_id INTEGER;
p_id INTEGER;
total NUMERIC;
marray RECORD;
chart RECORD;
begin
-- Check the sizes of the passed arrays to verify they are the same size.

array_size := 0;
for marray in select * from unnest(chart_id) loop
array_size := array_size + 1;
end loop;

array_size2 := 0;
for marray in select * from unnest(debit) loop
array_size2 := array_size2 + 1;
end loop;

if array_size  array_size2 then
raise 'Arrays are not balanced.';
end if;
 array_size2 := 0;
for marray in select * from unnest(credit) loop
array_size2 := array_size2 + 1;
end loop;

if array_size  array_size2 then
raise 'Arrays are not balanced.';
end if;
 array_size2 := 0;
for marray in select * from unnest(source) loop
array_size2 := array_size2 + 1;
end loop;

if array_size  array_size2 then
raise 'Arrays are not balanced.';
end if;

array_size2 := 0;
for marray in select * from unnest(memo) loop
array_size2 := array_size2 + 1;
end loop;

if array_size  array_size2 then
raise 'Arrays are not balanced.';
end if;

-- Be sure the transaction is balanced.
total := 0;
for marray in select unnest(debit) as d, unnest(credit) as c loop
total := total + marray.d - marray.c;
end loop;

if total  0 then
raise 'The transaction is not balanced. %', total;
end if;

-- Get a transaction ID.

select * into trans_id from nextval('id'::regclass);

-- Make an entry into the gl table.

insert into gl (id, reference, description, transdate, person_id, notes,
approved, department_id)
values (trans_id::integer, ref, description, trans_date, (select id from
users where username=SESSION_USER), notes,
approved, department_id);

-- Loop through arrays and make entries to acc_trans.

for marray in select unnest(chart_id) as cid, unnest(debit) as d,
unnest(credit) as c, unnest(source) as s, unnest(memo) as m loop
begin
select * into strict chart from account__get_from_accno(marray.cid);
exception
when NO_DATA_FOUND then
raise 'Account % not found', marray.cid;
when TOO_MANY_ROWS then
raise 'Account % not unique.', marray.cid;
end;

total := marray.c - marray.d;

insert into acc_trans(trans_id, chart_id, amount, transdate, source, memo)
values(trans_id, chart.id, total, trans_date, marray.s, marray.m);
end loop;

-- If transaction is approved, update the transactions table.

if approved then
if not draft_approve(trans_id) then
raise 'Unable to approve this transaction.';
end if;
end if;

return TRUE;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE SECURITY DEFINER
  COST 100;
ALTER FUNCTION gl__transaction_create(date, text, text, text, boolean,
integer, text[], numeric[], numeric[], text[], text[]) OWNER TO mpl;
GRANT EXECUTE ON FUNCTION gl__transaction_create(date, text, text, text,
boolean, integer, text[], numeric[], numeric[], text[], text[]) TO public;
GRANT EXECUTE ON FUNCTION gl__transaction_create(date, text, text, text,
boolean, integer, text[], numeric[], numeric[], text[], text[]) TO mpl;
GRANT EXECUTE ON FUNCTION gl__transaction_create(date, text, text, text,
boolean, integer, text[], numeric[], numeric[], text[], text[]) TO
lsmb_josephine_ledger__gl_voucher_create;
GRANT EXECUTE ON FUNCTION gl__transaction_create(date, text, text, text,
boolean, integer, text[], numeric[], numeric[], text[], text[]) TO
lsmb_josephine_ledger__gl_transaction_create;
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. 

Re: [Ledger-smb-devel] G/L Procedure

2012-07-29 Thread Chris Travers
Hi;

On Sun, Jul 29, 2012 at 4:40 AM, M Lubratt mplubr...@gmail.com wrote:
 Good morning!

 In order to integrate LSMB into another business workflow application I've
 developed, I've written a stored procedure that can be called to insert GL
 transactions into the LSMB database instead of trying to use HTTP calls to
 the web based system.  I know that Chris is starting to move to bindings for
 other languages; so, I don't know if this would be useful for everyone, or
 not.  There's probably more work that could be done here.  I only did some
 rudimentary error checking and I'm not terribly familiar with the schema.  I
 attempted to do something similar for AR and AP as well, but I ran out of
 development time before I was able to get them working.

Wow, thanks!

Any objection to me including this in addons as it is? I'd also add
you to the CONTRIBUTORS file-- do you want me to redact your email
address or do what we do with most entries so far?

I will probably change the array size checks to use array_upper() in
this process, as it will cut down on the code (and I assume execution
time also).  That may also cut the size down and increase readability.

Best Wishes,
Chris Travers

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel


Re: [Ledger-smb-devel] initial draft of PHP mapper class

2012-07-29 Thread John Locke
I'd be interested in the PHP classes...

Regarding separate SF projects, that sounds worse -- what about moving 
to Github or something more flexible/easier to use?

Cheers,
John Locke
http://freelock.com

On 07/28/2012 05:52 AM, Chris Travers wrote:
 On Sat, Jul 28, 2012 at 1:32 AM, herman vierendeels
 herman.vierende...@gmail.com wrote:
 Hi Chris,

 I am interested.
 And i am still more interested in your java-implementation plans.
 As an experienced java-programmer, i might be able to help you in that field

 Hi Herman;

 I am sending you the couple of files I have.  I have not tested the
 exec_method call but I don't see why it wouldnt work.  The
 call_procedure seems to work however.

 I guess this is a question for everyone interested but would it make
 sense to create separate Sourceforge projects for each extra language
 binding?

 Best Wishes,
 Chris Travers

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Ledger-smb-devel mailing list
 Ledger-smb-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

 !DSPAM:5013e0e9129416620714272!



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel


Re: [Ledger-smb-devel] initial draft of PHP mapper class

2012-07-29 Thread Chris Travers
On Sun, Jul 29, 2012 at 7:56 AM, John Locke m...@freelock.com wrote:
 I'd be interested in the PHP classes...

 Regarding separate SF projects, that sounds worse -- what about moving
 to Github or something more flexible/easier to use?

Sure that might be good.

Best Wishes,
Chris Travers

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel


Re: [Ledger-smb-devel] Where to put the PHP interop classes

2012-07-29 Thread John Locke
[Replying to more appropriate thread...]

What about Github?

Not just for the PHP classes -- the whole project?

SF is annoying, by comparison...

Cheers,
John Locke
http://www.freelock.com

On 07/29/2012 01:57 AM, Chris Travers wrote:
 Hi all;

 I am trying to decide where to put the PHP interop classes.  It seems
 we have a few possibilities:

 1)  In /addons/ maybe a new directory like /addons/languages/
 2)  In a separate open source project like ledgersmb-php on
 Sourceforge or Google Code

 I am leaning towards the latter because we could do additional
 releases on Freecode and hopefully get more interest that way.
 However, I would like to get feedback from others first.  Maybe I am
 missing something.  Maybe the other way is better, etc.  So let me
 know what you think and have your say.

 Best Wishes,
 Chris Travers

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Ledger-smb-devel mailing list
 Ledger-smb-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

 !DSPAM:501500c8129411235955660!



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel


Re: [Ledger-smb-devel] Where to put the PHP interop classes

2012-07-29 Thread Chris Travers
On Sun, Jul 29, 2012 at 8:02 AM, John Locke m...@freelock.com wrote:
 [Replying to more appropriate thread...]

 What about Github?

 Not just for the PHP classes -- the whole project?


At least for the PHP classes, I think the more sites we are using for
some of these side-projects the more exposure we get.  Moving a
project at this stage is a lot of work and would probably have to be
phased.  Realistically I don't see it happening short-term.  It might
be worth thinking about/discussing once we are in beta and feature
requests are relatively stable.  I haven't really formed an opinion of
that longer-term but we'd want to keep in mind that effort migrating
would likely cause a temporary loss of momentum.  The question is
really whether we'd pick up enough additional momentum for that to be
worth it.

Best Wishes,
Chris Trabvers

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel