[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [2203] trunk
- Subject: SF.net SVN: ledger-smb: [2203] trunk
- From: ..hidden..
- Date: Wed, 09 Jul 2008 17:56:58 -0700
Revision: 2203
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2203&view=rev
Author: einhverfr
Date: 2008-07-09 17:56:58 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
Correcting the last errors for the draft approval on secondary test instance
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Draft.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/Sysconfig.pm
trunk/bin/aa.pl
trunk/scripts/drafts.pl
trunk/sql/modules/Drafts.sql
Modified: trunk/LedgerSMB/DBObject/Draft.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Draft.pm 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/LedgerSMB/DBObject/Draft.pm 2008-07-10 00:56:58 UTC (rev 2203)
@@ -4,24 +4,27 @@
sub search {
my ($self) = @_;
- @{$self->{draft_results} = $self->exec_method(funcname => 'draft__search');
- return @{$self->{draft_results};
+ @{$self->{draft_results}} = $self->exec_method(funcname => 'draft__search');
+ return @{$self->{draft_results}};
}
sub approve {
my ($self) = @_;
if (!$self->{id}){
- $self->error($self->{_locale}->text('No ID Set');
+ $self->error($self->{_locale}->text('No ID Set'));
}
($self->{approved}) = $self->exec_method(funcname => 'draft_approve');
+ $self->{dbh}->commit;
return $self->{approved};
}
sub delete {
my ($self) = @_;
if (!$self->{id}){
- $self->error($self->{_locale}->text('No ID Set');
+ $self->error($self->{_locale}->text('No ID Set'));
}
($self->{deleted}) = $self->exec_method(funcname => 'draft_delete');
return $self->{deleted};
}
+
+1;
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/LedgerSMB/Form.pm 2008-07-10 00:56:58 UTC (rev 2203)
@@ -2241,7 +2241,8 @@
d.description AS department,
a.amount AS oldinvtotal, a.paid AS oldtotalpaid,
a.person_id, e.name AS employee,
- c.language_code, a.ponumber, a.reverse
+ c.language_code, a.ponumber, a.reverse,
+ a.approved
FROM $arap a
JOIN entity_credit_account c USING (entity_id)
JOIN entity ce ON (ce.id = c.entity_id)
@@ -2258,6 +2259,10 @@
$ref = $sth->fetchrow_hashref('NAME_lc');
$self->db_parse_numeric(sth=>$sth, hashref=>$ref);
+ if (!defined $ref->{approved}){
+ $ref->{approved} = 0;
+ }
+
foreach $key ( keys %$ref ) {
$self->{$key} = $ref->{$key};
}
Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/LedgerSMB/Sysconfig.pm 2008-07-10 00:56:58 UTC (rev 2203)
@@ -83,7 +83,7 @@
# Root variables
for $var (
qw(pathsep logging check_max_invoices language auth latex
- db_autoupdate force_username_case)
+ db_autoupdate force_username_case max_post_size)
)
{
${$var} = $config{''}{$var} if $config{''}{$var};
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/bin/aa.pl 2008-07-10 00:56:58 UTC (rev 2203)
@@ -843,7 +843,6 @@
}
sub form_footer {
-
$form->hide_form(qw(callback path login sessionid));
$transdate = $form->datetonum( \%myconfig, $form->{transdate} );
@@ -888,6 +887,13 @@
'delete' =>
{ ndx => 8, key => 'D', value => $locale->text('Delete') },
);
+ if (!$form->{approved}){
+ $button{approve} = { ndx => 3, key => 'O', value => $locale->text('Post') };
+ delete $button{post_as_new};
+ delete $button{print_and_post_as_new};
+ delete $button{post};
+ delete $button{print_and_post};
+ }
if ($form->{separate_duties}){
$button{post}->{value} = $locale->text('Save');
@@ -943,6 +949,18 @@
}
+sub approve {
+ use LedgerSMB::DBObject::Draft;
+ use LedgerSMB;
+ my $lsmb = LedgerSMB->new();
+ $lsmb->merge($form);
+
+ my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb});
+
+ $draft->approve();
+ $form->info($locale->text('Draft Posted'));
+}
+
sub update {
my $display = shift;
$is_update = 1;
Modified: trunk/scripts/drafts.pl
===================================================================
--- trunk/scripts/drafts.pl 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/scripts/drafts.pl 2008-07-10 00:56:58 UTC (rev 2203)
@@ -1,5 +1,5 @@
-package LedgerSMB::Scripts::vouchers;
+package LedgerSMB::Scripts::drafts;
our $VERSION = '0.1';
use LedgerSMB::DBObject::Draft;
@@ -8,6 +8,11 @@
sub search {
my ($request) = @_;
+ $request->{class_types} = [
+ {text => $request->{_locale}->text('AR'), value => 'ar'},
+ {text => $request->{_locale}->text('AP'), value => 'ap'},
+ {text => $request->{_locale}->text('GL'), value => 'GL'},
+ ];
my $template = LedgerSMB::Template->new(
user =>$request->{_user},
locale => $request->{_locale},
@@ -20,12 +25,12 @@
sub list_drafts {
my ($request) = @_;
- my $draft= LedgerSMB::Draft->new(base => $request);
+ my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
my @search_results = $draft->search;
$draft->{script} = "drafts.pl";
my @columns =
- qw(select id transdate reference description, amount);
+ qw(select id transdate reference description amount);
my $base_href = "drafts.pl";
my $search_href = "$base_href?action=list_transactions";
@@ -39,26 +44,26 @@
my %column_heading = (
'select' => $draft->{_locale}->text('Select'),
- transaction_total => {
+ amount => {
text => $draft->{_locale}->text('AR/AP/GL Total'),
href => "$search_href&order_by=transaction_total"
},
- payment_total => {
- text => $draft->{_locale}->text('Paid/Received Total'),
- href => "$search_href&order_by=payment_total"
- },
description => {
text => $draft->{_locale}->text('Description'),
href => "$search_href&order_by=description"
},
- control_code => {
- text => $draft->{_locale}->text('Batch Number'),
- href => "$search_href&order_by=control_code"
- },
id => {
text => $draft->{_locale}->text('ID'),
- href => "$search_href&order_by=control_code"
+ href => "$search_href&order_by=id"
},
+ reference => {
+ text => $draft->{_locale}->text('Reference'),
+ href => "$search_href&order_by=reference"
+ },
+ transdate => {
+ text => $draft->{_locale}->text('Date'),
+ href => "$search_href&order_by=transdate"
+ },
);
my $count = 0;
my @rows;
@@ -73,18 +78,15 @@
name => "draft_$result->{id}"
}
},
- transaction_total => $draft->format_amount(
- amount => $result->{transaction_total}
+ amount => $draft->format_amount(
+ amount => $result->{amount}
),
- payment_total => $draft->format_amount (
- amount => $result->{payment_total}
- ),
+ reference => {
+ text => $result->{reference},
+ href => "$request->{type}.pl?action=edit&id=$result->{id}",
+ },
description => $result->{description},
- control_code => {
- text => $result->{control_code},
- href => "$draft_href&draft_id=$result->{id}",
-
- },
+ transdate => $result->{transdate},
id => $result->{id},
};
}
Modified: trunk/sql/modules/Drafts.sql
===================================================================
--- trunk/sql/modules/Drafts.sql 2008-07-09 21:30:49 UTC (rev 2202)
+++ trunk/sql/modules/Drafts.sql 2008-07-10 00:56:58 UTC (rev 2203)
@@ -24,17 +24,19 @@
ELSE 0
END) as amount
FROM (
+ SELECT id, transdate, reference, description,
+ approved from gl
+ WHERE in_type = 'gl'
+ UNION
SELECT id, transdate, invnumber as reference,
- description, approved from ap
+ description::text,
+ approved from ap
WHERE in_type = 'ap'
UNION
SELECT id, transdate, invnumber as reference,
- description, approved from ar
+ description,
+ approved from ar
WHERE in_type = 'ar'
- UNION
- SELECT id, transdate, reference, description,
- approved from gl
- WHERE in_type = 'gl'
) trans
JOIN acc_trans line ON (trans.id = line.trans_id)
JOIN chart ON (line.chart_id = chart.id)
@@ -43,7 +45,7 @@
or trans.transdate <= in_to_date)
AND trans.approved IS FALSE
AND trans.id NOT IN (select trans_id from voucher)
- GROUP BY trans.id, trans.transdate, trans.description
+ GROUP BY trans.id, trans.transdate, trans.description, trans.reference
HAVING (in_with_accno IS NULL or in_with_accno =
ANY(as_array(chart.accno)))
LOOP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.