From 82985b5fe151f6a30b4a98d75cebf4e58eb75977 Mon Sep 17 00:00:00 2001 From: Rene Vergara A Date: Fri, 23 Dec 2022 17:14:03 -0500 Subject: [PATCH] Fix error caclulating total number of pages --- admin/class-submenu-page.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/class-submenu-page.php b/admin/class-submenu-page.php index 4ab6d62..26ade54 100644 --- a/admin/class-submenu-page.php +++ b/admin/class-submenu-page.php @@ -23,6 +23,7 @@ class Submenu_Page { public $_path; function __construct( $path ) { + global $wpdb; $this->_path = $path; $this->console_log('$_path -> '. $this->_path); @@ -39,7 +40,7 @@ class Submenu_Page { 'pg_limit integer not null default 0,' . 'pg_dt datetime default current_timestamp, '. 'unique lstix (pg_ix) );'; - $GLOBALS['wpdb']->query($sql); + $wpdb->query($sql); if ( ! $this->pmtLstRdy() ) { // @@ -58,7 +59,7 @@ class Submenu_Page { $this->_npages . ',' . $this->_offset . ',' . $this->_limit .')'; - $GLOBALS['wpdb']->query($sql); + $wpdb->query($sql); } else { // Load last state $params = $this->pmtLstParams(); @@ -70,12 +71,12 @@ class Submenu_Page { // // Calc new number of pages // - $this->_npages = intdiv($this->_npages,$this->_limit); + $this->_npages = intdiv($this->_nrows,$this->_limit); if ( $this->_nrows > ($this->_npages*$this->_limit) ) { $this->_npages++; } $sql = 'update zgo_pmtlst set pg_npages=' . $this->_npages . ' where pg_ix=1'; - $GLOBALS['wpdb']->query($sql); + $wpdb->query($sql); } } } @@ -116,7 +117,6 @@ class Submenu_Page { } public function render() { - global $wpdb; $currentDate = date('Y-m-d H:i:s');