Fix error caclulating total number of pages

This commit is contained in:
Rene V. Vergara A. 2022-12-23 17:14:03 -05:00
parent 0f803336c2
commit 82985b5fe1

View file

@ -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');