[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4013] trunk
- Subject: SF.net SVN: ledger-smb:[4013] trunk
- From: ..hidden..
- Date: Thu, 17 Nov 2011 13:32:32 +0000
Revision: 4013
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4013&view=rev
Author: einhverfr
Date: 2011-11-17 13:32:31 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
Merging from branches/1.3
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/BP.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/OE.pm
trunk/LedgerSMB/Scripts/payment.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/payments/payment1.html
trunk/UI/payments/payment2.html
trunk/UPGRADE
trunk/bin/aa.pl
trunk/doc/LedgerSMB-manual.pdf
trunk/doc/manual/LedgerSMB-manual.tex
trunk/lsmb-request.pl
trunk/old-handler.pl
trunk/sql/modules/Roles.sql
trunk/sql/upgrade/1.2-1.3-manual.sql
trunk/sql/upgrade/1.2-pre-upgrade-checks.sql
trunk/t/04-template-handling.t
trunk/templates/demo/invoice.html
trunk/templates/demo/pos_invoice.txt
Added Paths:
-----------
trunk/css/scripts/create_batch.css
trunk/templates/xedemo/
trunk/templates/xedemo/ap_transaction.html
trunk/templates/xedemo/ap_transaction.tex
trunk/templates/xedemo/ar_EG/
trunk/templates/xedemo/ar_transaction.html
trunk/templates/xedemo/ar_transaction.tex
trunk/templates/xedemo/balance_sheet.html
trunk/templates/xedemo/bg/
trunk/templates/xedemo/bin_list.html
trunk/templates/xedemo/bin_list.tex
trunk/templates/xedemo/ca/
trunk/templates/xedemo/check.tex
trunk/templates/xedemo/check_base.tex
trunk/templates/xedemo/check_multiple.tex
trunk/templates/xedemo/cs/
trunk/templates/xedemo/da/
trunk/templates/xedemo/de/
trunk/templates/xedemo/de_CH/
trunk/templates/xedemo/el/
trunk/templates/xedemo/en/
trunk/templates/xedemo/en_CA/
trunk/templates/xedemo/en_GB/
trunk/templates/xedemo/es/
trunk/templates/xedemo/es_CO/
trunk/templates/xedemo/es_EC/
trunk/templates/xedemo/es_MX/
trunk/templates/xedemo/es_PA/
trunk/templates/xedemo/es_PY/
trunk/templates/xedemo/es_SV/
trunk/templates/xedemo/es_VE/
trunk/templates/xedemo/et/
trunk/templates/xedemo/fi/
trunk/templates/xedemo/fr/
trunk/templates/xedemo/fr_BE/
trunk/templates/xedemo/fr_CA/
trunk/templates/xedemo/hu/
trunk/templates/xedemo/id/
trunk/templates/xedemo/income_statement.html
trunk/templates/xedemo/invoice.html
trunk/templates/xedemo/invoice.tex
trunk/templates/xedemo/is/
trunk/templates/xedemo/it/
trunk/templates/xedemo/letterhead.html
trunk/templates/xedemo/letterhead.tex
trunk/templates/xedemo/lt/
trunk/templates/xedemo/lv/
trunk/templates/xedemo/nb/
trunk/templates/xedemo/nl/
trunk/templates/xedemo/nl_BE/
trunk/templates/xedemo/packing_list.html
trunk/templates/xedemo/packing_list.tex
trunk/templates/xedemo/pick_list.html
trunk/templates/xedemo/pick_list.tex
trunk/templates/xedemo/pl/
trunk/templates/xedemo/pos_invoice.txt
trunk/templates/xedemo/printPayment.html
trunk/templates/xedemo/pt/
trunk/templates/xedemo/pt_BR/
trunk/templates/xedemo/purchase_order.html
trunk/templates/xedemo/purchase_order.tex
trunk/templates/xedemo/receipt.tex
trunk/templates/xedemo/request_quotation.html
trunk/templates/xedemo/request_quotation.tex
trunk/templates/xedemo/ru/
trunk/templates/xedemo/sales_order.html
trunk/templates/xedemo/sales_order.tex
trunk/templates/xedemo/sales_quotation.html
trunk/templates/xedemo/sales_quotation.tex
trunk/templates/xedemo/statement.html
trunk/templates/xedemo/statement.tex
trunk/templates/xedemo/sv/
trunk/templates/xedemo/timecard.html
trunk/templates/xedemo/timecard.tex
trunk/templates/xedemo/tr/
trunk/templates/xedemo/uk/
trunk/templates/xedemo/work_order.html
trunk/templates/xedemo/work_order.tex
trunk/templates/xedemo/zh_CN/
trunk/templates/xedemo/zh_TW/
Removed Paths:
-------------
trunk/doc/manual/LedgerSMB-manual.aux
trunk/doc/manual/LedgerSMB-manual.lof
trunk/doc/manual/LedgerSMB-manual.toc
trunk/templates/xedemo/ap_transaction.html
trunk/templates/xedemo/ap_transaction.tex
trunk/templates/xedemo/ar_EG/
trunk/templates/xedemo/ar_transaction.html
trunk/templates/xedemo/ar_transaction.tex
trunk/templates/xedemo/balance_sheet.html
trunk/templates/xedemo/bg/
trunk/templates/xedemo/bin_list.html
trunk/templates/xedemo/bin_list.tex
trunk/templates/xedemo/ca/
trunk/templates/xedemo/check.tex
trunk/templates/xedemo/check_base.tex
trunk/templates/xedemo/check_multiple.tex
trunk/templates/xedemo/cs/
trunk/templates/xedemo/da/
trunk/templates/xedemo/de/
trunk/templates/xedemo/de_CH/
trunk/templates/xedemo/el/
trunk/templates/xedemo/en/
trunk/templates/xedemo/en_CA/
trunk/templates/xedemo/en_GB/
trunk/templates/xedemo/es/
trunk/templates/xedemo/es_CO/
trunk/templates/xedemo/es_EC/
trunk/templates/xedemo/es_MX/
trunk/templates/xedemo/es_PA/
trunk/templates/xedemo/es_PY/
trunk/templates/xedemo/es_SV/
trunk/templates/xedemo/es_VE/
trunk/templates/xedemo/et/
trunk/templates/xedemo/fi/
trunk/templates/xedemo/fr/
trunk/templates/xedemo/fr_BE/
trunk/templates/xedemo/fr_CA/
trunk/templates/xedemo/hu/
trunk/templates/xedemo/id/
trunk/templates/xedemo/income_statement.html
trunk/templates/xedemo/invoice.html
trunk/templates/xedemo/invoice.tex
trunk/templates/xedemo/is/
trunk/templates/xedemo/it/
trunk/templates/xedemo/letterhead.html
trunk/templates/xedemo/letterhead.tex
trunk/templates/xedemo/lt/
trunk/templates/xedemo/lv/
trunk/templates/xedemo/nb/
trunk/templates/xedemo/nl/
trunk/templates/xedemo/nl_BE/
trunk/templates/xedemo/packing_list.html
trunk/templates/xedemo/packing_list.tex
trunk/templates/xedemo/pick_list.html
trunk/templates/xedemo/pick_list.tex
trunk/templates/xedemo/pl/
trunk/templates/xedemo/pos_invoice.txt
trunk/templates/xedemo/printPayment.html
trunk/templates/xedemo/pt/
trunk/templates/xedemo/pt_BR/
trunk/templates/xedemo/purchase_order.html
trunk/templates/xedemo/purchase_order.tex
trunk/templates/xedemo/receipt.tex
trunk/templates/xedemo/request_quotation.html
trunk/templates/xedemo/request_quotation.tex
trunk/templates/xedemo/ru/
trunk/templates/xedemo/sales_order.html
trunk/templates/xedemo/sales_order.tex
trunk/templates/xedemo/sales_quotation.html
trunk/templates/xedemo/sales_quotation.tex
trunk/templates/xedemo/statement.html
trunk/templates/xedemo/statement.tex
trunk/templates/xedemo/sv/
trunk/templates/xedemo/timecard.html
trunk/templates/xedemo/timecard.tex
trunk/templates/xedemo/tr/
trunk/templates/xedemo/uk/
trunk/templates/xedemo/work_order.html
trunk/templates/xedemo/work_order.tex
trunk/templates/xedemo/zh_CN/
trunk/templates/xedemo/zh_TW/
Property Changed:
----------------
trunk/
trunk/LedgerSMB/Scripts/admin.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/payment.pm
trunk/LedgerSMB/Scripts/setup.pm
trunk/doc/manual/
trunk/sql/upgrade/1.2-1.3-manual.sql
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3:3711-3983
+ /branches/1.3:3711-4009
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/Changelog 2011-11-17 13:32:31 UTC (rev 4013)
@@ -9,6 +9,13 @@
Initial Release: Monday, Oct 12 2011
Supported Presently
+Changelog for LedgerSMB 1.3.6
+* Including xelatex templates under directory templates/xedemo (Chris T)
+* Fix for company name in order entry (David B)
+
+Chris T is Chris Travers
+David B is David Bandel
+
Changelog for LedgerSMB 1.3.5
* Fixing Menu and Permissions bug 3430820 (Chris T)
* Fixing permissions bug 3433644 (Chris T)
@@ -20,6 +27,15 @@
* Corrected company name representation in timecard->sales order (Chris T)
* Better error handling when currency not set (Chris T)
* Exposed adding currency for customer/vendor to UI (Chris T)
+* Corrected POS roles as per bug 3434549 (Chris T)
+* Updated manual per ticket 3435124 (Chris T)
+* Removed intermediate LaTeX files (Erik H)
+* Fixed error: css/scripts/create_batch.css not found (Erik H)
+* Translation string updates Herman V)
+* Additional upgrade checks added (Herman V)
+* Better whitespace handling in upgrade scripts (from 1.2) (Herman V)
+* Translation string fixes for Payment workflow (Herman V)
+* Fixed UTF8 chars broken in printed HTML invoices (Chris T)
Chris T is Chris Travers
Erik H is Erik Huelsmann
Modified: trunk/LedgerSMB/BP.pm
===================================================================
--- trunk/LedgerSMB/BP.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/BP.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -157,7 +157,7 @@
'' AS ordnumber, '' AS quonumber, '0' AS invoice,
'$arap{$form->{type}}[0]' AS module, s.spoolfile
FROM jcitems j
- JOIN employees e ON (e.id = j.employee_id)
+ JOIN employees e ON (e.entity_id = j.employee_id)
JOIN status s ON (s.trans_id = j.id)
WHERE s.formname = ?
AND s.spoolfile IS NOT NULL|;
@@ -203,7 +203,7 @@
SELECT a.id, c.legal_name AS name, a.$invnumber AS invnumber, a.transdate,
a.ordnumber, a.quonumber, $invoice AS invoice,
'$item' AS module, s.spoolfile
- FROM $item a,
+ FROM $item a
JOIN entity_credit_account vc
ON vc.id = a.entity_credit_account
JOIN status s ON s.trans_id = a.id
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Form.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -70,6 +70,7 @@
use charnames qw(:full);
use open ':utf8';
package Form;
+use utf8;
use LedgerSMB::Log;
our $logger = Log::Log4perl->get_logger('LedgerSMB::Form');
@@ -120,6 +121,10 @@
$self->{unescape( "", $_) } = unescape( "", $orig->{$_} );
}
+ for my $p(keys %$self){
+ utf8::decode($self->{$p});
+ utf8::upgrade($self->{$p});
+ }
$self->{action} = "" unless defined $self->{action};
if ( substr( $self->{action}, 0, 1 ) !~ /( |\.)/ ) {
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/OE.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -151,7 +151,7 @@
$query = qq|
SELECT DISTINCT o.id, o.ordnumber, o.transdate,
- o.reqdate, o.amount, ct.name, o.netamount,
+ o.reqdate, o.amount, ct.legal_name, o.netamount,
o.entity_credit_account as $form->{vc}_id, ex.$rate AS exchangerate,
o.closed, o.quonumber, o.shippingpoint,
o.shipvia, ee.name AS employee, o.curr,
@@ -200,7 +200,7 @@
$query .= qq| AND o.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
}
elsif ( $form->{ $form->{vc} } ne "" ) {
- $query .= " AND lower(ct.name) LIKE ?";
+ $query .= " AND lower(ct.legal_name) LIKE ?";
push @queryargs, $name;
}
Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-3983
/branches/1.3/scripts/admin.pl:3711-3903
+ /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4009
/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-3983
/branches/1.3/scripts/employee.pl:3842-3843
+ /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4009
/branches/1.3/scripts/employee.pl:3842-3843
Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Scripts/payment.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -918,6 +918,7 @@
my $unhandled_overpayment;
for my $ref (0 .. $#array_options) {
if ( !$request->{"checkbox_$array_options[$ref]->{invoice_id}"}) {
+ my $request_topay_fx_bigfloat=$Payment->parse_amount(amount=>$request->{"topay_fx_$array_options[$ref]->{invoice_id}"});
# SHOULD I APPLY DISCCOUNTS?
$request->{"optional_discount_$array_options[$ref]->{invoice_id}"} = $request->{first_load}? "on": $request->{"optional_discount_$array_options[$ref]->{invoice_id}"};
@@ -949,10 +950,11 @@
# XXX: This causes issues currently, so display of unhandled overpayment has
# disabled. Was getting numbers that didn't make a lot of sense to me. --CT
- if ( $due_fx < $request->{"topay_fx_$array_options[$ref]->{invoice_id}"}) {
+ if ( $due_fx < $request_topay_fx_bigfloat) {
# We need to store all the overpayments so we can use it on the screen
- $unhandled_overpayment = $request->round_amount($unhandled_overpayment + $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} - $due_fx );
- $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} = "$due_fx";
+ $unhandled_overpayment = $request->round_amount($unhandled_overpayment + $request_topay_fx_bigfloat - $due_fx );
+ #$request->{"topay_fx_$array_options[$ref]->{invoice_id}"} = "$due_fx";
+ $request_topay_fx_bigfloat=$due_fx;
}
#Now its time to build the link to the invoice :)
@@ -964,8 +966,8 @@
href => $uri
},
invoice_date => "$array_options[$ref]->{invoice_date}",
- amount => "$array_options[$ref]->{amount}",
- due => $request->{"optional_discount_$array_options[$ref]->{invoice_id}"}? "$array_options[$ref]->{due}" : "$array_options[$ref]->{due}" + "$array_options[$ref]->{discount}",
+ amount => $Payment->format_amount(amount=>$array_options[$ref]->{amount}),
+ due => $Payment->format_amount(amount=>$request->{"optional_discount_$array_options[$ref]->{invoice_id}"}? $array_options[$ref]->{due} : $array_options[$ref]->{due} + $array_options[$ref]->{discount}),
paid => "$array_options[$ref]->{amount}" - "$array_options[$ref]->{due}"-"$array_options[$ref]->{discount}",
discount => $request->{"optional_discount_$array_options[$ref]->{invoice_id}"} ? "$array_options[$ref]->{discount}" : 0 ,
optional_discount => $request->{"optional_discount_$array_options[$ref]->{invoice_id}"},
@@ -980,10 +982,10 @@
value => $request->{"memo_invoice_$array_options[$ref]->{invoice_id}"}
},#END HASH
topay_fx => { name => "topay_fx_$array_options[$ref]->{invoice_id}",
- value => $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} ?
+ value => $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} ?
$request->{"topay_fx_$array_options[$ref]->{invoice_id}"} eq 'N/A' ?
"$topay_fx_value" :
- $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} :
+ "$request_topay_fx_bigfloat":
"$topay_fx_value"
# Ugly hack, but works ;) ...
}#END HASH
@@ -1109,7 +1111,8 @@
selectedcheckboxes => @selected_checkboxes ? ..hidden.. : '',
notes => $request->{notes},
overpayment => ..hidden..,
- overpayment_account => ..hidden..
+ overpayment_account => ..hidden..,
+ format_amount => sub {return $Payment->format_amount(amount=>@_)}
};
my $template = LedgerSMB::Template->new(
user => $request->{_user},
@@ -1198,16 +1201,17 @@
# we will assume that a discount should apply only
# if this is the last payment of an invoice
my $temporary_discount = 0;
- if (($request->{"optional_discount_$array_options[$ref]->{invoice_id}"})&&("$array_options[$ref]->{due_fx}" <= $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} + $array_options[$ref]->{discount_fx})) {
+ my $request_topay_fx_bigfloat=$Payment->parse_amount(amount=>$request->{"topay_fx_$array_options[$ref]->{invoice_id}"});
+ if (($request->{"optional_discount_$array_options[$ref]->{invoice_id}"})&&("$array_options[$ref]->{due_fx}" <= $request_topay_fx_bigfloat + $array_options[$ref]->{discount_fx})) {
$temporary_discount = $array_options[$ref]->{discount_fx};
}
#
# The prefix cash is to set the movements of the cash accounts,
# same names are used for ap/ar accounts w/o the cash prefix.
#
- if ( "$array_options[$ref]->{due_fx}" < $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} ) {
+ if ( "$array_options[$ref]->{due_fx}" < $request_topay_fx_bigfloat ) {
# We need to store all the overpayments so we can use it on a new payment2 screen
- $unhandled_overpayment = $request->round_amount($unhandled_overpayment + $request->{"topay_fx_$array_options[$ref]->{invoice_id}"} + $temporary_discount - $array_options[$ref]->{amount}) ;
+ $unhandled_overpayment = $request->round_amount($unhandled_overpayment + $request_topay_fx_bigfloat + $temporary_discount - $array_options[$ref]->{amount}) ;
}
if ($temporary_discount != 0) {
@@ -1216,7 +1220,7 @@
push @source, $locale->text('Applied discount');
push @transaction_id, $array_options[$ref]->{invoice_id};
}
- push @amount, $request->{"topay_fx_$array_options[$ref]->{invoice_id}"}; # We'll use this for both cash and ap/ar accounts
+ push @amount, $request_topay_fx_bigfloat; # We'll use this for both cash and ap/ar accounts
push @cash_account_id, $request->{"optional_pay_$array_options[$ref]->{invoice_id}"} ? $request->{"account_$array_options[$ref]->{invoice_id}"} : $request->{account};
push @source, $request->{"optional_pay_$array_options[$ref]"} ?
$request->{"source_$array_options[$ref]->{invoice_id}"}.' '.$request->{"source_text_$array_options[$ref]->{invoice_id}"}
Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/1.3/scripts/payment.pl:3711-4011
Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-3983
/branches/1.3/scripts/setup.pl:3711-3967
+ /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4009
/branches/1.3/scripts/setup.pl:3711-3967
Modified: trunk/LedgerSMB/Template/CSV.pm
===================================================================
--- trunk/LedgerSMB/Template/CSV.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/CSV.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -103,7 +103,7 @@
$source = get_template($parent->{template});
}
$template = Template->new({
- INCLUDE_PATH => $parent->{include_path},
+ INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
Modified: trunk/LedgerSMB/Template/HTML.pm
===================================================================
--- trunk/LedgerSMB/Template/HTML.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/HTML.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -91,7 +91,7 @@
my $vars = shift @_;
if (defined $vars){
$vars = escapeHTML($vars);
- $vars =~ s|\n|<br />|gm;
+ $vars =~ s|\n|<br \/>|gm;#better syntax-look under gvim with escaped slash
return $vars;
}
return undef;
@@ -137,7 +137,7 @@
$source,
{%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs,
'escape' => \&preprocess},
- $output, binmode => ':utf8')) {
+ $output, {binmode => ':utf8'})) {
throw Error::Simple $template->error();
}
$parent->{mimetype} = 'text/html';
Modified: trunk/LedgerSMB/Template/LaTeX.pm
===================================================================
--- trunk/LedgerSMB/Template/LaTeX.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/LaTeX.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -132,7 +132,7 @@
}
$template = Template::Latex->new({
LATEX_FORMAT => $format,
- INCLUDE_PATH => $parent->{include_path},
+ INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
Modified: trunk/LedgerSMB/Template/ODS.pm
===================================================================
--- trunk/LedgerSMB/Template/ODS.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/ODS.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -835,7 +835,7 @@
$source = get_template($parent->{template});
}
$template = Template->new({
- INCLUDE_PATH => $parent->{include_path},
+ INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
Modified: trunk/LedgerSMB/Template/TXT.pm
===================================================================
--- trunk/LedgerSMB/Template/TXT.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/TXT.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -87,7 +87,7 @@
$source = get_template($parent->{template}, $parent);
}
$template = Template->new({
- INCLUDE_PATH => $parent->{include_path},
+ INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
Modified: trunk/LedgerSMB/Template/XLS.pm
===================================================================
--- trunk/LedgerSMB/Template/XLS.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template/XLS.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -107,7 +107,7 @@
params => {%$cleanvars, %$LedgerSMB::Template::TTI18N::ttfuncs,
'escape' => \&preprocess},
config => {
- INCLUDE_PATH => $parent->{include_path},
+ INCLUDE_PATH => [$parent->{include_path_lang}, $parent->{include_path}, 'UI/lib'],
START_TAG => quotemeta('<?lsmb'),
END_TAG => quotemeta('?>'),
DELIMITER => ';',
Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB/Template.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -1,480 +1,481 @@
-
-=head1 NAME
-
-LedgerSMB::Template - Template support module for LedgerSMB
-
-=head1 SYNOPSIS
-
-This module renders templates.
-
-=head1 METHODS
-
-=over
-
-=item new(user => \%myconfig, template => $string, format => $string, [locale => $locale] [language => $string], [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool], [debug => $bool], [output_file => $string] );
-
-This command instantiates a new template:
-
-=over
-
-=item template
-
-The template to be processed. This can either be a reference to the template
-in string form or the name of the file that is the template to be processed.
-
-=item format
-
-The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported.
-
-=item format_options (optional)
-
-A hash of format-specific options. See the appropriate LSMB::T::foo for
-details.
-
-=item output_options (optional)
-
-A hash of output-specific options. See the appropriate output method for
-details.
-
-=item locale (optional)
-
-The locale object to use for regular gettext lookups. Having this option adds
-the text function to the usable list for the templates. Has no effect on the
-gettext function.
-
-=item language (optional)
-
-The language for template selection.
-
-=item include_path (optional)
-
-Overrides the template directory. Used with user interface templates.
-
-=item no_auto_output (optional)
-
-Disables the automatic output of rendered templates.
-
-=item no_escape (optional)
-
-Disables escaping on the template variables.
-
-=item debug (optional)
-
-Enables template debugging.
-
-With the TT-based renderers, HTML, PS, PDF, TXT, and CSV, the portion of the
-template to get debugging messages is to be surrounded by
-<?lsmb DEBUG format 'foo' ?> statements. Example:
-
- <tr><td colspan="<?lsmb columns.size ?>"></td></tr>
- <tr class="listheading">
- <?lsmb FOREACH column IN columns ?>
- <?lsmb DEBUG format '$file line $line : [% $text %]' ?>
- <th class="listtop"><?lsmb heading.$column ?></th>
- <?lsmb DEBUG format '' ?>
- <?lsmb END ?>
- </tr>
-
-=item method/media (optional)
-
-The output method to use, defaults to HTTP. Media is a synonym for method
-
-=item output_file (optional)
-
-The base name of the file for output.
-
-=back
-
-=item new_UI(user => \%myconfig, locale => $locale, template => $file, ...)
-
-Wrapper around the constructor that sets the path to 'UI', format to 'HTML',
-and leaves auto-output enabled.
-
-=item render($hashref)
-
-This command renders the template. If no_auto_output was not specified during
-instantiation, this also writes the result to standard output and exits.
-Otherwise it returns the name of the output file if a file was created. When
-no output file is created, the output is held in $self->{output}.
-
-Currently email and server-side printing are not supported.
-
-=item output
-
-This function outputs the rendered file in an appropriate manner.
-
-=item my $bool = _valid_language()
-
-This command checks for valid langages. Returns 1 if the language is valid,
-0 if it is not.
-
-=item column_heading()
-
-Apply locale settings to column headings and add sort urls if necessary.
-
-=item escape($string)
-
-Escapes a scalar string if the format supports such escaping and returns the
-sanitized version.
-
-=back
-
-=head1 Copyright 2007, The LedgerSMB Core Team
-
-This file is licensed under the GNU General Public License version 2, or at your
-option any later version. A copy of the license should have been included with
-your software.
-
-=cut
-
-package LedgerSMB::Template;
-
-use warnings;
-use strict;
-use Carp;
-
-use Error qw(:try);
-use LedgerSMB::CancelFurtherProcessing;
-use LedgerSMB::Sysconfig;
-use LedgerSMB::Mailer;
-use LedgerSMB::Company_Config;
-use LedgerSMB::Locale;
-
-sub new {
- my $class = shift;
- my $self = {};
- my %args = @_;
-
- $self->{myconfig} = $args{user};
- $self->{template} = $args{template};
- $self->{format} = $args{format};
- $self->{language} = $args{language};
- $self->{no_escape} = $args{no_escape};
- $self->{debug} = $args{debug};
- $self->{outputfile} =
- "${LedgerSMB::Sysconfig::tempdir}/$args{output_file}" if
- $args{output_file};
- $self->{include_path} = $args{path};
- $self->{locale} = $args{locale};
- $self->{noauto} = $args{no_auto_output};
- $self->{method} = $args{method};
- $self->{method} ||= $args{media};
- $self->{format_args} = $args{format_options};
- $self->{output_args} = $args{output_options};
- if ($self->{language}){ # Language takes precedence over locale
- $self->{locale} = LedgerSMB::Locale->get_handle($self->{language});
- }
-
- # SC: Muxing pre-format_args LaTeX format specifications. Now with
- # DVI support.
- if (lc $self->{format} eq 'dvi') {
- $self->{format} = 'LaTeX';
- $self->{format_args}{filetype} = 'dvi';
- } elsif (lc $self->{format} eq 'pdf') {
- $self->{format} = 'LaTeX';
- $self->{format_args}{filetype} = 'pdf';
- } elsif (lc $self->{format} eq 'ps' or lc $self->{format} eq 'postscript') {
- $self->{format} = 'LaTeX';
- $self->{format_args}{filetype} = 'ps';
- }
- bless $self, $class;
-
- if ($self->{format} !~ /^\p{IsAlnum}+$/) {
- throw Error::Simple "Invalid format";
- }
- if (!$self->{include_path}){
- $self->{include_path} = $self->{'myconfig'}->{'templates'};
- $self->{include_path} ||= 'templates/demo';
- if (defined $self->{language}){
- if (!$self->_valid_language){
- throw Error::Simple 'Invalid language';
- return undef;
- }
- $self->{include_path_lang} = "$self->{'include_path'}"
- ."/$self->{language}";
- $self->{locale}
- = LedgerSMB::Locale->get_handle($self->{language});
- }
- }
-
- return $self;
-}
-
-sub new_UI {
- my $class = shift;
- return $class->new(@_, no_auto_ouput => 0, format => 'HTML', path => 'UI');
-}
-
-sub _valid_language {
- my $self = shift;
- if ($self->{language} =~ m#(/|\\|:|\.\.|^\.)#){
- return 0;
- }
- return 1;
-}
-
-sub _preprocess {
- my ($self, $vars) = @_;
- return unless $self->{myconfig};
- use LedgerSMB;
- my $type = ref($vars);
-
- if ($type eq 'SCALAR' || !$type){
- return;
- }
- if ($type eq 'ARRAY'){
- for (@$vars){
- if (ref($_)){
- $self->_preprocess($_);
- }
- }
- }
- else {
- for my $key (keys %$vars){
- $self->_preprocess($vars->{$key});
- }
- }
-}
-
-sub render {
- my $self = shift;
- my $vars = shift;
- if ($self->{format} !~ /^\p{IsAlnum}+$/) {
- throw Error::Simple "Invalid format";
- }
- my $format = "LedgerSMB::Template::$self->{format}";
-
-# if ($self->{myconfig}){
-# $self->_preprocess($vars);
-# }
- eval "require $format";
- if ($@) {
- throw Error::Simple $@;
- }
-
- my $cleanvars;
- if ($self->{no_escape}) {
- carp 'no_escape mode enabled in rendering';
- $cleanvars = $vars;
- } else {
- $cleanvars = $format->can('preprocess')->($vars);
- }
- $cleanvars->{escape} = sub { return $format->escape(@_)};
- if (UNIVERSAL::isa($self->{locale}, 'LedgerSMB::Locale')){
- $cleanvars->{text} = sub { return $self->escape($self->{locale}->text(@_))};
- }
- else {
- $cleanvars->{text} = sub { return $self->escape(shift @_) };
-
- }
- $cleanvars->{tt_url} = sub {
- my $str = shift @_;
-
- my $regex = qr/([^a-zA-Z0-9_.-])/;
- $str =~ s/$regex/sprintf("%%%02x", ord($1))/ge;
- return $str;
- };
-
- $format->can('process')->($self, $cleanvars);
- #return $format->can('postprocess')->($self);
- my $post = $format->can('postprocess')->($self);
- if (!$self->{'noauto'}) {
- # Clean up
- $self->output(%$vars);
- if ($self->{rendered}) {
- unlink($self->{rendered}) or
- throw Error::Simple 'Unable to delete output file';
- }
- }
- return $post;
-}
-
-sub escape {
- my ($self, $vars) = @_;
- my $format = "LedgerSMB::Template::$self->{format}";
- return $format->can('escape')->($vars) || $vars;
-}
-
-sub output {
- my $self = shift;
- my %args = @_;
-
- for ( keys %args ) { $self->{output_args}->{$_} = $args{$_}; };
-
- my $method = $self->{method} || $args{method} || $args{media};
- $method = '' if !defined $method;
- if ('email' eq lc $method) {
- $self->_email_output;
- } elsif ('print' eq lc $method) {
- $self->_lpr_output;
- } elsif (defined $self->{output} or lc $method eq 'screen') {
- $self->_http_output;
- throw CancelFurtherProcessing();
- } elsif (defined $method) {
- $self->_lpr_output;
- } else {
- $self->_http_output_file;
- }
-}
-
-sub _http_output {
- my ($self, $data) = @_;
- $data ||= $self->{output};
- if ($self->{format} !~ /^\p{IsAlnum}+$/) {
- throw Error::Simple "Invalid format";
- }
-
- if (!defined $data and defined $self->{rendered}){
- $data = "";
- open (DATA, '<', $self->{rendered});
- while (my $line = <DATA>){
- $data .= $line;
- }
- }
-
- my $format = "LedgerSMB::Template::$self->{format}";
- my $disposition = "";
- my $name = $format->can('postprocess')->($self);
-
- if ($name) {
- $name =~ s#^.*/##;
- $disposition .= qq|\nContent-Disposition: attachment; filename="$name"|;
- }
- if ($self->{mimetype} =~ /^text/) {
- print "Content-Type: $self->{mimetype}; charset=utf-8$disposition\n\n";
- } else {
- print "Content-Type: $self->{mimetype}$disposition\n\n";
- }
- binmode STDOUT, ':utf8';
- print $data;
-}
-
-sub _http_output_file {
- my $self = shift;
- my $FH;
-
- open($FH, '<:bytes', $self->{rendered}) or
- throw Error::Simple 'Unable to open rendered file';
- my $data;
- {
- local $/;
- $data = <$FH>;
- }
- close($FH);
-
- $self->_http_output($data);
-
- unlink($self->{rendered}) or
- throw Error::Simple 'Unable to delete output file';
- throw CancelFurtherProcessing();
-}
-
-sub _email_output {
- my $self = shift;
- my $args = $self->{output_args};
-
- my @mailmime;
- if (!$self->{rendered} and !$args->{attach}) {
- $args->{message} .= $self->{output};
- @mailmime = ('contenttype', $self->{mimetype});
- }
-
- # User default for email from
- $args->{from} ||= $self->{user}->{email};
-
- # Default addresses
- my $csettings = $LedgerSMB::Company_Config::settings;
- $args->{from} ||= $csettings->{default_email_from};
- $args->{to} ||= $csettings->{default_email_to};
- $args->{cc} ||= $csettings->{default_email_cc};
- $args->{bcc} ||= $csettings->{default_email_bcc};
-
-
- # Mailer stuff
- my $mail = new LedgerSMB::Mailer(
- from => $args->{from},
- to => $args->{to},
- cc => $args->{cc},
- bcc => $args->{bcc},
- subject => $args->{subject},
- notify => $args->{notify},
- message => $args->{message},
- @mailmime,
- );
- if ($args->{attach} or $self->{mimetype} !~ m#^text/# or $self->{rendered}) {
- my @attachment;
- my $name = $args->{filename};
- if ($self->{rendered}) {
- @attachment = ('file', $self->{rendered});
- $name ||= $self->{rendered};
- } else {
- @attachment = ('data', $self->{output});
- }
- $mail->attach(
- mimetype => $self->{mimetype},
- filename => $name,
- strip => $$,
- @attachment,
- );
- }
- $mail->send;
-}
-
-sub _lpr_output {
- my ($self, $in_args) = shift;
- my $args = $self->{output_args};
- if ($self->{format} ne 'LaTeX') {
- throw Error::Simple "Invalid Format";
- }
- my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}};
-
- open (LPR, '|-', $lpr);
-
- # Output is not defined here. In the future we should consider
- # changing this to use the system command and hit the file as an arg.
- # -- CT
- open (FILE, '<', "$self->{rendered}");
- while (my $line = <FILE>){
- print LPR $line;
- }
- close(LPR);
-}
-
-# apply locale settings to column headings and add sort urls if necessary.
-sub column_heading {
-
- my $self = shift;
- my ($names, $sortby) = @_;
- my %sorturls;
-
- if ($sortby) {
- %sorturls = map
- { $_ => $sortby->{href}."=$_"} @{$sortby->{columns}};
- }
-
- foreach my $attname (keys %$names) {
-
- # process 2 cases - simple name => value, and complex name => hash
- # pairs. The latter is used to include urls in column headers.
-
- if (ref $names->{$attname} eq 'HASH') {
- my $t = $self->{locale}->text($names->{$attname}{text});
- $names->{$attname}{text} = $t;
- } else {
- my $t = $self->{locale}->text($names->{$attname});
- if (defined $sorturls{$attname}) {
- $names->{$attname} =
- {
- text => $t,
- href => $sorturls{$attname}
- };
- } else {
- $names->{$attname} = $t;
- }
- }
- }
-
- return $names;
-}
-
-1;
+
+=head1 NAME
+
+LedgerSMB::Template - Template support module for LedgerSMB
+
+=head1 SYNOPSIS
+
+This module renders templates.
+
+=head1 METHODS
+
+=over
+
+=item new(user => \%myconfig, template => $string, format => $string, [locale => $locale] [language => $string], [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool], [debug => $bool], [output_file => $string] );
+
+This command instantiates a new template:
+
+=over
+
+=item template
+
+The template to be processed. This can either be a reference to the template
+in string form or the name of the file that is the template to be processed.
+
+=item format
+
+The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported.
+
+=item format_options (optional)
+
+A hash of format-specific options. See the appropriate LSMB::T::foo for
+details.
+
+=item output_options (optional)
+
+A hash of output-specific options. See the appropriate output method for
+details.
+
+=item locale (optional)
+
+The locale object to use for regular gettext lookups. Having this option adds
+the text function to the usable list for the templates. Has no effect on the
+gettext function.
+
+=item language (optional)
+
+The language for template selection.
+
+=item include_path (optional)
+
+Overrides the template directory. Used with user interface templates.
+
+=item no_auto_output (optional)
+
+Disables the automatic output of rendered templates.
+
+=item no_escape (optional)
+
+Disables escaping on the template variables.
+
+=item debug (optional)
+
+Enables template debugging.
+
+With the TT-based renderers, HTML, PS, PDF, TXT, and CSV, the portion of the
+template to get debugging messages is to be surrounded by
+<?lsmb DEBUG format 'foo' ?> statements. Example:
+
+ <tr><td colspan="<?lsmb columns.size ?>"></td></tr>
+ <tr class="listheading">
+ <?lsmb FOREACH column IN columns ?>
+ <?lsmb DEBUG format '$file line $line : [% $text %]' ?>
+ <th class="listtop"><?lsmb heading.$column ?></th>
+ <?lsmb DEBUG format '' ?>
+ <?lsmb END ?>
+ </tr>
+
+=item method/media (optional)
+
+The output method to use, defaults to HTTP. Media is a synonym for method
+
+=item output_file (optional)
+
+The base name of the file for output.
+
+=back
+
+=item new_UI(user => \%myconfig, locale => $locale, template => $file, ...)
+
+Wrapper around the constructor that sets the path to 'UI', format to 'HTML',
+and leaves auto-output enabled.
+
+=item render($hashref)
+
+This command renders the template. If no_auto_output was not specified during
+instantiation, this also writes the result to standard output and exits.
+Otherwise it returns the name of the output file if a file was created. When
+no output file is created, the output is held in $self->{output}.
+
+Currently email and server-side printing are not supported.
+
+=item output
+
+This function outputs the rendered file in an appropriate manner.
+
+=item my $bool = _valid_language()
+
+This command checks for valid langages. Returns 1 if the language is valid,
+0 if it is not.
+
+=item column_heading()
+
+Apply locale settings to column headings and add sort urls if necessary.
+
+=item escape($string)
+
+Escapes a scalar string if the format supports such escaping and returns the
+sanitized version.
+
+=back
+
+=head1 Copyright 2007, The LedgerSMB Core Team
+
+This file is licensed under the GNU General Public License version 2, or at your
+option any later version. A copy of the license should have been included with
+your software.
+
+=cut
+
+package LedgerSMB::Template;
+
+use warnings;
+use strict;
+use Carp;
+
+use Error qw(:try);
+use LedgerSMB::CancelFurtherProcessing;
+use LedgerSMB::Sysconfig;
+use LedgerSMB::Mailer;
+use LedgerSMB::Company_Config;
+use LedgerSMB::Locale;
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ my %args = @_;
+
+ $self->{myconfig} = $args{user};
+ $self->{template} = $args{template};
+ $self->{format} = $args{format};
+ $self->{language} = $args{language};
+ $self->{no_escape} = $args{no_escape};
+ $self->{debug} = $args{debug};
+ $self->{outputfile} =
+ "${LedgerSMB::Sysconfig::tempdir}/$args{output_file}" if
+ $args{output_file};
+ $self->{include_path} = $args{path};
+ $self->{locale} = $args{locale};
+ $self->{noauto} = $args{no_auto_output};
+ $self->{method} = $args{method};
+ $self->{method} ||= $args{media};
+ $self->{format_args} = $args{format_options};
+ $self->{output_args} = $args{output_options};
+ if ($self->{language}){ # Language takes precedence over locale
+ $self->{locale} = LedgerSMB::Locale->get_handle($self->{language});
+ }
+
+ # SC: Muxing pre-format_args LaTeX format specifications. Now with
+ # DVI support.
+ if (lc $self->{format} eq 'dvi') {
+ $self->{format} = 'LaTeX';
+ $self->{format_args}{filetype} = 'dvi';
+ } elsif (lc $self->{format} eq 'pdf') {
+ $self->{format} = 'LaTeX';
+ $self->{format_args}{filetype} = 'pdf';
+ } elsif (lc $self->{format} eq 'ps' or lc $self->{format} eq 'postscript') {
+ $self->{format} = 'LaTeX';
+ $self->{format_args}{filetype} = 'ps';
+ }
+ bless $self, $class;
+
+ if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+ throw Error::Simple "Invalid format";
+ }
+ if (!$self->{include_path}){
+ $self->{include_path} = $self->{'myconfig'}->{'templates'};
+ $self->{include_path} ||= 'templates/demo';
+ if (defined $self->{language}){
+ if (!$self->_valid_language){
+ throw Error::Simple 'Invalid language';
+ return undef;
+ }
+ $self->{include_path_lang} = "$self->{'include_path'}"
+ ."/$self->{language}";
+ $self->{locale}
+ = LedgerSMB::Locale->get_handle($self->{language});
+ }
+ }
+
+ return $self;
+}
+
+sub new_UI {
+ my $class = shift;
+ return $class->new(@_, no_auto_ouput => 0, format => 'HTML', path => 'UI');
+}
+
+sub _valid_language {
+ my $self = shift;
+ if ($self->{language} =~ m#(/|\\|:|\.\.|^\.)#){
+ return 0;
+ }
+ return 1;
+}
+
+sub _preprocess {
+ my ($self, $vars) = @_;
+ return unless $self->{myconfig};
+ use LedgerSMB;
+ my $type = ref($vars);
+
+ if ($type eq 'SCALAR' || !$type){
+ return;
+ }
+ if ($type eq 'ARRAY'){
+ for (@$vars){
+ if (ref($_)){
+ $self->_preprocess($_);
+ }
+ }
+ }
+ else {
+ for my $key (keys %$vars){
+ $self->_preprocess($vars->{$key});
+ }
+ }
+}
+
+sub render {
+ my $self = shift;
+ my $vars = shift;
+ if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+ throw Error::Simple "Invalid format";
+ }
+ my $format = "LedgerSMB::Template::$self->{format}";
+
+# if ($self->{myconfig}){
+# $self->_preprocess($vars);
+# }
+ eval "require $format";
+ if ($@) {
+ throw Error::Simple $@;
+ }
+
+ my $cleanvars;
+ if ($self->{no_escape}) {
+ carp 'no_escape mode enabled in rendering';
+ $cleanvars = $vars;
+ } else {
+ $cleanvars = $format->can('preprocess')->($vars);
+ }
+ $cleanvars->{escape} = sub { return $format->escape(@_)};
+ if (UNIVERSAL::isa($self->{locale}, 'LedgerSMB::Locale')){
+ $cleanvars->{text} = sub { return $self->escape($self->{locale}->text(@_))};
+ }
+ else {
+ $cleanvars->{text} = sub { return $self->escape(shift @_) };
+
+ }
+ $cleanvars->{tt_url} = sub {
+ my $str = shift @_;
+
+ my $regex = qr/([^a-zA-Z0-9_.-])/;
+ $str =~ s/$regex/sprintf("%%%02x", ord($1))/ge;
+ return $str;
+ };
+
+ $format->can('process')->($self, $cleanvars);
+ #return $format->can('postprocess')->($self);
+ my $post = $format->can('postprocess')->($self);
+ if (!$self->{'noauto'}) {
+ # Clean up
+ $self->output(%$vars);
+ if ($self->{rendered}) {
+ unlink($self->{rendered}) or
+ throw Error::Simple 'Unable to delete output file';
+ }
+ }
+ return $post;
+}
+
+sub escape {
+ my ($self, $vars) = @_;
+ my $format = "LedgerSMB::Template::$self->{format}";
+ return $format->can('escape')->($vars) || $vars;
+}
+
+sub output {
+ my $self = shift;
+ my %args = @_;
+
+ for ( keys %args ) { $self->{output_args}->{$_} = $args{$_}; };
+
+ my $method = $self->{method} || $args{method} || $args{media};
+ $method = '' if !defined $method;
+ if ('email' eq lc $method) {
+ $self->_email_output;
+ } elsif ('print' eq lc $method) {
+ $self->_lpr_output;
+ } elsif (defined $self->{output} or lc $method eq 'screen') {
+ $self->_http_output;
+ throw CancelFurtherProcessing();
+ } elsif (defined $method) {
+ $self->_lpr_output;
+ } else {
+ $self->_http_output_file;
+ }
+}
+
+sub _http_output {
+ my ($self, $data) = @_;
+ $data ||= $self->{output};
+ if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+ throw Error::Simple "Invalid format";
+ }
+
+ if (!defined $data and defined $self->{rendered}){
+ $data = "";
+ open (DATA, '<', $self->{rendered});
+ binmode DATA, ':utf8';
+ while (my $line = <DATA>){
+ $data .= $line;
+ }
+ }
+
+ my $format = "LedgerSMB::Template::$self->{format}";
+ my $disposition = "";
+ my $name = $format->can('postprocess')->($self);
+
+ if ($name) {
+ $name =~ s#^.*/##;
+ $disposition .= qq|\nContent-Disposition: attachment; filename="$name"|;
+ }
+ if ($self->{mimetype} =~ /^text/) {
+ print "Content-Type: $self->{mimetype}; charset=utf-8$disposition\n\n";
+ } else {
+ print "Content-Type: $self->{mimetype}$disposition\n\n";
+ }
+ binmode STDOUT, ':utf8';
+ print $data;
+}
+
+sub _http_output_file {
+ my $self = shift;
+ my $FH;
+
+ open($FH, '<:bytes', $self->{rendered}) or
+ throw Error::Simple 'Unable to open rendered file';
+ my $data;
+ {
+ local $/;
+ $data = <$FH>;
+ }
+ close($FH);
+
+ $self->_http_output($data);
+
+ unlink($self->{rendered}) or
+ throw Error::Simple 'Unable to delete output file';
+ throw CancelFurtherProcessing();
+}
+
+sub _email_output {
+ my $self = shift;
+ my $args = $self->{output_args};
+
+ my @mailmime;
+ if (!$self->{rendered} and !$args->{attach}) {
+ $args->{message} .= $self->{output};
+ @mailmime = ('contenttype', $self->{mimetype});
+ }
+
+ # User default for email from
+ $args->{from} ||= $self->{user}->{email};
+
+ # Default addresses
+ my $csettings = $LedgerSMB::Company_Config::settings;
+ $args->{from} ||= $csettings->{default_email_from};
+ $args->{to} ||= $csettings->{default_email_to};
+ $args->{cc} ||= $csettings->{default_email_cc};
+ $args->{bcc} ||= $csettings->{default_email_bcc};
+
+
+ # Mailer stuff
+ my $mail = new LedgerSMB::Mailer(
+ from => $args->{from},
+ to => $args->{to},
+ cc => $args->{cc},
+ bcc => $args->{bcc},
+ subject => $args->{subject},
+ notify => $args->{notify},
+ message => $args->{message},
+ @mailmime,
+ );
+ if ($args->{attach} or $self->{mimetype} !~ m#^text/# or $self->{rendered}) {
+ my @attachment;
+ my $name = $args->{filename};
+ if ($self->{rendered}) {
+ @attachment = ('file', $self->{rendered});
+ $name ||= $self->{rendered};
+ } else {
+ @attachment = ('data', $self->{output});
+ }
+ $mail->attach(
+ mimetype => $self->{mimetype},
+ filename => $name,
+ strip => $$,
+ @attachment,
+ );
+ }
+ $mail->send;
+}
+
+sub _lpr_output {
+ my ($self, $in_args) = shift;
+ my $args = $self->{output_args};
+ if ($self->{format} ne 'LaTeX') {
+ throw Error::Simple "Invalid Format";
+ }
+ my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}};
+
+ open (LPR, '|-', $lpr);
+
+ # Output is not defined here. In the future we should consider
+ # changing this to use the system command and hit the file as an arg.
+ # -- CT
+ open (FILE, '<', "$self->{rendered}");
+ while (my $line = <FILE>){
+ print LPR $line;
+ }
+ close(LPR);
+}
+
+# apply locale settings to column headings and add sort urls if necessary.
+sub column_heading {
+
+ my $self = shift;
+ my ($names, $sortby) = @_;
+ my %sorturls;
+
+ if ($sortby) {
+ %sorturls = map
+ { $_ => $sortby->{href}."=$_"} @{$sortby->{columns}};
+ }
+
+ foreach my $attname (keys %$names) {
+
+ # process 2 cases - simple name => value, and complex name => hash
+ # pairs. The latter is used to include urls in column headers.
+
+ if (ref $names->{$attname} eq 'HASH') {
+ my $t = $self->{locale}->text($names->{$attname}{text});
+ $names->{$attname}{text} = $t;
+ } else {
+ my $t = $self->{locale}->text($names->{$attname});
+ if (defined $sorturls{$attname}) {
+ $names->{$attname} =
+ {
+ text => $t,
+ href => $sorturls{$attname}
+ };
+ } else {
+ $names->{$attname} = $t;
+ }
+ }
+ }
+
+ return $names;
+}
+
+1;
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/LedgerSMB.pm 2011-11-17 13:32:31 UTC (rev 4013)
@@ -217,6 +217,7 @@
use LedgerSMB::Log;
use LedgerSMB::Company_Config;
use strict;
+use utf8;
$CGI::Simple::POST_MAX = -1;
@@ -247,6 +248,10 @@
# my $params = $query->Vars; returns a tied hash with keys that
# are not parameters of the CGI query.
my %params = $query->Vars;
+ for my $p(keys %params){
+ utf8::decode($params{$p});
+ utf8::upgrade($params{$p});
+ }
$logger->debug("LedgerSMB::new: params = ", Data::Dumper::Dumper(\%params));
$self->{VERSION} = $VERSION;
$self->{_request} = $query;
Modified: trunk/UI/payments/payment1.html
===================================================================
--- trunk/UI/payments/payment1.html 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/UI/payments/payment1.html 2011-11-17 13:32:31 UTC (rev 4013)
@@ -28,7 +28,12 @@
<?lsmb type.type = "hidden"; INCLUDE input element_data=type; -?>
<table width="100%">
<tr id="top-bar" class="listtop">
- <th id="top-bar-header" class="listtop"><label id="top-bar-header-label"><?lsmb text('Receipts') ?></th>
+ <th id="top-bar-header" class="listtop"><label id="top-bar-header-label">
+ <?lsmb IF (type.value == 'receipt') -?>
+ <?lsmb text('Receipts') ?>
+ <?lsmb ELSE; text('Payments') -?>
+ <?lsmb END -?>
+ </th>
</tr>
</table>
Modified: trunk/UI/payments/payment2.html
===================================================================
--- trunk/UI/payments/payment2.html 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/UI/payments/payment2.html 2011-11-17 13:32:31 UTC (rev 4013)
@@ -174,8 +174,8 @@
<td><div id="<?lsmb "div_topay_invoice_$i" ?>"><?lsmb row.due_fx ?></div></td>
<?lsmb END ?>
<?lsmb #This should be computed and updated to the div using ?>
- <td align="center"><?lsmb row.topay_fx.id = row.topay_fx.name ;INCLUDE input element_data=row.topay_fx;
- topay_subtotal = topay_subtotal + row.topay_fx.value -?>
+ <?lsmb topay_subtotal=topay_subtotal + row.topay_fx.value; -?>
+ <td align="center"><?lsmb row.topay_fx.id=row.topay_fx.name;INCLUDE input element_data={id=>row.topay_fx.id,name=>row.topay_fx.name,value=>format_amount(row.topay_fx.value)}; -?>
<?lsmb # A DEGRADABLE JAVASCRIPT IS USED, BECAUSE OF THE VISUAL IMPACT
# THAT CAUSES THE SIZE OF THIS DIV -?>
<img src="UI/payments/img/up.gif" id="button_topay_<?lsmb row.invoice.id ?>" name="<?lsmb "button_topay_$i" ?>"
@@ -222,7 +222,7 @@
<?lsmb colspan = column_count - 2 # We will use this later on totals -?>
<tr class="listsubtotal">
<th colspan="<?lsmb colspan -?>" align="right"><?lsmb text('Subtotal') -?></th>
- <th colspan="2"><?lsmb topay_subtotal -?> <?lsmb curr.value -?></th>
+ <th colspan="2"><?lsmb format_amount(topay_subtotal) -?> <?lsmb curr.value -?></th>
</tr>
</table>
<table width="100%">
@@ -321,7 +321,7 @@
<tr class="listtotal">
<?lsmb payment_total = overpayment_subtotal + topay_subtotal -?>
<th colspan="5" align="right"><?lsmb text('Total') -?></th>
- <th colspan="2"><?lsmb payment_total -?> <?lsmb curr.value -?></th>
+ <th colspan="2"><?lsmb format_amount(payment_total) -?> <?lsmb curr.value -?></th>
</tr>
</table>
@@ -330,13 +330,13 @@
update.title = "UPDATE ALT+U";
update.name = "action";
update.value = "payment2";
- update.text = text("UPDATE");
+ update.text = text("Update");
INCLUDE button element_data=update -?>
<?lsmb post.accesskey = "P";
post.title = "POST ALT+P";
post.name = "action";
post.value = "post_payment";
- post.text = text("POST");
+ post.text = text("Post");
INCLUDE button element_data=post -?>
<?lsmb post_and_print.accesskey = "R";
post_and_print.title = "POST AND PRINT ALT+R";
Modified: trunk/UPGRADE
===================================================================
--- trunk/UPGRADE 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/UPGRADE 2011-11-17 13:32:31 UTC (rev 4013)
@@ -31,6 +31,7 @@
* perl Makefile.PL
* make
* make test
+ But run 'make test' under an english locale, because some tests check for english error messages.
* run the install.sh script.
* direct your browser to the setup.pl script in your ledgersmb directory (via
http) and follow the prompts:
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/bin/aa.pl 2011-11-17 13:32:31 UTC (rev 4013)
@@ -439,14 +439,18 @@
# $locale->text('Add AP Transaction');
# $locale->text('Edit AR Transaction');
# $locale->text('Edit AP Transaction');
+ my $title_msgid="$title $form->{ARAP} Transaction";
if ($form->{reverse} == 0){
- $form->{title} = $locale->text("[_1] [_2] Transaction", $title, $form->{ARAP});
+ #$form->{title} = $locale->text("[_1] [_2] Transaction", $title, $form->{ARAP});
+ $form->{title} = $locale->text($title_msgid);
}
elsif($form->{reverse} == 1) {
if ($form->{subtype} eq 'credit_note'){
- $form->{title} = $locale->text("[_1] Credit Note", $title);
+ $title_msgid="$title Credit Note";$form->{title}=$locale->text($title_msgid);
+ #$form->{title} = $locale->text("[_1] Credit Note", $title);
} elsif ($form->{subtype} eq 'debit_note'){
- $form->{title} = $locale->text("[_1] Debit Note", $title);
+ $title_msgid="$title Debit Note";$form->{title}=$locale->text($title_msgid);
+ #$form->{title} = $locale->text("[_1] Debit Note", $title);
} else {
$form->error("Unknown subtype $form->{subtype} in $form->{ARAP} "
. "transaction.");
Copied: trunk/css/scripts/create_batch.css (from rev 4009, branches/1.3/css/scripts/create_batch.css)
===================================================================
--- trunk/css/scripts/create_batch.css (rev 0)
+++ trunk/css/scripts/create_batch.css 2011-11-17 13:32:31 UTC (rev 4013)
@@ -0,0 +1,8 @@
+
+.labelledinput { }
+
+.value { }
+
+.label { }
+
+.date { }
Modified: trunk/doc/LedgerSMB-manual.pdf
===================================================================
--- trunk/doc/LedgerSMB-manual.pdf 2011-11-17 13:25:32 UTC (rev 4012)
+++ trunk/doc/LedgerSMB-manual.pdf 2011-11-17 13:32:31 UTC (rev 4013)
@@ -1372,26 +1372,27 @@
<< /S /GoTo /D [918 0 R /Fit ] >>
endobj
933 0 obj <<
-/Length 1928
+/Length 1932
/Filter /FlateDecode
>>
stream
-x\xDA\xEDXÝ\xDAF\xCF_\xC1\xE4%f\xE6p\xD7^\xE0\xF6É\x8Fsj>j\x9B\2Mp\xEE\xDC\xBEbsi\xFE\xFBJ+\xE1\xA6\xD7v\xFAÐ/ì\x95\xB4\xD2O\xF2.\xA2s\xD7\x9D\xF1\xF1\xC48H_|s-e\xC7puÓ\xADN\xFA\xB1c
-W\xEF\xF7\x8D\x8EcÛaÛt\xD5\xF9Q\x8B\xF2\xD5]\xBEK&\x83nÏ\x856É\xFBlM\xF3Ça\x9A\xDE\xEDICh\x86.\xBB?\xA5\xAFI\xA7\xA1{\xB6m*\x9D\xB6\xEE\xBBÓ\xB6\x8EFPcz\x9F\xD3\xFE3\xD5\xC3r\xD75\xFA3Ógjy\xB6A\xA5\xD3 ÇNÏ\xBAë&\xC9\xEA|\xF3!ß\xBCi]\xF1D\xC6\xC1O\xF7\xD3AGzp"]\xF6]p\xC5\xD1\xFB+ ~[\x82\xD8\xE8
-\xEDc\x89\xAAO\xAB\x95\x83@)\xB6\xCB\xF5~\x95\xAF\x88\-w\xC5C]ëÅ\xFBbyO\xBC\xEC\xE0:\xF0\xD6\xC52\xDFVj\xAC\xF6\xDBU~\xAEx<\x8F\x88\xF2h\xA11\xBD\xCE\xEA|\xBA
-<\x8Ckw|,\xD7ë\x95\x9F\x8A\xEDQre\xB3\xA7\xD43,Ý Bz:Ü\xA8\xAA\xE2\x91\xE3\xC9N\xD1\xE2\xAE|\xCCwÛ\xF5}\xC1\xB3O\xE5\xEE]énX>|\xDEw\xF7uga\xF7\xE0\xC7\xE3|=\x91Õ\xF2\xB2\xFC9_Ö\xCD\xF8Q\xCA\xD84Å\xCAw\x8F\xF9\x8A\l\xDD!\xEBq\xBE*\xAAzW|\xD8\xD7E\xB9M\x96\xADe\xDBN,..hidden..'
-\x80\xDFQ*U>Z\xBAe\xB9H\x97\x92\xDD\x98Þ\x8CN\x8B\xFCsz\xE6\xF4\xABe\xB9y(\xD6\xF9\xEA1 \x9B\x8A\xA6\xE8n2\x9EDW$y\x93\xF2\xD4\xD6\xE6\xA3k,\x8CfUVu\xA2`y\xC50\xE8Kt\xFA4qqW\xBAZz
-\x816Ùi:""\x80\xD9\xFA\x9E\xDCCò'\x86\xC2$S\xCA}M\xC4M\xB9*\xDEa.3L\xA2T\x8A\xFAAp\xB9)\xEAZ\xC16<P\xFE\xAA#\xA8\xEF3VF\xE8\xA2\xBB\x816Ð\xE5vU\xA0\xFE\xEA |\x9C\xAC\xDD&6y\xFD-
-\xFAZ\xC70u\xCB\xC6^[\x8C>..hidden..,Ý\x84%\xE3YX2Î\xE4<\x81%\xF3\x96ÐÍ\xAAiF1\xA93, \Sha\x92}(Gh\xB0\xA7m\xCBz\xA6\xD01M ZP\xD1\xE8lB\xA1\xD2\xD1\xF4\xEC\xA2\xD8\xD0\xDB9\x84O0\xBCTW\xE1\xB5sK\xF9r\x9D\x9B\xA6ogÕ<\xA2kW\xD5M\xD7\xDA\xE6,@Þ\xDBJ\xAEy\xD7~\xDB \x93\xFB\xC71\xD9=\x85 #$\xC1d\x97\xCD\xE7!B
-A=EZS\xAE\xB4\xC2j%>\xE2B\xB5n\x98uI\xACV\xB5\xB5]\xAD\xD0 \xE5\xB10Q\x96\xFA\x88\x95\x8A\xD1\xD0HVW\xDC<\x80\xA7\xAEts\xA6V\p\xAB\xBDB\xAE%9\xB20A(\xC07\x84Wm4\xC0\xF2\x88h8c 3`\xA6\xE2o\x99\xED\xE2$\xAD*\xE3m;\xED\x8CÃ3\x96)..hidden..(\xE5-z\xFD\xAA\\xEE7\xF9\xB6Î\xD53\xAE\xBE)2 U\xFE\xF8\xBD,\xB25#\xE2\xAC\xD9\xE0'\x8D\xDAY`\xEDÓ|\xD1=\xE1r\xCFp\xB9*o\xC2\x83\xEEi\xA3\xD9p1 \xA6i×\xA0\xA2\xE1'
-gS\xFA\x965"\xF3x\xF6&#\xA2\xDE5\xBD h\xA3q\xABo"\xF2A\xFAu0L\x89\xF7\xD2O]/\x89\xE2OY\x8F?eE\xC1\xDBÞ8\xCD\xE3 Q\x9B=m\xD3N\xE6QH~x\xDA-\x82Ïc\x9A\x86Ar\xC5\xD3a\xB4\x85\xD31\xAFt\xC26\x9D\xA5D\x89\xC2I\x986:..hidden..'\xB4\xD95\x8D\x93 \xDE\xF8\xD0A\x85\xE9;b\xA8\x93\xE3\xE4:L\xA7\xEAlj\x81\x87Sl\xE6d\xAF+\xFB\x90\x89\xE1"\xF2\x99=_\xC4\xF3Y\xB0lÌQ\x98#?\x9C#\xFD\x92\x83!d\xD24\8=\x8E\x8E\xBC\xC1L+Rr\xE3GQ\xD5\xC1\x91\xD6\xCA$.\x99D\xA1A#\xFA\x83\x88\xE7\xCAwd\xAA\"eÆ\x8E~E\x9CpzFr\x81t1\x98C\x80G-R\xB7]CK\xE6\xC10<\xAC\x82\xB7$\xC6W}å\x9D\xF3\xA5Xy\xC3\xD94 ~X\x80\xD8D\xA4\x91?\xF1Ç!\`/k\xF7*\x80 r\xC1\xAB\LK\xE1bZFg\xB8\x88\x83 E\xD4"