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

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



Revision: 4716
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4716&view=rev
Author:   einhverfr
Date:     2012-05-16 01:25:11 +0000 (Wed, 16 May 2012)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/AM.pm
    trunk/LedgerSMB/File.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/Tax.pm
    trunk/LedgerSMB.pm
    trunk/Makefile.PL
    trunk/UI/am-defaults.html
    trunk/bin/am.pl
    trunk/bin/io.pl
    trunk/bin/rp.pl
    trunk/doc/release_notes
    trunk/lsmb-request.pl
    trunk/sql/Pg-database.sql
    trunk/sql/modules/Files.sql
    trunk/t/04-template-handling.t
    trunk/templates/xedemo/bin_list.tex

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/account.pm
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/customer.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/recon.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/LedgerSMB/Scripts/vendor.pm
    trunk/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4703
   + /branches/1.3:3711-4715

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/Changelog	2012-05-16 01:25:11 UTC (rev 4716)
@@ -52,7 +52,24 @@
 Changelog for 1.3.17
 * Address now shows on ECA selection screen (Erik H)
 * Taxes::Simple now respects min/max values based on subtotal (Chris T)
+* Fixed company name/address missing from income statement (Chris T, h/t Mark L)
+* Fixed company name/address missing from balance sheet (Chris T, h/t Mark L)
+* Optional image retrieval with size detection for latex templates (Chris T)
+* Added option to attach images to LaTeX PDF invoices/orders/etc (Chris T)
+* Corrected one is_zero error with latest Math::BigInt (Chris T)
+* Fixed file uploads sometimes hanging (Chris T)
+* Fixed file uploads sometimes throwing action not found errors (Chris T)
+* Fixed helpful DB error messages not displayed (Chris T)
+* Fixing Form.pm so that max_post_size = -1 behaves as in CGI::Simple (Chris T)
+* Fixed internal server error on tax lookup (Chris T)
+* Better error message on db version error (Herman V)
+* Fixed parsing error in xedemo bin_list.tex (Erik H)
 
+Chris T is Chris Travers
+Erik H is Erik Huelsmann
+Herman V is Herman Vierendiels
+Mark L is Matt Lubratt
+
 Changelog for 1.3.16
 
 * Changes in <head> element for non-Latin characters, HTML invoices (Erik H)

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB/AM.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -1404,7 +1404,7 @@
                       sonumber ponumber sqnumber rfqnumber partnumber 
                       employeenumber customernumber vendornumber projectnumber 
                       yearend curr weightunit businessnumber default_country 
-                      check_prefix password_duration templates vclimit)
+                      check_prefix password_duration templates vclimit template_images)
     }
     for (@$defaults)
     {

Modified: trunk/LedgerSMB/File.pm
===================================================================
--- trunk/LedgerSMB/File.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB/File.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -75,10 +75,25 @@
 
 ID of class of the original attachment point (for a link)
 
+=item file_path
+
+Path, relative to $LedgerSMB::tempdir, where file data is stored (for LaTeX use
+of attached images).
+
 =item dbobject
 
 Object for db interface.
 
+=item sizex
+
+X axis dimensions, if Image::Size is installed and file is image (only on files
+retrieved for invoices).
+
+=item sizey
+
+Y axis dimensions, if Image::Size is installed and file is image (only on files
+retrieved for invoices).
+
 =item x_info
 
 A hash for extended information
@@ -105,6 +120,9 @@
    file_class     =>  '$',
    src_class      =>  '$',
    dbobject       =>  'LedgerSMB::DBObject',
+   file_path      =>  '$',
+   sizex          =>  '$',
+   sizey          =>  '$',
    x_info         =>  '%'
 };
 
@@ -271,6 +289,53 @@
     $self->merge($ref);
 }
 
