Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 13 Jan 2011 15:47:01 +0000 (16:47 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Thu, 13 Jan 2011 15:47:01 +0000 (16:47 +0100)
Conflicts:
SL/Dispatcher.pm

23 files changed:
SL/CT.pm
SL/CVar.pm
SL/DB/MetaSetup/Customer.pm
SL/DB/MetaSetup/Default.pm
SL/DB/MetaSetup/DeliveryOrder.pm
SL/DB/MetaSetup/Invoice.pm
SL/DB/MetaSetup/MakeModel.pm
SL/DB/MetaSetup/Order.pm
SL/DB/MetaSetup/PurchaseInvoice.pm
SL/DB/MetaSetup/SepaExport.pm
SL/DB/MetaSetup/SepaExportItem.pm
SL/DB/MetaSetup/Shipto.pm
SL/Dispatcher.pm
SL/Helper/DateTime.pm [new file with mode: 0644]
SL/IC.pm
SL/Locale.pm
bin/mozilla/ct.pl
bin/mozilla/io.pl
bin/mozilla/is.pl
scripts/console
scripts/locales.pl
scripts/mklinks.sh
templates/webpages/ic/assembly_row.html

index e6a14e3..3c17ca5 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -698,7 +698,7 @@ sub search {
   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;
index 8c4f6a8..0de9a4b 100644 (file)
@@ -30,6 +30,7 @@ sub get_configs {
     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);
 
index 93f63b7..00bdb25 100644 (file)
@@ -11,14 +11,14 @@ __PACKAGE__->meta->setup(
 
   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' },
@@ -33,8 +33,8 @@ __PACKAGE__->meta->setup(
     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' },
@@ -50,10 +50,10 @@ __PACKAGE__->meta->setup(
     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' ],
index 4eb5e66..f213eda 100644 (file)
@@ -17,7 +17,6 @@ __PACKAGE__->meta->setup(
     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 },
@@ -42,6 +41,7 @@ __PACKAGE__->meta->setup(
     dunning_ar                 => { type => 'integer' },
     pdonumber                  => { type => 'text' },
     sdonumber                  => { type => 'text' },
+    ar_paid_accno_id           => { type => 'integer' },
     id                         => { type => 'serial', not_null => 1 },
   ],
 
index 806c963..6659654 100644 (file)
@@ -36,7 +36,6 @@ __PACKAGE__->meta->setup(
     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' },
index 6269da9..be3466d 100644 (file)
@@ -54,7 +54,6 @@ __PACKAGE__->meta->setup(
     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' },
   ],
 
index cc0ae7f..c6499a5 100644 (file)
@@ -10,12 +10,15 @@ __PACKAGE__->meta->setup(
   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' ],
index 914918d..e616aa3 100644 (file)
@@ -46,8 +46,6 @@ __PACKAGE__->meta->setup(
     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' ],
@@ -65,11 +63,6 @@ __PACKAGE__->meta->setup(
       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' },
index 0ea9d10..448b2a6 100644 (file)
@@ -43,7 +43,6 @@ __PACKAGE__->meta->setup(
     globalproject_id        => { type => 'integer' },
     transaction_description => { type => 'text' },
     storno_id               => { type => 'integer' },
-    notes_bottom            => { type => 'text' },
   ],
 
   primary_key_columns => [ 'id' ],
index 943121a..da09817 100644 (file)
@@ -15,6 +15,7 @@ __PACKAGE__->meta->setup(
     executed    => { type => 'boolean', default => 'false' },
     closed      => { type => 'boolean', default => 'false' },
     itime       => { type => 'timestamp', default => 'now()' },
+    vc          => { type => 'varchar', length => 10 },
   ],
 
   primary_key_columns => [ 'id' ],
index b9899c2..cd2152b 100644 (file)
@@ -12,7 +12,7 @@ __PACKAGE__->meta->setup(
   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 },
@@ -21,9 +21,10 @@ __PACKAGE__->meta->setup(
     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' ],
@@ -34,6 +35,11 @@ __PACKAGE__->meta->setup(
       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' },
index 0943c04..cde5a32 100644 (file)
@@ -26,6 +26,7 @@ __PACKAGE__->meta->setup(
     mtime              => { type => 'timestamp' },
     module             => { type => 'text' },
     shipto_id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    shiptocp_gender    => { type => 'text' },
   ],
 
   primary_key_columns => [ 'shipto_id' ],
index 2389b11..2f23952 100644 (file)
@@ -8,12 +8,14 @@ BEGIN {
 }
 
 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;
 
diff --git a/SL/Helper/DateTime.pm b/SL/Helper/DateTime.pm
new file mode 100644 (file)
index 0000000..fa035eb
--- /dev/null
@@ -0,0 +1,57 @@
+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
index f3f887d..ac3d6f2 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -1535,7 +1535,7 @@ sub retrieve_accounts {
   }
 
   if ($transdate eq "") {
-    $transdate = "current_date";
+    $transdate = DateTime->today_local->to_lxoffice;
   } else {
     $transdate = $dbh->quote($transdate);
   }
index e996739..c45a1a1 100644 (file)
@@ -497,4 +497,10 @@ sub restore_numberformat {
   $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;
index 63aa831..b6e8c7b 100644 (file)
@@ -50,6 +50,7 @@ use POSIX qw(strftime);
 
 use SL::CT;
 use SL::CVar;
+use SL::DB::Business;
 use SL::ReportGenerator;
 
 require "bin/mozilla/common.pl";
@@ -141,6 +142,14 @@ sub list_names {
   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',
@@ -175,7 +184,8 @@ sub list_names {
 
   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});
index 03ca708..9260981 100644 (file)
@@ -151,7 +151,7 @@ sub display_row {
     {  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, },
index 7ac9f4d..aeba187 100644 (file)
@@ -468,7 +468,7 @@ sub update {
 
   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};
@@ -631,7 +631,7 @@ sub post_payment {
   # 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));
 
index e3129a0..42c193a 100755 (executable)
@@ -39,8 +39,10 @@ package Devel::REPL;
 
 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;
index bdc3852..b972a49 100755 (executable)
@@ -331,6 +331,8 @@ sub scanfile {
     my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0);
 
     while (<$fh>) {
+      last if /^\s*__END__/;
+
       $line_no++;
 
       # is this another file
index 2888a20..190433f 100755 (executable)
@@ -1,10 +1,14 @@
 #!/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
index c7f8d83..02a7804 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE T8 %]
 [%- USE LxERP %]
+[%- USE HTML %]
   <tr class=listheading>
    <th class=listheading>[% 'Individual Items' | $T8 %]</th>
   </tr>
@@ -19,7 +20,7 @@
       <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 %]