Merge branch 'master' of github.com:kivitendo/kivitendo-erp
authorJan Büren <jan@kivitendo-premium.de>
Wed, 15 Jan 2014 14:00:10 +0000 (15:00 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Wed, 15 Jan 2014 14:00:10 +0000 (15:00 +0100)
17 files changed:
SL/Template/Plugin/L.pm
bin/mozilla/common.pl
bin/mozilla/do.pl
bin/mozilla/io.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
js/common.js
js/kivi.SalesPurchase.js [new file with mode: 0644]
js/locale/de.js
locale/de/all
scripts/rose_auto_create_model.pl
templates/webpages/do/form_header.html
templates/webpages/generic/set_longdescription.html
templates/webpages/ir/form_header.html
templates/webpages/is/form_header.html
templates/webpages/oe/form_header.html

index 0c3fe74..2411416 100644 (file)
@@ -247,7 +247,7 @@ sub customer_picker {
   $::request->{layout}->add_javascripts('autocomplete_customer.js');
 
   $self->hidden_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'customer_autocomplete') .
-  $self->input_tag("$name_e\_name", (ref $value && $value->can('name')) ? $value->name : '', %params);
+  $self->input_tag('', (ref $value && $value->can('name')) ? $value->name : '', id => $self->name_to_id("$name_e\_name"), %params);
 }
 
 # simple version with select_tag
index abe3451..c51b13f 100644 (file)
@@ -343,21 +343,6 @@ sub calculate_qty {
 
 # -------------------------------------------------------------------------
 
-sub set_longdescription {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my $locale   = $main::locale;
-
-  $form->{title} = $locale->text("Enter longdescription");
-  $form->header(no_layout => 1);
-  print $form->parse_html_template("generic/set_longdescription");
-
-  $main::lxdebug->leave_sub();
-}
-
-# -------------------------------------------------------------------------
-
 sub H {
   return $main::locale->quote_special_chars('HTML', $_[0]);
 }
index 776a992..26985e2 100644 (file)
@@ -310,6 +310,8 @@ sub form_header {
 
   $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
+
   $form->header();
   # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
   # und Erweiterung für Bug 1760:
index 413a7f6..c584f32 100644 (file)
@@ -274,12 +274,12 @@ sub display_row {
     my $linetotal      = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2);
     my $rows            = $form->numtextrows($form->{"description_$i"}, 30, 6);
 
-    $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -size => 5,  -value => $i);    # HuT
-    $column_data{partnumber}    = $cgi->textfield(-name => "partnumber_$i",    -size => 12, -value => $form->{"partnumber_$i"});
+    $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -id => "runningnumber_$i", -size => 5,  -value => $i);    # HuT
+    $column_data{partnumber}    = $cgi->textfield(-name => "partnumber_$i",    -id => "partnumber_$i",    -size => 12, -value => $form->{"partnumber_$i"});
     $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead
-                                ? $cgi->textarea( -name => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30)
-                                : $cgi->textfield(-name => "description_$i",   -size => 30, -value => $form->{"description_$i"}))
-                                . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')");
+                                ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30)
+                                : $cgi->textfield(-name => "description_$i", -id => "description_$i",   -value => $form->{"description_$i"}, -size => 30))
+                                . $cgi->button(-value => $locale->text('L'), -onClick => "kivi.SalesPurchase.edit_longdescription($i)");
 
     my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2;
 
