function _purgeHistory($mbrid) { $setQ = new SettingsQuery(); $purgeMo = $setQ->getPurgeHistoryAfterMonths($this); if ($purgeMo == 0) { return TRUE; } $sql = $this->mkSQL("delete from biblio_status_hist where mbrid = %N" . " and status_begin_dt <= date_add(sysdate(),interval - %N month)", $mbrid, $purgeMo); // need to add where clause for purge rule return $this->_query($sql, $this->_loc->getText("biblioStatusHistQueryErr5")); }
function _purgeHistory($mbrid) { $setQ = new SettingsQuery(); $purgeMo = $setQ->getPurgeHistoryAfterMonths($this); if ($purgeMo == 0) { return TRUE; } // do not purge at all when there might be unpaid overdue fees $acctQ = new MemberAccountQuery(); $balance = $acctQ->getBalance($mbrid); if ($balance != 0) { return TRUE; } $sql = $this->mkSQL("delete biblio_status_hist from biblio_status_hist" . " left join biblio_copy on biblio_copy.mbrid = biblio_status_hist.mbrid" . " and biblio_copy.bibid = biblio_status_hist.bibid" . " and biblio_copy.copyid = biblio_status_hist.copyid" . " where biblio_status_hist.mbrid = %N" . " and biblio_status_hist.status_begin_dt <= date_add(sysdate(),interval - %N month)" . " and biblio_copy.mbrid is null", $mbrid, $purgeMo); // history is not purged for copies that are not returned return $this->_query($sql, $this->_loc->getText("biblioStatusHistQueryErr5")); }