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")); }
* See the file COPYRIGHT.html for more details. */ /**************************************************************************** * Reading settings from database **************************************************************************** */ include_once "../classes/Settings.php"; include_once "../classes/SettingsQuery.php"; require_once "../classes/Theme.php"; require_once "../classes/ThemeQuery.php"; include_once "../functions/errorFuncs.php"; /**************************************************************************** * Reading general settings **************************************************************************** */ $setQ = new SettingsQuery(); $setQ->connect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $setQ->execSelect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $set = $setQ->fetchRow(); $setQ->close(); /**************************************************************************** * Reading theme settings ****************************************************************************
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")); }
function autoInactive() { $setQ = new SettingsQuery(); $setQ->connect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $setQ->execSelect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $set = $setQ->fetchRow(); $inactiveMemberAfterDays = 0 + $set->getInactiveMemberAfterDays(); if ($inactiveMemberAfterDays > 0) { $sql = $this->mkSQL("UPDATE member SET is_active = 'N' WHERE last_activity_dt <= DATE_SUB(NOW(), INTERVAL %N DAY) ", $inactiveMemberAfterDays); $this->exec($sql); } }
/** * Save PHPExcel to file * * @param string $pFileName * @throws Exception */ public function save($pFilename = null, $title = '') { // garbage collect $this->_phpExcel->garbageCollect(); $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); // Open file $fileHandle = fopen($pFilename, 'w'); if ($fileHandle === false) { throw new Exception("Could not open file {$pFilename} for writing."); } // Set PDF $this->_isPdf = true; // Build CSS $this->buildCSS(true); // Generate HTML $html = ''; //$html .= $this->generateHTMLHeader(false); if (!empty($title)) { $html .= '<h1 align="center">' . $title . '</h1>'; } $html .= $this->generateSheetData(); //$html .= $this->generateHTMLFooter(); // Default PDF paper size $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.) // Check for paper size and page orientation if (is_null($this->getSheetIndex())) { $orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); } else { $orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P'; $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); } // Override Page Orientation if (!is_null($this->_orientation)) { $orientation = $this->_orientation == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P'; } // Override Paper Size if (!is_null($this->_paperSize)) { $printPaperSize = $this->_paperSize; } if (isset(self::$_paperSizes[$printPaperSize])) { $paperSize = self::$_paperSizes[$printPaperSize]; } // Create PDF $pdf = new TCPDF($orientation, 'pt', $paperSize); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); // Set the appropriate font require_once "../classes/Settings.php"; require_once "../classes/SettingsQuery.php"; $setQ = new SettingsQuery(); $setQ->connect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $setQ->execSelect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $set = $setQ->fetchRow(); $pdf->setFont($set->getFontNormal(), '', $set->getFontSize()); //$pdf->SetFont($this->_font); $pdf->writeHTML($html); // Document info $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle()); $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator()); $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject()); $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords()); $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator()); // Write to file fwrite($fileHandle, $pdf->output($pFilename, 'S')); // Close file fclose($fileHandle); PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); }
function output($html, $title = 'document', $pFilename = 'doc.pdf') { require_once '../classes/PHPExcel/Shared/PDF/tcpdf.php'; require_once "../classes/Settings.php"; require_once "../classes/SettingsQuery.php"; // Create PDF $pdf = new TCPDF('P', 'pt', 'A4'); $pdf->SetMargins(56.7, 56.7); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->setTitle($title); $pdf->AddPage(); // Set the appropriate font $setQ = new SettingsQuery(); $setQ->connect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $setQ->execSelect(); if ($setQ->errorOccurred()) { $setQ->close(); displayErrorPage($setQ); } $set = $setQ->fetchRow(); $pdf->setFont($set->getFontNormal()); $pdf->writeHTML($html); $pdf->SetTitle($title); return $pdf->output($pFilename, 'S'); }