Anpassung der Historienfunktion
[kivitendo-erp.git] / bin / mozilla / pe.pl
index d95a7ee..54eba99 100644 (file)
@@ -50,15 +50,17 @@ sub add {
     "$form->{script}?action=add&type=$form->{type}&path=$form->{path}&login=$form->{login}&password=$form->{password}"
     unless $form->{callback};
 
-  &{"form_$form->{type}_header"};
-  &{"form_$form->{type}_footer"};
+  call_sub("form_$form->{type}_header");
+  call_sub("form_$form->{type}_footer");
 
   $lxdebug->leave_sub();
 }
 
 sub edit {
   $lxdebug->enter_sub();
-
+  # show history button
+  $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
+  #/show hhistory button
   $form->{title} = "Edit";
 
   if ($form->{type} eq 'project') {
@@ -70,8 +72,8 @@ sub edit {
   if ($form->{type} eq 'pricegroup') {
     PE->get_pricegroup(\%myconfig, \%$form);
   }
-  &{"form_$form->{type}_header"};
-  &{"form_$form->{type}_footer"};
+  call_sub("form_$form->{type}_header");
+  call_sub("form_$form->{type}_footer");
 
   $lxdebug->leave_sub();
 }
@@ -425,6 +427,14 @@ sub form_project_footer {
       . $locale->text('Delete') . qq|">|;
   }
 
+# button for saving history
+print qq|
+       <input type=button onclick=set_history_window(|
+       . $form->{id} 
+       . qq|); name=history id=history value=|
+       . $locale->text('history') 
+       . qq|>|;
+# /button for saving history
   print qq|
 </form>
 
@@ -455,6 +465,13 @@ sub save {
     PE->save_pricegroup(\%myconfig, \%$form);
     $form->redirect($locale->text('Pricegroup saved!'));
   }
+  # saving the history
+  if(!exists $form->{addition} && $form->{id} ne "") {
+    $form->{snumber} = qq|projectnumber_| . $form->{projectnumber};
+       $form->{addition} = "SAVED";
+       $form->save_history($form->dbconnect(\%myconfig));
+  }
+  # /saving the history 
 
   $lxdebug->leave_sub();
 }
@@ -473,11 +490,17 @@ sub delete {
   if ($form->{type} eq 'pricegroup') {
     $form->redirect($locale->text('Pricegroup deleted!'));
   }
-
+  # saving the history
+  if(!exists $form->{addition}) {
+    $form->{snumber} = qq|projectnumber_| . $form->{projectnumber};
+       $form->{addition} = "DELETED";
+       $form->save_history($form->dbconnect(\%myconfig));
+  }
+  # /saving the history
   $lxdebug->leave_sub();
 }
 
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
 
 sub partsgroup_report {
   $lxdebug->enter_sub();
@@ -653,6 +676,14 @@ sub form_partsgroup_footer {
       . $locale->text('Delete') . qq|">|;
   }
 
+# button for saving history
+print qq|
+       <input type=button onclick=set_history_window(|
+       . $form->{id} 
+       . qq|); name=history id=history value=|
+       . $locale->text('history') 
+       . qq|>|;
+# /button for saving history
   print qq|
 </form>
 
@@ -847,6 +878,14 @@ sub form_pricegroup_footer {
       . $locale->text('Delete') . qq|">|;
   }
 
+# button for saving history
+print qq|
+       <input type=button onclick=set_history_window(|
+       . $form->{id} 
+       . qq|); name=history id=history value=|
+       . $locale->text('history') 
+       . qq|>|;
+# /button for saving history
   print qq|
 </form>