ruleName = JText::translate('VBO_CONDTEXT_RULE_RETCUST'); $this->ruleDescr = JText::translate('VBO_CONDTEXT_RULE_RETCUST_DESCR'); $this->ruleId = basename(__FILE__); } /** * Displays the rule parameters. * * @return void */ public function renderParams() { ?>
vbo_app->printYesNoButtons($this->inputName('returning'), JText::translate('VBYES'), JText::translate('VBNO'), (int)$this->getParam('returning', 0), 1, 0); ?>
getParam('returning', 0); if (!$returning) { return true; } $book_id = $this->getPropVal('booking', 'id', ''); if (empty($book_id)) { return true; } $cpin = VikBooking::getCPinIstance(); $customer = $cpin->getCustomerFromBooking($book_id); if (!is_array($customer) || !count($customer)) { // customer not found return false; } $dbo = JFactory::getDbo(); $q = "SELECT `co`.`idcustomer`, `co`.`idorder`, `o`.`id` FROM `#__vikbooking_customers_orders` AS `co` LEFT JOIN `#__vikbooking_orders` AS `o` ON `co`.`idorder`=`o`.`id` WHERE `co`.`idcustomer`=" . $customer['id'] . " AND `o`.`status`='confirmed';"; $dbo->setQuery($q); $dbo->execute(); // we need at least two confirmed orders return ($dbo->getNumRows() > 1); } }