]> wagnertech.de Git - kivitendo-erp.git/commitdiff
history_erp : Unterscheidung von id und glid
authorG. Richardson <information@kivitendo-premium.de>
Tue, 3 Feb 2015 07:34:39 +0000 (08:34 +0100)
committerG. Richardson <information@kivitendo-premium.de>
Wed, 4 Feb 2015 15:59:59 +0000 (16:59 +0100)
behebt #2493

Es gibt in der Datenbank zwei Sequenzen, mit der die ids von
Datenbankeinträgen gespeichert werden, und die die Historiensuche
betreffen:
 glid: ar,ap,gl
 id:   delivery_orders parts oe customer vendor

In der history_erp gibt es allerdings nur eine Datenbankspalte für
trans_id, wo sowohl ids als auch glids gespeichert werden.
(Wahrscheinlich wurde glid irgendwann mal neu eingeführt, damit man bei
den Buchungen einen durchgängigen Buchungsnummernkreis hat, ohne dies
für die Historie zu berücksichtigen.)

Da das Historienfenster nur eine id als Parameter übergibt kann es also
vorkommen, daß z.B. in einer Artikelhistorie eine Eintrag aus einer
Buchungshistorie erscheint, wenn es eine Buchungs-glid gibt, die gleich
der Artikel-id ist.

Mit diesem Patch wird nun schon im Template festgelegt, ob es sich bei
der Historie um eine Buchung (trans_id_type = glid) oder nicht
(trans_id_type = id) handelt, und die Datenbankabfrage entsprechend
modifiziert. Dies sollte nur die Historie von einzelnen Seiten betreffen
(z.B. Artikel, Kunde, Verkaufsrechnung), nicht die Historiensuchmaschine
unter dem Menüpunkt "System".

Die Modifizierung des SQL-Statements ist allerdings noch recht unschön,
da diese eventuell angepasst werden muß, wenn sich etwas an der
Beschreibung der history_erp Zeilen ändert (wie beispielsweise in Commit
01b4e844b89 ).

Wenn die Historie mal überarbeitet wird sollte besser direkt schon
gespeichert werden, ob es sich um eine Buchung oder nicht handelt, bzw.
den Typ des Objekts, um das es gerade geht.
Und dann wäre es auch noch schön, die Historie in einen Tab zu
verlagern, statt eines Knopfs im Workflow.

bin/mozilla/common.pl
js/show_history.js
templates/webpages/ap/form_footer.html
templates/webpages/ar/form_footer.html
templates/webpages/do/form_footer.html
templates/webpages/ic/form_footer.html
templates/webpages/ir/form_footer.html
templates/webpages/is/form_footer.html
templates/webpages/oe/form_footer.html
templates/webpages/pe/partsgroup_form.html
templates/webpages/pe/pricegroup_form.html

