本文整理汇总了PHP中SearchHandler::addConstraintChain方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler::addConstraintChain方法的具体用法?PHP SearchHandler::addConstraintChain怎么用?PHP SearchHandler::addConstraintChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHandler
的用法示例。
在下文中一共展示了SearchHandler::addConstraintChain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyStructure
function copyStructure($data, &$errors)
{
$mfstructures = new MFStructureCollection(DataObjectFactory::Factory('MFStructure'));
$cc1 = new ConstraintChain();
$cc1->add(new Constraint('stitem_id', '=', $data->stitem_id));
$cc1->add(new Constraint('start_date', '<=', fix_date(date(DATE_FORMAT))));
$cc2 = new ConstraintChain();
$cc2->add(new Constraint('end_date', '>=', fix_date(date(DATE_FORMAT))));
$cc2->add(new Constraint('end_date', 'is', 'NULL'), 'OR');
$sh = new SearchHandler($mfstructures, false);
$sh->addConstraintChain($cc1);
$sh->addConstraintChain($cc2);
$mfstructures->load($sh);
$wo_structure = array();
$wo_structures = array();
$copyfields = array('line_no', 'qty', 'uom_id', 'remarks', 'waste_pc', 'ststructure_id');
foreach ($mfstructures as $input) {
$wo_structure['work_order_id'] = $data->id;
foreach ($copyfields as $field) {
$wo_structure[$field] = $input->{$field};
}
$wo_structures[$input->line_no] = DataObject::Factory($wo_structure, $errors, 'MFWOStructure');
}
return $wo_structures;
}
示例2: summary_report
public function summary_report()
{
$users = array();
if (isModuleAdmin()) {
$u = DataObjectFactory::Factory('User');
$users = $u->getAll();
}
$this->view->set('users', $users);
if (isset($this->_data['filter'])) {
$cc = new ConstraintChain();
if (!empty($this->_data['from_date'])) {
$cc->add(new Constraint('enddate', '>', fix_date($this->_data['from_date'])));
}
if (!empty($this->_data['to_date'])) {
$cc->add(new Constraint('enddate', '<', fix_date($this->_data['to_date'])));
}
if (!isModuleAdmin()) {
$cc->add(new Constraint('assigned', '=' . EGS_USERNAME));
} elseif (!empty($this->_data['assigned'])) {
$cc->add(new Constraint('assigned', '=', $this->_data['assigned']));
}
$opp_sh = new SearchHandler(new OpportunityCollection($this->_templateobject), false);
$opp_sh->addConstraintChain($cc);
$opp_sh->extract();
$os = DataObjectFactory::Factory('Opportunitystatus');
$os->addSearchHandler('opportunities', $opp_sh);
$statuses = new OpportunitystatusCollection($os);
$sh = new SearchHandler($statuses, false);
$sh->extract();
$statuses->load($sh);
$this->view->set('statuses', $statuses);
$this->view->set('report_headings', array('name', 'company', 'person', 'enddate', 'type', 'cost', 'assigned'));
$this->view->set('cc', $cc);
}
}
示例3: index
public function index()
{
$id = $this->_data['stitem_id'];
$transaction = new STItem();
$transaction->load($id);
$this->view->set('transaction', $transaction);
$outside_ops = new MFOutsideOperationCollection($this->_templateobject);
$sh = new SearchHandler($outside_ops, false);
$cc = new ConstraintChain();
$cc->add(new Constraint('stitem_id', '=', $id));
$db = DB::Instance();
$date = Constraint::TODAY;
$between = $date . ' BETWEEN ' . $db->IfNull('start_date', $date) . ' AND ' . $db->IfNull('end_date', $date);
$cc->add(new Constraint('', '', '(' . $between . ')'));
$sh->addConstraintChain($cc);
$sh->setOrderby('op_no');
$outside_ops->load($sh);
$this->view->set('outside_ops', $outside_ops);
$this->view->set('linkfield', 'id');
$this->view->set('linkvaluefield', 'id');
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'MFOutsideOperations');
$this->view->set('no_ordering', true);
$sidebar = new SidebarController($this->view);
$sidebar->addList('Show', array('allItems' => array('tag' => 'All Items', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'index'))), 'thisItem' => array('tag' => 'Item Detail', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'view', 'id' => $id))), 'addoperation' => array('tag' => 'Add Outside Operation', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new', 'stitem_id' => $id)))));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例4: close_off_current
public function close_off_current($_employee_id, $_end_date)
{
$sh = new SearchHandler($this, FALSE);
$sh->addConstraint(new Constraint('employee_id', '=', $_employee_id));
$sh->addConstraintChain(new Constraint('end_date', 'is', 'NULL'));
return $this->update('end_date', $_end_date, $sh);
}
示例5: 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);
}
示例6: 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;
}
示例7: getMostRecent
public static function getMostRecent($stitem_id, $type)
{
$cc = new ConstraintChain();
$cc->add(new Constraint('stitem_id', '=', $stitem_id));
$cc->add(new Constraint('type', '=', $type));
$sh = new SearchHandler(new STCostCollection(), false);
$sh->addConstraintChain($cc);
$sh->setOrderBy(array('lastupdated', 'id'), array('DESC', 'DESC'));
$stcost = new STCost();
return $stcost->loadBy($sh);
}
示例8: 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;
}
示例9: forPayment
function forPayment($cc = '')
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('for_payment', 'is', 'true'));
$sh->addConstraint(new Constraint('status', '=', 'O'));
if (!empty($cc) && $cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$fields = array('employee_id', 'employee', 'company_id', 'currency', 'payment_type', 'currency_id', 'payment_type_id');
$sh->setGroupBy($fields);
$sh->setOrderby('supplier');
$fields[] = 'sum(os_value) as payment';
$sh->setFields($fields);
$this->load($sh);
}
示例10: forPayment
function forPayment($cc = '')
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('for_payment', 'is', 'true'));
$sh->addConstraint(new Constraint('status', '=', 'O'));
if (!empty($cc) && $cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$fields = array('plmaster_id', 'supplier', 'payee_name', 'company_id', 'currency', 'payment_type', 'currency_id', 'payment_type_id');
$sh->setGroupBy($fields);
$sh->setOrderby('supplier');
$fields[] = 'sum(os_value-cast(include_discount as integer)*coalesce(settlement_discount,0)) as payment';
$sh->setFields($fields);
$this->load($sh);
}
示例11: populate
function populate()
{
$sttransactions = new STTransactionCollection();
$sttransactions->setParams();
$sh = new SearchHandler($sttransactions, false);
$sh->addConstraint(new Constraint('status', '=', 'E'));
$cc = new ConstraintChain();
$cc->add(new Constraint('error_qty', '<', 0));
$cc->add(new Constraint('qty', '<', 0), 'OR');
$sh->addConstraintChain($cc);
$this->setSearchLimit($sh);
$sh->setOrderBy('created', 'DESC');
$sttransactions->load($sh);
$this->contents = $sttransactions;
}
示例12: getLocationList
function getLocationList($cc = "")
{
$sh = new SearchHandler($this, false);
if ($cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$sh->setOrderby(array('whstore', 'location'));
$this->load($sh);
$list = array();
if ($this->count() > 0) {
foreach ($this as $location) {
$list[$location->id] = $location->whstore . '/' . $location->location . '-' . $location->description;
}
}
return $list;
}
示例13: getItemOrders
public function getItemOrders($cc = "")
{
$sh = new SearchHandler($this, FALSE);
$DisplayFields = array('id', 'stitem_id', 'due_despatch_date', 'stitem', 'order_number', 'line_number', 'order_id', 'customer', 'slmaster_id', 'stuom', 'required', 'delivery_note', 'despatch_action', 'status', 'account_status', 'status', 'item_description', 'productline_id');
// $sh->setOrderby(
// array('order_number', 'line_number'),
// array('ASC', 'ASC')
// );
$sh->setFields($DisplayFields);
if (!empty($cc) && $cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$this->_tablename = 'so_itemorders';
$this->load($sh);
return $this;
}
示例14: populate
function populate()
{
$pl = new PageList('my_tickets');
$my_tickets = new TicketCollection(new Ticket());
$sh = new SearchHandler($my_tickets, false);
$sh->extract();
$sh->addConstraint(new Constraint('assigned_to', 'IS', 'NULL'));
$cc = new ConstraintChain();
$cc->add(new Constraint('internal_status_code', '=', 'NEW'), 'OR');
$cc->add(new Constraint('internal_status_code', '=', 'OPEN'), 'OR');
$sh->addConstraintChain($cc);
$sh->setLimit(10);
$sh->setOrderBy('created', 'DESC');
$my_tickets->load($sh);
$pl->addFromCollection($my_tickets, array('module' => 'ticketing', 'controller' => 'tickets', 'action' => 'view'), array('id'), 'ticket', 'summary');
$this->contents = $pl->getPages()->toArray();
}
示例15: checkPermission
function checkPermission($permissions, $types, $parent_ids = '')
{
$cc = new ConstraintChain();
if (is_array($permissions)) {
$permissions = implode("','", $permissions);
}
$cc->add(new Constraint('permission', 'in', "('" . $permissions . "')"));
if (is_array($types)) {
$types = implode("','", $types);
}
$cc->add(new Constraint('type', 'in', "('" . $types . "')"));
if (!empty($parent_ids)) {
if (is_array($parent_ids)) {
$parent_ids = implode(',', $parent_ids);
}
$cc->add(new Constraint('parent_id', 'in', '(' . $parent_ids . ')'));
}
$sh = new SearchHandler($this, false);
$sh->addConstraintChain($cc);
return $this->load($sh, null, RETURN_ROWS);
}