[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2778] addons/1.3/templatetrans/trunk
- Subject: SF.net SVN: ledger-smb:[2778] addons/1.3/templatetrans/trunk
- From: ..hidden..
- Date: Wed, 28 Oct 2009 19:33:59 +0000
Revision: 2778
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2778&view=rev
Author: einhverfr
Date: 2009-10-28 19:33:59 +0000 (Wed, 28 Oct 2009)
Log Message:
-----------
Correcting bad versions of committed files for template transactions
Modified Paths:
--------------
addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm
addons/1.3/templatetrans/trunk/patches/aa_gl.patch
addons/1.3/templatetrans/trunk/scripts/transtemplate.pl
addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql
Added Paths:
-----------
addons/1.3/templatetrans/trunk/transtemplate.pl
Modified: addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm
===================================================================
--- addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm 2009-10-28 19:32:09 UTC (rev 2777)
+++ addons/1.3/templatetrans/trunk/LedgerSMB/DBObject/TransTemplate.pm 2009-10-28 19:33:59 UTC (rev 2778)
@@ -1,32 +1,35 @@
-package LedgerSMB::DBObject::TempTrans;
+package LedgerSMB::DBObject::TransTemplate;
use base qw(LedgerSMB::DBObject);
+use strict;
sub save {
my $self = shift @_;
- $self->execute_method(funcname => 'journal__add');
+ $self->exec_method(funcname => 'journal__add');
for my $line (@{$self->{journal_lines}}){
- bless $line, LedgerSMB::DBObject;
- $line->execute_method(funcname=> 'journal__add_line');
+ my $l = $line, 'LedgerSMB::DBObject';
+ $l->exec_method(funcname=> 'journal__add_line');
}
if ($self->{is_invoice}){
- $self->execute_method(funcname => 'journal__make_invoice');
+ $self->exec_method(funcname => 'journal__make_invoice');
}
$self->commit;
}
sub search {
my $self = shift @_;
- @{$self->{search_results}} = $self->execute_method(
+ $self->{approved} = 'false';
+ $self->{is_template} = 'true';
+ @{$self->{search_results}} = $self->exec_method(
funcname => 'journal__search'
);
}
sub retrieve {
my $self = shift @_;
- my @vals = $self->execute_method(funcname => 'journal__retrieve');
+ my @vals = $self->exec_method(funcname => 'journal__retrieve');
$self->merge(shift @vals);
- @{$self->{line_items}} = $self->execute_method(funcname => 'journal__retrieve_lines');
- ($self->{inv_data}) = $self->execute_method(funcname => 'journal__retrieve_invoice');
+ @{$self->{line_items}} = $self->exec_method(funcname => 'journal__retrieve_lines');
+ ($self->{inv_data}) = $self->exec_method(funcname => 'journal__retrieve_invoice');
}
1;
Modified: addons/1.3/templatetrans/trunk/patches/aa_gl.patch
===================================================================
--- addons/1.3/templatetrans/trunk/patches/aa_gl.patch 2009-10-28 19:32:09 UTC (rev 2777)
+++ addons/1.3/templatetrans/trunk/patches/aa_gl.patch 2009-10-28 19:33:59 UTC (rev 2778)
@@ -1,6 +1,6 @@
Index: bin/aa.pl
===================================================================
---- bin/aa.pl (revision 2719)
+--- bin/aa.pl (revision 2770)
+++ bin/aa.pl (working copy)
@@ -959,6 +959,8 @@
@@ -11,7 +11,7 @@
);
if (!$form->{approved} && !$form->{batch_id}){
$button{approve} = {
-@@ -1028,6 +1030,21 @@
+@@ -1028,6 +1030,22 @@
|;
}
@@ -19,6 +19,7 @@
+ use LedgerSMB;
+ use LedgerSMB::DBObject::TransTemplate;
+ my $lsmb = LedgerSMB->new();
++ $lsmb->merge($form);
+ $lsmb->{is_invoice} = 1;
+ if ($form->{arap} eq 'ar'){
+ $lsmb->{entity_class} = 2;
@@ -35,20 +36,36 @@
use LedgerSMB;
Index: bin/gl.pl
===================================================================
---- bin/gl.pl (revision 2764)
+--- bin/gl.pl (revision 2770)
+++ bin/gl.pl (working copy)
-@@ -247,6 +247,10 @@
- { ndx => 7, key => 'H', value => $locale->text('Schedule') },
- 'delete' =>
- { ndx => 8, key => 'D', value => $locale->text('Delete') },
+@@ -241,6 +241,10 @@
+ 'update' =>
+ { ndx => 1, key => 'U', value => $locale->text('Update') },
+ 'post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
+ 'save_temp' =>
+ { ndx => 9,
+ key => 'T',
+ value => $locale->text('Save Template') },
- );
+ 'post_as_new' =>
+ { ndx => 6, key => 'N', value => $locale->text('Post as new') },
+ 'schedule' =>
+@@ -254,6 +258,7 @@
+ $button{post}->{value} = $locale->text('Save');
+ }
+ %a = ();
++ $a{save_temp} = 1;
+ if ( $form->{id} ) {
- if ($form->{separate_duties}){
-@@ -334,7 +338,17 @@
+ for ( 'update', 'post_as_new', 'schedule' ) { $a{$_} = 1 }
+@@ -301,6 +306,7 @@
+ accesskey => $button{$_}->{key},
+ order => $i
+ };
++ print STDERR $button{$_}->{value};
+ $i++;
+ }
+
+@@ -334,7 +340,17 @@
}
Modified: addons/1.3/templatetrans/trunk/scripts/transtemplate.pl
===================================================================
--- addons/1.3/templatetrans/trunk/scripts/transtemplate.pl 2009-10-28 19:32:09 UTC (rev 2777)
+++ addons/1.3/templatetrans/trunk/scripts/transtemplate.pl 2009-10-28 19:33:59 UTC (rev 2778)
@@ -1,5 +1,6 @@
package LedgerSMB::Scripts::transtemplate;
+use LedgerSMB::DBObject::TransTemplate;
our $VERSION = '0.1';
sub view {
@@ -23,7 +24,7 @@
}
- $vouchers_dispatch->{$request->{batch_type}}{function}($request);
+ $vouchers_dispatch->{$request->{entry_type}}{function}($request);
}
@@ -39,4 +40,41 @@
$template->render($request);
}
+sub display_results {
+ my ($request) = @_;
+ my $transtemplate = LedgerSMB::DBObject::TransTemplate->new(base => $request);
+ $transtemplate->search;
+ my $template = LedgeSMB::Template->new(
+ user => $request->{_user},
+ locale => $request->{_locale},
+ path => 'UI',
+ template => 'form-dynatable',
+ format => 'HTML',
+ );
+ my @cols = qw(id entry_type source description meta_number entity_name class);
+ my $column_headers = {
+ id => 'ID',
+ source => 'Reference',
+ description => 'Description',
+ meta_number => 'Account Number',
+ entity_name => 'Name',
+ class => 'Type of Account',
+ };
+ my $rows = [];
+ $base_url = $request->{script} . "?action=view";
+ for my $line (@{$templatetrans->{search_resuts}}){
+ $line->{source} = {
+ text => $line->{source},
+ href => "$base_url&entry_type=$line->{entry_type}&id=$line->{id}",
+ };
+ push @$rows, $line;
+ }
+ $template->render({
+ columns => ..hidden..,
+ headers => $column_headers,
+ title => $request->locale->text('Memorized Transaction List'),
+ rows => $rows,
+ form => $request,
+ });
+}
1;
Modified: addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql
===================================================================
--- addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql 2009-10-28 19:32:09 UTC (rev 2777)
+++ addons/1.3/templatetrans/trunk/sql/modules/trans-functions.sql 2009-10-28 19:33:59 UTC (rev 2778)
@@ -4,7 +4,7 @@
in_source text,
in_description text,
in_entry_type int,
-in_transaction_date,
+in_transaction_date date,
in_approved bool,
in_department_id int,
in_is_template bool
@@ -24,7 +24,8 @@
$$ language plpgsql;
CREATE OR REPLACE FUNCTION journal__add_line(
-in_account_id, in_journal_id, in_amount numeric, in_cleared bool, in_memo text
+in_account_id int, in_journal_id int, in_amount numeric,
+in_cleared bool, in_memo text
) RETURNS journal_line AS $$
DECLARE retval journal_line;
BEGIN
@@ -36,9 +37,9 @@
END;
$$ LANGUAGE PLPGSQL;
-CREATE OR REPLACE FUNCTION journal__validate_entry(in_id) RETURNS bool AS
+CREATE OR REPLACE FUNCTION journal__validate_entry(in_id int) RETURNS bool AS
$$
- SELECT sum(amount) = 0 FROM journal_line WHERE id = in_id;
+ SELECT sum(amount) = 0 FROM journal_line WHERE journal_id = $1;
$$ language sql;
CREATE OR REPLACE FUNCTION journal__make_invoice(
@@ -47,7 +48,7 @@
) returns t_invoice AS $$
DECLARE retval t_invoice;
BEGIN
- INSERT INTO t_invoice (order_id, journal_id, on_hold, reverse
+ INSERT INTO t_invoice (order_id, journal_id, on_hold, reverse,
credit_id, language_id)
VALUES (in_order_id, in_journal_id, coalesce(in_on_hold, false),
in_reverse, in_credit_id, in_language_id);
@@ -58,34 +59,72 @@
END;
$$ language plpgsql;
+CREATE TYPE journal_search_result AS (
+id bigint,
+source text,
+description text,
+entry_type int,
+transaction_date date,
+approved bool,
+is_template bool,
+meta_number text,
+entity_name text,
+entity_class text
+);
+
CREATE OR REPLACE FUNCTION journal__search(
in_source text,
in_description text,
in_entry_type int,
-in_transaction_date,
+in_transaction_date date,
in_approved bool,
in_department_id int,
in_is_template bool,
in_meta_number text,
in_entity_class int
) RETURNS SETOF journal_search_result AS $$
-$$
-DECLARE retval journal;
+DECLARE retval journal_search_result;
BEGIN
+ FOR retval IN
+ SELECT j.id, j.source, j.description, j.entry_type,
+ j.transaction_date, j.is_template, eca.meta_number,
+ e.name, ec.class
+ FROM journal j
+ LEFT JOIN t_invoice i ON (i.journal_id = j.id)
+ LEFT JOIN entity_credit_account eca ON (eca.id = credit_id)
+ LEFT JOIN entity e ON (eca.entity_id = e.id)
+ LEFT JOIN entity_class ec ON (eca.entity_class = ec.id)
+ WHERE (in_source IS NULL OR in_source = j.source) AND
+ (in_description IS NULL
+ or in_descripition = j.description) AND
+ (in_entry_type is null or in_entry_type = j.entry_type)
+ and (in_transaction_date is null
+ or in_transaction_date = j.transaction_date) and
+ j.approved = coalesce(in_approved, true) and
+ j.is_template = coalesce(in_is_template, false) and
+ (in_department_id is null
+ or j.department_id = in_department_id) and
+ (in_meta_number is null
+ or eca.meta_number = in_meta_number) and
+ (in_entity_class is null
+ or eca.entity_class = in_entity_class)
+ LOOP
+ RETURN NEXT retval;
+ END LOOP;
END;
$$ language plpgsql;
-CREATE OR REPLACE FUNCTION journal__get_invoice(in_id) RETURNS t_invoice AS
+CREATE OR REPLACE FUNCTION journal__get_invoice(in_id int) RETURNS t_invoice AS
$$
SELECT * FROM t_invoice where journal_id = $1;
$$ language sql;
-CREATE OR REPLACE FUNCTION journal__get_entry(in_id) RETURNS journal AS
+CREATE OR REPLACE FUNCTION journal__get_entry(in_id int) RETURNS journal AS
$$
SELECT * FROM journal where id = $1;
-$$ laguage sql;
+$$ language sql;
-CREATE OR REPLACE FUNCTION journal__lines(in_id) RETURNS SETOF journal_line AS
+CREATE OR REPLACE FUNCTION journal__lines(in_id int) RETURNS SETOF journal_line AS
$$
select * from journal_line where journal_id = $1;
$$ language sql;
Added: addons/1.3/templatetrans/trunk/transtemplate.pl
===================================================================
--- addons/1.3/templatetrans/trunk/transtemplate.pl (rev 0)
+++ addons/1.3/templatetrans/trunk/transtemplate.pl 2009-10-28 19:33:59 UTC (rev 2778)
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+require "lsmb-request.pl";
+#!/usr/bin/perl
+
+require "lsmb-request.pl";
+#!/usr/bin/perl
+
+require "lsmb-request.pl";
Property changes on: addons/1.3/templatetrans/trunk/transtemplate.pl
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.