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

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



Revision: 5622
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5622&view=rev
Author:   einhverfr
Date:     2013-01-24 06:12:47 +0000 (Thu, 24 Jan 2013)
Log Message:
-----------
Fix for translation showing more translations than is appropriate

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/PE.pm

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2013-01-24 06:07:11 UTC (rev 5621)
+++ trunk/Changelog	2013-01-24 06:12:47 UTC (rev 5622)
@@ -84,6 +84,7 @@
 
 Changelog for 1.3.30
 * Documented behavior of Outstanding Summary report (Chris T, 3601314)
+* Fix for translations showing multiple types (Chris T, 3601737)
 
 Changelog for 1.3.29
 * Added db routines for role backup and restore for shared hosting

Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm	2013-01-24 06:07:11 UTC (rev 5621)
+++ trunk/LedgerSMB/PE.pm	2013-01-24 06:12:47 UTC (rev 5622)
@@ -266,7 +266,7 @@
     $sth   = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 
-    $query = qq|DELETE FROM translation WHERE trans_id = ?|;
+    $query = qq|DELETE FROM translation_partsgroup WHERE trans_id = ?|;
     $sth   = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 
@@ -517,7 +517,7 @@
     my $query = qq|
 		  SELECT l.description AS language, 
 		         t.description AS translation, l.code
-		    FROM translation t
+		    FROM parts_translation t
 		    JOIN language l ON (l.code = t.language_code)
 		   WHERE trans_id = ?
 		ORDER BY 1|;
@@ -589,7 +589,7 @@
     my $query = qq|
 		  SELECT l.description AS language, 
 		         t.description AS translation, l.code
-		    FROM translation t
+		    FROM partsgroup_translation t
 		    JOIN language l ON (l.code = t.language_code)
 		   WHERE trans_id = ?
 		ORDER BY 1|;
@@ -645,6 +645,7 @@
 $myconfig is unused.  $form->{trans_id} is set to the last encountered id.
 
 =cut
+
 sub project_translations {
     my ( $self, $myconfig, $form ) = @_;
     my $dbh = $form->{dbh};
@@ -670,7 +671,7 @@
     my $query = qq|
 		  SELECT l.description AS language, 
 		         t.description AS translation, l.code
-		    FROM translation t
+		    FROM project_translation t
 		    JOIN language l ON (l.code = t.language_code)
 		   WHERE trans_id = ?
 		ORDER BY 1|;
@@ -793,7 +794,15 @@
 
     my $dbh = $form->{dbh};
 
-    my $query = qq|DELETE FROM translation WHERE trans_id = ?|;
+    my %tables = (
+        partsgroup => 'partsgroup_translation',
+        description => 'parts_translation'
+    );
+
+    my $table = $tables{$form->{translation}};
+
+    # table is whitelisted below, so safe.
+    my $query = qq|DELETE FROM $table WHERE trans_id = ?|;
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);
 

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