Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorMoritz Bunkus <moritz@bunkus.org>
Mon, 9 Jan 2012 17:28:51 +0000 (18:28 +0100)
committerMoritz Bunkus <moritz@bunkus.org>
Mon, 9 Jan 2012 17:28:51 +0000 (18:28 +0100)
bin/mozilla/dn.pl
js/checkbox_utils.js [deleted file]
templates/webpages/dunning/show_invoices.html

index 132286f..6c3492b 100644 (file)
@@ -368,7 +368,7 @@ sub show_dunning {
                                duedate amount dunning_date dunning_duedate fee interest salesman));
   $report->set_sort_indicator($form->{sort}, $form->{sortdir});
 
-  my $edit_url  = build_std_url('script=is.pl', 'action=edit', 'callback') . '&id=';
+  my $edit_url  = sub { build_std_url('script=' . ($_[0]->{invoice} ? 'is' : 'ar') . '.pl', 'action=edit', 'callback') . '&id=' . $::form->escape($_[0]->{id}) };
   my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
   my $sort_url  = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list);
 
@@ -403,8 +403,9 @@ sub show_dunning {
 
         'align' => $alignment{$column},
 
-        'link'  => ($column eq 'invnumber'           ? $edit_url  . E($ref->{id})         :
-                    $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id}) : ''),
+        'link'  => (  $column eq 'invnumber'           ? $edit_url->($ref)
+                    : $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id})
+                    :                                    ''),
       };
     }
 
diff --git a/js/checkbox_utils.js b/js/checkbox_utils.js
deleted file mode 100644 (file)
index b5d4e61..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-function checkbox_check_all(cb_name, prefix, start, end) {
-  var i;
-
-  var control = document.getElementsByName(cb_name)[0];
-  if (!control)
-    return;
-
-  var checked = control.checked;
-
-  for (i = start; i <= end; i++) {
-    control = document.getElementsByName(prefix + i)[0];
-    if (control)
-      control.checked = checked;
-  }
-}
index db6b1ad..cd8c434 100644 (file)
@@ -1,6 +1,10 @@
 [%- USE T8 %]
-[% USE HTML %]<body>
- <script type="text/javascript" src="js/checkbox_utils.js"></script>
+[% USE HTML %]
+[% USE L %]
+[% L.javascript_tag('jquery.checkall') %]
+[% SET all_active = 1 %][% FOREACH row = DUNNINGS %][% IF !row.active %][% SET all_active = 0 %][% LAST %][% END %][% END %]
+[% SET all_email = 1 %][% FOREACH row = DUNNINGS %][% IF !row.email %][% SET all_email = 0 %][% LAST %][% END %][% END %]
+<body>
  <script type="text/javascript" src="js/common.js"></script>
  <script type="text/javascript" src="js/dunning.js"></script>
 
    <th class="listheading" colspan="2">[% 'Current / Next Level' | $T8 %]</th>
 
    <th class="listheading">
-    <input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, [% rowcount %]);">
+    [% L.checkbox_tag('selectall_active', checkall='INPUT[name*=active_]', checked=all_active) %]
     <label for="selectall_active">[% 'Active?' | $T8 %]</label>
    </th>
 
    <th class="listheading">
-    <input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, [% rowcount %]);">
+    [% L.checkbox_tag('selectall_email', checkall='INPUT[name*=email_]', checked=all_email) %]
     <label for="selectall_email">[% 'eMail?' | $T8 %]</label>
    </th>