+=item get_for_template({ref_key => int, file_class => int})
+
+Returns file data for invoices for embedded images, except that content is set
+to a directive relative to tempdir where these files are stored.
+
+=cut
+
+sub get_for_template{
+    my ($self, $args) = @_;
+
+    my @results = $self->exec_method(
+                 {funcname => 'file__get_for_template',
+                      args => [$args->{ref_key}, $args->{file_class}]
+                 }
+     );
+    if ( -d $LedgerSMB::Sysconfig::tempdir . '/' . $$){
+        die 'directory exists';
+    }
+    mkdir $LedgerSMB::Sysconfig::tempdir . '/' . $$;
+    $self->file_path($LedgerSMB::Sysconfig::tempdir . '/' . $$);
+    
+    for my $result (@results) {
+        open FILE, '>', $self->file_path . "/$result->{file_name}";
+        binmode FILE, ':bytes';
+        print FILE $result->{content};
+        close FILE;
+        eval { # Block used so that Image::Size is optional
+           require Image::Size;
+           my ($x, $y);
+           ($x, $y) = imgsize(\{$result->{content}});
+           $result->{sizex} = $x;
+           $result->{sizey} = $y;
+        };
+    }
+}
+
+
+sub DESTROY {
+   my ($self) = $_;
+   opendir(TMP, $self->{file_path}) || return 1;
+   for my $file (readdir(TMP)){
+       unlink $self->{file_path} . '/' . $file;
+   }
+   closedir (TMP);
+   rmdir $self->{file_path};
+}
+
 =item list({ref_key => int, file_class => int})
 
 Lists files directly attached to the object.

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB/Form.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -97,7 +97,9 @@
 
     $ENV{CONTENT_LENGTH} = 0 unless defined $ENV{CONTENT_LENGTH};
 
-    if ( ( $ENV{CONTENT_LENGTH} != 0 ) && ( $ENV{CONTENT_LENGTH} > $LedgerSMB::Sysconfig::max_post_size ) ) {
+    if ( ( $ENV{CONTENT_LENGTH} != 0 ) 
+         && ( $ENV{CONTENT_LENGTH} > $LedgerSMB::Sysconfig::max_post_size ) 
+         && $LedgerSMB::Sysconfig::max_post_size  != -1) {
         print "Status: 413\n Request entity too large\n\n";
         die "Error: Request entity too large\n";
     }
@@ -1171,6 +1173,26 @@
 qq|<button class="submit" type="submit" name="action" value="$name" accesskey="$button->{$name}{key}" title="$button->{$name}{value} [Alt-$button->{$name}{key}]">$button->{$name}{value}</button>\n|;
 }
 
+
+=item test_should_get_images
+
+Returns true if images should get be retrieved for embedding in templates
+
+=cut
+
+
+sub test_should_get_images {
+    my ($self)  = @_;
+    my $dbh = $self->{dbh};
+    my $sth = $dbh->prepare(
+        "SELECT value FROM defaults WHERE setting_key = 'template_images'"
+    );
+    $sth->execute;
+    my ($retval) = $sth->fetchrow_array();
+    return $retval;
+}
+
+
 # Database routines used throughout
 
 =item $form->db_init($myconfig);

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB/IS.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -717,6 +717,8 @@
 
     $form->format_string(qw(text_amount text_decimal));
 
+    $form->{invtotal} ||= 0;
+    $form->{paid} ||= 0;
     $form->{total} =
       $form->format_amount( $myconfig, $form->{invtotal} - $form->{paid}, 2 );
 


Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4703
/branches/1.3/scripts/account.pl:3711-4368
   + /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4715
/branches/1.3/scripts/account.pl:3711-4368


Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4703
/branches/1.3/scripts/admin.pl:3711-4678
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4715
/branches/1.3/scripts/admin.pl:3711-4678


Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4703
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4715
/branches/1.3/scripts/customer.pl:4273-4287


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4703
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4715
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310


Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4703
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4715
/branches/1.3/scripts/file.pl:3711-4138


Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4703
/branches/1.3/scripts/journal.pl:3711-4328
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4715
/branches/1.3/scripts/journal.pl:3711-4328


Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4703
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4715
/branches/1.3/scripts/login.pl:3711-4192


Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4703
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4715
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4703
/branches/1.3/scripts/payment.pl:3711-4680
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4715
/branches/1.3/scripts/payment.pl:3711-4680


Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4703
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4715
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4703
/branches/1.3/scripts/setup.pl:3711-4550
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4715
/branches/1.3/scripts/setup.pl:3711-4550


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4703
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4715
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4703
/branches/1.3/scripts/vendor.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4715
/branches/1.3/scripts/vendor.pl:4273-4287

