]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/DB/Helper/Paginated.pm
Paginating Helper: Funktion um paginating nachträglich zu deaktivieren
[kivitendo-erp.git] / SL / DB / Helper / Paginated.pm
index e170ad383b8e07cbc217f5d81cf85e73a60c62df..a24d4d7e065d14f7babcc30f1b0d9b0dfc8f611c 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 
 require Exporter;
 our @ISA    = qw(Exporter);
-our @EXPORT = qw(paginate);
+our @EXPORT = qw(paginate disable_paginating);
 
 use List::MoreUtils qw(any);
 
@@ -59,9 +59,16 @@ sub make_common_pages {
 sub calc_visibility {
   my ($cur, $max, $this) = @_;
   any { $_ } abs($cur - $this) < 5,
-             $cur <= 3,
-             $cur == $max,
-             any { ! abs ($cur - $this) % $_ } 10, 50, 100, 500, 1000, 5000;
+             $this <= 3,
+             $this == $max,
+             any { abs ($cur - $this) == $_ } 10, 50, 100, 500, 1000, 5000;
+}
+
+sub disable_paginating {
+  my ($self, %params) = @_;
+
+  delete $params{args}{page};
+  delete $params{args}{per_page};
 }
 
 1;