[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4139] trunk
- Subject: SF.net SVN: ledger-smb:[4139] trunk
- From: ..hidden..
- Date: Sun, 04 Dec 2011 06:45:01 +0000
Revision: 4139
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4139&view=rev
Author: einhverfr
Date: 2011-12-04 06:45:01 +0000 (Sun, 04 Dec 2011)
Log Message:
-----------
Merging from branches/1.3
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/AM.pm
trunk/LedgerSMB/Database.pm
trunk/LedgerSMB/File/Order.pm
trunk/LedgerSMB/OE.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/LedgerSMB/Sysconfig.pm
trunk/LedgerSMB/Tax.pm
trunk/LedgerSMB/Template/CSV.pm
trunk/LedgerSMB/Template/HTML.pm
trunk/LedgerSMB/Template/LaTeX.pm
trunk/LedgerSMB/Template/ODS.pm
trunk/LedgerSMB/Template/TXT.pm
trunk/LedgerSMB/Template/XLS.pm
trunk/LedgerSMB/Template.pm
trunk/LedgerSMB.pm
trunk/UI/Contact/contact.html
trunk/UI/batch/filter.html
trunk/UI/login.js
trunk/bin/am.pl
trunk/bin/io.pl
trunk/bin/oe.pl
trunk/ledgersmb.conf.default
trunk/old-handler.pl
trunk/sql/Pg-database.sql
trunk/sql/modules/Files.sql
trunk/sql/modules/Fixes.sql
Added Paths:
-----------
trunk/tools/delete-mycompany-roles.sh
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-4102
+ /branches/1.3:3711-4138
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/Changelog 2011-12-04 06:45:01 UTC (rev 4139)
@@ -9,6 +9,19 @@
Initial Release: Monday, Oct 12 2011
Supported Presently
+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)
+* Fixed "no such file or directory found" error when logging db tasks (David B)
+* Logging improvements (Herman V)
+* Fixed company fax being printed under shipto (Herman V)
+* Fixed "File does not exist... [object HTMLButtonElement]" js error (Herman V)
+
Changelog for LedgerSMB 1.3.7 (Categorized due to length)
Database
* Added foreign key of entity_credit_account.language_code (Herman V)
@@ -41,6 +54,7 @@
* Corrected double escaping bug in balance sheet template (Erik H)
* Corrected filtering of customers/vendors on AR/AP screens (Chris T)
* Added logged in username to setup utility confirm operation screen (Chris T)
+* Corrected sales tax issue for sales/purchase orders (Herman V)
Logging
* Allow log-level to be set from config file (Herman V)
@@ -48,8 +62,13 @@
* Reduced warnings in logs (Chris T)
* Logging enhancements (Herman V)
* Corrected error regarding css file not found (Erik H)
+* Corrected global.css not found error (Chris T)
+Chris T is Chris Travers
+Erik H is Erik Huelsmann
+Herman V is Herman Vierendeels
+
Changelog for LedgerSMB 1.3.6
* Including xelatex templates under directory templates/xedemo (Chris T)
* Fix for company name in order entry (David B)
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/AA.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -1444,6 +1444,7 @@
}
}
}
+ #$logger->trace("\$form->{taxaccounts}=$form->{taxaccounts}");
$sth->finish;
chop $form->{taxaccounts};
Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/AM.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -56,6 +56,160 @@
use LedgerSMB::Tax;
use LedgerSMB::Sysconfig;
+my $logger = Log::Log4perl->get_logger('AM');
+
+=item AM->get_account($myconfig, $form);
+
+Populates the $form attributes accno, description, charttype, gifi_accno,
+category, link, and contra with details about the account that has the id
+$form->{id}. If there are no acc_trans entries that refer to that account,
+$form->{orphaned} is made true, otherwise $form->{orphaned} is set to false.
+
+Also populates 'inventory_accno_id', 'income_accno_id', 'expense_accno_id',
+'fxgain_accno_id', and 'fxloss_accno_id' with the values from defaults.
+
+$myconfig is unused.
+
+=cut
+
+sub get_account {
+
+ my ( $self, $myconfig, $form ) = @_;
+
+ my $dbh = $form->{dbh};
+
+ my $query = qq|
+ SELECT accno, description, charttype, gifi_accno,
+ category, link, contra
+ FROM chart
+ WHERE id = ?|;
+
+ my $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} ) || $form->dberror($query);
+
+ my $ref = $sth->fetchrow_hashref(NAME_lc);
+ for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
+ $sth->finish;
+
+ # get default accounts
+ $query = qq|
+ SELECT (SELECT value FROM defaults
+ WHERE setting_key = 'inventory_accno_id')
+ AS inventory_accno_id,
+ (SELECT value FROM defaults
+ WHERE setting_key = 'income_accno_id')
+ AS income_accno_id,
+ (SELECT value FROM defaults
+ WHERE setting_key = 'expense_accno_id')
+ AS expense_accno_id,
+ (SELECT value FROM defaults
+ WHERE setting_key = 'fxgain_accno_id')
+ AS fxgain_accno_id,
+ (SELECT value FROM defaults
+ WHERE setting_key = 'fxloss_accno_id')
+ AS fxloss_accno_id|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+
+ $ref = $sth->fetchrow_hashref(NAME_lc);
+ for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
+ $sth->finish;
+
+ # check if we have any transactions
+ $query = qq|
+ SELECT trans_id
+ FROM acc_trans
+ WHERE chart_id = ?
+ LIMIT 1|;
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} );
+ ( $form->{orphaned} ) = $sth->fetchrow_array();
+ $form->{orphaned} = !$form->{orphaned};
+
+ $dbh->commit;
+}
+
+=item AM->delete_account($myconfig, $form);
+
+Deletes the account with the id $form->{id}. Calls $form->error if there are
+any acc_trans entries that reference it. If any parts have that account for
+an inventory, income, or COGS (expense) account, switch the part to using the
+default account for that type. Also deletes all tax, partstax, customertax, and
+vendortax table entries for the account.
+
+$myconfig is unused.
+
+=cut
+
+sub delete_account {
+
+ my ( $self, $myconfig, $form ) = @_;
+
+ # connect to database, turn off AutoCommit
+ my $dbh = $form->{dbh};
+ my $sth;
+ my $query = qq|
+ SELECT count(*)
+ FROM acc_trans
+ WHERE chart_id = ?|;
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} );
+ my ($rowcount) = $sth->fetchrow_array();
+
+ if ($rowcount) {
+ $form->error( "Cannot delete accounts with associated transactions!" );
+ }
+
+ # delete chart of account record
+ $query = qq|
+ DELETE FROM chart
+ WHERE id = ?|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} ) || $form->dberror($query);
+
+ # set inventory_accno_id, income_accno_id, expense_accno_id to defaults
+ $query = qq|
+ UPDATE parts
+ SET inventory_accno_id = (SELECT value::int
+ FROM defaults
+ WHERE setting_key =
+ 'inventory_accno_id')
+ WHERE inventory_accno_id = ?|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} ) || $form->dberror($query);
+
+ for (qw(income_accno_id expense_accno_id)) {
+ $query = qq|
+ UPDATE parts
+ SET $_ = (SELECT value::int
+ FROM defaults
+ WHERE setting_key = '$_')
+ WHERE $_ = ?|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} ) || $form->dberror($query);
+ $sth->finish;
+ }
+
+ foreach my $table (qw(partstax customertax vendortax tax)) {
+ $query = qq|
+ DELETE FROM $table
+ WHERE chart_id = ?|;
+
+ $sth = $dbh->prepare($query);
+ $sth->execute( $form->{id} ) || $form->dberror($query);
+ $sth->finish;
+ }
+
+ # commit and redirect
+ my $rc = $dbh->commit;
+
+ $rc;
+}
+
=item AM->gifi_accounts($myconfig, $form);
Populates the list referred to as $form->{ALL} with hashes of gifi numbers and
@@ -1774,9 +1928,31 @@
foreach my $item ( split / /, $form->{taxaccounts} ) {
my ( $chart_id, $i ) = split /_/, $item;
- my $rate =
- $form->parse_amount( $myconfig, $form->{"taxrate_$i"} ) / 100;
- my $validto = $form->{"validto_$i"};
+
+ my $rate=$form->{"taxrate_$i"};
+ $rate=~s/^\s+|\s+$//g;
+ $rate=$form->parse_amount( $myconfig, $form->{"taxrate_$i"} ) / 100;
+ my $validto=$form->{"validto_$i"};
+ $validto=~s/^\s+|\s+$//g;
+ my $pass=$form->{"pass_$i"};
+ $pass=~s/^\s+|\s+$//g;
+ my $taxnumber=$form->{"taxnumber_$i"};
+ $taxnumber=~s/^\s+|\s+$//g;
+ my $old_validto=$form->{"old_validto_$i"};
+ $old_validto=~s/^\s+|\s+$//g;
+ #print STDERR localtime()." AM save_taxes chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto\n";
+ if($rate==0 && $validto eq '' && $pass eq '' && $taxnumber eq '')
+ {
+ $logger->debug("skipping chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto skipping");
+ next;
+ }
+ if($old_validto eq '')
+ {
+ $logger->info("will insert new chart_id=$chart_id i=$i rate=$rate validto=$validto pass=$pass taxnumber=$taxnumber old_validto=$old_validto");
+ }
+
+ #$rate=$form->parse_amount( $myconfig, $form->{"taxrate_$i"} ) / 100;
+ $validto = $form->{"validto_$i"};
$validto = 'infinity' if not $validto;
$form->{"pass_$i"} = 0 if not $form->{"pass_$i"};
delete $form->{"old_validto_$i"} if ! $form->{"old_validto_$i"};
@@ -1788,9 +1964,7 @@
$form->{"old_validto_$i"}
);
$sth->execute(@queryargs) ||$form->dberror($query);
-
-
-
+ $sth->finish;
}
my $rc = $dbh->commit;
Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Database.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -36,7 +36,10 @@
};
my $temp = $LedgerSMB::Sysconfig::tempdir;
+#(-d "$temp") || system("mkdir -p $temp"); moved to Sysconfig, so can be trapped earlier
+my $logger = Log::Log4perl->get_logger('LedgerSMB::Database');
+
=item LedgerSMB::Database->new({dbname = $dbname, countrycode = $cc, chart_name = $name, company_name = $company, username = $username, password = $password})
This function creates a new database management object with the specified
@@ -354,25 +357,31 @@
sub create {
my ($self) = @_;
-
+ $logger->trace("trying to create db \$ENV{PG_CONTRIB_DIR}=$ENV{PG_CONTRIB_DIR}");
# We have to use template0 because of issues that Debian has with database
# encoding. Apparently that causes problems for us, so template0 must be
# used.
my $rc = system("createdb -T template0 -E UTF8 > $temp/dblog");
+ $logger->trace("after create db \$rc=$rc");
if ($rc) {
return $rc;
}
-
- my @contrib_scripts = qw(pg_trgm tsearch2 tablefunc);
-
+ my $rc2=0;
+ my @contrib_scripts = qw(pg_trgm tsearch2 tablefunc);
+ if($ENV{PG_CONTRIB_DIR})
+ {
+ #postgres 9.1 this is done by create extension pg_trgm btree_gist ..
for my $contrib (@contrib_scripts){
- my $rc2;
$rc2=system("psql -f $ENV{PG_CONTRIB_DIR}/$contrib.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
$rc ||= $rc2
}
- my $rc2 = system("psql -f $self->{source_dir}sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
-
- $rc ||= $rc2;
+ }
+ else
+ {
+ $logger->info("Skipping contrib_scripts @contrib_scripts");
+ }
+ $rc2 = system("psql -f $self->{source_dir}sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
+ $rc ||= $rc2;
# TODO Add logging of errors/notices
Modified: trunk/LedgerSMB/File/Order.pm
===================================================================
--- trunk/LedgerSMB/File/Order.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/File/Order.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -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: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/OE.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -36,6 +36,7 @@
use LedgerSMB::Tax;
use LedgerSMB::Sysconfig;
+my $logger = Log::Log4perl->get_logger('OE');
=over
=item get_files
@@ -59,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 ) = @_;
@@ -1352,7 +1371,8 @@
$form->format_amount( $myconfig, $linetotal, 2 );
push( @{ $form->{linetotal} }, $form->{"linetotal_$i"} );
- @taxaccounts = Tax::init_taxes( $form, $form->{"taxaccounts_$i"} );
+ @taxaccounts = Tax::init_taxes( $form, $form->{"taxaccounts_$i"} , $form->{taxaccounts} );#limit to vendor/customer taxes, else invalid totals!!
+ #$logger->trace("linetotal=".$form->{"linetotal_$i"}." i=$i taxaccounts_i=".$form->{"taxaccounts_$i"}." taxaccounts size=".scalar @taxaccounts);
my $ml = 1;
my @taxrates = ();
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4102
/branches/1.3/scripts/admin.pl:3711-3903
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4138
/branches/1.3/scripts/admin.pl:3711-3903
Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4102
/branches/1.3/scripts/employee.pl:3842-3843
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4138
/branches/1.3/scripts/employee.pl:3842-3843
Modified: trunk/LedgerSMB/Scripts/file.pm
===================================================================
--- trunk/LedgerSMB/Scripts/file.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Scripts/file.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -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},
Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4102
/branches/1.3/scripts/file.pl:3711-4079
+ /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4138
/branches/1.3/scripts/file.pl:3711-4138
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4102
/branches/1.3/scripts/payment.pl:3711-4011
+ /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4138
/branches/1.3/scripts/payment.pl:3711-4011
Modified: trunk/LedgerSMB/Scripts/setup.pm
===================================================================
--- trunk/LedgerSMB/Scripts/setup.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Scripts/setup.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -23,6 +23,8 @@
use LedgerSMB::Database;
use strict;
+my $logger = Log::Log4perl->get_logger('LedgerSMB::Scripts::setup');
+
sub __default {
my ($request) = @_;
@@ -442,6 +444,7 @@
use LedgerSMB::Sysconfig;
my ($request) = @_;
my $creds = LedgerSMB::Auth::get_credentials();
+ my $rc=0;
# ENVIRONMENT NECESSARY
@@ -454,7 +457,8 @@
company_name => $request->{database},
password => $creds->{password}}
);
- $database->create_and_load();
+ $rc=$database->create_and_load();#TODO what if createdb fails?
+ $logger->info("create_and_load rc=$rc");
$database->process_roles('Roles.sql');
#COA Directories
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4102
/branches/1.3/scripts/setup.pl:3711-4102
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4138
/branches/1.3/scripts/setup.pl:3711-4138
Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Sysconfig.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -201,4 +201,11 @@
# Backup path
our $backuppath = $tempdir;
+if(-d "$tempdir"){}
+else
+{
+ my $rc=system("mkdir -p $tempdir");#TODO what if error?
+ #$logger->info("created tempdir \$tempdir rc=\$rc"); log4perl not initialised yet!
+ print STDERR localtime()." Sysconfig.pm created tempdir $tempdir rc=$rc\n";
+}
1;
Modified: trunk/LedgerSMB/Tax.pm
===================================================================
--- trunk/LedgerSMB/Tax.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Tax.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -29,21 +29,25 @@
use Math::BigFloat;
+my $logger = Log::Log4perl->get_logger('Tax');
+
sub init_taxes {
my ( $form, $taxaccounts, $taxaccounts2 ) = @_;
my $dbh = $form->{dbh};
@taxes = ();
my @accounts = split / /, $taxaccounts;
if ( defined $taxaccounts2 ) {
- my @tmpaccounts = @accounts;
- $#accounts = -1;
+ #my @tmpaccounts = @accounts;#unused var
+ $#accounts = -1;# empty @accounts,@accounts=();
for my $acct ( split / /, $taxaccounts2 ) {
if ( $taxaccounts =~ /\b$acct\b/ ) {
push @accounts, $acct;
}
}
-
}
+ else{
+ $logger->trace("taxaccounts2 undefined");
+ }
my $query = qq|
SELECT t.taxnumber, c.description,
t.rate, t.chart_id, t.pass, m.taxmodulename
@@ -79,7 +83,7 @@
$tax->value( Math::BigFloat->bzero() );
push @taxes, $tax;
- $sth->finish;
+ $sth->finish;#should this not be out of foreach loop?, to examine
}
return @taxes;
}
Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/CSV.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -45,8 +45,9 @@
use Template;
use LedgerSMB::Template::TTI18N;
-binmode STDOUT, ':utf8';
-binmode STDERR, ':utf8';
+my $binmode = ':utf8';
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
sub get_template {
my $name = shift;
@@ -89,6 +90,7 @@
my $template;
my $source;
my $output;
+ $parent->{binmode} = $binmode;
if ($parent->{outputfile}) {
$output = "$parent->{outputfile}.csv";
Modified: trunk/LedgerSMB/Template/HTML.pm
===================================================================
--- trunk/LedgerSMB/Template/HTML.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/HTML.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -51,8 +51,9 @@
use Template;
use LedgerSMB::Template::TTI18N;
-binmode STDOUT, ':utf8';
-binmode STDERR, ':utf8';
+my $binmode = ':utf8';
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
sub get_template {
my $name = shift;
@@ -103,6 +104,8 @@
my $template;
my $output;
my $source;
+ $parent->{binmode} = $binmode;
+
if ($parent->{outputfile}) {
$output = "$parent->{outputfile}.html";
Modified: trunk/LedgerSMB/Template/LaTeX.pm
===================================================================
--- trunk/LedgerSMB/Template/LaTeX.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/LaTeX.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -58,6 +58,11 @@
use Template::Latex;
use LedgerSMB::Template::TTI18N;
+#my $binmode = ':utf8';
+my $binmode = ':raw';
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
+
my $logger = Log::Log4perl->get_logger('LedgerSMB::Template::LaTeX');
sub get_template {
@@ -118,6 +123,7 @@
$parent->{outputfile} ||=
"${LedgerSMB::Sysconfig::tempdir}/$parent->{template}-output-$$";
+ $parent->{binmode} = $binmode;
if (ref $parent->{template} eq 'SCALAR') {
$source = $parent->{template};
} elsif (ref $parent->{template} eq 'ARRAY') {
Modified: trunk/LedgerSMB/Template/ODS.pm
===================================================================
--- trunk/LedgerSMB/Template/ODS.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/ODS.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -55,6 +55,10 @@
use OpenOffice::OODoc;
use LedgerSMB::Template::TTI18N;
+my $binmode = undef;
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
+
# SC: The ODS handlers need these vars in common
my $ods;
my $rowcount;
@@ -825,6 +829,7 @@
my $source;
my $tempdir = ${LedgerSMB::Sysconfig::tempdir};
my $output = '';
+ $parent->{binmode} = $binmode;
$parent->{outputfile} ||= "$tempdir/$parent->{template}-output-$$";
if (ref $parent->{template} eq 'SCALAR') {
Modified: trunk/LedgerSMB/Template/TXT.pm
===================================================================
--- trunk/LedgerSMB/Template/TXT.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/TXT.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -48,6 +48,10 @@
use Template;
use LedgerSMB::Template::TTI18N;
+my $binmode = ':utf8';
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
+
sub get_extension {
my ($parent) = shift;
if ($parent->{format_args}->{extension}){
@@ -74,6 +78,7 @@
my $template;
my $source;
my $output;
+ $parent->{binmode} = $binmode;
if ($parent->{outputfile}) {
$output = "$parent->{outputfile}.". get_extension($parent);
} else {
Modified: trunk/LedgerSMB/Template/XLS.pm
===================================================================
--- trunk/LedgerSMB/Template/XLS.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template/XLS.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -55,7 +55,11 @@
use CGI::Simple::Standard qw(:html);
use Excel::Template::Plus;
use LedgerSMB::Template::TTI18N;
+my $binmode = ':utf8';
+binmode STDOUT, $binmode;
+binmode STDERR, $binmode;
+
sub get_template {
my $name = shift;
return "${name}.xlst";
@@ -92,6 +96,7 @@
my $template;
my $source;
my $tempdir = ${LedgerSMB::Sysconfig::tempdir};
+ $parent->{binmode} = $binmode;
$parent->{outputfile} ||= "$tempdir/$parent->{template}-output-$$";
if (ref $parent->{template} eq 'SCALAR') {
Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB/Template.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -153,6 +153,7 @@
$self->{language} = $args{language};
$self->{no_escape} = $args{no_escape};
$self->{debug} = $args{debug};
+ $self->{binmode} = undef;
$self->{outputfile} =
"${LedgerSMB::Sysconfig::tempdir}/$args{output_file}" if
$args{output_file};
@@ -331,11 +332,13 @@
if (!defined $data and defined $self->{rendered}){
$data = "";
+ $logger->trace("begin DATA < self->{rendered}=$self->{rendered} \$self->{format}=$self->{format}");
open (DATA, '<', $self->{rendered});
- binmode DATA, ':utf8';
+ binmode DATA, $self->{binmode};
while (my $line = <DATA>){
$data .= $line;
}
+ $logger->trace("end DATA < self->{rendered}");
unlink($self->{rendered}) or throw Error::Simple 'Unable to delete output file';
}
@@ -354,8 +357,9 @@
print "Content-Type: $self->{mimetype}$disposition\n\n";
}
}
- binmode STDOUT, ':utf8';
+ binmode STDOUT, $self->{binmode};
print $data;
+ $logger->trace("end print to STDOUT");
}
sub _http_output_file {
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/LedgerSMB.pm 2011-12-04 06:45:01 UTC (rev 4139)
@@ -622,9 +622,9 @@
if (!defined $procname){
$self->error('Undefined function in call_procedure.');
}
-
$procname = $self->{dbh}->quote_identifier($procname);
# Add the test for whether the schema is something useful.
+ $logger->trace("\$procname=$procname");
$schema = $schema || $LedgerSMB::Sysconfig::db_namespace;
Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/UI/Contact/contact.html 2011-12-04 06:45:01 UTC (rev 4139)
@@ -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: trunk/UI/batch/filter.html
===================================================================
--- trunk/UI/batch/filter.html 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/UI/batch/filter.html 2011-12-04 06:45:01 UTC (rev 4139)
@@ -1,8 +1,5 @@
<?lsmb INCLUDE "ui-header.html"
stylesheet = stylesheet
- include_stylesheet = [
- "css/global.css"
- ]
titlebar = text('Batch Selection') # '
?><?lsmb PROCESS "elements.html" ?>
<body>
Modified: trunk/UI/login.js
===================================================================
--- trunk/UI/login.js 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/UI/login.js 2011-12-04 06:45:01 UTC (rev 4139)
@@ -2,9 +2,10 @@
var http = get_http_request_object();
var username = document.login.login.value;
var password = document.login.password.value;
- http.open("get", 'login.pl?action=authenticate&company='
- + document.login.company.value, false,
- username, password);
+ var company = document.login.company.value;
+ var action = document.login.action.value;
+ //alert('document.login.company.value='+document.login.company.value);
+ http.open("get", 'login.pl?action=authenticate&company='+company, false, username, password);
http.send("");
if (http.status != 200){
if (http.status != '454'){
@@ -14,8 +15,7 @@
}
return false;
}
- document.location = document.login.action + "?action=login&company="+
- document.login.company.value;
+ document.location=document.login.action.value+".pl?action=login&company="+document.login.company.value;
}
function check_auth() {
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/bin/am.pl 2011-12-04 06:45:01 UTC (rev 4139)
@@ -1531,7 +1531,7 @@
( $null, $i ) = split /_/, $_;
$form->{"taxrate_$i"} =
- $form->format_amount( \%myconfig, $form->{"taxrate_$i"} );
+ $form->format_amount( \%myconfig, $form->{"taxrate_$i"},3,'0');
$hiddens{"taxdescription_$i"} = $form->{"taxdescription_$i"};
$hiddens{"old_validto_$i"} = $form->{"old_validto_$i"};
@@ -1586,11 +1586,16 @@
@a = split / /, $form->{taxaccounts};
$ndx = $#a + 1;
+ my $inserted=0;
+
AM->taxes( \%myconfig, \%$form );
foreach $item (@a) {
( $accno, $i ) = split /_/, $item;
push @t, $accno;
+
+ $i=$i+$inserted;
+
$form->{"taxmodulename_$i"} =
$form->{ "taxmodule_" . $form->{"taxmodule_id_$i"} };
@@ -1600,34 +1605,37 @@
{
#insert line
+ #print STDERR localtime()." am.pl update insert line\n";
for ( $j = $ndx + 1 ; $j > $i ; $j-- ) {
$k = $j - 1;
- for (qw(taxrate taxdescription taxnumber validto)) {
+ for (qw(taxrate taxdescription taxnumber validto pass old_validto)) {
$form->{"${_}_$j"} = $form->{"${_}_$k"};
}
}
$ndx++;
+ $inserted++;
$k = $i + 1;
for (qw(taxdescription taxnumber)) {
$form->{"${_}_$k"} = $form->{"${_}_$i"};
}
- for (qw(taxrate validto)) { $form->{"${_}_$k"} = "" }
+ for (qw(taxrate validto pass old_validto)) { $form->{"${_}_$k"} = "" }
push @t, $accno;
}
}
else {
-
# remove line
$j = $i + 1;
if ( $form->{"taxdescription_$i"} eq $form->{"taxdescription_$j"} )
{
+ #print STDERR localtime()." am.pl update remove line\n";
for ( $j = $i + 1 ; $j <= $ndx ; $j++ ) {
$k = $j + 1;
- for (qw(taxrate taxdescription taxnumber validto)) {
+ for (qw(taxrate taxdescription taxnumber validto pass old_validto)) {
$form->{"${_}_$j"} = $form->{"${_}_$k"};
}
}
$ndx--;
+ $inserted--;
splice @t, $i - 1, 1;
}
}
Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/bin/io.pl 2011-12-04 06:45:01 UTC (rev 4139)
@@ -1464,7 +1464,9 @@
$form->{email} = $csettings->{company_email};
$form->{address} = $csettings->{company_address};
$form->{tel} = $csettings->{company_phone};
+ #$form->{myCompanyFax} = $csettings->{company_fax};#fax should be named myCompanyFax ?
$form->{fax} = $csettings->{company_fax};
+ $logger->trace("setting fax from LedgerSMB::Company_Config::settings \$form->{formname}=$form->{formname} \$form->{fax}=$form->{fax}");
# if this goes to the printer pass through
@@ -1668,6 +1670,7 @@
}
}
+ $logger->trace("\$form->{formname}=$form->{formname} \$form->{fax}=$form->{fax} \$shipto=$shipto \$form->{shiptofax}=$form->{shiptofax}");
if ($shipto) {
if ( $form->{formname} eq 'purchase_order'
|| $form->{formname} eq 'request_quotation' )
@@ -1677,7 +1680,7 @@
}
else {
if ( $form->{formname} !~ /bin_list/ ) {
- for (@vars) { $form->{"shipto$_"} = $form->{$_} }
+ for (@vars) {if($_ ne 'fax'){$form->{"shipto$_"}=$form->{$_}}} #fax contains myCompanyFax
}
}
}
Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/bin/oe.pl 2011-12-04 06:45:01 UTC (rev 4139)
@@ -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';
@@ -639,6 +639,7 @@
}
sub form_footer {
+ #print STDERR localtime()." oe.pl form_footer calling __calc_taxes\n";
_calc_taxes();
$form->{invtotal} = $form->{invsubtotal};
@@ -888,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>
@@ -927,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>|;
}
@@ -1129,7 +1130,8 @@
$form->{"${_}_base"} += $amount;
}
if ( !$form->{taxincluded} ) {
- _calc_taxes();
+ #print STDERR localtime()."HV oe.pl update after retrieve item,skipping __calc_taxes,because this will be done again in form_footer\n";
+ #_calc_taxes();
}
$form->{creditremaining} -= $amount;
Modified: trunk/ledgersmb.conf.default
===================================================================
--- trunk/ledgersmb.conf.default 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/ledgersmb.conf.default 2011-12-04 06:45:01 UTC (rev 4139)
@@ -91,6 +91,8 @@
default_db = lsmb13
host = localhost
db_namespace = public
+#contrib_dir PG_CONTRIB_DIR
+#with postgresql-9.1 this stuff is in /usr/share/postgresql/9.1/extension and is injected in database with create extension pg_trgm,btree_gist...
contrib_dir = /usr/share/pgsql/contrib/
# sslmode can be require, allow, prefer, or disable. Defaults to prefer.
sslmode = prefer
Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/old-handler.pl 2011-12-04 06:45:01 UTC (rev 4139)
@@ -61,6 +61,9 @@
use LedgerSMB::Session;
use LedgerSMB::CancelFurtherProcessing;
use Data::Dumper;
+
+our $logger=Log::Log4perl->get_logger('old-handler-chain');#make logger available to other old programs
+
require "common.pl";
# for custom preprocessing logic
@@ -132,7 +135,7 @@
or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
}
# pull in the main code
-
+$logger->trace("trying script=bin/$form->{script} action=$form->{action}");#trace flow
try {
require "bin/$form->{script}";
@@ -169,6 +172,7 @@
my $ex = shift;
};
+$logger->trace("leaving after script=bin/$form->{script} action=$form->{action}");#trace flow
1;
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/sql/Pg-database.sql 2011-12-04 06:45:01 UTC (rev 4139)
@@ -1,4 +1,6 @@
999REATE LANGUAGE PLPGSQL; -- separate transaction since may already exist
+CREATE EXTENSION pg_trgm; -- Separate transaction, only needed for 9.1
+CREATE EXTENSION btree_gist; -- Separate transaction, only needed for 9.1
begin;
Modified: trunk/sql/modules/Files.sql
===================================================================
--- trunk/sql/modules/Files.sql 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/sql/modules/Files.sql 2011-12-04 06:45:01 UTC (rev 4139)
@@ -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;
Modified: trunk/sql/modules/Fixes.sql
===================================================================
--- trunk/sql/modules/Fixes.sql 2011-12-03 23:38:29 UTC (rev 4138)
+++ trunk/sql/modules/Fixes.sql 2011-12-04 06:45:01 UTC (rev 4139)
@@ -35,6 +35,9 @@
DELETE FROM menu_attribute WHERE node_id BETWEEN 133 AND 135;
DELETE FROM menu_node WHERE id BETWEEN 133 AND 135;
+-- bad batch type for receipt batches
+update menu_attribute set value = 'receipt' where node_id = 203 and attribute='batch_type';
+
COMMIT;
BEGIN;
@@ -51,3 +54,10 @@
UPDATE menu_attribute SET value = 'sales_order'
WHERE node_id = 118 AND attribute = 'type';
COMMIT;
+
+BEGIN;
+ALTER TABLE entity_bank_account DROP CONSTRAINT entity_bank_account_pkey;
+ALTER TABLE entity_bank_account ALTER COLUMN bic DROP NOT NULL;
+ALTER TABLE entity_bank_account ADD UNIQUE(bic,iban);
+CREATE UNIQUE INDEX eba_iban_null_bic_u ON entity_bank_account(iban) WHERE bic IS NULL;
+COMMIT;
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-4102
/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-4138
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
Copied: trunk/tools/delete-mycompany-roles.sh (from rev 4138, branches/1.3/tools/delete-mycompany-roles.sh)
===================================================================
--- trunk/tools/delete-mycompany-roles.sh (rev 0)
+++ trunk/tools/delete-mycompany-roles.sh 2011-12-04 06:45:01 UTC (rev 4139)
@@ -0,0 +1,22 @@
+#!/bin/sh
+RC=0;
+MY_COMPANY=$1;
+[ -n "$MY_COMPANY" ] || { echo "parm 1 MY_COMPANY missing!";exit 1;}
+LIKE_ARG="'lsmb_$MY_COMPANY%'";
+CMD="select '\"'||rolname||'\"'||'@' FROM pg_roles WHERE rolname LIKE $LIKE_ARG;";
+echo "MY_COMPANY=$MY_COMPANY LIKE_ARG=$LIKE_ARG CMD=$CMD";
+company_roles=`sudo -u postgres psql -q -t -c "$CMD"`;
+#echo "company_roles=$company_roles";
+OLDIFS=$IFS
+IFS=@
+for role in $company_roles
+do
+ #echo "role=$role"
+ role1=$(echo $role|tr '\n' ' ')
+ #echo "role1=$role1"
+ cmd_drop="drop user $role1;"
+ #echo "cmd_drop=$cmd_drop"
+ #echo $cmd | psql template1
+ RC=`sudo -u postgres psql -q -t -c "$cmd_drop"`
+ echo "cmd_drop=$cmd_drop RC=$RC \$?=$?";
+done
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.