Modified: trunk/LedgerSMB/Tax.pm
===================================================================
--- trunk/LedgerSMB/Tax.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB/Tax.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -82,7 +82,8 @@
         $tax->chart( $ref->{'chart'} );
         $tax->description( $ref->{'description'} );
         $tax->value( Math::BigFloat->bzero() );
-        $tax->minvalue($ref->{'minvalue'});
+        $tax->minvalue(Math::BigFloat->new($ref->{'minvalue'} || 0));
+        $tax->maxvalue(Math::BigFloat->new($ref->{'maxvalue'} || 0));
 
         push @taxes, $tax;
         $sth->finish;#should this not be out of foreach loop?, to examine

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/LedgerSMB.pm	2012-05-16 01:25:11 UTC (rev 4716)
@@ -899,7 +899,7 @@
 
     ($self->{_role_prefix}) = $sth->fetchrow_array;
     if ($dbversion ne $self->{dbversion}){
-        $self->error("Database is not the expected version.  Was $dbversion, expected $self->{dbversion}.  Please re-run setup.pl against this database to correct.");
+        $self->error("Database is not the expected version.  Was $dbversion, expected $self->{dbversion}.  Please re-run setup.pl against this database to correct.<a href='setup.pl'>setup.pl</a>");
     }
 
     $sth = $self->{dbh}->prepare('SELECT check_expiration()');
