本文整理汇总了PHP中SearchHandler::addConstraint方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler::addConstraint方法的具体用法?PHP SearchHandler::addConstraint怎么用?PHP SearchHandler::addConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHandler
的用法示例。
在下文中一共展示了SearchHandler::addConstraint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: delete
public function delete()
{
$flash = Flash::Instance();
$db = DB::Instance();
$db->StartTrans();
$result = parent::delete();
// Save the header to update the header totals
if ($result && !$this->invoice_detail->save()) {
$result = false;
$flash->addError('Error updating header');
}
if ($result) {
// Now update the line numbers of following lines
$sinvoicelines = new SInvoiceLineCollection($this);
$sh = new SearchHandler($sinvoicelines, false);
$sh->addConstraint(new Constraint('invoice_id', '=', $this->invoice_id));
$sh->addConstraint(new Constraint('line_number', '>', $this->line_number));
if ($sinvoicelines->update('line_number', '(line_number-1)', $sh) === false) {
$flash->addError('Error updating line numbers ' . $db->ErrorMsg());
$result = false;
}
}
if ($result === false) {
$db->FailTrans();
}
$db->CompleteTrans();
return $result;
}
示例3: populate
function populate()
{
$tickets = new TicketCollection(new Ticket());
$pl = new PageList('current_tickets');
$ticket_sh = new SearchHandler($tickets, false);
$ticket_sh->setLimit(10);
$ticket_sh->setOrderBy('created', 'ASC');
$user = new User();
$user->loadBy('username', EGS_USERNAME);
$ticket_sh->addConstraint(new Constraint('originator_person_id', '=', $user->username));
$ticket_sh->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
// Find open statuses
$statuses = new TicketStatusCollection(new TicketStatus());
$status_sh = new SearchHandler($statuses);
$status_sh->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$status_sh->addConstraint(new Constraint('status_code', '=', 'NEW'), 'OR');
$status_sh->addConstraint(new Constraint('status_code', '=', 'OPEN'), 'OR');
$statuses->load($status_sh);
foreach ($statuses->getContents() as $status) {
$ticket_sh->addConstraint(new Constraint('client_ticket_status_id', '=', $status->id), 'OR');
}
$tickets->load($ticket_sh);
$pl->addFromCollection($tickets, array('module' => 'ticketing', 'controller' => 'tickets', 'action' => 'view'), array('id'), 'ticket', 'summary');
$this->contents = $pl->getPages()->toArray();
}
示例4: 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';
}
示例5: remittanceList
function remittanceList($trans_id)
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('status', '=', 'P'));
$sh->addConstraint(new Constraint('cross_ref', '=', $trans_id));
$sh->setOrderby('transaction_date');
$this->load($sh);
}
示例6: getPermissions
function getPermissions($systemcompany, $roles = null, $orderby = 'permission')
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('usercompanyid', '=', $systemcompany));
if (!empty($roles)) {
$sh->addConstraint(new Constraint('roleid', 'in', '(' . $roles . ')'));
}
$sh->setOrderby($orderby);
$this->load($sh);
}
示例7: getCompanies
function getCompanies($category_id)
{
$sh = new SearchHandler($this, false);
if (is_array($category_id)) {
$sh->addConstraint(new Constraint('category_id', 'in', '(' . implode(',', $category_id) . ')'));
} else {
$sh->addConstraint(new Constraint('category_id', '=', $category_id));
}
$sh->setOrderby('company');
$this->load($sh);
}
示例8: 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);
}
示例9: populate
function populate()
{
$pp = new PeriodicPaymentCollection();
$pl = new PageList('overdue_periodic_payments');
$sh = new SearchHandler($pp, false);
$sh->addConstraint(new Constraint('status', '=', "('A')"));
$sh->addConstraint(new Constraint('next_due_date', '<=', fix_date(date(DATE_FORMAT))));
$this->setSearchLimit($sh);
$sh->setOrderBy('next_due_date');
$pp->load($sh);
$this->contents = $pp;
}
示例10: loadBy
function loadBy($username = '', $order = '')
{
$db = DB::Instance();
$sh = new SearchHandler($this, false);
if (!empty($username)) {
$sh->addConstraint(new Constraint('username', '=', $username));
}
if (!empty($order)) {
$sh->addConstraint(new Constraint('order_id', '=', $order));
}
$this->load($sh);
}
示例11: getRows
public function getRows($object_id = '', $object_type, $accesstype = '')
{
$sh = new SearchHandler($this, false);
if (!empty($object_id)) {
$sh->addConstraint(new Constraint('object_id', '=', $object_id));
}
$sh->addConstraint(new Constraint('object_type', '=', $object_type));
$sh->addConstraint(new Constraint('username', '=', EGS_USERNAME));
if (!empty($accesstype)) {
$sh->addConstraint(new Constraint('"' . $accesstype . '"', 'is', true));
}
$this->load($sh);
}
示例12: remittanceList
function remittanceList($trans_id)
{
$allocation = DataObjectFactory::Factory('PLAllocation');
$allocation->loadBy('transaction_id', $trans_id);
if ($allocation->isLoaded()) {
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('transaction_type', '!=', 'P'));
$sh->addConstraint(new Constraint('status', '=', 'P'));
$sh->addConstraint(new Constraint('allocation_id', '=', $allocation->allocation_id));
$sh->setOrderby('transaction_date');
$this->load($sh);
}
}
示例13: populate
function populate()
{
$pl = new PageList('companies_added_today');
$companies_do = new CompanyCollection(new Company());
$sh = new SearchHandler($companies_do, false);
$sh->extract();
$sh->addConstraint(new Constraint('is_lead', '=', 'false'));
$sh->addConstraint(new Constraint('created', '>', fix_date(date(DATE_FORMAT))));
$sh->setLimit(10);
$companies_do->load($sh);
$pl->addFromCollection($companies_do, array('module' => 'contacts', 'controller' => 'companys', 'action' => 'view'), array('id'), 'company', 'name');
$this->contents = $pl->getPages()->toArray();
}
示例14: populate
function populate()
{
$orders = new POrderLineCollection();
$orders->setParams();
$sh = new SearchHandler($orders, false);
$sh->addConstraint(new Constraint('status', 'in', "('A','P')"));
$sh->addConstraint(new Constraint('order_status', '!=', "X"));
$sh->addConstraint(new Constraint('due_delivery_date', '<', fix_date(date(DATE_FORMAT))));
$this->setSearchLimit($sh);
$sh->setOrderBy(array('due_delivery_date', 'id'));
$orders->load($sh);
$this->contents = $orders;
}
示例15: populate
function populate()
{
$pl = new PageList('open_opportunities');
$open_opportunities = new OpportunityCollection(new Opportunity());
$sh = new SearchHandler($open_opportunities, false);
$sh->extract();
$sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
$sh->addConstraint(new Constraint('open', '=', 'true'));
$sh->setLimit(10);
$sh->setOrderBy('cost', 'DESC');
$open_opportunities->load($sh);
$pl->addFromCollection($open_opportunities, array('module' => 'crm', 'controller' => 'opportunitys', 'action' => 'view'), array('id'), 'opportunity', 'name');
$this->setData($pl->getPages()->toArray());
}