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

SF.net SVN: ledger-smb:[5576] trunk/LedgerSMB/PE.pm



Revision: 5576
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5576&view=rev
Author:   einhverfr
Date:     2013-01-15 08:48:29 +0000 (Tue, 15 Jan 2013)
Log Message:
-----------
Correcting error, access denied to translations, when saving a translation

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

Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm	2013-01-15 01:10:49 UTC (rev 5575)
+++ trunk/LedgerSMB/PE.pm	2013-01-15 08:48:29 UTC (rev 5576)
@@ -1,4 +1,5 @@
 # SLATED TO BE GREATLY REDUCED IN 1.4
+
 =head1 NAME
 
 LedgerSMB::PE - Support functions for projects, partsgroups, and parts
@@ -748,12 +749,20 @@
 
     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);
 
     $query = qq|
-		INSERT INTO translation (trans_id, language_code, description)
+		INSERT INTO $table (trans_id, language_code, description)
 		     VALUES (?, ?, ?)|;
     my $sth = $dbh->prepare($query) || $form->dberror($query);
 

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