From: Moritz Bunkus Date: Wed, 21 Jan 2015 15:22:49 +0000 (+0100) Subject: Einkauf/Verkauf: Bemerkungsfeld mit HTML-Editor ausgestattet X-Git-Tag: release-3.2.1~55 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a34c05f386bc2abb45a097dcb4d68e8ab2f5af94;p=kivitendo-erp.git Einkauf/Verkauf: Bemerkungsfeld mit HTML-Editor ausgestattet --- diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm index c99d2fdca..b530db731 100644 --- a/SL/DB/DeliveryOrder.pm +++ b/SL/DB/DeliveryOrder.pm @@ -8,6 +8,7 @@ use Rose::DB::Object::Helpers (); use SL::DB::MetaSetup::DeliveryOrder; use SL::DB::Manager::DeliveryOrder; +use SL::DB::Helper::AttrHTML; use SL::DB::Helper::FlattenToForm; use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::TransNumberGenerator; @@ -29,6 +30,8 @@ __PACKAGE__->meta->add_relationship(orderitems => { type => 'one to many __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('notes'); + __PACKAGE__->before_save('_before_save_set_donumber'); # hooks diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index a64ef2fb3..3e6c65a49 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -12,6 +12,7 @@ use Rose::DB::Object::Helpers (); use SL::DB::MetaSetup::Invoice; use SL::DB::Manager::Invoice; +use SL::DB::Helper::AttrHTML; use SL::DB::Helper::FlattenToForm; use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::PriceTaxCalculator; @@ -58,6 +59,8 @@ __PACKAGE__->meta->add_relationship( __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('notes'); + __PACKAGE__->before_save('_before_save_set_invnumber'); # hooks diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm index 28b1b5726..48e2be664 100644 --- a/SL/DB/Order.pm +++ b/SL/DB/Order.pm @@ -9,6 +9,7 @@ use List::Util qw(max); use SL::DB::MetaSetup::Order; use SL::DB::Manager::Order; +use SL::DB::Helper::AttrHTML; use SL::DB::Helper::FlattenToForm; use SL::DB::Helper::LinkedRecords; use SL::DB::Helper::PriceTaxCalculator; @@ -41,6 +42,8 @@ __PACKAGE__->meta->add_relationship( __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('notes'); + __PACKAGE__->before_save('_before_save_set_ord_quo_number'); # hooks diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index d5955c57c..19808eba5 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -6,6 +6,7 @@ use Carp; use SL::DB::MetaSetup::PurchaseInvoice; use SL::DB::Manager::PurchaseInvoice; +use SL::DB::Helper::AttrHTML; use SL::DB::Helper::LinkedRecords; use SL::Locale::String qw(t8); @@ -42,6 +43,8 @@ __PACKAGE__->meta->add_relationship( __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('notes'); + sub items { goto &invoiceitems; } sub add_items { goto &add_invoiceitems; } diff --git a/SL/DO.pm b/SL/DO.pm index 5adccd535..17876e514 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -451,7 +451,7 @@ SQL $form->{cusordnumber}, conv_date($form->{transdate}), conv_i($form->{vendor_id}), conv_i($form->{customer_id}), conv_date($form->{reqdate}), $form->{shippingpoint}, $form->{shipvia}, - $form->{notes}, $form->{intnotes}, + $restricter->process($form->{notes}), $form->{intnotes}, $form->{closed} ? 't' : 'f', $form->{delivered} ? "t" : "f", conv_i($form->{department_id}), conv_i($form->{language_id}), conv_i($form->{shipto_id}), conv_i($form->{globalproject_id}), conv_i($form->{employee_id}), diff --git a/SL/IR.pm b/SL/IR.pm index a87fca31b..6cd555669 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -722,7 +722,7 @@ SQL $form->{invnumber}, $form->{ordnumber}, $form->{quonumber}, conv_date($form->{invdate}), conv_date($form->{orddate}), conv_date($form->{quodate}), conv_i($form->{vendor_id}), $amount, $netamount, $form->{paid}, conv_date($form->{duedate}), - '1', $taxzone_id, $form->{notes}, $form->{taxincluded} ? 't' : 'f', + '1', $taxzone_id, $restricter->process($form->{notes}), $form->{taxincluded} ? 't' : 'f', $form->{intnotes}, conv_i($form->{storno_id}), $form->{storno} ? 't' : 'f', conv_i($form->{cp_id}), conv_i($form->{employee_id}), conv_i($form->{department_id}), conv_i($form->{delivery_term_id}), conv_i($form->{globalproject_id}), diff --git a/SL/IS.pm b/SL/IS.pm index 43303e894..989330c90 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1171,7 +1171,7 @@ SQL conv_date($form->{"invdate"}), conv_date($form->{"orddate"}), conv_date($form->{"quodate"}), conv_i($form->{"customer_id"}), $amount, $netamount, $form->{"paid"}, conv_date($form->{"duedate"}), conv_date($form->{"deliverydate"}), '1', $form->{"shippingpoint"}, - $form->{"shipvia"}, conv_i($form->{"terms"}), $form->{"notes"}, $form->{"intnotes"}, + $form->{"shipvia"}, conv_i($form->{"terms"}), $restricter->process($form->{"notes"}), $form->{"intnotes"}, $form->{"currency"}, conv_i($form->{"department_id"}), conv_i($form->{"payment_id"}), $form->{"taxincluded"} ? 't' : 'f', $form->{"type"}, conv_i($form->{"language_id"}), conv_i($form->{"taxzone_id"}), conv_i($form->{"shipto_id"}), conv_i($form->{"employee_id"}), conv_i($form->{"salesman_id"}), conv_i($form->{storno_id}), $form->{"storno"} ? 't' : 'f', diff --git a/SL/OE.pm b/SL/OE.pm index 870673a5c..061cd27a0 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -634,7 +634,7 @@ SQL conv_i($form->{vendor_id}), conv_i($form->{customer_id}), $amount, $netamount, conv_date($reqdate), $form->{taxincluded} ? 't' : 'f', $form->{shippingpoint}, - $form->{shipvia}, $form->{notes}, $form->{intnotes}, + $form->{shipvia}, $restricter->process($form->{notes}), $form->{intnotes}, $form->{currency}, $form->{closed} ? 't' : 'f', $form->{delivered} ? "t" : "f", $form->{proforma} ? 't' : 'f', $quotation, conv_i($form->{department_id}), diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 302832403..1acd6a0d3 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1351,6 +1351,7 @@ sub print_form { $form->{TEMPLATE_DRIVER_OPTIONS}->{variable_content_types} = { longdescription => 'html', partnotes => 'html', + notes => 'html', }; } diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 8e47d512a..4483deb1f 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -510,11 +510,9 @@ sub form_footer { $form->{invtotal} = $form->{invsubtotal}; - my $rows = max 2, $form->numtextrows($form->{notes}, 25, 8); - my $introws = max 2, $form->numtextrows($form->{intnotes}, 35, 8); - $rows = max $rows, $introws; + my $introws = max 5, $form->numtextrows($form->{intnotes}, 35, 8); - $TMPL_VAR{notes} = qq||; + $TMPL_VAR{notes} = qq||; $TMPL_VAR{intnotes} = qq||; if( $form->{customer_id} && !$form->{taxincluded_changed_by_user} ) { diff --git a/sql/Pg-upgrade2/oe_ar_ap_delivery_orders_edit_notes_as_html.pl b/sql/Pg-upgrade2/oe_ar_ap_delivery_orders_edit_notes_as_html.pl new file mode 100644 index 000000000..2be82f172 --- /dev/null +++ b/sql/Pg-upgrade2/oe_ar_ap_delivery_orders_edit_notes_as_html.pl @@ -0,0 +1,41 @@ +# @tag: oe_ar_ap_delivery_orders_edit_notes_as_html +# @description: Einkaufs- und Verkaufsbelege: Bemerkungsfeld in HTML umwandeln +# @depends: requirement_spec_edit_html +package SL::DBUpgrade2::oe_ar_ap_delivery_orders_edit_notes_as_html; + +use strict; +use utf8; + +use SL::DBUtils; + +use parent qw(SL::DBUpgrade2::Base); + +sub convert_column { + my ($self, $table, $column) = @_; + + my $sth = $self->dbh->prepare(qq|UPDATE $table SET $column = ? WHERE id = ?|) || $self->dberror; + + foreach my $row (selectall_hashref_query($::form, $self->dbh, qq|SELECT id, $column FROM $table WHERE $column IS NOT NULL|)) { + next if !$row->{$column} || (($row->{$column} =~ m{^<[a-z]+>}) && ($row->{$column} =~ m{$})); + + my $new_content = "" . $::request->presenter->escape($row->{$column}); + $new_content =~ s{\r}{}g; + $new_content =~ s{\n\n+}{

}g; + $new_content =~ s{\n}{
}g; + $new_content = "

${new_content}

" if $new_content; + + $sth->execute($new_content, $row->{id}) if $new_content ne $row->{$column}; + } + + $sth->finish; +} + +sub run { + my ($self) = @_; + + $self->convert_column($_, 'notes') for qw(oe delivery_orders ar ap); + + return 1; +} + +1; diff --git a/templates/webpages/do/form_footer.html b/templates/webpages/do/form_footer.html index 7f6c9bd6c..6c8e0c62e 100644 --- a/templates/webpages/do/form_footer.html +++ b/templates/webpages/do/form_footer.html @@ -1,5 +1,5 @@ [%- USE T8 %] -[% USE HTML %][% USE LxERP %][%- USE L -%] +[% USE HTML %][% USE LxERP %][%- USE L -%][%- USE P -%] [%- IF delivered %] [%- SET RO = ' readonly' %] [%- END %] @@ -13,7 +13,14 @@ - + + [% IF delivered %] + [% L.hidden_tag("notes", notes) %] +
[% P.restricted_html(notes) %]
+ [% ELSE %] + [% L.textarea_tag("notes", notes, wrap="soft", style="width: 350px; height: 150px", class="texteditor") %] + [% END %] + diff --git a/templates/webpages/ir/form_footer.html b/templates/webpages/ir/form_footer.html index 99767155d..08fb4cb80 100644 --- a/templates/webpages/ir/form_footer.html +++ b/templates/webpages/ir/form_footer.html @@ -15,7 +15,7 @@ - + [% L.textarea_tag("notes", notes, wrap="soft", style="width: 350px; height: 150px", class="texteditor") %] diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index bc69dfd80..e3775c83f 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -15,7 +15,7 @@ - + [% L.textarea_tag("notes", notes, wrap="soft", style="width: 350px; height: 150px", class="texteditor") %]