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

SF.net SVN: ledger-smb:[2804] addons/1.3/assets/trunk



Revision: 2804
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2804&view=rev
Author:   einhverfr
Date:     2009-12-07 17:00:19 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
Asset note handling

Modified Paths:
--------------
    addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
    addons/1.3/assets/trunk/scripts/asset.pl
    addons/1.3/assets/trunk/sql/modules/Assets.sql

Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2009-12-06 23:25:50 UTC (rev 2803)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2009-12-07 17:00:19 UTC (rev 2804)
@@ -41,6 +41,11 @@
     return @results;
 }
 
+sub save_note {
+    my ($self) = @_;
+    my ($ref) = $self->exec_method(funcname => 'asset_item__add_note');
+    $self->{dbh}->commit;
+}
 
 sub get_metadata {
     my ($self) = @_;

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2009-12-06 23:25:50 UTC (rev 2803)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2009-12-07 17:00:19 UTC (rev 2804)
@@ -106,8 +106,11 @@
 sub asset_save {
     my ($request) = @_;
     my $asset = LedgerSMB::DBObject::Asset->new(base => $request);
-    $asset->debug({file => '/tmp/asset'});
     $asset->save;
+    $asset->{note} = 'Vendor:' . $asset->{meta_number} . "\n" 
+                   . 'Invoice:'.$asset->{invnumber};
+    $asset->{subject} = 'Vendor/Invoice Note';
+    $asset->save_note;
     my $template = LedgerSMB::Template->new(
         user =>$request->{_user}, 
         locale => $request->{_locale},

Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-06 23:25:50 UTC (rev 2803)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-07 17:00:19 UTC (rev 2804)
@@ -351,3 +351,11 @@
 end;
 $$ language plpgsql;
 revoke execute on function asset_report__approve(int) from public;
+
+
+CREATE OR REPLACE FUNCTION asset_item__add_note(in_id int, in_subject text, in_note text)
+RETURNS asset_note AS
+$$
+INSERT INTO asset_note (asset_id, subject, note) values ($1, $2, $3);
+SELECT * FROM asset_note WHERE note_id = currval('note_id_seq');
+$$ language sql;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.