[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3622] trunk
- Subject: SF.net SVN: ledger-smb:[3622] trunk
- From: ..hidden..
- Date: Wed, 03 Aug 2011 22:58:00 +0000
Revision: 3622
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3622&view=rev
Author: einhverfr
Date: 2011-08-03 22:57:59 +0000 (Wed, 03 Aug 2011)
Log Message:
-----------
File attachments added for ar/ap transactions. Next up: invoices and orders
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/bin/aa.pl
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2011-08-03 21:36:34 UTC (rev 3621)
+++ trunk/LedgerSMB/AA.pm 2011-08-03 22:57:59 UTC (rev 3622)
@@ -29,6 +29,7 @@
package AA;
use LedgerSMB::Sysconfig;
use LedgerSMB::Log;
+use LedgerSMB::File;
my $logger = Log::Log4perl->get_logger("AA");
@@ -700,6 +701,26 @@
}
+=item get_files
+
+Returns a list of files associated with the existing transaction. This is
+provisional, and will change for 1.4 as the GL transaction functionality is
+ {ref_key => $self->{id}, file_class => 1}
+rewritten
+
+=cut
+
+sub get_files {
+ my ($self, $form, $locale) = @_;
+ return if !$form->{id};
+ my $file = LedgerSMB::File->new();
+ $file->new_dbobject({base => $form, locale => $locale});
+ @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 1});
+ @{$form->{file_links}} = $file->list_links(
+ {ref_key => $form->{id}, file_class => 1}
+ );
+
+}
=item delete_transaction(\%myconfig, $form)
Deletes a transaction identified by $form->{id}, whether it is an ar or ap
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2011-08-03 21:36:34 UTC (rev 3621)
+++ trunk/bin/aa.pl 2011-08-03 22:57:59 UTC (rev 3622)
@@ -159,6 +159,7 @@
$form->close_form;
$form->open_form;
$form->{dbh}->commit;
+ AA->get_files($form, $locale);
&form_header;
&form_footer;
@@ -1063,7 +1064,64 @@
}
}
-
+ if ($form->{id}){
+ print qq|
+<table width="100%">
+<tr class="listtop">
+<th colspan="4">| . $locale->text('Attached and Linked Files') . qq|</th>
+<tr class="listheading">
+<th>| . $locale->text('File name') . qq|</th>
+<th>| . $locale->text('File type') . qq|</th>
+<th>| . $locale->text('Attached at') . qq|</th>
+<th>| . $locale->text('Attached by') . qq|</th>
+</tr> |;
+ foreach my $file (@{$form->{files}}){
+ print qq|
+<tr>
+<td><a href="file.pl?action=get&file_class=1&ref_key=$form->{id}&id=$file->{id}"
+ >$file->{file_name}</a></td>
+<td>$file->{mime_type}</td>
+<td>$file->{uploaded_at}</td>
+<td>$file->{uploaded_by_name}</td>
+</tr>
+ |;
+ }
+ print qq|
+<table width="100%">
+<tr class="listheading">
+<th>| . $locale->text('File name') . qq|</th>
+<th>| . $locale->text('File type') . qq|</th>
+<th>| . $locale->text('Attached To Type') . qq|</th>
+<th>| . $locale->text('Attached To') . qq|</th>
+<th>| . $locale->text('Attached at') . qq|</th>
+<th>| . $locale->text('Attached by') . qq|</th>
+</tr>|;
+ foreach my $link (@{$form->{file_links}}){
+ $aclass=" ";
+ if ($link.src_class == 1){
+ $aclass="Transaction";
+ } elsif ($link.src_class == 2){
+ $aclass="Order";
+ }
+ print qq|
+<tr>
+<td> $file->{file_name} </td>
+<td> $file->{mime_type} </td>
+<td> $aclass </td>
+<td> $file->{reference} </td>
+<td> $file->{attached_at} </td>
+<td> $file->{attached_by} </td>
+</tr>|;
+ }
+ print qq|
+</table>|;
+ $callback = $form->escape(
+ lc($form->{ARAP}) . ".pl?action=edit&id=".$form->{id}
+ );
+ print qq|
+<a href="file.pl?action=show_attachment_screen&ref_key=$form->{id}&file_class=1&callback=$callback"
+ >[| . $locale->text('Attach') . qq|]</a>|;
+ }
if ( $form->{lynx} ) {
require "bin/menu.pl";
&menubar;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.