index c51b13f7ab8dd3ebc4952f1fbb3002d0075ba555..9756f92160da45ddac71718e25ebf5b9fad1ee59 100644 (file)
@@ -385,8 +385,18 @@ sub show_history {
 
   $form->{title} = $locale->text("History");
   $form->header(no_layout => 1);
 
   $form->{title} = $locale->text("History");
   $form->header(no_layout => 1);
+
+  my $restriction;
+  if ( $form->{trans_id_type} eq 'glid' ) {
+    $restriction = "AND ( snumbers LIKE 'invnumber%' OR what_done LIKE '%Buchungsnummer%' OR snumbers LIKE 'gltransaction%' ) ";
+  } elsif ( $form->{trans_id_type} eq 'id' ) {
+    $restriction = " AND ( snumbers NOT LIKE 'invnumber_%' AND snumbers NOT LIKE 'gltransaction%' AND (what_done NOT LIKE '%Buchungsnummer%' OR what_done IS null))";
+  } else {
+    $restriction = '';
+  };
+
   print $form->parse_html_template( "common/show_history", {
   print $form->parse_html_template( "common/show_history", {
-    "DATEN"        => $form->get_history($dbh,$form->{input_name},"",$form->{order}),
+    "DATEN"        => $form->get_history($dbh,$form->{input_name},$restriction,$form->{order}),
     "SUCCESS"      => ($form->get_history($dbh,$form->{input_name}) ne "0"),
     uc($sort)      => 1,
     uc($sort)."BY" => $sortby,
     "SUCCESS"      => ($form->get_history($dbh,$form->{input_name}) ne "0"),
     uc($sort)      => 1,
     uc($sort)."BY" => $sortby,
index e0cfec45e61dcc6ae9296a2e812c1f1d947d17a3..6985c69415066ea9cf3bd8a06c62cd04cd172000 100644 (file)
@@ -10,13 +10,14 @@ function centerParms(width,height,extra) {
   return string;
 }
 
   return string;
 }
 
-function set_history_window(id) {
+function set_history_window(id,trans_id_type) {
   var parm = centerParms(800,500) + ",width=800,height=500,status=yes,scrollbars=yes";
   var name = "History";
   url = "common.pl?" +
     "INPUT_ENCODING=UTF-8&" +
     "action=show_history&" +
     "longdescription=" + "&" +
   var parm = centerParms(800,500) + ",width=800,height=500,status=yes,scrollbars=yes";
   var name = "History";
   url = "common.pl?" +
     "INPUT_ENCODING=UTF-8&" +
     "action=show_history&" +
     "longdescription=" + "&" +
+    "trans_id_type=" + encodeURIComponent(trans_id_type) + "&" +
     "input_name=" + encodeURIComponent(id) + "&"
   window.open(url, "_new_generic", parm);
 }
     "input_name=" + encodeURIComponent(id) + "&"
   window.open(url, "_new_generic", parm);
 }
index 33635031510249d8e59b9969fb771ccf0d54e6dc..d98e2839380dcf914a8ab55145811fda9e1d5c84 100644 (file)
@@ -41,7 +41,7 @@
 [%- END %]
 
 [%- IF id %]
 [%- END %]
 
 [%- IF id %]
-  <input type=button class=submit onclick="set_history_window([% id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+  <input type=button class=submit onclick="set_history_window([% id %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
   [% IF INSTANCE_CONF.get_ap_show_mark_as_paid %]
     <input type="submit" name="action" value="[% 'mark as paid' | $T8 %]">
   [% END %]
   [% IF INSTANCE_CONF.get_ap_show_mark_as_paid %]
     <input type="submit" name="action" value="[% 'mark as paid' | $T8 %]">
   [% END %]
index 6fa8b4441d6ff50f547deaa626386915b1e9393f..9927cc8529bfaacd2c1942a06238c520b4173da2 100644 (file)
@@ -37,7 +37,7 @@
 
     <input class="submit" type="submit" name="action" value="[% 'Post Payment' | $T8 %]">
     <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
 
     <input class="submit" type="submit" name="action" value="[% 'Post Payment' | $T8 %]">
     <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
-    <input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+    <input type="button" class="submit" onclick="set_history_window([% id %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
   [% ELSE %]
     [% IF ( !is_closed ) %]
       <input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
   [% ELSE %]
     [% IF ( !is_closed ) %]
       <input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
index e15b4409937ca2079583a7d0d70bafbb1d1f33ce..7f6c9bd6c0015dc1547820e9a5cd8e965c7a4627 100644 (file)
@@ -89,7 +89,7 @@
    [%- UNLESS closed %]
    <input class="submit" type="submit" name="action_mark_closed" value="[% 'Mark closed' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
    [%- END %]
    [%- UNLESS closed %]
    <input class="submit" type="submit" name="action_mark_closed" value="[% 'Mark closed' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
    [%- END %]
-   <input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+   <input type="button" class="submit" onclick="set_history_window([% id %], 'id');" name="history" id="history" value="[% 'history' | $T8 %]">
    [%- END %]
   </p>
 
    [%- END %]
   </p>
 
index 32c19a7ac1f26cf0ba28af2faec364ba98298124..0cdd026ffd427416924b65ae84f4242a2af90827 100644 (file)
@@ -93,7 +93,7 @@
 [%- END %]
 
   [%- IF id != "" %]
 [%- END %]
 
   [%- IF id != "" %]
-<input type="button" class="submit" onclick="set_history_window([% id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+<input type="button" class="submit" onclick="set_history_window([% id %], 'id');" name="history" id="history" value="[% 'history' | $T8 %]">
   [%- END %]
 
 </form>
   [%- END %]
 
 </form>
index ad241a17a1c332e49356e34e938205b512577b06..99767155d8ae40dc9e76e2c381b43b0293c877b9 100644 (file)
 
   [% IF id %]
       [%#- button for saving history %]
 
   [% IF id %]
       [%#- button for saving history %]
-      <input type="button" class="submit" onclick="set_history_window([% id | html %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+      <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
 
       [% IF INSTANCE_CONF.get_ir_show_mark_as_paid %]
           <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
 
       [% IF INSTANCE_CONF.get_ir_show_mark_as_paid %]
           <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
index d3c8ccf3a58c864683c70f05ef0365de8818897a..bc69dfd80612791a1fb8b8f6a10061c0129fbb6d 100644 (file)
 
   [% IF id %]
       [%#- button for saving history %]
 
   [% IF id %]
       [%#- button for saving history %]
-      <input type="button" class="submit" onclick="set_history_window([% id | html %]);" name="history" id="history" value="[% 'history' | $T8 %]">
+      <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
       [% IF INSTANCE_CONF.get_is_show_mark_as_paid %]
           <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
       [% END %]
       [% IF INSTANCE_CONF.get_is_show_mark_as_paid %]
           <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
       [% END %]
index 8a8dd0845cf0339f7905e20d59e5d45ee4637cac..9f0b6db3ab25274f90f74b5bcc15f9aa946e5732 100644 (file)
 
 [%- IF id %]
   <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
 
 [%- IF id %]
   <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
-  <input type="button" class="submit" onclick="set_history_window([% HTML.escape(id) %])" name="history" id="history" value="[% 'history' | $T8 %]">
+  <input type="button" class="submit" onclick="set_history_window([% HTML.escape(id) %], 'id')" name="history" id="history" value="[% 'history' | $T8 %]">
 
   <br>[% label_workflow %]<br>
   <input class="submit" type="submit" name="action_save_as_new" value="[% 'Save as new' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
 
   <br>[% label_workflow %]<br>
   <input class="submit" type="submit" name="action_save_as_new" value="[% 'Save as new' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
index 81fea2b98c3dc77779d38e569b88e97f8276fcd9..632cd7afaf903b862cac080ce294cdd3d0a9e10a 100644 (file)
@@ -34,7 +34,7 @@
 [%- END %]
 
 [%- IF ( id ) %]
 [%- END %]
 
 [%- IF ( id ) %]
-  <input type=button onclick="set_history_window([% id %]);" name=history id=history value="[% 'history' | $T8 %]">
+  <input type=button onclick="set_history_window([% id %], 'id');" name=history id=history value="[% 'history' | $T8 %]">
 [%- END %]
 
 </form>
 [%- END %]
 
 </form>
index 328c45a67cbd3fa628e0e66b7a7fc9073fba06c7..850275fbf1c32766f96e8e94e02fb711196dc7c3 100644 (file)
@@ -34,7 +34,7 @@
 [%- END %]
 
 [%- IF ( id ) %]
 [%- END %]
 
 [%- IF ( id ) %]
-  <input type=button onclick="set_history_window([% id %]);" name=history id=history value="[% 'history' | $T8 %]">
+  <input type=button onclick="set_history_window([% id %], 'id');" name=history id=history value="[% 'history' | $T8 %]">
 [%- END %]
 
 </form>
 [%- END %]
 
 </form>