本文整理汇总了PHP中DataObjectFactory::Factory方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectFactory::Factory方法的具体用法?PHP DataObjectFactory::Factory怎么用?PHP DataObjectFactory::Factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectFactory
的用法示例。
在下文中一共展示了DataObjectFactory::Factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transactions
public static function transactions($search_data = null, &$errors = array(), $defaults = null)
{
$search = new assetsSearch($defaults);
$trans = DataObjectFactory::Factory('ARTransaction');
// Search by Transaction Date
$search->addSearchField('transaction_date', 'Transaction Date between', 'between', '', 'basic');
// Search by Asset
$search->addSearchField('armaster_id', 'Asset', 'select', 0, 'basic');
$asset = DataObjectFactory::Factory('Asset');
$options = array('0' => 'All');
$assets = $asset->getAll();
$options += $assets;
$search->setOptions('armaster_id', $options);
// Search by Transaction Type
$search->addSearchField('transaction_type', 'Transaction Type', 'multi_select', array(''), 'advanced');
$search->setOptions('transaction_type', $trans->getEnumOptions('transaction_type'));
// Search by Group
$search->addSearchField('to_group_id', 'Group', 'multi_select', array(0), 'advanced');
$argroup = DataObjectFactory::Factory('ARGroup');
$search->setOptions('to_group_id', $argroup->getAll());
// Search by Location
$search->addSearchField('to_location_id', 'Location', 'multi_select', array(0), 'advanced');
$arlocation = DataObjectFactory::Factory('ARLocation');
$search->setOptions('to_location_id', $arlocation->getAll());
$search->setSearchData($search_data, $errors);
return $search;
}
示例2: setData
function setData($bacs_reference, $payments, &$errors = array(), $data, $plpayment)
{
$this->bacs_reference = $bacs_reference;
$this->payments = $payments;
$this->plpayment = $plpayment;
$account = DataObjectFactory::Factory('CBAccount');
if (isset($data['cb_account_id'])) {
$account->load($data['cb_account_id']);
}
$this->account = $account;
$userPreferences = UserPreferences::instance(EGS_USERNAME);
$defaultPrinter = $userPreferences->getPreferenceValue('default_printer', 'shared');
$params = $data['print'];
$print_params = array();
$params['printer'] = empty($data['printer']) ? $defaultPrinter : $data['printer'];
if (!$this->controller->setPrintParams($params, $print_params, $errors)) {
$errors[] = 'Failed to set print parameters';
}
$year = date('y');
$create_date = bcadd(date('z'), 1, 0);
$this->create_date = $year . str_pad($create_date, 3, '0', STR_PAD_LEFT);
$expiry_date = bcadd(date('z', strtotime($this->plpayment->payment_date)), 1, 0);
$processing_date = bcadd(date('z', strtotime($this->getProcessDate($plpayment->payment_date))), 1, 0);
$this->processing_date = $year . str_pad($processing_date, 3, '0', STR_PAD_LEFT);
$this->expiry_date = $year . str_pad($expiry_date, 3, '0', STR_PAD_LEFT);
if ($plpayment->override === 'f') {
$this->validate(array('payment_date' => un_fix_date($plpayment->payment_date)), $errors);
if ($this->processing_date <= $this->create_date) {
$errors[] = 'Invalid Processing Date';
}
}
}
示例3: _new
public function _new($followup = FALSE)
{
if (array_key_exists('followup', $this->_data)) {
$followup = $this->_data['followup'];
}
$this->view->set('page_title', 'New CRM Activity');
// New follow-up activity
if ($followup) {
$this->view->set('page_title', 'New CRM Follow-up Activity');
unset($this->_data['id']);
$activity = new Activity();
$activity->load($followup);
$this->_data['person_id'] = $activity->person_id;
$this->_data['company_id'] = $activity->company_id;
$this->_data['name'] = $activity->name;
$this->_data['description'] = $activity->description;
$this->_data['completed'] = '';
}
// Edit existing activity
if (isset($this->_data['id'])) {
$this->view->set('page_title', 'Edit CRM Activity');
}
// New activity from opportunity
if (isset($this->_data['opportunity_id'])) {
$this->view->set('page_title', 'New CRM Activity');
$opportunity = DataObjectFactory::Factory('Opportunity');
$opportunity->load($this->_data['opportunity_id']);
$this->_data['person_id'] = $opportunity->person_id;
$this->_data['company_id'] = $opportunity->company_id;
}
parent::_new();
}
示例4: getComponentId
static function getComponentId($_module_name, $_component_name)
{
$module = ModuleObject::getModule($_module_name);
$modulecomponent = DataObjectFactory::Factory(__CLASS__);
$modulecomponent->loadBy(array('name', 'module_id'), array($_component_name, $module->id));
return $modulecomponent->id;
}
示例5: __construct
public function __construct($module = null, $action = null)
{
parent::__construct($module, $action);
$this->_templateobject = DataObjectFactory::Factory('Personaddress');
$this->uses($this->_templateobject);
$this->related['person'] = array('clickaction' => 'edit');
}
示例6: workSchedules
public static function workSchedules($search_data = null, &$errors, $defaults = null)
{
$search = new EngineeringSearch($defaults);
// Search on Job Number
$search->addSearchField('job_no', 'job_number', 'equal');
// Search on Job Number
$search->addSearchField('description', 'description', 'contains');
// Search on Status
$search->addSearchField('status', 'status', 'multi_select', array('A'));
$project = DataObjectFactory::Factory('WorkSchedule');
$options = array('' => 'All');
$statuses = $project->getEnumOptions('status');
$options += $statuses;
$search->setOptions('status', $options);
// Search on Work Centre
$search->addSearchField('centre_id', 'centre', 'select', '', 'advanced');
$centre = DataObjectFactory::Factory('MFCentre');
$centres = $centre->getAll();
$options = array('' => 'all');
$options += $centres;
$search->setOptions('centre_id', $options);
// Search on Downtime Code
$search->addSearchField('mf_downtime_code_id', 'Downtime Code', 'select', '', 'advanced');
$downtimecode = DataObjectFactory::Factory('MFDowntimeCode');
$downtimecodes = $downtimecode->getAll();
$options = array('' => 'all');
$options += $downtimecodes;
$search->setOptions('mf_downtime_code_id', $options);
$search->setSearchData($search_data, $errors, workSchedules);
return $search;
}
示例7: getObjectPolicyValue
function getObjectPolicyValue()
{
$policy_detail = DataObjectFactory::Factory('SystemObjectPolicy');
$policy_detail->load($this->object_policies_id);
$policy_value = $policy_detail->getComponentTitle() . ' ' . prettify($policy_detail->get_field()) . ' ' . $policy_detail->getFormatted('operator') . ' ' . $policy_detail->getvalue();
return $policy_value;
}
示例8: useDefault
public static function useDefault($search_data = null, &$errors = array(), $defaults = null)
{
$search = new poauthlimitsSearch($defaults);
// Search by Person
$search->addSearchField('username', 'Person', 'select', '');
$people = DataObjectFactory::Factory('Usercompanyaccess');
$people->idField = 'username';
$people->identifierField = 'username';
$people->orderby = 'username';
$options = array('0' => 'All');
$cc = new ConstraintChain();
$cc->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$peoplelist = $people->getAll($cc);
$options += $peoplelist;
$search->setOptions('username', $options);
// Search by GL Centre
$search->addSearchField('glcentre_id', 'GL Centre', 'select', 0);
$options = array('0' => 'All');
$centres = DataObjectFactory::Factory('GLCentre');
$centrelist = $centres->getAll();
$options += $centrelist;
$search->setOptions('glcentre_id', $options);
$search->setSearchData($search_data, $errors);
return $search;
}
示例9: getCentres
public function getCentres()
{
$mf_centre = DataObjectFactory::Factory('MFCentre');
$cc = new ConstraintChain();
$cc->add(new Constraint('production_recording', 'is', 'true'));
return $mf_centre->getAll($cc);
}
示例10: 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;
}
示例11: 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;
}
示例12: useDefault
public static function useDefault($search_data = null, &$errors = array(), $defaults = null)
{
$search = new pinvoicesSearch($defaults);
$invoice = DataObjectFactory::Factory('PInvoice');
// Search by Customer
$search->addSearchField('plmaster_id', 'Supplier', 'select', 0, 'advanced');
$supplier = DataObjectFactory::Factory('PLSupplier');
$options = array('0' => 'All');
$suppliers = $supplier->getAll(null, false, true, '', '');
$options += $suppliers;
$search->setOptions('plmaster_id', $options);
// Search by Invoice Number
$search->addSearchField('invoice_number', 'invoice_number', 'equal', '', 'advanced');
// Search by Invoice Number
$search->addSearchField('ext_reference', 'supplier_reference begins', 'begins', '', 'advanced');
// Search by Purchase Order Number
$search->addSearchField('purchase_order_number', 'PO Number', 'equal', '', 'advanced');
// Search by Invoice Date
$search->addSearchField('invoice_date', 'invoice_date_between', 'between', '', 'basic');
// Search by Transaction Type
$search->addSearchField('transaction_type', 'transaction_type', 'select', '', 'advanced');
$options = array_merge(array('' => 'All'), $invoice->getEnumOptions('transaction_type'));
$search->setOptions('transaction_type', $options);
// Search by Status
$search->addSearchField('status', 'status', 'select', '', 'advanced');
$options = array_merge(array('' => 'All'), $invoice->getEnumOptions('status'));
$search->setOptions('status', $options);
$search->setSearchData($search_data, $errors);
return $search;
}
示例13: view_allocations
public function view_allocations()
{
$flash = Flash::Instance();
$collection = new SLTransactionCollection($this->_templateobject);
$this->_templateobject->setAdditional('payment_value', 'numeric');
$allocation = DataObjectFactory::Factory('SLAllocation');
$allocationcollection = new SLAllocationCollection($allocation);
$collection->_tablename = $allocationcollection->_tablename;
$sh = $this->setSearchHandler($collection);
$fields = array("our_reference||'-'||transaction_type as id", 'customer', 'slmaster_id', 'transaction_date', 'transaction_type', 'our_reference', 'ext_reference', 'currency', 'gross_value', 'allocation_date');
$sh->setGroupBy($fields);
$fields[] = 'sum(payment_value) as payment_value';
$sh->setFields($fields);
if (isset($this->_data['trans_id'])) {
$allocation->identifierField = 'allocation_id';
$cc = new ConstraintChain();
$cc->add(new Constraint('transaction_id', '=', $this->_data['trans_id']));
$alloc_ids = $allocation->getAll($cc);
if (count($alloc_ids) > 0) {
$sh->addConstraint(new Constraint('allocation_id', 'in', '(' . implode(',', $alloc_ids) . ')'));
} else {
$flash->addError('Error loading allocation');
sendBack();
}
}
parent::index($collection, $sh);
$this->view->set('collection', $collection);
$this->view->set('invoice_module', 'sales_invoicing');
$this->view->set('invoice_controller', 'sinvoices');
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'slcustomers');
$this->view->set('linkvaluefield', 'slmaster_id');
}
示例14: 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';
}
示例15: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
$partyaddress = $this->_uses[$this->modeltype];
if (!empty($this->_data[$this->modeltype][$partyaddress->idField])) {
// This is an update to an existing party address/address
// so check if the address is used by other parties
// - update it if address is only used by this party
// - insert it if the current address is used by other parties and it does not already exist
// - otherwise, no need to do anything here (but see below)
if ($partyaddress->load($this->_data[$this->modeltype][$partyaddress->idField])) {
$partyaddress->checkAddress($this->_data);
} else {
$errors[] = 'Error loading current Address details ' . $db->errorMsg();
}
}
if (isset($this->_data['Address'])) {
// Check if this address exists; if it does, point the PartyAddress to it
// and remove the input address as it does not need inserting/updating
$address = DataObjectFactory::Factory('Address');
$address->check_exists($this->_data['Address']);
if ($address->isLoaded()) {
unset($this->_data['Address']);
$this->_data[$this->modeltype]['address_id'] = $address->{$address->idField};
}
}
if (count($errors) == 0 && parent::save($this->modeltype)) {
sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
} else {
$flash->addErrors($errors);
$this->refresh();
}
}