setDBO(VoxelCareDB::getDatabase()); } function SetIds($cid) { $this->_ids = $cid; $this->_data = null; } function getData() { if (!$this->_data && is_array($this->_ids)&& count($this->_ids)>0) { $newModeFields = ''; $newJoins = ''; $oldModeFields =''; if (LegacyHelper::getNewMode()) { $newModeFields = "o.uuid uuid, CONCAT_WS(' ',NULLIF(CONCAT_WS(' ',NULLIF(c.name,''),NULLIF(c.middlename,''),NULLIF(c.surname,'')),''),NULLIF(atfirst.value,''),NULLIF(atmiddle.value,''),NULLIF(atlast.value,'')) customerfullname,"; $newJoins = " LEFT JOIN jos_vxc_attribute atfirst ON atfirst.orderid = o.id AND atfirst.name = 'patient.firstName' LEFT JOIN jos_vxc_attribute atmiddle ON atmiddle.orderid = o.id AND atmiddle.name = 'patient.middleName' LEFT JOIN jos_vxc_attribute atlast ON atlast.orderid = o.id AND atlast.name = 'patient.lastName' "; } else { $oldModeFields = "CONCAT_WS(' ',NULLIF(c.name,''),NULLIF(c.middlename,''),NULLIF(c.surname,'')) customerfullname,"; } $sql = "SELECT o.id id,o.user user, $newModeFields o.customer customer, o.reference reference, o.creationdate creationdate, o.currentStep currentStep, o.completedSteps completedSteps, $oldModeFields o.state state, o.shipping_address shipping_address, os.nameid statenameid, os.name statename FROM #__vxc_order o LEFT JOIN #__vxc_customer c ON c.id = o.customer LEFT JOIN #__vxc_orderstate os ON os.id = o.state ".$newJoins . ' '; $sql .=" WHERE o.id IN (".implode(',',$this->_ids).")"; $this->_db->setQuery($sql); $this->_data = $this->_db->loadObjectList(); $modelOrder = new vxcModelOrder(); foreach($this->_data as $order) { $modelOrder->SetId($order->id); $order->price = $modelOrder->getCurrentCompanyPrice(); } } return $this->_data; } } ?>