/** * Test the publish method. * * @return void * * @since 12.3 */ public function testPublish() { $this->object->publish(array(array('id1' => 25, 'id2' => 50), array('id1' => 25, 'id2' => 51)), 2); $this->object->load(array('id1' => 25, 'id2' => 50)); $this->assertEquals(2, $this->object->published); $this->object->load(array('id1' => 25, 'id2' => 51)); $this->assertEquals(2, $this->object->published); }
function publish($cids, $value) { $db = JFactory::getDBO(); $ids = array(); foreach ($cids as $id) { $ids[] = (int) FSSJ3Helper::getEscaped($db, $id); } $query = "SELECT * FROM #__fss_ticket_status WHERE id IN ( " . implode(", ", $ids) . ")"; $db->setQuery($query); $rows = $db->loadObjectList(); foreach ($rows as $row) { if ($row->def_user || $row->def_open || $row->def_admin) { return "You cannot unpublish your default status"; } } return parent::publish($cids, $value); }