@@ -951,7 +951,7 @@
    my $self = shift @_;
    my $state_error = {};
    if ($self->{_locale}){
-       my $state_error = {
+       $state_error = {
             '42883' => $self->{_locale}->text('Internal Database Error'),
             '42501' => $self->{_locale}->text('Access Denied'),
             '42401' => $self->{_locale}->text('Access Denied'),
@@ -959,7 +959,7 @@
             '22012' => $self->{_locale}->text('Division by 0 error'),
             '22004' => $self->{_locale}->text('Required input not provided'),
             '23502' => $self->{_locale}->text('Required input not provided'),
-            '23505' => $self->{_locale}->text('Conflict with Existing Data'),
+            '23505' => $self->{_locale}->text('Conflict with Existing Data.  Perhaps you already entered this?'),
             'P0001' => $self->{_locale}->text('Error from Function:') . "\n" .
                     $self->{dbh}->errstr,
        };

Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/Makefile.PL	2012-05-16 01:25:11 UTC (rev 4716)
@@ -43,6 +43,10 @@
 test_requires 'Test::Trap';
 test_requires 'Test::Exception';
 
+feature 'Size detection for images for embedding in LaTeX templates',
+    -default => 1,
+    'Image::Size' => 0;
+
 feature 'POS module credit card processing support',
     -default => 0,
     'Net::TCLink' => 0;

Modified: trunk/UI/am-defaults.html
===================================================================
--- trunk/UI/am-defaults.html	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/UI/am-defaults.html	2012-05-16 01:25:11 UTC (rev 4716)
@@ -34,6 +34,10 @@
 	  <th align="right"><?lsmb text('Separate Duties') ?></th>
 	  <td><input name="separate_duties" size="5" value="<?lsmb form.separate_duties ?>" /></td>
 	</tr>
+	<tr>
+	  <th align="right"><?lsmb text('Images in Templates') ?></th>
+	  <td><input name="template_images" size="5" value="<?lsmb form.template_images ?>" /></td>
+	</tr>
         <tr>
          <th align="right"><?lsmb text('default_language') ?></th>
 	  <td>

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/bin/am.pl	2012-05-16 01:25:11 UTC (rev 4716)
@@ -84,7 +84,7 @@
 my @default_others = qw(businessnumber weightunit separate_duties default_language
                         inventory_accno_id income_accno_id expense_accno_id 
                         fxgain_accno_id fxloss_accno_id default_country 
-                        templates curr);
+                        templates curr template_images);
 
 sub save_as_new {
 

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/bin/io.pl	2012-05-16 01:25:11 UTC (rev 4716)
@@ -43,6 +43,7 @@
 use LedgerSMB::Template;
 use LedgerSMB::Sysconfig;
 use LedgerSMB::Company_Config;
+use LedgerSMB::File;
 
 # any custom scripts for this one
 if ( -f "bin/custom/io.pl" ) {
@@ -1610,6 +1611,23 @@
         $order         = 1;
     }
 
+    if ($form->test_should_get_images){
+        my $file = LedgerSMB::File->new();
+        $file->new_dbobject({base => $form, locale => $locale});
+        my @files;
+        my $fc;
+        if ($inv eq 'inv') {
+           $fc = 1;
+        } else {
+           $fc = 2;
+        }
+        my @files = $file->get_for_template(
+                {ref_key => $form->{id}, file_class => $fc}
+        );
+        $form->{file_list} = ..hidden..;
+        $form->{file_path} = $file->file_path;
+    }
+
     &validate_items;
 
     $form->{"${inv}date"} = $form->{transdate};

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/bin/rp.pl	2012-05-16 01:25:11 UTC (rev 4716)
@@ -48,52 +48,30 @@
 use LedgerSMB::Template;
 use LedgerSMB::PE;
 use LedgerSMB::RP;
+use LedgerSMB::Company_Config;
 
 1;
 
 # end of main
 
-# this is for our long dates
-# $locale->text('January')
-# $locale->text('February')
-# $locale->text('March')
-# $locale->text('April')
-# $locale->text('May ')
-# $locale->text('June')
-# $locale->text('July')
-# $locale->text('August')
-# $locale->text('September')
-# $locale->text('October')
-# $locale->text('November')
-# $locale->text('December')
+=item init_company_config
 
-# this is for our short month
-# $locale->text('Jan')
-# $locale->text('Feb')
-# $locale->text('Mar')
-# $locale->text('Apr')
-# $locale->text('May')
-# $locale->text('Jun')
-# $locale->text('Jul')
-# $locale->text('Aug')
-# $locale->text('Sep')
-# $locale->text('Oct')
-# $locale->text('Nov')
-# $locale->text('Dec')
+Sets $form->{company} and $form->{address} for income statement and balance 
+statement
 
-# $locale->text('Balance Sheet')
-# $locale->text('Income Statement')
-# $locale->text('Trial Balance')
-# $locale->text('AR Aging')
-# $locale->text('AP Aging')
-# $locale->text('Tax collected')
-# $locale->text('Tax paid')
-# $locale->text('Receipts')
-# $locale->text('Payments')
-# $locale->text('Project Transactions')
-# $locale->text('Non-taxable Sales')
-# $locale->text('Non-taxable Purchases')
+=cut
 
+sub init_company_config {
+   my ($form) = @_;
+   $cconfig = LedgerSMB::Company_Config->new();
+   $cconfig->merge($form);
+   $cconfig->initialize;
+   $form->{company} = $LedgerSMB::Company_Config::settings->{company_name};
+   $form->{address} = $LedgerSMB::Company_Config::settings->{company_address};
+}
+
+
+
 sub report {
     my %hiddens;
     my %report = (
@@ -464,6 +442,7 @@
 }
 
 sub generate_income_statement {
+    init_company_config($form);
 
     RP->income_statement( \%myconfig, \%$form );
 
@@ -507,9 +486,6 @@
             $longcomparefromdate, $longcomparetodate);
     }
 
-    # setup variables for the form
-    my @vars = qw(company address businessnumber);
-    for (@vars) { $form->{$_} = $myconfig{$_} }
     ##SC: The escaped form will be converted in-template
     $form->{address} =~ s/\\n/<br>/g;
 
@@ -533,7 +509,7 @@
 }
 
 sub generate_balance_sheet {
-
+    init_company_config($form);
     RP->balance_sheet( \%myconfig, \%$form );
 
     $form->{asofdate} = $form->current_date( \%myconfig )
@@ -556,7 +532,7 @@
       $locale->date( \%myconfig, $form->{compareasofdate}, 0 );
 
     # setup company variables for the form
-    for (qw(company address businessnumber nativecurr login)) {
+    for (qw(nativecurr login)) {
         $form->{$_} = $myconfig{$_};
     }
     ##SC: The escaped form will be converted in-template

Modified: trunk/doc/release_notes
===================================================================
--- trunk/doc/release_notes	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/doc/release_notes	2012-05-16 01:25:11 UTC (rev 4716)
@@ -1,7 +1,7 @@
 RELEASE NOTES
 LedgerSMB 1.3
 
-Latest Revision:  1.3.16, April 30, 2012.
+Latest Revision:  1.3.17, May 18, 2012.
 
 1:  Welcome to LedgerSMB
 

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/lsmb-request.pl	2012-05-16 01:25:11 UTC (rev 4716)
@@ -26,7 +26,7 @@
 
 $| = 1;
 
-binmode (STDIN, ':utf8');
+binmode (STDIN, ':bytes');
 binmode (STDOUT, ':utf8');
 use LedgerSMB::User;
 use LedgerSMB::App_State;

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/sql/Pg-database.sql	2012-05-16 01:25:11 UTC (rev 4716)
@@ -3670,7 +3670,8 @@
 
 CREATE TABLE mime_type (
        id serial not null unique,
-       mime_type text primary key
+       mime_type text primary key,
+       invoice_include bool default false
 );
 
 COMMENT ON TABLE mime_type IS
@@ -4361,6 +4362,8 @@
 INSERT INTO mime_type (mime_type) VALUES('application/vnd.ms-tnef');
 INSERT INTO mime_type (mime_type) VALUES('video/vnd.rn-realvideo');
 
+UPDATE mime_type SET invoice_include = 'true' where mime_type like 'image/%';
+
 CREATE TABLE file_class (
        id serial not null unique,
        class text primary key

Modified: trunk/sql/modules/Files.sql
===================================================================
--- trunk/sql/modules/Files.sql	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/sql/modules/Files.sql	2012-05-16 01:25:11 UTC (rev 4716)
@@ -152,6 +152,22 @@
        content bytea
 );
 
+CREATE OR REPLACE FUNCTION file__get_for_template
+(in_ref_key int, in_file_class int)
+RETURNS SETOF file_list_item AS
+$$ 
+
+SELECT m.mime_type, f.file_name, 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;
+
+$$ language sql;
+
+
 CREATE OR REPLACE FUNCTION file__list_by(in_ref_key int, in_file_class int)
 RETURNS SETOF file_list_item AS
 $$


Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4703
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
   + /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4715
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

Modified: trunk/t/04-template-handling.t
===================================================================
--- trunk/t/04-template-handling.t	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/t/04-template-handling.t	2012-05-16 01:25:11 UTC (rev 4716)
@@ -390,7 +390,7 @@
 is($template->{include_path}, 't/data',
 	'Template, new (TXT): Object creation with format and template');
 is($template->render({'login' => 'foo&bar'}),
-	undef,
+	'04-template.txt',
 	'Template, render: Simple text template, no filename');
 is($template->{output}, "I am a template.\nLook at me foo&bar.\n", 
 	'Template, render (TXT): Simple TXT template, correct output');

Modified: trunk/templates/xedemo/bin_list.tex
===================================================================
--- trunk/templates/xedemo/bin_list.tex	2012-05-15 00:35:18 UTC (rev 4715)
+++ trunk/templates/xedemo/bin_list.tex	2012-05-16 01:25:11 UTC (rev 4716)
@@ -100,7 +100,7 @@
   
 \vspace{1cm}
   
..hidden..@{}}
..hidden..@{}}
   \textbf{<?lsmb text('Item') ?>} & \textbf{<?lsmb text('Number') ?>} 
      & \textbf{<?lsmb text('Description') ?>} & 
      \textbf{<?lsmb text('Serial Number') ?>} & 

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