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


PHP SearchHandler类代码示例

本文整理汇总了PHP中SearchHandler的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler类的具体用法?PHP SearchHandler怎么用?PHP SearchHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

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

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

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

示例4: getCompanies

 function getCompanies()
 {
     $sh = new SearchHandler($this, false);
     $sh->setFields(array('company_id', 'company'));
     $this->load($sh);
     return $this->getAssoc();
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:SystemcompanyCollection.php

示例5: getPeople

 function getPeople($category_id)
 {
     $sh = new SearchHandler($this, false);
     $sh->addConstraint(new Constraint('category_id', '=', $category_id));
     $sh->setOrderby('surname');
     $this->load($sh);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:PeopleInCategoriesCollection.php

示例6: useDefault

 public static function useDefault($search_data = null, &$errors = array(), $defaults = null)
 {
     $search = new VatSearch($defaults);
     $search->addSearchField('box', 'Box', 'hidden', '', 'hidden');
     $default_year = date('Y');
     $default_tax_period = 1;
     $glperiod = GLPeriod::getPeriod(date('Y-m-d'));
     if ($glperiod && count($glperiod) > 0) {
         $default_year = $glperiod['year'];
         $default_tax_period = $glperiod['tax_period'];
     }
     $search->addSearchField('year', 'Year', 'select', $default_year, 'basic');
     $search->addSearchField('tax_period', 'Tax Period', 'select', $default_tax_period, 'basic');
     $glperiods = new GLPeriodCollection();
     $sh = new SearchHandler($glperiods, false);
     $sh->setOrderBy('year');
     $glperiods->load($sh);
     $glperiods = $glperiods->getContents();
     $options = array();
     foreach ($glperiods as $glperiod) {
         if (!array_key_exists($glperiod->year, $options)) {
             $options[$glperiod->year] = $glperiod->year;
         }
     }
     $search->setOptions('year', $options);
     $tax_periods = GLPeriod::getTaxPeriods();
     $options = array_combine($tax_periods, $tax_periods);
     $search->setOptions('tax_period', $options);
     $search->setSearchData($search_data, $errors);
     return $search;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:31,代码来源:VatSearch.php

示例7: _new

 public function _new()
 {
     parent::_new();
     $permissions = new PermissionCollection(new Permission());
     $sh = new SearchHandler($permissions, FALSE);
     $sh->addConstraint(new Constraint('parent_id', 'is', 'NULL'));
     $sh->setOrderby('title');
     $permissions->load($sh);
     $systemcompany = $this->_uses[$this->modeltype];
     if ($systemcompany->isLoaded()) {
         $companypermissions = new CompanypermissionCollection(new Companypermission());
         $checked = $companypermissions->getPermissionIDs($systemcompany->id);
         $this->view->set('checked', $checked);
         $debug = DebugOption::getCompanyOption($systemcompany->id);
         $this->view->set('debug_id', $debug->id);
         $this->view->set('selected_options', $debug->getOptions());
         foreach ($permissions as $permission) {
             $permission->setAdditional('permissions');
             if (isset($checked[$permission->id])) {
                 $permission->permissions = TRUE;
             } else {
                 $permission->permissions = FALSE;
             }
         }
     }
     $this->view->set('permissions', $permissions);
     $debug = new DebugOption();
     $this->view->set('debug_options', $debug->getEnumOptions('options'));
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:29,代码来源:SystemcompanysController.php

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

示例9: __construct

 function __construct($getCurrentValues = true)
 {
     parent::__construct();
     $userPreferences = UserPreferences::instance();
     $this->setModuleName('contacts');
     $roleCollection = new RoleCollection();
     $sh = new SearchHandler($roleCollection, false);
     $sh->AddConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
     $sh->setOrderby('name');
     $roleCollection->load($sh);
     $roles = array();
     foreach ($roleCollection->getContents() as $role) {
         $roles[$role->id] = array('value' => $role->id, 'label' => $role->name);
         if ($getCurrentValues) {
             if (in_array($role->id, $userPreferences->getPreferenceValue('default-read-roles', 'contacts'))) {
                 $roles[$role->id]['selected'] = true;
             }
         }
     }
     $this->registerPreference(array('name' => 'default-read-roles', 'display_name' => 'Default Read Access', 'type' => 'select_multiple', 'data' => $roles, 'default' => array()));
     foreach ($roleCollection->getContents() as $role) {
         $roles[$role->id] = array('value' => $role->id, 'label' => $role->name);
         if ($getCurrentValues) {
             if (in_array($role->id, $userPreferences->getPreferenceValue('default-write-roles', 'contacts'))) {
                 $roles[$role->id]['selected'] = true;
             }
         }
     }
     $this->registerPreference(array('name' => 'default-write-roles', 'display_name' => 'Default Write Access', 'type' => 'select_multiple', 'data' => $roles, 'default' => array()));
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:30,代码来源:ContactsPreferences.php

示例10: 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

示例11: getCompanyEmail

 static function getCompanyEmail($company_id)
 {
     // Get the email address for the company
     // Use the first Technical address that is not defined as name TICKET_SUPPORT
     //      TICKET_SUPPORT is defined in conf/config.php
     // If that does not exist, use the main address
     $config = Config::Instance();
     $contact = '';
     $company = new Company();
     $company->load($company_id);
     $party = $company->party;
     $sh = new SearchHandler(new PartyContactMethodCollection(new PartyContactMethod()), false);
     $sh->AddConstraint(new Constraint('type', '=', 'E'));
     $ticket_support = $config->get('TICKET_SUPPORT');
     if (!empty($ticket_support)) {
         $sh->AddConstraint(new Constraint('name', '!=', $ticket_support));
     }
     $party->addSearchHandler('contactmethods', $sh);
     $methods = $party->contactmethods;
     foreach ($methods as $method) {
         if ($method->technical == true) {
             // Technical contact favoured above all else
             $contact = $method->contact;
             break;
         }
         if ($method->main == true) {
             // If no contact yet found and this contact is the main contact, use this instead
             $contact = $method->contact;
         }
     }
     return $contact;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:Ticket.php

示例12: 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

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

示例14: getRoles

 function getRoles()
 {
     $roles = new RoleCollection(new Role());
     $sh = new SearchHandler($roles, false, false);
     $sh->addConstraint(new Constraint('usercompanyid', '=', $this->usercompanyid));
     $roles->load($sh);
     return $roles;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:8,代码来源:Usercompanyaccess.php

示例15: getClassesList

 function getClassesList($category = '')
 {
     $sh = new SearchHandler($this, false);
     if (!empty($category)) {
         $sh->addConstraint(new Constraint('category', '=', $category));
     }
     $this->load($sh);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:8,代码来源:InjectorClassCollection.php


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