Verkaufs-/Einkaufsmasken: HTML in Langtexten nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 15 Jan 2014 12:33:59 +0000 (13:33 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:12:25 +0000 (13:12 +0200)
SL/DO.pm
SL/IR.pm
SL/IS.pm
SL/OE.pm
bin/mozilla/do.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
js/kivi.SalesPurchase.js
js/kivi.js
templates/webpages/generic/set_longdescription.html

index a0087de..1da5a8e 100644 (file)
--- 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"}),
index e5e02f5..301fe3b 100644 (file)
--- 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"},
index c5fd882..5a64845 100644 (file)
--- 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"}),
index 13e735a..547985c 100644 (file)
--- 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"}),
index 06b8f65..67f2740 100644 (file)
@@ -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'
index 2666efd..e90b12c 100644 (file)
@@ -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();
 
index a83897a..3795448 100644 (file)
@@ -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();
 
index a2d7175..0dabe9e 100644 (file)
@@ -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} ) {
index 0331d84..a390c87 100644 (file)
@@ -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'); }
       }
     });
   };
index 469d889..17c0ab0 100644 (file)
@@ -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;
     }
 
index f7855f3..4612225 100644 (file)
@@ -20,7 +20,7 @@
   </table>
  </p>
 
- <p>[% L.textarea_tag("popup_edit_longdescription_input", "", wrap="soft", style="width: 750px; height: 240px;") %]</p>
+ <p>[% L.textarea_tag("popup_edit_longdescription_input", "", class="texteditor-in-dialog" wrap="soft", style="width: 750px; height: 220px;") %]</p>
 
  <p>
   [% L.button_tag("kivi.SalesPurchase.set_longdescription()", LxERP.t8("Close")) %]