From: Moritz Bunkus Date: Wed, 15 Jan 2014 12:33:59 +0000 (+0100) Subject: Verkaufs-/Einkaufsmasken: HTML in Langtexten nutzen X-Git-Tag: release-3.2.0beta~467^2~45 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5f6d6d4eaca3a3d238c678ef3f2a1fe676c3a77a;p=kivitendo-erp.git Verkaufs-/Einkaufsmasken: HTML in Langtexten nutzen --- diff --git a/SL/DO.pm b/SL/DO.pm index a0087dee0..1da5a8e2d 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -42,6 +42,7 @@ use SL::CVar; use SL::DB::DeliveryOrder; use SL::DB::Status; use SL::DBUtils; +use SL::HTML::Restrict; use SL::RecordLinks; use SL::IC; use SL::TransNumber; @@ -216,6 +217,7 @@ sub save { # connect to database, turn off autocommit my $dbh = $form->get_standard_dbh($myconfig); + my $restricter = SL::HTML::Restrict->create; my ($query, @values, $sth, $null); @@ -323,7 +325,7 @@ sub save { # save detail record in delivery_order_items table @values = (conv_i($item_id), conv_i($form->{id}), conv_i($form->{"id_$i"}), - $form->{"description_$i"}, $form->{"longdescription_$i"}, + $form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), $form->{"qty_$i"}, $baseqty, $form->{"sellprice_$i"}, $form->{"discount_$i"} / 100, $form->{"unit_$i"}, conv_date($items_reqdate), conv_i($form->{"project_id_$i"}), diff --git a/SL/IR.pm b/SL/IR.pm index e5e02f5be..301fe3b64 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -42,6 +42,7 @@ use SL::DATEV qw(:CONSTANTS); use SL::DBUtils; use SL::DO; use SL::GenericTranslations; +use SL::HTML::Restrict; use SL::IO; use SL::MoreCommon; use SL::DB::Default; @@ -56,6 +57,8 @@ sub post_invoice { # connect to database, turn off autocommit my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); + my $restricter = SL::HTML::Restrict->create; + $form->{defaultcurrency} = $form->get_default_currency($myconfig); my $defaultcurrency = $form->{defaultcurrency}; @@ -378,7 +381,7 @@ sub post_invoice { project_id, serialnumber, price_factor_id, price_factor, marge_price_factor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT factor FROM price_factors WHERE id = ?), ?)|; @values = ($invoice_id, conv_i($form->{id}), conv_i($form->{"id_$i"}), - $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"} * -1, + $form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), $form->{"qty_$i"} * -1, $baseqty * -1, $form->{"sellprice_$i"}, $fxsellprice, $form->{"discount_$i"}, $allocated, $form->{"unit_$i"}, conv_date($form->{deliverydate}), conv_i($form->{"project_id_$i"}), $form->{"serialnumber_$i"}, diff --git a/SL/IS.pm b/SL/IS.pm index c5fd8821f..5a6484505 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -44,6 +44,7 @@ use SL::DATEV qw(:CONSTANTS); use SL::DBUtils; use SL::DO; use SL::GenericTranslations; +use SL::HTML::Restrict; use SL::MoreCommon; use SL::IC; use SL::IO; @@ -546,6 +547,7 @@ sub post_invoice { # connect to database, turn off autocommit my $dbh = $provided_dbh ? $provided_dbh : $form->get_standard_dbh; + my $restricter = SL::HTML::Restrict->create; my ($query, $sth, $null, $project_id, @values); my $exchangerate = 0; @@ -749,7 +751,7 @@ sub post_invoice { (SELECT factor FROM price_factors WHERE id = ?), ?)|; @values = ($invoice_id, conv_i($form->{id}), conv_i($form->{"id_$i"}), - $form->{"description_$i"}, $form->{"longdescription_$i"}, $form->{"qty_$i"}, + $form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), $form->{"qty_$i"}, $form->{"sellprice_$i"}, $fxsellprice, $form->{"discount_$i"}, $allocated, 'f', $form->{"unit_$i"}, conv_date($form->{"reqdate_$i"}), conv_i($form->{"project_id_$i"}), diff --git a/SL/OE.pm b/SL/OE.pm index 13e735a38..547985cf7 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -45,6 +45,7 @@ use SL::DB::PeriodicInvoicesConfig; use SL::DB::Status; use SL::DB::Tax; use SL::DBUtils; +use SL::HTML::Restrict; use SL::IC; use SL::TransNumber; @@ -330,6 +331,7 @@ sub save { # connect to database, turn off autocommit my $dbh = $form->get_standard_dbh; + my $restricter = SL::HTML::Restrict->create; my ($query, @values, $sth, $null); my $exchangerate = 0; @@ -500,7 +502,7 @@ sub save { (SELECT factor FROM price_factors WHERE id = ?), ?)|; push(@values, conv_i($orderitems_id), conv_i($form->{id}), conv_i($form->{"id_$i"}), - $form->{"description_$i"}, $form->{"longdescription_$i"}, + $form->{"description_$i"}, $restricter->process($form->{"longdescription_$i"}), $form->{"qty_$i"}, $baseqty, $fxsellprice, $form->{"discount_$i"}, $form->{"unit_$i"}, conv_date($reqdate), conv_i($form->{"project_id_$i"}), diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 06b8f6552..67f2740c5 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -310,7 +310,7 @@ sub form_header { $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')'; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header(); # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID' diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 2666efd34..e90b12cf6 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -331,7 +331,7 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header(); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index a83897a45..379544809 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -383,7 +383,7 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header(); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index a2d7175bc..0dabe9ec1 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -429,7 +429,7 @@ sub form_header { } } - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header; if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) { diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 0331d8408..a390c8721 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -22,7 +22,8 @@ namespace('kivi.SalesPurchase', function(ns) { kivi.popup_dialog({ id: 'edit_longdescription_dialog', dialog: { - title: kivi.t8('Enter longdescription') + title: kivi.t8('Enter longdescription'), + open: function() { kivi.set_focus('#popup_edit_longdescription_input'); } } }); }; diff --git a/js/kivi.js b/js/kivi.js index 469d889d3..17c0ab056 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -190,7 +190,12 @@ namespace("kivi", function(ns) { if (!params.url) { // Use existing DOM element and show it. No AJAX call. - dialog = $('#' + id).dialog(dialog_params); + dialog = + $('#' + id) + .bind('dialogopen', function() { + ns.run_once_for('.texteditor-in-dialog,.texteditor-dialog', 'texteditor', kivi.init_text_editor); + }) + .dialog(dialog_params); return true; } diff --git a/templates/webpages/generic/set_longdescription.html b/templates/webpages/generic/set_longdescription.html index f7855f341..461222541 100644 --- a/templates/webpages/generic/set_longdescription.html +++ b/templates/webpages/generic/set_longdescription.html @@ -20,7 +20,7 @@

-

[% L.textarea_tag("popup_edit_longdescription_input", "", wrap="soft", style="width: 750px; height: 240px;") %]

+

[% L.textarea_tag("popup_edit_longdescription_input", "", class="texteditor-in-dialog" wrap="soft", style="width: 750px; height: 220px;") %]

[% L.button_tag("kivi.SalesPurchase.set_longdescription()", LxERP.t8("Close")) %]