Inheritance: extends Handler
コード例 #1
0
ファイル: SInvoiceLine.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #2
0
ファイル: MFWOStructure.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 function getCompanies()
 {
     $sh = new SearchHandler($this, false);
     $sh->setFields(array('company_id', 'company'));
     $this->load($sh);
     return $this->getAssoc();
 }
コード例 #5
0
 function getPeople($category_id)
 {
     $sh = new SearchHandler($this, false);
     $sh->addConstraint(new Constraint('category_id', '=', $category_id));
     $sh->setOrderby('surname');
     $this->load($sh);
 }
コード例 #6
0
ファイル: VatSearch.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #7
0
 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'));
 }
コード例 #8
0
 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';
 }
コード例 #9
0
 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()));
 }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
ファイル: Ticket.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #12
0
 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);
 }
コード例 #13
0
 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);
 }
コード例 #14
0
ファイル: Usercompanyaccess.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #15
0
 function getClassesList($category = '')
 {
     $sh = new SearchHandler($this, false);
     if (!empty($category)) {
         $sh->addConstraint(new Constraint('category', '=', $category));
     }
     $this->load($sh);
 }
コード例 #16
0
 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);
 }
コード例 #17
0
ファイル: Project.php プロジェクト: uzerpllp/uzerp
 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'));
 }
コード例 #18
0
 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();
 }
コード例 #19
0
ファイル: UzletsController.php プロジェクト: uzerpllp/uzerp
 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();
     }
 }
コード例 #20
0
 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;
 }
コード例 #21
0
 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);
 }
コード例 #22
0
 public function showParts($id)
 {
     $elements = new MFWOStructureCollection(new MFWOStructure());
     $sh = new SearchHandler($elements, false);
     $sh->addConstraint(new Constraint('work_order_id', '=', $id));
     $sh->setOrderBy('line_no');
     $sh->extractOrdering();
     $elements->load($sh);
     return $elements;
 }
コード例 #23
0
 function populate()
 {
     $customers = new SLCustomerCollection();
     $customers->setParams();
     $sh = new SearchHandler($customers, false);
     $sh->addConstraint(new Constraint('account_status', '=', 'S'));
     $this->setSearchLimit($sh);
     $customers->load($sh);
     $this->contents = $customers;
 }
コード例 #24
0
ファイル: STCost.php プロジェクト: uzerpllp/uzerp
 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);
 }
コード例 #25
0
 function populate()
 {
     $worder = new MFWorkorderCollection();
     $worder->setParams();
     $sh = new SearchHandler($worder, false);
     $sh->addConstraint(new Constraint('status', 'in', "('R')"));
     $this->setSearchLimit($sh);
     $sh->setOrderBy('wo_number');
     $worder->load($sh);
     $this->contents = $worder;
 }
コード例 #26
0
 function populate()
 {
     $orders = new POrderCollection();
     $orders->setParams();
     $sh = new SearchHandler($orders, false);
     $sh->addConstraint(new Constraint('status', '=', 'O'));
     $this->setSearchLimit($sh);
     $sh->setOrderBy('due_date');
     $orders->load($sh);
     $this->contents = $orders;
 }
コード例 #27
0
ファイル: StcostsController.php プロジェクト: uzerpllp/uzerp
 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;
 }
コード例 #28
0
ファイル: WHActionsEGlet.php プロジェクト: uzerpllp/uzerp
 function populate()
 {
     $collection = new WHActionCollection();
     $collection->setParams();
     $sh = new SearchHandler($collection);
     $sh->addConstraint(new Constraint('type', '=', 'M'));
     $this->setSearchLimit($sh);
     $sh->setOrderBy('position');
     $collection->load($sh);
     $this->contents = $collection;
 }
コード例 #29
0
 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);
 }
コード例 #30
0
ファイル: MFShiftOutput.php プロジェクト: uzerpllp/uzerp
 public function getWorkOrders($stitem_id = '')
 {
     if (empty($stitem_id)) {
         return array();
     }
     $mfworkorders = new MFWorkorderCollection();
     $sh = new SearchHandler($mfworkorders, false);
     $sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
     $sh->setOrderby('wo_number', 'DESC');
     $mfworkorders->load($sh);
     return $mfworkorders->getAssoc('wo_number');
 }