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

SF.net SVN: ledger-smb:[2758] addons/1.3



Revision: 2758
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2758&view=rev
Author:   einhverfr
Date:     2009-08-24 05:15:36 +0000 (Mon, 24 Aug 2009)

Log Message:
-----------
Fixes for fixed assets

Modified Paths:
--------------
    addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
    addons/1.3/assets/trunk/UI/asset/edit_asset.html

Added Paths:
-----------
    addons/1.3/base/
    addons/1.3/base/tags/
    addons/1.3/base/trunk/
    addons/1.3/base/trunk/sql/
    addons/1.3/base/trunk/sql/modules/
    addons/1.3/base/trunk/sql/modules/Util.sql

Modified: addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2009-08-24 04:45:19 UTC (rev 2757)
+++ addons/1.3/assets/trunk/LedgerSMB/DBObject/Asset.pm	2009-08-24 05:15:36 UTC (rev 2758)
@@ -43,7 +43,18 @@
 sub get_metadata {
     my ($self) = @_;
     @{$self->{asset_classes}} = $self->exec_method(funcname => 'asset_class__list');
+   @{$self->{locations}} = $self->exec_method(funcname => 'warehouse__list_all');
+   @{$self->{departments}} = $self->exec_method(funcname => 'department__list_all');
 }
 
+sub get_invoice_id {
+    my ($self) = @_;
+    my ($ref) = $self->exec_method(funcname => 'get_vendor_invoice_id');
+    if (!$ref) {
+        $self->error($self->{_locale}->text('Invoice not found'));
+    } else {
+        $self->{invoice_id} = $ref->{get_vendor_invoice_id};
+    }
+}
 
 1;

Modified: addons/1.3/assets/trunk/UI/asset/edit_asset.html
===================================================================
--- addons/1.3/assets/trunk/UI/asset/edit_asset.html	2009-08-24 04:45:19 UTC (rev 2757)
+++ addons/1.3/assets/trunk/UI/asset/edit_asset.html	2009-08-24 05:15:36 UTC (rev 2758)
@@ -78,6 +78,28 @@
 } ?>
 </span>
 </div>
+<div class="inputrow" id="business_row">
+<span class="inputgroup" id="locationgroup">
+<?lsmb PROCESS select element_data = {
+	name = "warehouse_id"
+	options = warehouses
+	value_attr = "id"
+	text_attr = "description"
+	default_values = [warehouse_id]
+	label = text('Location')
+} ?>
+</span>
+<span class="inputgroup" id="departmentgroup">
+<?lsmb PROCESS select element_data = {
+	name = "department_id"
+	options = departments
+	value_attr = "id"
+	text_attr = "description"
+	default_values = [department_id]
+	label = text('Department')
+} ?>
+</span>
+</div>
 <div class="inputrow" id="buttonrow">
 <?lsmb PROCESS button element_data = {
 	text = text("Save")

Added: addons/1.3/base/trunk/sql/modules/Util.sql
===================================================================
--- addons/1.3/base/trunk/sql/modules/Util.sql	                        (rev 0)
+++ addons/1.3/base/trunk/sql/modules/Util.sql	2009-08-24 05:15:36 UTC (rev 2758)
@@ -0,0 +1,23 @@
+CREATE OR REPLACE FUNCTION department__list_all() RETURNS SETOF department AS
+$$
+SELECT * FROM department order by description;
+$$ language sql;
+
+CREATE OR REPLACE FUNCTION warehouse__list_all() RETURNS SETOF warehouse AS
+$$
+SELECT * FROM warehouse order by description;
+$$ language sql;
+
+CREATE OR REPLACE FUNCTION nvoice__get_by_vendor_number
+(in_meta_nunber text, in_invoice_number text)
+RETURNS ap AS
+$$
+DECLARE retval ap;
+BEGIN
+	SELECT * INTO retval FROM ap WHERE entity_credit_id = 
+		(select id from entity_credit_account where entity_class = 1
+		AND meta_number = in_meta_number)
+		AND invnumber = in_invoice_number;
+	RETURN retval;
+END;
+$$ LANGUAGE PLPGSQL;


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