当前位置: 首页>>代码示例>>PHP>>正文


PHP ConstraintChain::add方法代码示例

本文整理汇总了PHP中ConstraintChain::add方法的典型用法代码示例。如果您正苦于以下问题:PHP ConstraintChain::add方法的具体用法?PHP ConstraintChain::add怎么用?PHP ConstraintChain::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConstraintChain的用法示例。


在下文中一共展示了ConstraintChain::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:35,代码来源:OpportunitysController.php

示例2: 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);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:28,代码来源:MfoutsideoperationsController.php

示例3: getTotals

 public function getTotals($_project_id = '', $_task_id = '')
 {
     if (empty($_project_id)) {
         return false;
     }
     $cc = new ConstraintChain();
     $cc->add(new Constraint('project_id', '=', $_project_id));
     if (!empty($_task_id)) {
         $cc->add(new Constraint('task_id', '=', $_task_id));
     }
     $costs_charges = array();
     foreach ($this->getEnumOptions('item_type') as $key => $type) {
         $cc1 = new ConstraintChain();
         $cc1->add($cc);
         $cc1->add(new Constraint('item_type', '=', $key));
         switch ($key) {
             case 'PO':
                 $subkey = 'total_costs';
                 $tablename = 'project_purchase_orders';
                 break;
             case 'SI':
                 $subkey = 'total_invoiced';
                 $tablename = 'project_sales_invoices';
                 break;
         }
         $totals = $this->getSumFields(array('net_value'), $cc1, $tablename);
         $costs_charges[$subkey] = $totals['net_value'];
     }
     return $costs_charges;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:30,代码来源:ProjectCostCharge.php

示例4: getCalendarList

 function getCalendarList($options = array())
 {
     $calendars = new CalendarCollection(new Calendar());
     $sh = new SearchHandler($calendars, false);
     $cc = new ConstraintChain();
     $cc->add(new Constraint('owner', '=', EGS_USERNAME));
     $cc->add(new Constraint('username', '=', EGS_USERNAME), 'OR');
     $sh->addConstraintChain($cc);
     $sh->setOrderby('name', 'ASC');
     $calendars->load($sh);
     $calendar_list = $calendars->getArray();
     if (count($calendar_list) > 0) {
         foreach ($calendar_list as $key => $value) {
             if (isset($options[$value['id']]['status']) && $options[$value['id']]['status'] == 'on') {
                 $calendar_list[$key]['show'] = true;
             } else {
                 $calendar_list[$key]['show'] = false;
             }
             switch ($value['type']) {
                 case "personal":
                 case "group":
                     $calendar_list[$key]['url'] = "/?module=calendar&controller=index&action=getJSON&id=" . $value['id'];
                     break;
                 case "gcal":
                     $calendar_list[$key]['url'] = $calendar_list[$key]['gcal_url'];
                     break;
             }
             $calendar_list[$key]['className'] = str_replace("#", "", $calendar_list[$key]['colour']);
         }
     }
     return $calendar_list;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:IndexController.php

示例5: getvalue

 function getvalue()
 {
     $model = $this->get_model();
     if ($this->idField == $this->fieldname) {
         $cc = new ConstraintChain();
         if (substr($this->value, -1) == ')') {
             $cc->add(new Constraint($model->idField, 'IN', $this->value));
         } else {
             $cc->add(new Constraint($model->idField, '=', $this->value));
         }
         $values = $model->getAll($cc);
         if (count($values) > 0) {
             return implode(',', $values);
         }
     } elseif (isset($model->belongsToField[$this->fieldname])) {
         if ($this->value === "'NULL'") {
             return 'NULL';
         }
         $fk = DataObjectFactory::Factory($model->belongsTo[$model->belongsToField[$this->fieldname]]['model']);
         $fk->load($this->value);
         return $fk->getIdentifierValue();
     } elseif ($model->isEnum($this->fieldname)) {
         return $model->getEnum($this->fieldname, $this->value);
     }
     return $this->value;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:SystemObjectPolicy.php

示例6: toConstraintChain

 public function toConstraintChain()
 {
     $cc = new ConstraintChain();
     if ($this->cleared) {
         return $cc;
     }
     debug('BaseSearch::toConstraintChain Fields: ' . print_r($this->fields, true));
     // Certain hidden fields need to be excluded from the constraint
     foreach ($this->fields as $group => $group_data) {
         foreach ($group_data as $field => $searchField) {
             if ($field == 'purchase_order_number') {
                 $search_value = $searchField->getValue();
                 if (!empty($search_value)) {
                     $invoices = PInvoice::getInvoices($searchField->getValue());
                     if (!empty($invoices)) {
                         $cc->add(new Constraint('id', 'in', '(' . implode(',', array_keys($invoices)) . ')'));
                     }
                 }
             } elseif ($searchField->doConstraint()) {
                 $c = $searchField->toConstraint();
                 if ($c !== false) {
                     $cc->add($c);
                 }
             }
         }
     }
     debug('BaseSearch::toConstraintChain Constraints: ' . print_r($cc, true));
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:29,代码来源:pinvoicesSearch.php

示例7: toConstraintChain

 public function toConstraintChain()
 {
     $cc = new ConstraintChain();
     if ($this->cleared) {
         return $cc;
     }
     debug('BaseSearch::toConstraintChain Fields: ' . print_r($this->fields, true));
     foreach ($this->fields as $group) {
         foreach ($group as $field => $searchField) {
             if ($field == 'balance') {
                 $cc1 = new ConstraintChain();
                 if ($searchField->getValue() == '') {
                     $cc1->add(new Constraint('balance', '>', '0'));
                 }
                 $cc->add($cc1);
             } elseif ($field != 'parent_id' && $field != 'search_id') {
                 $c = $searchField->toConstraint();
                 if ($c !== false) {
                     $cc->add($c);
                 }
             }
         }
     }
     debug('BaseSearch::toConstraintChain Constraints: ' . print_r($cc, true));
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:whlocationsSearch.php

示例8: getBinLocationList

 public function getBinLocationList($source)
 {
     $WHLocation = DataObjectFactory::Factory('WHLocation');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('whstore_id', '=', $source));
     $cc->add(new Constraint('bin_controlled', '=', 'true'));
     return $WHLocation->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:8,代码来源:WHStore.php

示例9: getCompanies

 function getCompanies($username = '')
 {
     $cc = new ConstraintChain();
     if (!empty($username)) {
         $cc->add(new Constraint('username', '=', $username));
     }
     $cc->add(new Constraint('enabled', 'is', true));
     return $this->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:9,代码来源:Usercompanyaccess.php

示例10: getCompanyOption

 static function getCompanyOption($companyname)
 {
     $debugoption = new DebugOption();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('username', 'is', 'NULL'));
     $cc->add(new Constraint('company_id', '=', EGS_COMPANY_ID));
     $debugoption->loadBy($cc);
     return $debugoption;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:9,代码来源:DebugOption.php

示例11: getRoleID

 function getRoleID($company_id, $accesstype)
 {
     $cc = new ConstraintChain();
     $cc->add(new Constraint('company_id', '=', $company_id));
     $cc->add(new Constraint('"' . $accesstype . '"', 'is', true));
     $this->idField = 'role_id';
     $this->identifierField = 'role_id';
     return $this->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:9,代码来源:CompanyRole.php

示例12: getActions

 function getActions($type = '')
 {
     $cc = new ConstraintChain();
     if (!empty($type)) {
         $cc->add(new Constraint('type', '=', $type));
     }
     $cc->add(new Constraint('defined_rules', '>', 0));
     return $this->getAll($cc, true, true);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:9,代码来源:WHAction.php

示例13: getRoleID

 function getRoleID($_username, $_object_type, $_accesstype)
 {
     $cc = new ConstraintChain();
     $cc->add(new Constraint('username', '=', $_username));
     $cc->add(new Constraint('object_type', '=', $_object_type));
     $cc->add(new Constraint('"' . $_accesstype . '"', 'is', true));
     $this->idField = 'role_id';
     $this->identifierField = 'role_id';
     return $this->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:10,代码来源:SharedRole.php

示例14: close

 static function close($periodid, &$errors)
 {
     $result = false;
     $errors = array();
     $period = DataObjectFactory::Factory('GLPeriod');
     $period->load($periodid);
     if ($period->isLoaded()) {
         // Check for any unposted journals for the period to be closed
         $journal_header = DataObjectFactory::Factory('GLTransactionHeader');
         $cc = new ConstraintChain();
         $cc->add(new Constraint('glperiods_id', '=', $period->{$period->idField}));
         $cc->add(new Constraint('status', '=', $journal_header->newStatus()));
         $cc->add(new Constraint('type', '=', $journal_header->standardJournal()));
         if ($journal_header->getCount($cc) > 0) {
             $errors[] = 'Cannot close period due to unposted journals';
             return FALSE;
         }
         // Ensure all assets are depreciated for the the period
         assetHandling::depreciateAll($errors);
         // Close the period if no errors
         if (count($errors) === 0) {
             $result = $period->update($period->id, 'closed', 'true');
         }
         if ($result) {
             // Rollup year-to-datebalances
             $periodendbalances = new GLPeriodEndBalanceCollection(DataObjectFactory::Factory('GLPeriodEndBalance'));
             if ($periodendbalances->create($period) === FALSE) {
                 $errors[] = 'Error creating period end balances';
             }
         } else {
             $errors[] = 'Error closing period';
         }
         // Create the new period for next year
         $newperiod = DataObjectFactory::Factory('GLPeriod');
         $nextyear = date(DATE_FORMAT, strtotime('+12 months', strtotime($period->enddate)));
         $newperiod->loadPeriod($nextyear);
         if ($result && count($errors) === 0 && !$newperiod->isLoaded()) {
             if (!self::createNew($period, $errors)) {
                 $errors[] = 'Error creating new period for next year';
             }
         }
         // If closing last period of the year, do year end
         $glparams = DataObjectFactory::Factory('GLParams');
         if (!is_numeric($glparams->number_of_periods_in_year())) {
             $errors[] = 'GL Parameters No.of periods in year not defined';
         }
         if ($result && count($errors) === 0 && $period->period == $glparams->number_of_periods_in_year()) {
             self::yearEnd($period, $errors);
         }
         return $period;
     } else {
         $errors[] = 'Error loading period details';
         return false;
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:55,代码来源:periodHandling.php

示例15: getSaleLocations

 static function getSaleLocations($whstore = "")
 {
     $location = DataObjectFactory::Factory('WHLocation');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('saleable', 'is', true));
     if (!empty($whstore)) {
         $cc->add(new Constraint('whstore_id', '=', $whstore));
     }
     $locations = $location->getAll($cc);
     return array_keys($locations);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:11,代码来源:WHLocation.php


注:本文中的ConstraintChain::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。