my %allowed_sort_columns =
map { $_, 1 } qw(
id customernumber vendornumber name contact phone fax email street
- taxnumber business invnumber ordnumber quonumber
+ taxnumber business invnumber ordnumber quonumber zipcode city
);
my $sortorder = $form->{sort} && $allowed_sort_columns{$form->{sort}} ? $form->{sort} : "name";
$form->{sort} = $sortorder;
FROM custom_variable_configs $where ORDER BY sortkey
SQL
+ $::form->{CVAR_CONFIGS} = {} unless 'HASH' eq ref $::form->{CVAR_CONFIGS};
if (!$::form->{CVAR_CONFIGS}->{$params{module}}) {
my $configs = selectall_hashref_query($form, $dbh, $query, @values);
columns => [
id => { type => 'integer', not_null => 1, sequence => 'id' },
- name => { type => 'varchar', length => 75, not_null => 1 },
+ name => { type => 'text', not_null => 1 },
department_1 => { type => 'varchar', length => 75 },
department_2 => { type => 'varchar', length => 75 },
street => { type => 'varchar', length => 75 },
zipcode => { type => 'varchar', length => 10 },
city => { type => 'varchar', length => 75 },
country => { type => 'varchar', length => 75 },
- contact => { type => 'varchar', length => 75 },
+ contact => { type => 'text' },
phone => { type => 'varchar', length => 30 },
fax => { type => 'varchar', length => 30 },
homepage => { type => 'text' },
bcc => { type => 'text' },
business_id => { type => 'integer' },
taxnumber => { type => 'text' },
- account_number => { type => 'varchar', length => 15 },
- bank_code => { type => 'varchar', length => 10 },
+ account_number => { type => 'text' },
+ bank_code => { type => 'text' },
bank => { type => 'text' },
language => { type => 'varchar', length => 5 },
datevexport => { type => 'integer' },
payment_id => { type => 'integer' },
taxzone_id => { type => 'integer', default => '0', not_null => 1 },
greeting => { type => 'text' },
- ustid => { type => 'varchar', length => 14 },
- direct_debit => { type => 'boolean', default => 'false' },
+ ustid => { type => 'text' },
iban => { type => 'varchar', length => 100 },
bic => { type => 'varchar', length => 100 },
+ direct_debit => { type => 'boolean', default => 'false' },
],
primary_key_columns => [ 'id' ],
fxloss_accno_id => { type => 'integer' },
invnumber => { type => 'text' },
sonumber => { type => 'text' },
- yearend => { type => 'varchar', length => 5 },
weightunit => { type => 'varchar', length => 5 },
businessnumber => { type => 'text' },
version => { type => 'varchar', length => 8 },
dunning_ar => { type => 'integer' },
pdonumber => { type => 'text' },
sdonumber => { type => 'text' },
+ ar_paid_accno_id => { type => 'integer' },
id => { type => 'serial', not_null => 1 },
],
is_sales => { type => 'boolean' },
itime => { type => 'timestamp', default => 'now()' },
mtime => { type => 'timestamp' },
- notes_bottom => { type => 'text' },
taxzone_id => { type => 'integer' },
taxincluded => { type => 'boolean' },
terms => { type => 'integer' },
storno_id => { type => 'integer' },
marge_total => { type => 'numeric', precision => 5, scale => 15 },
marge_percent => { type => 'numeric', precision => 5, scale => 15 },
- notes_bottom => { type => 'text' },
donumber => { type => 'text' },
],
table => 'makemodel',
columns => [
- parts_id => { type => 'integer' },
- model => { type => 'text' },
- itime => { type => 'timestamp', default => 'now()' },
- mtime => { type => 'timestamp' },
- make => { type => 'integer' },
- id => { type => 'serial', not_null => 1 },
+ parts_id => { type => 'integer' },
+ model => { type => 'text' },
+ itime => { type => 'timestamp', default => 'now()' },
+ mtime => { type => 'timestamp' },
+ lastcost => { type => 'numeric', precision => 5, scale => 15 },
+ lastupdate => { type => 'date' },
+ sortorder => { type => 'integer' },
+ make => { type => 'integer' },
+ id => { type => 'serial', not_null => 1 },
],
primary_key_columns => [ 'id' ],
transaction_description => { type => 'text' },
marge_total => { type => 'numeric', precision => 5, scale => 15 },
marge_percent => { type => 'numeric', precision => 5, scale => 15 },
- notes_bottom => { type => 'text' },
- project_manager_id => { type => 'integer' },
],
primary_key_columns => [ 'id' ],
key_columns => { globalproject_id => 'id' },
},
- project_manager => {
- class => 'SL::DB::Employee',
- key_columns => { project_manager_id => 'id' },
- },
-
salesman => {
class => 'SL::DB::Employee',
key_columns => { salesman_id => 'id' },
globalproject_id => { type => 'integer' },
transaction_description => { type => 'text' },
storno_id => { type => 'integer' },
- notes_bottom => { type => 'text' },
],
primary_key_columns => [ 'id' ],
executed => { type => 'boolean', default => 'false' },
closed => { type => 'boolean', default => 'false' },
itime => { type => 'timestamp', default => 'now()' },
+ vc => { type => 'varchar', length => 10 },
],
primary_key_columns => [ 'id' ],
columns => [
id => { type => 'integer', not_null => 1, sequence => 'id' },
sepa_export_id => { type => 'integer', not_null => 1 },
- ap_id => { type => 'integer', not_null => 1 },
+ ap_id => { type => 'integer' },
chart_id => { type => 'integer', not_null => 1 },
amount => { type => 'numeric', precision => 5, scale => 25 },
reference => { type => 'varchar', length => 35 },
execution_date => { type => 'date' },
our_iban => { type => 'varchar', length => 100 },
our_bic => { type => 'varchar', length => 100 },
- vendor_iban => { type => 'varchar', length => 100 },
- vendor_bic => { type => 'varchar', length => 100 },
+ vc_iban => { type => 'varchar', length => 100 },
+ vc_bic => { type => 'varchar', length => 100 },
end_to_end_id => { type => 'varchar', length => 35 },
+ ar_id => { type => 'integer' },
],
primary_key_columns => [ 'id' ],
key_columns => { ap_id => 'id' },
},
+ ar => {
+ class => 'SL::DB::Invoice',
+ key_columns => { ar_id => 'id' },
+ },
+
chart => {
class => 'SL::DB::Chart',
key_columns => { chart_id => 'id' },
mtime => { type => 'timestamp' },
module => { type => 'text' },
shipto_id => { type => 'integer', not_null => 1, sequence => 'id' },
+ shiptocp_gender => { type => 'text' },
],
primary_key_columns => [ 'shipto_id' ],
}
use CGI qw( -no_xhtml);
+use DateTime;
use English qw(-no_match_vars);
use SL::Auth;
use SL::LXDebug;
use SL::Locale;
use SL::Common;
use SL::Form;
+use SL::Helper::DateTime;
use List::Util qw(first);
use File::Basename;
--- /dev/null
+package DateTime;
+
+sub now_local {
+ return shift->now(time_zone => $::locale->get_local_time_zone);
+}
+
+sub today_local {
+ return shift->now(time_zone => $::locale->get_local_time_zone)->truncate(to => 'day');
+}
+
+sub to_lxoffice {
+ return $::locale->format_date(\%::myconfig, $_[0]);
+}
+
+sub from_lxoffice {
+ return $::locale->parse_date_to_object(\%::myconfig, $_[1]);
+}
+
+1;
+
+__END__
+
+=encoding utf8
+
+=head1 NAME
+
+SL::Helpers::DateTime - helper functions for L<DateTime>
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item C<now_local>
+
+Returns the current time with the time zone set to the local time zone.
+
+=item C<today_local>
+
+Returns the current date with the time zone set to the local time zone.
+
+=item C<to_lxoffice>
+
+Formats the date according to the current Lx-Office user's date
+format.
+
+=item C<from_lxoffice>
+
+Parses a date string formatted in the current Lx-Office user's date
+format and returns an instance of L<DateTime>.
+
+=back
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
}
if ($transdate eq "") {
- $transdate = "current_date";
+ $transdate = DateTime->today_local->to_lxoffice;
} else {
$transdate = $dbh->quote($transdate);
}
$myconfig->{numberformat} = $self->{saved_numberformat} if $self->{saved_numberformat};
}
+sub get_local_time_zone {
+ my $self = shift;
+ $self->{local_time_zone} ||= DateTime::TimeZone->new(name => 'local');
+ return $self->{local_time_zone};
+}
+
1;
use SL::CT;
use SL::CVar;
+use SL::DB::Business;
use SL::ReportGenerator;
require "bin/mozilla/common.pl";
push @options, $locale->text('Billing/shipping address (zipcode)') . " : $form->{zipcode}" if $form->{addr_zipcode};
push @options, $locale->text('Billing/shipping address (street)') . " : $form->{street}" if $form->{addr_street};
+ if ($form->{business_id}) {
+ my $business = SL::DB::Manager::Business->find_by(id => $form->{business_id});
+ if ($business) {
+ my $label = $form->{IS_CUSTOMER} ? $::locale->text('Customer type') : $::locale->text('Vendor type');
+ push @options, $label . " : " . $business->description;
+ }
+ }
+
my @columns = (
'id', 'name', "$form->{db}number", 'contact', 'phone',
'fax', 'email', 'taxnumber', 'street', 'zipcode' , 'city',
map { $column_defs{$_}->{visible} = $form->{"l_$_"} eq 'Y' } @columns;
- my @hidden_variables = (qw(db status obsolete name contact email cp_name addr_city), "$form->{db}number", @searchable_custom_variables, map { "l_$_" } @columns);
+ my @hidden_variables = (qw(db status obsolete name contact email cp_name addr_street addr_zipcode addr_city business_id),
+ "$form->{db}number", @searchable_custom_variables, map { "l_$_" } @columns);
my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
my $callback = build_std_url('action=list_names', grep { $form->{$_} } @hidden_nondefault);
$form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir});
{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, },
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, },
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, },
- { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^(sales_|invoice)/) && !$is_delivery_order, },
+ { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => !$is_delivery_order && !$is_purchase, },
{ id => 'discount', width => 5, value => $locale->text('Discount'), display => !$is_delivery_order, },
{ id => 'linetotal', width => 10, value => $locale->text('Extended'), display => !$is_delivery_order, },
{ id => 'bin', width => 10, value => $locale->text('Bin'), display => 0, },
my ($recursive_call) = shift;
-# map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call;
+ $form->{exchangerate} = $form->parse_amount(\%myconfig, $form->{exchangerate}) unless $recursive_call;
$form->{print_and_post} = 0 if $form->{second_run};
my $taxincluded = "checked" if $form->{taxincluded};
# Das Problem hierbei ist, dass in IS.pm post_invoice IMMER alle Zahlungseingänge aus $form
# erneut gespeichert werden. Prinzipiell wäre es besser NUR die Änderungen des Rechnungs-
# belegs (neue Zahlung aber nichts anderes) zu speichern ...
- # Vielleicht könnte man ähnlich wie bei Rechnung löschen verfahren
+ # Vielleicht könnte man ähnlich wie bei Rechnung löschen verfahren
$form->error($locale->text('Cannot post payment for a closed period!'))
if ($form->date_closed($form->{"datepaid_$form->{paidaccounts}"}, \%myconfig));
use utf8;
use CGI qw( -no_xhtml);
+use DateTime;
use SL::Auth;
use SL::Form;
+use SL::Helper::DateTime;
use SL::Locale;
use SL::LXDebug;
use Data::Dumper;
my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0);
while (<$fh>) {
+ last if /^\s*__END__/;
+
$line_no++;
# is this another file
#!/bin/sh
-for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh; do
+for i in am dispatcher kopf login; do
+ rm $i.pl 2> /dev/null
+ ln -s admin.pl $i.pl
+done
+for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do
rm $i.pl 2> /dev/null
ln -s am.pl $i.pl
done
-rm admin.pl 2> /dev/null
-ln -s login.pl admin.pl
rm generictranslations.pl 2> /dev/null
ln -s common.pl generictranslations.pl
+rm dispatcher.fcgi 2> /dev/null
+ln -s dispatcher.fpl dispatcher.fcgi
[%- USE T8 %]
[%- USE LxERP %]
+[%- USE HTML %]
<tr class=listheading>
<th class=listheading>[% 'Individual Items' | $T8 %]</th>
</tr>
<td[% ' align=' _ rcol.align IF rcol.align %]>[%- rcol.data %]</td>
[%- END %]
[%- FOREACH hidden = row.hiddens %]
- <input type=hidden name="[% hidden.name %]" value="[% hidden.value %]">
+ <input type=hidden name="[% HTML.escape(hidden.name) %]" value="[% HTML.escape(hidden.value) %]">
[%- END %]
</tr>
[%- END %]