本文整理汇总了PHP中SearchHandler::setFields方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler::setFields方法的具体用法?PHP SearchHandler::setFields怎么用?PHP SearchHandler::setFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHandler
的用法示例。
在下文中一共展示了SearchHandler::setFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompanies
function getCompanies()
{
$sh = new SearchHandler($this, false);
$sh->setFields(array('company_id', 'company'));
$this->load($sh);
return $this->getAssoc();
}
示例2: populate
function populate()
{
$employee = DataObjectFactory::Factory('Employee');
$user = getCurrentUser();
if (!is_null($user->person_id)) {
$employee->loadBy('person_id', $user->person_id);
}
if ($employee->isLoaded()) {
$authorisor_model = $employee->expense_model();
$employee->authorisationPolicy($authorisor_model);
$authorisees = $employee->getAuthorisees($authorisor_model);
} else {
$authorisees = array();
}
$expense = DataObjectFactory::Factory('Expense');
$expenses = new ExpenseCollection($expense);
if (count($authorisees) > 0) {
$expenses->setParams();
$sh = new SearchHandler($expenses, false);
$sh->setFields(array('id', 'expense_number', 'employee', 'employee_id', 'description', 'gross_value'));
$sh->addConstraint(new Constraint('status', '=', $expense->statusAwaitingAuthorisation()));
$sh->addConstraint(new Constraint('employee_id', 'in', '(' . implode(',', $authorisees) . ')'));
$this->setSearchLimit($sh);
$sh->setOrderby(array('expense_number'));
$expenses->load($sh);
$expenses->clickcontroller = 'expenses';
$expenses->editclickaction = 'view';
}
$this->contents = $expenses;
$this->vars['module'] = 'hr';
$this->vars['controller'] = 'expenses';
}
示例3: populate
function populate()
{
$employee = DataObjectFactory::Factory('Employee');
$user = getCurrentUser();
if (!is_null($user->person_id)) {
$employee->loadBy('person_id', $user->person_id);
}
if ($employee->isLoaded()) {
$authorisor_model = $employee->holiday_model();
$employee->authorisationPolicy($authorisor_model);
$authorisees = $employee->getAuthorisees($authorisor_model);
} else {
$authorisees = array();
}
$holiday = DataObjectFactory::Factory('HolidayRequest');
$holidays = new HolidayrequestCollection($holiday);
if (count($authorisees) > 0) {
$holidays->setParams();
$sh = new SearchHandler($holidays, false);
$sh->setFields(array('id', 'employee', 'employee_id', 'start_date', 'end_date', 'num_days'));
$sh->addConstraint(new Constraint('status', '=', $holiday->newRequest()));
$sh->addConstraint(new Constraint('employee_id', 'in', '(' . implode(',', $authorisees) . ')'));
$this->setSearchLimit($sh);
$sh->setOrderby(array('employee', 'start_date'));
$holidays->load($sh);
$holidays->clickcontroller = 'holidayrequests';
$holidays->editclickaction = 'view';
}
$this->contents = $holidays;
}
示例4: getPermissionIDs
function getPermissionIDs($systemcompany, $orderby = 'permission')
{
$sh = new SearchHandler($this, false, false);
$sh->setFields(array('permissionid', 'permission'));
$sh->addConstraint(new Constraint('usercompanyid', '=', $systemcompany));
$sh->setOrderby($orderby);
$this->load($sh);
return $this->getAssoc();
}
示例5: getOutsideOperationCosts
public static function getOutsideOperationCosts(ConstraintChain $cc, $type = 'latest')
{
$mfoutsideops = new MFOutsideOperationCollection();
$sh = new SearchHandler($mfoutsideops, false);
$sh->addConstraintChain($cc);
$fields = array('id', 'op_no', 'description', $type . '_osc');
$sh->setFields($fields);
$sh->setOrderby('op_no');
$mfoutsideops->load($sh);
return $mfoutsideops;
}
示例6: sumByStatus
function sumByStatus($cc = '')
{
$sh = new SearchHandler($this, FALSE);
if ($cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$sh->setFields(array('status as id', 'status', 'sum(num_days) as num_days'));
$sh->setGroupBy(array('status as id', 'status'));
$sh->setOrderBy('status');
return $this->load($sh);
}
示例7: getAuthSummary
public function getAuthSummary($_order_id)
{
$sh = new SearchHandler($this, false);
$fields = array("glcentre||' '||glaccount", 'glcentre_id', 'glaccount_id');
$sh->setGroupBy($fields);
$sh->setOrderBy($fields);
$fields[] = 'sum(base_net_value) as net_value';
$sh->setFields($fields);
$sh->addConstraint(new Constraint('order_id', '=', $_order_id));
$sh->addConstraint(new Constraint('status', '!=', $this->_templateobject->cancelStatus()));
$this->load($sh);
}
示例8: summaryPayments
function summaryPayments()
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('for_payment', 'is', 'true'));
$sh->addConstraint(new Constraint('status', '=', 'O'));
$fields = array('currency', 'payment_type', 'currency_id', 'payment_type_id');
$sh->setGroupBy($fields);
$sh->setOrderby($fields);
$fields[] = 'sum(os_value) as payment';
$fields[] = 'count(*) as records';
$sh->setFields($fields);
$this->load($sh);
}
示例9: getItemDates
public function getItemDates($cc = "")
{
$sh = new SearchHandler($this, false);
$DisplayFields = array('due_delivery_date', 'stitem_id', 'stitem', 'uom_name', 'on_order');
$sh->setOrderby('due_delivery_date');
$sh->setFields($DisplayFields);
if (!empty($cc) && $cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$this->_tablename = 'po_itemdates';
$this->load($sh);
return $this;
}
示例10: getToLocations
function getToLocations($whaction_id, $from_whlocation_id)
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('whaction_id', '=', $whaction_id));
if (!is_array($from_whlocation_id)) {
$from_whlocation_id = array($from_whlocation_id);
}
if (count($from_whlocation_id) > 0) {
$sh->addConstraint(new Constraint('from_whlocation_id', '=', '(' . implode(',', $from_whlocation_id) . ')'));
}
$sh->setFields(array('to_whlocation_id', 'to_location'));
$this->load($sh);
return $this->getAssoc();
}
示例11: populate
function populate()
{
$tasks_do = new TaskCollection();
$tasks_do->setParams();
$sh = new SearchHandler($tasks_do, false);
$sh->setFields(array('id', 'name'));
$this->setSearchLimit($sh);
$sh->setOrderBy('created', 'ASC');
$sh->addConstraint(new Constraint('progress', '<', 100));
$sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
$tasks_do->load($sh);
$tasks_do->clickcontroller = 'tasks';
$tasks_do->editclickaction = 'view';
$this->contents = $tasks_do;
}
示例12: populate
function populate()
{
$po_obj = new DataObject('po_no_auth_user');
$po_obj->idField = 'id';
$po_obj->identifierField = 'order_number';
$po_col = new DataObjectCollection($po_obj);
$po_col->setParams();
$sh = new SearchHandler($po_col, false);
$sh->setFields(array('id', 'order_number', 'supplier', 'status'));
$sh->addConstraint(new Constraint('status', '!=', 'X'));
$this->setSearchLimit($sh);
$sh->setOrderby(array('order_date', 'due_date', 'order_number'));
$po_col->load($sh);
$this->contents = $po_col;
}
示例13: populate
function populate()
{
$header = DataObjectFactory::Factory('GLTransactionHeader');
$journals = new GLTransactionHeaderCollection($header);
$journals->setParams();
$sh = new SearchHandler($journals, false);
$sh->addConstraint(new Constraint('status', '=', $header->newStatus()));
$sh->addConstraint(new Constraint('type', '=', $header->standardJournal()));
$sh->setFields(array('id', 'docref', 'transaction_date', 'glperiod', 'reference', 'comment'));
$this->setSearchLimit($sh);
$journals->load($sh);
$journals->clickcontroller = 'gltransactionheaders';
$journals->editclickaction = 'view';
$this->contents = $journals;
}
示例14: index
public function index()
{
$collection = new TicketCollection($this->_templateobject);
$sh = new SearchHandler($collection, false);
$sh->extract();
$sh->setFields(array('id' => 'id', 'summary' => 'summary', 'originator_person' => 'originator_person', 'client_ticket_status' => 'client_ticket_status', 'client_ticket_priority' => 'client_ticket_priority', 'client_ticket_severity' => 'client_ticket_severity', 'created' => 'created', 'lastupdated' => 'lastupdated'));
$this->setSearch('TicketsSearch', 'useClient');
parent::index($collection, $sh);
$this->view->set('no_delete', true);
$this->view->set('clickaction', 'view');
$sidebar = new SidebarController($this->view);
$sidebar->addList('Actions', array('new' => array('link' => array('module' => 'ticketing', 'controller' => 'client', 'action' => 'new'), 'tag' => 'New Ticket')));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例15: accrueLine
public function accrueLine($_ids = '', &$errors = array(), $_reverse_accrual = FALSE)
{
if (empty($_ids) || !is_array($_ids)) {
return FALSE;
}
$db =& DB::Instance();
$db->StartTrans();
$poreceivedline = DataObjectFactory::Factory('POReceivedLine');
$poreceivedlines = new POReceivedLineCollection($poreceivedline);
$sh = new SearchHandler($poreceivedlines, FALSE);
$sh->addConstraint(new Constraint('id', 'in', '(' . implode(',', array_keys($_ids)) . ')'));
$glparams = DataObjectFactory::Factory('GLParams');
$accrual_control = $glparams->accruals_control_account();
$result = TRUE;
if (!empty($accrual_control)) {
$cost_centre = $glparams->balance_sheet_cost_centre();
$sh->setFields(array('id', 'glaccount_id', 'glcentre_id', 'item_description', 'net_value', 'order_number', 'rate', 'received_date'));
$rows = $poreceivedlines->load($sh, null, RETURN_ROWS);
$gltransactions = GLTransaction::makeFromGRN(array('control_glaccount_id' => $accrual_control, 'control_glcentre_id' => $cost_centre, 'reverse_accrual' => $_reverse_accrual), $rows, $errors);
if (count($errors) > 0) {
$result = FALSE;
$errors[] = 'Error saving GL Transaction : ' . $db->ErrorMsg();
} else {
// Save the GL Transactions and update the balances
if (!GLTransaction::saveTransactions($gltransactions, $errors)) {
$result = FALSE;
$errors[] = 'Error saving GL Transaction : ' . $db->ErrorMsg();
}
}
}
// Now update the received lines status to accrued
if ($result !== FALSE) {
if ($_reverse_accrual) {
$result = $poreceivedlines->update('status', $poreceivedline->writeOffStatus(), $sh);
} else {
$result = $poreceivedlines->update('status', $poreceivedline->accrualStatus(), $sh);
}
if ($result !== FALSE && $result != count($_ids)) {
$errors[] = 'Updated ' . $result . ' expected ' . count($_ids);
$result = FALSE;
}
}
if ($result === FALSE) {
$db->FailTrans();
}
$db->CompleteTrans();
return $result;
}