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

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



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

Log Message:
-----------
Asset note fixes.

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-tables.sql
    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-07 19:03:28 UTC (rev 2806)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2009-12-07 19:40:13 UTC (rev 2807)
@@ -17,8 +17,7 @@
 sub save {
     my ($self) = @_;
     my ($ref) = $self->exec_method(funcname => 'asset__save');
-    my ($ar) = $self->call_procedure(funcname => 'invoice__get_by_vendor_number');
-    $self->{invoice_id} = $ar->{id};
+    $self->{invoice_id} = $ref->{id};
     $self->merge($ref);
     $self->{dbh}->commit || $self->error(
                   $self->{_locale}->text("Unable to save [_1] object", 

Modified: addons/1.3/assets/trunk/scripts/asset.pl
===================================================================
--- addons/1.3/assets/trunk/scripts/asset.pl	2009-12-07 19:03:28 UTC (rev 2806)
+++ addons/1.3/assets/trunk/scripts/asset.pl	2009-12-07 19:40:13 UTC (rev 2807)
@@ -118,10 +118,14 @@
         template => 'edit_asset',
         format => 'HTML'
     );
-    $asset->get_metadata;
-    $template->render(
-	{title => $asset->{_locale}->text('Add Asset'),
-	asset_classes => $asset->{asset_classes}});
+    $newasset = LedgerSMB::DBObject::Asset->new(
+                  base  => $request, 
+                  copy  => 'list',
+                  merge => ['stylesheet'],
+    );
+    $newasset->{title} = $asset->{_locale}->text('Add Asset');
+    $newasset->get_metadata;
+    $template->render($newasset);
 }
 
 sub asset_search {

Modified: addons/1.3/assets/trunk/sql/modules/Assets-tables.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets-tables.sql	2009-12-07 19:03:28 UTC (rev 2806)
+++ addons/1.3/assets/trunk/sql/modules/Assets-tables.sql	2009-12-07 19:40:13 UTC (rev 2807)
@@ -52,7 +52,7 @@
 COMMENT ON column asset_item.tag IS $$ This can be plugged into other routines to generate it automatically via ALTER TABLE .... SET DEFAULT.....$$;
 
 CREATE TABLE asset_note (
-    asset_id int not null references asset_item (id),
+    foreign key (ref_key) references asset_item(id),
     check (note_class = 4)
 ) inherits (note);
 

Modified: addons/1.3/assets/trunk/sql/modules/Assets.sql
===================================================================
--- addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-07 19:03:28 UTC (rev 2806)
+++ addons/1.3/assets/trunk/sql/modules/Assets.sql	2009-12-07 19:40:13 UTC (rev 2807)
@@ -244,7 +244,7 @@
 CREATE OR REPLACE FUNCTION asset__save
 (in_id int, in_asset_class int, in_description text, in_tag text, 
 in_purchase_date date, in_purchase_value numeric,
-in_usable_life numeric, in_salvage_value numeric, in_location_id int, 
+in_usable_life numeric, in_salvage_value numeric, in_warehouse_id int, 
 in_department_id int, in_invoice_id int, 
 in_asset_account_id int, in_dep_account_id int)
 returns asset_item AS
@@ -258,7 +258,7 @@
 		purchase_date = in_purchase_date,
 		purchase_value = in_purchase_value,
 		usable_life = in_usable_life,
-		location_id = in_location_id,
+		location_id = in_warehouse_id,
 		department_id = in_department_id,
 		invoice_id = in_invoice_id,
 		salvage_value = in_salvage_value,
@@ -272,7 +272,7 @@
 
 	INSERT INTO asset_item (asset_class_id, description, tag, purchase_date,
 		purchase_value, usable_life, salvage_value, department_id,
-		warehouse_id, invoice_id, asset_account_id, dep_account_id)
+		location_id, invoice_id, asset_account_id, dep_account_id)
 	VALUES (in_asset_class, in_description, in_tag, in_purchase_date,
 		in_purchase_value, in_usable_life, in_salvage_value,
 		in_department_id, in_warehouse_id, in_invoice_id,
@@ -356,6 +356,6 @@
 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);
+INSERT INTO asset_note (ref_key, subject, note) values ($1, $2, $3);
 SELECT * FROM asset_note WHERE 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.