/** * Check if pclasses for given option exists and show warning if it doesn't * * @param string $option 'part' or 'spec' * * @return void */ public function checkForPClasses($option) { $sql = ""; $module = ""; if ($option == KiTT::PART) { $module = 'Part Payment Module'; $sql = "type <> 2"; } else { if (KiTT::SPEC) { $module = 'Special Campaigns Module'; $sql = "type = 2"; } else { return; } } if (KlarnaConstant::isEnabled($option, $this->_country)) { // instantiate MySQLStorage to ensure the table exists $pcURI = KlarnaConstant::pcURI(); $pcstorage = new MySQLStorage(); $pcstorage->load($pcURI); $count = $this->_klarnaDB->query("SELECT COUNT(type) as num FROM klarna_pclasses WHERE {$sql}")->getArray(); if ($count['num'] == 0 && !isset($_GET['get_pclasses']) && headers_sent()) { $templateLoader = KiTT::templateLoader(KiTT::Locale($this->_country)); $no_pclasses = $templateLoader->load('no_pclasses.mustache'); echo $no_pclasses->render(array('module' => $module)); } } }