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

SF.net SVN: ledger-smb:[4932] trunk



Revision: 4932
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4932&view=rev
Author:   einhverfr
Date:     2012-06-20 14:47:55 +0000 (Wed, 20 Jun 2012)
Log Message:
-----------
Fixing File.pm calls and verifying per-part file attachments are there in 1.4

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/IC.pm
    trunk/LedgerSMB/IR.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/OE.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/AA.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -741,8 +741,7 @@
 sub get_files {
      my ($self, $form, $locale) = @_;
      return if !$form->{id};
-     my $file = LedgerSMB::File->new();
-     $file->new_dbobject({base => $form, locale => $locale});
+     my $file = LedgerSMB::File->new(%$form);
      @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 1});
      @{$form->{file_links}} = $file->list_links(
                   {ref_key => $form->{id}, file_class => 1}

Modified: trunk/LedgerSMB/IC.pm
===================================================================
--- trunk/LedgerSMB/IC.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/IC.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -60,8 +60,7 @@
 
 sub get_files {
      my ($self, $form, $locale) = @_;
-     my $file = LedgerSMB::File->new();
-     $file->new_dbobject({base => $form, locale => $locale});
+     my $file = LedgerSMB::File->new(%$form);
      @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 3});
      @{$form->{file_links}} = $file->list_links(
                   {ref_key => $form->{id}, file_class => 3}

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/IR.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -57,8 +57,7 @@
 sub get_files {
      my ($self, $form, $locale) = @_;
      return if !$form->{id};
-     my $file = LedgerSMB::File->new();
-     $file->new_dbobject({base => $form, locale => $locale});
+     my $file = LedgerSMB::File->new(%$form);
      @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 1});
      @{$form->{file_links}} = $file->list_links(
                   {ref_key => $form->{id}, file_class => 1}

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/IS.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -105,8 +105,7 @@
 sub get_files {
      my ($self, $form, $locale) = @_;
      return if !$form->{id};
-     my $file = LedgerSMB::File->new();
-     $file->new_dbobject({base => $form, locale => $locale});
+     my $file = LedgerSMB::File->new(%$form);
      @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 1});
      @{$form->{file_links}} = $file->list_links(
                   {ref_key => $form->{id}, file_class => 1}

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/OE.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -58,8 +58,7 @@
 sub get_files {
      my ($self, $form, $locale) = @_;
      return if !$form->{id};
-     my $file = LedgerSMB::File->new();
-     $file->new_dbobject({base => $form, locale => $locale});
+     my $file = LedgerSMB::File->new(%$form);
      @{$form->{files}} = $file->list({ref_key => $form->{id}, file_class => 2});
      @{$form->{file_links}} = $file->list_links(
                   {ref_key => $form->{id}, file_class => 2}

Modified: trunk/LedgerSMB/Scripts/file.pm
===================================================================
--- trunk/LedgerSMB/Scripts/file.pm	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/LedgerSMB/Scripts/file.pm	2012-06-20 14:47:55 UTC (rev 4932)
@@ -32,6 +32,8 @@
    1   => 'LedgerSMB::File::Transaction',
    2   => 'LedgerSMB::File::Order',
    3   => 'LedgerSMB::File::Part',
+   4   => 'LedgerSMB::File::Entity',
+   5   => 'LedgerSMB::File::ECA',
 };
 
 sub get {

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-06-20 13:47:18 UTC (rev 4931)
+++ trunk/sql/Pg-database.sql	2012-06-20 14:47:55 UTC (rev 4932)
@@ -4472,10 +4472,13 @@
        class text primary key
 );
 
-insert into file_class values (1, 'transaction');
-insert into file_class values (2, 'order');
-insert into file_class values (3, 'part');
+insert into file_class values (1, 'transaction'),
+                              (2, 'order'),
+                              (3, 'part'),
+                              (4, 'entity'),
+                              (5, 'eca');
 
+
 COMMENT ON TABLE file_class IS
 $$ File classes are collections of files attached against rows in specific 
 tables in the database.  They can be used in the future to implement other form 
@@ -4535,8 +4538,28 @@
 ) inherits (file_base);
 
 COMMENT ON TABLE file_part IS
-$$ File attachments primarily attached to orders and quotations.$$;
+$$ File attachments primarily attached to goods and services.$$;
 
+CREATE TABLE file_entity (
+       check (file_class=4),
+       unique(id),
+       primary key (ref_key, file_name, file_class),
+       foreign key (ref_key) references entity(id)
+) inherits (file_base);
+
+COMMENT ON TABLE file_entity IS
+$$ File attachments primarily attached to entities.$$;
+
+CREATE TABLE file_eca (
+       check (file_class=5),
+       unique(id),
+       primary key (ref_key, file_name, file_class),
+       foreign key (ref_key) references entity_credit_account(id)
+) inherits (file_base);
+
+COMMENT ON TABLE file_eca IS
+$$ File attachments primarily attached to customer and vendor agreements.$$;
+
 CREATE TABLE file_secondary_attachment (
        file_id int not null,
        source_class int references file_class(id),

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