本文整理汇总了PHP中SearchHandler类的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler类的具体用法?PHP SearchHandler怎么用?PHP SearchHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SearchHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:8,代码来源:ELTransactionCollection.php
示例17: __construct
function __construct($tablename = 'projects')
{
// Register non-persistent attributes
// Contruct the object
parent::__construct($tablename);
// Set specific characteristics
$this->idField = 'id';
$this->identifierField = array('job_no', 'name');
$this->orderby = 'job_no';
// Define relationships
$this->belongsTo('Company', 'company_id', 'company');
$this->belongsTo('User', 'owner', 'project_owner');
$this->belongsTo('User', 'altered_by', 'altered');
$this->belongsTo('Person', 'person_id', 'person', null, "surname || ', ' || firstname");
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', EGS_COMPANY_ID));
$this->belongsTo('Person', 'key_contact_id', 'key_contact', $cc, "surname || ', ' || firstname");
$this->belongsTo('Opportunity', 'opportunity_id', 'opportunity');
$this->belongsTo('Projectcategory', 'category_id', 'category');
$this->belongsTo('Projectworktype', 'work_type_id', 'work_type');
$this->belongsTo('Projectphase', 'phase_id', 'phase');
$this->hasMany('ProjectBudget', 'budgets');
$this->hasMany('Task', 'tasks');
// $this->hasMany('ProjectIssue','issues');
$this->hasMany('ProjectNote', 'notes');
$this->hasMany('Hour', 'hours');
$this->hasMany('Expense', 'expenses');
$this->hasMany('Resource', 'resources');
// Note: 'projectattachment' model does not exist - it is here to generate
// the sidebar related link to projectattachmentcontroller
$this->hasMany('projectattachment', 'attachments');
$this->hasMany('LoggedCall', 'calls');
$this->hasMany('ProjectEquipmentAllocation', 'equipment_allocations', 'project_id');
$this->hasMany('ProjectCostCharge', 'actuals', 'project_id');
// $this->hasMany('ProjectCostCharge', 'purchase_orders', 'project_id');
// $this->hasMany('ProjectCostCharge', 'sales_invoices', 'project_id');
$this->hasMany('POrder', 'porders');
$this->hasMany('PInvoice', 'pinvoices');
$this->hasMany('SOrder', 'sorders');
$this->hasMany('SInvoice', 'sinvoices');
$this->hasMany('MFWorkorder', 'mfworkorders');
$tasks = new TaskCollection(new Task());
$sh = new SearchHandler($tasks, false);
$sh->addConstraint(new Constraint('parent_id', ' is ', 'NULL'));
$sh->setOrderBy('start_date');
$this->addSearchHandler('tasks', $sh);
// Define field formats
$this->getField('cost')->setFormatter(new PriceFormatter());
$this->getField('value')->setFormatter(new PriceFormatter());
// Define field defaults
$this->getField('status')->setDefault('N');
// Define validation
$this->validateUniquenessOf(array("job_no"));
// Define enumerated types
$this->setEnum('status', array('N' => 'New', 'A' => 'Active', 'C' => 'Complete', 'X' => 'Cancelled'));
// Define link rules for sidebar related view
$this->linkRules = array('expenses' => array('modules' => array('link' => array('module' => 'hr'), 'new' => array('module' => 'hr')), 'actions' => array('link', 'new'), 'rules' => array()), 'mfworkorders' => array('modules' => array('link' => array('module' => 'manufacturing')), 'actions' => array('link'), 'rules' => array(), 'label' => 'Show Works Orders'), 'porders' => array('modules' => array('link' => array('module' => 'purchase_order'), 'new' => array('module' => 'purchase_order')), 'actions' => array('link', 'new'), 'rules' => array(), 'label' => 'Show Purchase Orders'), 'pinvoices' => array('modules' => array('link' => array('module' => 'purchase_invoicing'), 'new' => array('module' => 'purchase_invoicing')), 'actions' => array('link', 'new'), 'rules' => array(), 'label' => 'Show Purchase Invoices'), 'sorders' => array('modules' => array('link' => array('module' => 'sales_order'), 'new' => array('module' => 'sales_order')), 'actions' => array('link'), 'rules' => array(), 'label' => 'Show Sales Orders'), 'sinvoices' => array('modules' => array('link' => array('module' => 'sales_invoicing'), 'new' => array('module' => 'sales_invoicing')), 'actions' => array('link'), 'rules' => array(), 'label' => 'Show Sales Invoices'));
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:58,代码来源:Project.php
示例18: 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();
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:9,代码来源:CompanypermissionCollection.php
示例19: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
// delete any existing uzlet / module relationships
if (isset($this->_data['Uzlet']['id']) && !empty($this->_data['Uzlet']['id'])) {
$uzlet_modules = new UzletModuleCollection(DataObjectFactory::Factory('UzletModule'));
$sh = new SearchHandler($uzlet_modules, false);
$sh->addConstraint(new Constraint('uzlet_id', '=', $this->_data['Uzlet']['id']));
$uzlet_modules->delete($sh);
}
// apply uzlet_id to UzletModulesCollection
if (isset($this->_data['UzletModuleCollection']) && !empty($this->_data['UzletModuleCollection']['module_id'])) {
foreach ($this->_data['UzletModuleCollection']['module_id'] as $key => $value) {
$this->_data['UzletModuleCollection']['uzlet_id'][$key] = '';
}
}
// delete any existing calls
if (isset($this->_data['Uzlet']['id']) && !empty($this->_data['Uzlet']['id'])) {
$uzlet_calls = new UzletCallCollection(DataObjectFactory::Factory('UzletCall'));
$sh = new SearchHandler($uzlet_calls, false);
$sh->addConstraint(new Constraint('uzlet_id', '=', $this->_data['Uzlet']['id']));
$uzlet_calls->delete($sh);
}
// prepare the call field
if (isset($this->_data['UzletCallCollection']['Call']) && $this->_data['UzletCallCollection']['Call'] != '') {
// split up the call field by line
$arr = explode("\n", $this->_data['UzletCallCollection']['Call']);
foreach ($arr as $key => $value) {
// we're not interested in empty lines
$empty_test = trim($value);
if (!empty($empty_test)) {
$pieces = explode(":", $value);
// we're also only interested if we have two pieces to work with
// actually we're interested if we have MORE THAN 2 parts, the arguement might be json for example
if (count($pieces) >= 2) {
$this->_data['UzletCallCollection']['uzlet_id'][$key] = '';
$this->_data['UzletCallCollection']['func'][$key] = $pieces[0];
// remove the function from the array, bind all the remaining part back together
// this will preserve any parameter that contains JSON etc (well, anything with a ":")
unset($pieces[0]);
$this->_data['UzletCallCollection']['arg'][$key] = implode(':', $pieces);
}
}
}
unset($this->_data['UzletCallCollection']['Call']);
} else {
unset($this->_data['UzletCallCollection']);
}
if (parent::save('Uzlet', '', $errors)) {
sendBack();
} else {
$flash->addErrors($errors);
sendBack();
}
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:56,代码来源:UzletsController.php
示例20: populate
function populate()
{
$customers = new SLCustomerCollection();
$customers->setParams();
$sh = new SearchHandler($customers, false);
$sh->addConstraint(new Constraint('credit_limit', '<', '(outstanding_balance)'));
$this->setSearchLimit($sh);
$customers->load($sh);
$this->contents = $customers;
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:10,代码来源:OverCreditLimitEGlet.php
注:本文中的SearchHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论