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

SF.net SVN: ledger-smb:[4127] branches/1.3



Revision: 4127
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4127&view=rev
Author:   einhverfr
Date:     2011-12-02 10:57:02 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Correcting attachment handling for orders/invoices

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/File/Order.pm
    branches/1.3/LedgerSMB/OE.pm
    branches/1.3/UI/Contact/contact.html
    branches/1.3/bin/oe.pl
    branches/1.3/scripts/file.pl
    branches/1.3/sql/modules/Files.sql

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/Changelog	2011-12-02 10:57:02 UTC (rev 4127)
@@ -4,7 +4,15 @@
 
 Changelog for 1.3.8:
 * Fixed duplicate key error saving taxes (Herman V)
+* Fixed not null violation when inserting bank acct w/o bic (Chris T)
+* Corrected fkey violation when attaching file to order (Chris T)
+* Moved language input on customer/vendor form for better display (Chris T)
+* Corrected binmode handling on templates (Herman V and Chris T)
+* File.sql now loads transactionally (Chris T)
+* OE no longer requires type input for editing orders/quotations (Chris T)
+* 
 
+
 Changelog for LedgerSMB 1.3.7 (Categorized due to length)
 Database
 * Added foreign key of entity_credit_account.language_code (Herman V)

Modified: branches/1.3/LedgerSMB/File/Order.pm
===================================================================
--- branches/1.3/LedgerSMB/File/Order.pm	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/LedgerSMB/File/Order.pm	2011-12-02 10:57:02 UTC (rev 4127)
@@ -38,7 +38,7 @@
 
 sub attach {
     my ($self, $args) = @_;
-    $self->exec_method({funcname => 'file__attach_to_tx'});
+    $self->exec_method({funcname => 'file__attach_to_order'});
     $self->commit unless $args->{no_commit};
 }
 

Modified: branches/1.3/LedgerSMB/OE.pm
===================================================================
--- branches/1.3/LedgerSMB/OE.pm	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/LedgerSMB/OE.pm	2011-12-02 10:57:02 UTC (rev 4127)
@@ -60,6 +60,24 @@
 
 }
 
+=get_type 
+
+Sets the type field for an existing order or quotation
+
+=cut
+
+sub get_type {
+    my ($self, $form) = @_;
+    my $dbh = $form->{dbh};
+    my @types = qw(null sales_order purchase_order sales_quotation 
+                   request_quotation);
+    my $sth = $dbh->prepare('select oe_class_id from oe where id = ?');
+    $sth->execute($form->{id});
+    my ($class) = $sth->fetchrow_array;
+    $form->{type} = $types[$class];
+    $sth->finish;
+}
+
 sub transactions {
     my ( $self, $myconfig, $form ) = @_;
 

Modified: branches/1.3/UI/Contact/contact.html
===================================================================
--- branches/1.3/UI/Contact/contact.html	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/UI/Contact/contact.html	2011-12-02 10:57:02 UTC (rev 4127)
@@ -438,15 +438,6 @@
 		value = description,
 		size = "20"
 	} ?></td>
-        <td> <?lsmb INCLUDE select element_data = {
-		label = text("language_code")
-		name = "language_code"
-                default_values = [language_code],
-                options = language_code_list
-		text_attr = "text"
-		value_attr = "code"
-                } ?>
-        </td>
 	</tr>
 	<tr class="pay_to_row">
 	<td colspan = "2">
@@ -594,6 +585,15 @@
 			label = text('Taxforms') 
 			} ?> 
 	  </td>
+        <td> <?lsmb INCLUDE select element_data = {
+		label = text("Language")
+		name = "language_code"
+                default_values = [language_code],
+                options = language_code_list
+		text_attr = "text"
+		value_attr = "code"
+                } ?>
+        </td>
           <td> <?lsmb INCLUDE select element_data = {
                         name = 'curr'
                         options = all_currencies

Modified: branches/1.3/bin/oe.pl
===================================================================
--- branches/1.3/bin/oe.pl	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/bin/oe.pl	2011-12-02 10:57:02 UTC (rev 4127)
@@ -85,7 +85,7 @@
 }
 
 sub edit {
-
+    OE->get_type($form);
     if ( $form->{type} =~ /(purchase_order|bin_list)/ ) {
         $form->{title} = $locale->text('Edit Purchase Order');
         $form->{vc}    = 'vendor';
@@ -889,7 +889,7 @@
         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}"
+<td><a href="file.pl?action=get&file_class=2&ref_key=$form->{id}&id=$file->{id}&type=sales_quotation&additional=type"
             >$file->{file_name}</a></td> 
 <td>$file->{mime_type}</td> 
 <td>$file->{uploaded_at}</td> 
@@ -928,7 +928,7 @@
 </table>|;
        $callback = $form->escape("oe.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"
+<a href="file.pl?action=show_attachment_screen&ref_key=$form->{id}&file_class=2&callback=$callback"
    >[| . $locale->text('Attach') . qq|]</a>|;
     }
 

Modified: branches/1.3/scripts/file.pl
===================================================================
--- branches/1.3/scripts/file.pl	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/scripts/file.pl	2011-12-02 10:57:02 UTC (rev 4127)
@@ -68,6 +68,7 @@
 
 sub show_attachment_screen {
     my ($request) = @_;
+    my @flds = split/\s/, $request->{additional};
     my $template = LedgerSMB::Template->new(
         user     => $request->{_user},
         locale   => $request->{_locale},

Modified: branches/1.3/sql/modules/Files.sql
===================================================================
--- branches/1.3/sql/modules/Files.sql	2011-12-02 09:28:42 UTC (rev 4126)
+++ branches/1.3/sql/modules/Files.sql	2011-12-02 10:57:02 UTC (rev 4127)
@@ -1,3 +1,5 @@
+BEGIN;
+
 CREATE OR REPLACE FUNCTION file__get_mime_type
  (in_mime_type_id int, in_mime_type_text text)
 RETURNS mime_type AS
@@ -116,7 +118,7 @@
        SELECT * INTO retval FROM file_base where id = in_id;
        RETURN retval;
    ELSE
-       INSERT INTO file_transaction 
+       INSERT INTO file_order
                    (content, mime_type_id, file_name, description, ref_key,
                    file_class, uploaded_by, uploaded_at)
             VALUES (in_content, in_mime_type_id, in_file_name, in_description,
@@ -136,7 +138,7 @@
 $$ Attaches or links a file to an order.  in_content OR id can be set.
 Setting both raises an exception.$$;
 
-
+DROP TYPE IF EXISTS file_list_item CASCADE;
 CREATE TYPE file_list_item AS (
        mime_type text,
        file_name text,
@@ -177,9 +179,9 @@
 COMMENT ON FUNCTION file__get(in_id int, in_file_class int) IS
 $$ Retrieves the file information specified including content.$$;
 
-DROP VIEW IF EXISTS file_order_links;
-DROP VIEW IF EXISTS file_tx_links;
-DROP VIEW IF EXISTS file_links;
+DROP VIEW IF EXISTS file_order_links CASCADE;
+DROP VIEW IF EXISTS file_tx_links CASCADE;
+DROP VIEW IF EXISTS file_links CASCADE;
 DELETE FROM file_view_catalog WHERE file_class in (1, 2);
 
 CREATE OR REPLACE view file_tx_links AS
@@ -250,3 +252,5 @@
 
 COMMENT ON FUNCTION file__list_links(in_ref_key int, in_file_class int) IS
 $$ This function retrieves a list of file attachments on a specified object.$$;
+
+COMMIT;

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