diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 3c0a9303..6ca5cce6 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -1416,6 +1416,9 @@ class Index extends CI_Controller { { $to_date = date('Y-m-d', strtotime("+$days days", strtotime($from_date))); $former_list = $this->Note_model->date_range($from_date, $to_date, $currency, $last_sn, false); + if (empty($former_list)) { + $former_list = $this->Note_model->top_list(100, $currency, $last_sn, false); + } $list_index = 0; $last_sn = $last_sn===null ? 0 : $last_sn; $last_flag = $last_flag===null ? null : $last_flag; diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php index 515f8c88..0c912567 100644 --- a/webht/third_party/paypal/models/note_model.php +++ b/webht/third_party/paypal/models/note_model.php @@ -175,6 +175,24 @@ class Note_model extends CI_Model { $this->orderby = " order by pn.pn_sn asc"; return $this->get_list(); } + public function top_list($top, $currency=NULL, $pn_sn=NULL, $includeWH=true) + { + $this->init(); + $this->topnum = $top; + $search_sql = " AND pn_payment_status in ('Completed','Refunded') "; + if ( ! empty($currency)) { + $search_sql .= " AND pn_mc_currency = '$currency' "; + } + if ( ! empty($pn_sn)) { + $search_sql .= " AND pn_sn >= $pn_sn "; + } + if (true !== $includeWH) { + $search_sql .= " AND isnull(pn_payer,'')<>'' and ISNULL(pn_payer_email,'')<>'' "; + } + $this->search = $search_sql; + $this->orderby = " order by pn.pn_sn asc"; + return $this->get_list(); + } /**