From: Sven Schöling Date: Tue, 3 Apr 2012 09:53:03 +0000 (+0200) Subject: Merge remote-tracking branch 'cebitversion/kivitendo_style' X-Git-Tag: release-3.0.0beta1~344^2~7 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/c707edd523dc852f3bd11008d64ab3cb1daca545?hp=e39733b27117138516ec4d566261c9570f07ff69 Merge remote-tracking branch 'cebitversion/kivitendo_style' Conflicts: SL/Form.pm --- diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index 0a483bfaa..9c860bf7e 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -13,7 +13,7 @@ use List::Util qw(first); __PACKAGE__->meta->add_relationship(orderitems => { type => 'one to many', class => 'SL::DB::DeliveryOrderItem', column_map => { id => 'delivery_order_id' }, - manager_args => { with_objects => [ 'part' ] } + manager_args => { with_objects => [ 'parts' ] } }, shipto => { type => 'one to one', class => 'SL::DB::Shipto', @@ -45,4 +45,16 @@ sub sales_order { return first { $_->is_type('sales_order') } @{ $orders }; } +sub type { + return shift->customer_id ? 'sales_delivery_order' : 'purchase_delivery_order'; +} + +sub displayable_state { + my ($self) = @_; + + return join '; ', + ($self->closed ? $::locale->text('closed') : $::locale->text('open')), + ($self->delivered ? $::locale->text('delivered') : $::locale->text('not delivered')); +} + 1; diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 14c11fa7d..c330084ed 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -236,6 +236,22 @@ sub _post_update_allocated { } } +sub invoice_type { + my ($self) = @_; + + return 'ar_transaction' if !$self->invoice; + return 'credit_note' if $self->type eq 'credit_note' && $self->amount < 0 && !$self->storno; + return 'invoice_storno' if $self->type ne 'credit_note' && $self->amount < 0 && $self->storno; + return 'credit_note_storno' if $self->type eq 'credit_note' && $self->amount > 0 && $self->storno; + return 'invoice'; +} + +sub displayable_state { + my $self = shift; + + return $self->closed ? $::locale->text('closed') : $::locale->text('open'); +} + 1; __END__ diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 6b31cd235..e28a87c7d 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -84,6 +84,23 @@ sub is_type { return shift->type eq shift; } +sub displayable_type { + my $type = shift->type; + + return $::locale->text('Sales quotation') if $type eq 'sales_quotation'; + return $::locale->text('Request quotation') if $type eq 'request_quotation'; + return $::locale->text('Sales Order') if $type eq 'sales_order'; + return $::locale->text('Purchase Order') if $type eq 'purchase_order'; + + die 'invalid type'; +} + + +sub is_sales { + croak 'not an accessor' if @_ > 1; + return shift->customer_id; +} + sub invoices { my $self = shift; my %params = @_; @@ -100,6 +117,12 @@ sub invoices { } } +sub displayable_state { + my ($self) = @_; + + return $self->closed ? $::locale->text('closed') : $::locale->text('open'); +} + sub abschlag_invoices { return shift()->invoices(query => [ abschlag => 1 ]); } diff --git a/SL/Form.pm b/SL/Form.pm index 392cd6648..95f4099e3 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -464,7 +464,12 @@ sub get_stylesheet_for_user { my $css_path = 'css'; if (my $user_style = $::myconfig{stylesheet}) { $user_style =~ s/\.css$//; # nuke trailing .css, this is a remnand of pre 2.7.0 stylesheet handling - $css_path = "$css_path/$user_style" if -d "$css_path/$user_style"; + if (-d "$css_path/$user_style" && + -f "$css_path/$user_style/main.css") { + $css_path = "$css_path/$user_style"; + } else { + $css_path = "$css_path/lx-office-erp"; + } } else { $css_path = "$css_path/lx-office-erp"; } @@ -502,6 +507,7 @@ sub header { push @header, "" if -f $self->{favicon}; push @header, map { qq|| } qw(jquery common jscalendar/calendar jscalendar/lang/calendar-de jscalendar/calendar-setup part_selection jquery-ui jqModal switchmenuframe); + push @header, $self->{javascript} if $self->{javascript}; push @header, map { qq|| } qw(main menu tabcontent list_accounts jquery.autocomplete jquery.multiselect2side frame_header/header ui-lightness/jquery-ui-1.8.12.custom); push @header, map { qq|| } @@ -2540,13 +2546,17 @@ sub all_vc { $table = $table eq "customer" ? "customer" : "vendor"; - my $query = qq|SELECT count(*) FROM $table WHERE NOT obsolete|; + # build selection list + # Hotfix für Bug 1837 - Besser wäre es alte Buchungsbelege + # OHNE Auswahlliste (reines Textfeld) zu laden. Hilft aber auch + # nicht für veränderbare Belege (oe, do, ...) + my $obsolete = "WHERE NOT obsolete" unless $self->{id}; + my $query = qq|SELECT count(*) FROM $table $obsolete|; my ($count) = selectrow_query($self, $dbh, $query); - # build selection list - if ($count <= $myconfig->{vclimit}) { + if ($count < $myconfig->{vclimit}) { $query = qq|SELECT id, name, salesman_id - FROM $table WHERE NOT obsolete + FROM $table $obsolete ORDER BY name|; $self->{"all_$table"} = selectall_hashref_query($self, $dbh, $query); } diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index f81435e71..3f5cdebba 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -204,8 +204,11 @@ sub set_custom_headers { sub get_attachment_basename { my $self = shift; my $filename = $self->{options}->{attachment_basename} || 'report'; + + # FIXME: this is bonkers. add a real sluggify method somewhere or import one. $filename =~ s|.*\\||; $filename =~ s|.*/||; + $filename =~ s| |_|g; return $filename; } @@ -228,6 +231,7 @@ sub generate_with_headers { print $self->generate_html_content(); } elsif ($format eq 'csv') { + # FIXME: don't do mini http in here my $filename = $self->get_attachment_basename(); print qq|content-type: text/csv\n|; print qq|content-disposition: attachment; filename=${filename}.csv\n\n|; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index cd30053ed..e69e13cbf 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -32,7 +32,7 @@ #====================================================================== use POSIX qw(strftime); -use List::Util qw(sum first); +use List::Util qw(sum first max); use SL::AR; use SL::FU; @@ -218,19 +218,16 @@ sub form_header { my $cgi = $::request->{cgi}; my ($title, $readonly, $exchangerate, $rows); - my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project); - my ($jsscript, $button1, $button2, $onload); - my ($selectAR_amount, $selectAR_paid, $ARselected, $tax); - my (@column_index, %column_data); + my ($notes, $department, $customer, $employee, $amount, $project); + my ($onload); + my ($ARselected); $title = $form->{title}; - $form->{title} = $locale->text("$title Accounts Receivables Transaction"); - - $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; - # $locale->text('Add Accounts Receivables Transaction') # $locale->text('Edit Accounts Receivables Transaction') + $form->{title} = $locale->text("$title Accounts Receivables Transaction"); + $form->{javascript} = qq|