From: G. Richardson Date: Tue, 20 Mar 2012 10:23:49 +0000 (+0100) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~345 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/24127d6f50fadaafaf676423cfab04556271db89?hp=5ae567349e69719bd1df8bf93166d2c47a18ee85 Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- 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 050614d56..84d64bd9f 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -507,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|| } 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|