ruleName = JText::translate('VBO_HISTORY_GPM');
$this->ruleDescr = JText::translate('VBO_CONDTEXT_RULE_BOOKSTAT_DESCR');
$this->ruleId = basename(__FILE__);
}
/**
* Displays the rule parameters.
*
* @return void
*/
public function renderParams()
{
$this->vbo_app->loadSelect2();
$statuses = $this->getStatuses();
$current_status = $this->getParam('statuses', '');
?>
getPropVal('booking', 'status', '');
$book_total = (float)$this->getPropVal('booking', 'total', 0);
$book_totpaid = (float)$this->getPropVal('booking', 'totpaid', 0);
$pay_status = $this->getParam('statuses', '');
if (empty($pay_status) || empty($book_total)) {
return false;
}
switch ($pay_status) {
case 'fully_paid':
return $book_status === 'confirmed' && $book_totpaid >= $book_total;
case 'partially_paid':
return $book_status === 'confirmed' && $book_totpaid > 0 && $book_totpaid < $book_total;
case 'payment_received':
return $book_status === 'confirmed' && $book_totpaid > 0;
case 'to_be_paid':
return $book_status === 'confirmed' && empty($book_totpaid);
default:
return false;
}
}
/**
* Internal function for this rule only.
*
* @return array
*/
protected function getStatuses()
{
return [
'fully_paid' => JText::translate('VBOCOLORTAGRULECONFFIVE'),
'partially_paid' => JText::translate('VBOCOLORTAGRULECONFFOUR'),
'payment_received' => JText::translate('VBOBOOKHISTORYTP0'),
'to_be_paid' => JText::translate('VBOCOLORTAGRULECONFTHREE'),
];
}
}