@@ -434,7 +434,7 @@ sub display_row {
     my @HIDDENS = map { value => $_}, (
           $cgi->hidden("-name" => "unit_old_$i", "-value" => $form->{"selected_unit_$i"}),
           $cgi->hidden("-name" => "price_new_$i", "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})),
-          map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" }
+          map { ($cgi->hidden("-name" => $_, "-id" => $_, "-value" => $form->{$_})); } map { $_."_$i" }
             (qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes
                 income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber
                 longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars)
index bad6e4f..2be2776 100644 (file)
@@ -331,6 +331,8 @@ sub form_header {
   ), @custom_hiddens,
   map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
+
   $form->header();
 
   print $form->parse_html_template("ir/form_header", \%TMPL_VAR);
index ffa7595..a1af7b1 100644 (file)
@@ -383,6 +383,8 @@ sub form_header {
   ), @custom_hiddens,
   map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
 
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
+
   $form->header();
 
   print $form->parse_html_template("is/form_header", \%TMPL_VAR);
index d4da314..8a8e6d4 100644 (file)
@@ -429,9 +429,7 @@ sub form_header {
     }
   }
 
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
-  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
+  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details));
 
   $form->header;
   if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) {
index 2bc9107..d961814 100644 (file)
@@ -33,17 +33,6 @@ function centerParms(width,height,extra) {
   return string;
 }
 
-function set_longdescription_window(input_name) {
-  var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
-  var name = document.getElementsByName(input_name)[0].value;
-  url = "common.pl?" +
-    "INPUT_ENCODING=UTF-8&" +
-    "action=set_longdescription&" +
-    "longdescription=" + encodeURIComponent(document.getElementsByName(input_name)[0].value) + "&" +
-    "input_name=" + encodeURIComponent(input_name) + "&"
-  window.open(url, "_new_generic", parm);
-  }
-
 function check_right_number_format(input_name) {
   if(decpoint && thpoint && thpoint == decpoint) {
     return show_alert_and_focus(input_name, wrongNumberFormat);
diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js
new file mode 100644 (file)
index 0000000..0331d84
--- /dev/null
@@ -0,0 +1,37 @@
+namespace('kivi.SalesPurchase', function(ns) {
+  this.edit_longdescription = function(row) {
+    var $edit    = $('#popup_edit_longdescription_input');
+    var $element = $('#longdescription_' + row);
+
+    if (!$element.length) {
+      console.error("kivi.SalesPurchase.edit_longdescription: Element #longdescription_" + row + " not found");
+      return;
+    }
+
+    $edit.data('element', $element);
+    $edit.val($element.val());
+
+    $('#popup_edit_longdescription_runningnumber').html(row);
+    $('#popup_edit_longdescription_partnumber').html($('#partnumber_' + row).val() || '');
+
+    var description = ($('#description_' + row).val() || '').replace(/[\n\r]+/, '');
+    if (description.length >= 50)
+      description = description.substring(0, 50) + "…";
+    $('#popup_edit_longdescription_description').html(description);
+
+    kivi.popup_dialog({
+      id:    'edit_longdescription_dialog',
+      dialog: {
+        title: kivi.t8('Enter longdescription')
+      }
+    });
+  };
+
+  this.set_longdescription = function() {
+    var $edit    = $('#popup_edit_longdescription_input');
+    var $element = $edit.data('element');
+
+    $element.val($edit.val());
+    $('#edit_longdescription_dialog').dialog('close');
+  };
+});
index 969a162..3fbe538 100644 (file)
@@ -3,6 +3,7 @@ namespace("kivi").setupLocale({
 "Are you sure?":"Sind Sie sicher?",
 "Database Connection Test":"Test der Datenbankverbindung",
 "Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?",
+"Enter longdescription":"Langtext eingeben",
 "Map":"Karte",
 "Part picker":"Artikelauswahl",
 "The description is missing.":"Die Beschreibung fehlt.",
index 4c83a36..14151a6 100755 (executable)
@@ -1589,7 +1589,6 @@ $self->{texts} = {
   'Please enter the taxnumber in the client configuration.' => 'Bitte geben Sie in der Mandantenkonfiguration die Steuernummer an.',
   'Please enter values'         => 'Bitte Werte eingeben',
   'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein',
-  'Please insert your longdescription below' => 'Bitte den Langtext eingeben',
   'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgef&uuml;hrten Module, oder bitten Sie Ihren Administrator darum.',
   'Please log in to the administration panel.' => 'Bitte melden Sie sich im Administrationsbereich an.',
   'Please re-run the analysis for broken general ledger entries by clicking this button:' => 'Bitte wiederholen Sie die Analyse der Hauptbucheinträge, indem Sie auf diesen Button klicken:',
@@ -1777,6 +1776,7 @@ $self->{texts} = {
   'Revenues EU without UStId'   => 'Erl&ouml;se EU o. UStId',
   'Review of Aging list'        => 'Altersstrukturliste',
   'Right'                       => 'Rechts',
+  'Row'                         => 'Zeile',
   'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.',
   'Row number'                  => 'Zeilennummer',
   'Row was created from current record' => 'Zeile wurde aus aktuellem Beleg erstellt',
index bb246f8..de7df3b 100755 (executable)
@@ -332,20 +332,20 @@ rose_auto_create_model - mana Rose::DB::Object classes for kivitendo
 
 =head1 SYNOPSIS
 
-  scripts/rose_create_model.pl --client name-or-id table1 [table2 ...]
-  scripts/rose_create_model.pl --client name-or-id [--all|-a]
+  scripts/rose_auto_create_model.pl --client name-or-id table1 [table2 ...]
+  scripts/rose_auto_create_model.pl --client name-or-id [--all|-a]
 
   # updates all models
-  scripts/rose_create_model.pl --client name-or-id --all
+  scripts/rose_auto_create_model.pl --client name-or-id --all
 
   # updates only customer table, login taken from config
-  scripts/rose_create_model.pl customer
+  scripts/rose_auto_create_model.pl customer
 
   # updates only parts table, package will be Part
-  scripts/rose_create_model.pl parts=Part
+  scripts/rose_auto_create_model.pl parts=Part
 
   # try to update parts, but don't do it. tell what would happen in detail
-  scripts/rose_create_model.pl --no-commit parts
+  scripts/rose_auto_create_model.pl --no-commit parts
 
 =head1 DESCRIPTION
 
index 5454d4d..2961b5c 100644 (file)
@@ -38,6 +38,7 @@
  <div class="listtop">[% title %]</div>
 
 [%- INCLUDE 'common/flash.html' %]
+[%- INCLUDE 'generic/set_longdescription.html' %]
 
  [%- IF ERRORS && ERRORS.size %]
  <p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
index 1b4b9d0..f7855f3 100644 (file)
@@ -1,25 +1,29 @@
-[%- USE T8 %]
-[%- USE HTML %]
- <form name="Form">
-
-  <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
-
-  <div class="listtop">[% title %]</div>
-
-  <p>[% 'Please insert your longdescription below' | $T8 %]</p>
-
-  <p><textarea id="longdescription" name="longdescription" rows="15" cols="45" wrap="soft">[% HTML.escape(longdescription) %]</textarea></p>
-
-  <p><input type="submit" onclick="longdescription_updated()" value="[% 'Close' | $T8 %]"></p>
- </form>
-
- <script type="text/javascript">
-  <!--
-      function longdescription_updated() {
-        window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = document.getElementsByName("longdescription")[0].value;
-
-        self.close();
-      }
-    -->
- </script>
-
+[%- USE L -%][%- USE LxERP -%]
+
+<div id="edit_longdescription_dialog" style="display: none">
+ <p>
+  <table>
+   <tr>
+    <th align="right">[% LxERP.t8("Row") %]:</th>
+    <td id="popup_edit_longdescription_runningnumber"></td>
+   </tr>
+
+   <tr>
+    <th align="right">[% LxERP.t8("Part Number") %]:</th>
+    <td id="popup_edit_longdescription_partnumber"></td>
+   </tr>
+
+   <tr>
+    <th align="right">[% LxERP.t8("Description") %]:</th>
+    <td id="popup_edit_longdescription_description"></td>
+   </tr>
+  </table>
+ </p>
+
+ <p>[% L.textarea_tag("popup_edit_longdescription_input", "", wrap="soft", style="width: 750px; height: 240px;") %]</p>
+
+ <p>
+  [% L.button_tag("kivi.SalesPurchase.set_longdescription()", LxERP.t8("Close")) %]
+  <a onclick="$('#edit_longdescription_dialog').dialog('close');" href="#">[% LxERP.t8("Abort") %]</a>
+ </p>
+</div>
index 66b7c0d..c42139e 100644 (file)
@@ -24,6 +24,7 @@
 <p><div class="listtop" width="100%">[% title %]</div></p>
 
 [%- INCLUDE 'common/flash.html' %]
+[%- INCLUDE 'generic/set_longdescription.html' %]
 
 <div class="tabwidget">
  <ul>
index f0184be..8c5c9f8 100644 (file)
@@ -25,6 +25,7 @@
 <p>[% saved_message %]</p>
 
 [%- PROCESS 'common/flash.html' %]
+[%- INCLUDE 'generic/set_longdescription.html' %]
 
 <div class="tabwidget">
  <ul>
index 5025d74..5d4afdc 100644 (file)
@@ -28,6 +28,7 @@
     <h1>[% title %]</h1>
 
 [%- INCLUDE 'common/flash.html' %]
+[%- INCLUDE 'generic/set_longdescription.html' %]
 
     <div class="tabwidget">
      <ul>