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

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



Revision: 5044
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5044&view=rev
Author:   einhverfr
Date:     2012-07-25 14:38:36 +0000 (Wed, 25 Jul 2012)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/AM.pm
    trunk/LedgerSMB/Locale.pm
    trunk/LedgerSMB/OE.pm
    trunk/bin/oe.pl
    trunk/sql/modules/Files.sql

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-5035
   + /branches/1.3:3711-5043

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/Changelog	2012-07-25 14:38:36 UTC (rev 5044)
@@ -88,6 +88,11 @@
 * Saving a part now returns to editing the same part (Chris T, h/t Brian W)
 * If pos.conf.pl is not found, now returns an intelligible error (Chris T)
 * Adding action/id div to top of many screens (Chris T, h/t Erik H)
+* File->get_for_template now gets most recent parts image (Chris T)
+* Fixed error on generate purchase orders (Chris T, 3544857, h/t Nigel T)
+* Fixed internal server errors with date parsing (Chris T, 3546698)
+* Fixed "Directory Transversal Not Allowed w/fs_cssdir (Chris T, h/t Robert C)
+* Fixed customer/vendor cleared on ship/receive update (Chris T, 3548104)
 
 Changelog for 1.3.20
 * Fixes for es_AR translation, duplicate keys removed (Andres B)

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/LedgerSMB/AM.pm	2012-07-25 14:38:36 UTC (rev 5044)
@@ -1200,6 +1200,11 @@
 
     my @allowedsuff = qw(css tex txt html xml);
     my $test = $form->{file};
+    $test =~ s|^$LedgerSMB::Sysconfig::fs_cssdir||;
+    if ($LedgerSMB::Sysconfig::fs_cssdir 
+           and $LedgerSMB::Sysconfig::fs_cssdir !~ m|/$|){
+         $test =~ s|^/||;
+    }
     if ($LedgerSMB::Sysconfig::templates =~ /^(.:)*?\//){
         $test =~ s#^$LedgerSMB::Sysconfig::templates/?\\?##;
     }

Modified: trunk/LedgerSMB/Locale.pm
===================================================================
--- trunk/LedgerSMB/Locale.pm	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/LedgerSMB/Locale.pm	2012-07-25 14:38:36 UTC (rev 5044)
@@ -123,7 +123,7 @@
         return $date;
     }
     if ( $date =~ /\D/ ) {
-        if ($date  =~ /\d{4}/){ # db date in
+        if ($date  =~ /^\d{4}/){ # db date in
             ( $yy, $mm, $dd ) = split /\D/, $date;
         }
         elsif ( $myconfig->{dateformat} =~ /^yy/ ) {

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/LedgerSMB/OE.pm	2012-07-25 14:38:36 UTC (rev 5044)
@@ -2332,9 +2332,10 @@
 
         $query = qq|
 			SELECT pv.partnumber, pv.leadtime, pv.lastcost, pv.curr,
-				v.id as vendor_id, v.name
+				eca.id as vendor_id, e.name
 			FROM partsvendor pv
-			JOIN vendor v ON (v.id = pv.credit_id)
+			JOIN entity_credit_account eca ON (eca.id = pv.credit_id)
+                        JOIN entity e ON e.id = eca.entity_id
 			WHERE pv.parts_id = ?|;
         $sth = $dbh->prepare($query) || $form->dberror($query);
 
@@ -2403,7 +2404,7 @@
 
         $query = qq|
 			SELECT v.curr, v.taxincluded, t.rate, c.accno
-			FROM vendor v
+			FROM entity_credit_account v
 			LEFT JOIN eca_tax vt ON (v.id = vt.vendor_id)
 			LEFT JOIN tax t ON (t.chart_id = vt.chart_id)
 			LEFT JOIN chart c ON (c.id = t.chart_id)
@@ -2426,9 +2427,11 @@
 
         # TODO:  Make this function insert as much as possible
         $query = qq|
-			INSERT INTO oe (ordnumber)
-			VALUES ('$uid')|;
-        $dbh->do($query) || $form->dberror($query);
+			INSERT INTO oe (ordnumber, entity_credit_account, 
+                                       oe_class_id)
+			VALUES (?, ?, 2)|;
+        $sth = $dbh->prepare($query);
+        $sth->execute($uid, $vendor_id) || $form->dberror($query);
 
         $query = qq|SELECT id FROM oe WHERE ordnumber = '$uid'|;
         $sth   = $dbh->prepare($query);
@@ -2518,7 +2521,7 @@
 			UPDATE oe SET
 				ordnumber = ?,
 				transdate = current_date,
-				entity_id = ?
+				entity_id = ?,
 				amount = ?,
 				netamount = ?,
 				taxincluded = ?,

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/bin/oe.pl	2012-07-25 14:38:36 UTC (rev 5044)
@@ -1003,6 +1003,10 @@
         &rebuild_vc( $form->{vc}, $ARAP, $form->{transdate}, 1 );
     }
 
+    # I think this is safe because the shipping or receiving is tied to the 
+    # order which is tied to the customer or vendor.  -CT
+    $newname = 1 if $form->{type} =~ /(ship|receive)/;
+
     if ( $form->{transdate} ne $form->{oldtransdate} ) {
         $form->{reqdate} =
           ( $form->{terms} )

Modified: trunk/sql/modules/Files.sql
===================================================================
--- trunk/sql/modules/Files.sql	2012-07-25 14:34:27 UTC (rev 5043)
+++ trunk/sql/modules/Files.sql	2012-07-25 14:38:36 UTC (rev 5044)
@@ -233,14 +233,22 @@
 RETURNS SETOF file_list_item AS
 $$ 
 
-SELECT m.mime_type, f.file_name, f.description, f.uploaded_by, e.name, 
+SELECT m.mime_type, CASE WHEN f.file_class = 3 THEN ref_key ||'-'|| f.file_name
+                         ELSE f.file_name END, 
+       f.description, f.uploaded_by, e.name, 
        f.uploaded_at, f.id, f.ref_key, f.file_class,  f.content
   FROM mime_type m
   JOIN file_base f ON f.mime_type_id = m.id
   JOIN entity e ON f.uploaded_by = e.id
  WHERE f.ref_key = $1 and f.file_class = $2
-       AND m.invoice_include;
-
+       AND m.invoice_include 
+       OR id IN (SELECT max(id) 
+                   FROM file_base fb
+                   JOIN mime_type m ON fb.mime_type_id = m.id
+                        AND m.mime_type ilike 'image%'
+                   JOIN invoice i ON i.trans_id = in_ref_key 
+                        AND i.parts_id = fb.ref_key
+                  WHERE fb.file_class = 3)
 $$ language sql;
 
 

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