public function _new() { parent::_new(); // work_order_id is set for adding a new structure // otherwise id is set, which is the id of the structure element $uom_list = array(); $wostructure = $this->_uses[$this->modeltype]; if (isset($this->_data['work_order_id'])) { $work_order_id = $this->_data['work_order_id']; $stitem_id = key($items_list); $uom_id = ''; } elseif ($wostructure->isLoaded()) { $work_order_id = $wostructure->work_order_id; $stitem_id = $wostructure->ststructure_id; $uom_id = $wostructure->uom_id; } if (isset($this->_data['ststructure_id'])) { $stitem_id = $this->_data['ststructure_id']; } $stitem = new STItem(); $stitem->load($stitem_id); $items_list = STItem::nonObsoleteItems(); if (!isset($items_list[$stitem_id])) { $items_list += array($stitem->id => $stitem->getIdentifierValue() . '(Obsolete)'); } $this->view->set('ststructures', $items_list); $uom_id = empty($uom_id) ? $stitem->uom_id : $uom_id; $this->view->set('uom_id', $uom_id); $uom_list = $stitem->getUomList(); if (isset($work_order_id)) { $this->view->set('elements', self::showParts($work_order_id)); $this->view->set('no_ordering', true); } $this->view->set('uom_list', $uom_list); }
public function _new() { parent::_new(); $resource = $this->_uses[$this->modeltype]; $db = DB::Instance(); if ($resource->isLoaded()) { $this->_data['work_schedule_id'] = $resource->work_schedule_id; $this->view->set('workschedule', $resource->work_schedule_detail); } elseif (isset($this->_data['work_schedule_id'])) { $resource->work_schedule_id = $this->_data['work_schedule_id']; $this->view->set('workschedule', $resource->work_schedule_detail); } else { $workschedule = DataObjectFactory::Factory('WorkSchedule'); $cc = new ConstraintChain(); $cc->add(new Constraint('status', '!=', $workschedule->completedStatus())); $cc->add(new Constraint('status', '!=', $workschedule->cancelledStatus())); $this->view->set('workschedules', $workschedule->getAll($cc)); } $person = DataObjectFactory::Factory('Person'); $cc = new ConstraintChain(); $cc->add(new Constraint('company_id', '=', COMPANY_ID)); $this->view->set('people', $person->getAll($cc)); $resources = new EngineeringResourceCollection($this->_templateobject); $sh = $this->setSearchHandler($resources); $sh->addConstraint(new Constraint('work_schedule_id', '=', $resource->work_schedule_id)); parent::index($resources, $sh); $this->view->set('clickaction', 'edit'); }
public function _new() { parent::_new(); // For new actions the stitem_id and from_uom_id will be set // For edit actions, the id will be set pointing to the uom conversion to be edited if ($this->_data['action'] == 'edit') { $stuom = $this->_uses[$this->modeltype]; $stitem_id = $stuom->stitem_id; $stitem_uom_id = $stuom->from_uom_id; $stitem_uom_name = $stuom->from_uom_name; } else { $stitem = new STitem(); $stitem->load($this->_data['stitem_id']); $stitem_id = $stitem->id; $stitem_uom_id = $stitem->uom_id; $stitem_uom_name = $stitem->uom_name; } $this->view->set('stitem_id', $stitem_id); $this->view->set('stitem_uom_id', $stitem_uom_id); $this->view->set('stitem_uom_name', $stitem_uom_name); $this->view->set('stitem', Stuomconversion::getStockItem($stitem_id)); $elements = new STuomconversionCollection(new STuomconversion()); $sh = new SearchHandler($elements, false); $sh->extract(); $sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id)); $sh->setOrderBy('from_uom_name'); $sh->extractOrdering(); $sh->extractPaging(); $elements->load($sh); $this->view->set('elements', $elements); $this->view->set('no_ordering', true); }
public function _new() { $flash = Flash::Instance(); // ensure that a project id is specified for new notes if ($this->_data['action'] === 'new' && (!isset($this->_data['project_id']) || empty($this->_data['project_id']))) { $flash->addError('No project id specified'); sendBack(); } parent::_new(); // load either a new project or the current note model to get the project name and id if ($this->_data['action'] === 'new') { $project = new Project(); $project->load($this->_data['project_id']); $project_name = $project->name; $project_id = $project->id; } else { $model = $this->_uses[$this->modeltype]; $project_name = $model->project; $project_id = $model->project_id; } $sidebar = new SidebarController($this->view); $sidebar->addList('Project', array('view_project' => array('tag' => $project_name, 'link' => array('module' => 'projects', 'controller' => 'projects', 'action' => 'view', 'id' => $project_id)))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function _new() { parent::_new(); $this->setTemplateName('calls_new'); $projects = $opportunities = $activities = null; if (isset($this->_data['person_id'])) { $person = new Person(); $person->load($this->_data['person_id']); $this->_data['company_id'] = $person->company_id; $projects = $person->projects; $opportunities = $person->opportunities; $activities = $person->activities; $this->view->set('person', $person->fullname); } if (isset($this->_data['company_id'])) { $company = new Company(); $company->load($this->_data['company_id']); $projects = DataObjectCollection::Merge($company->projects, $projects); $opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities); $activities = DataObjectCollection::Merge($company->activities, $activities); $this->view->set('company', $company->name); } if (isset($this->_data['project_id'])) { $project = new Project(); $project->load($this->_data['project_id']); $this->_data['company_id'] = $project->company_id; } $this->view->set('projects', $projects); $this->view->set('opportunities', $opportunities); $this->view->set('activities', $activities); }
public function _new() { parent::_new(); $role = $this->_uses['Role']; $users = DataObjectFactory::Factory('User'); $this->view->set('users', $users->getActive()); $companypermissions = DataObjectFactory::Factory('Companypermission'); $modulepermissions = $companypermissions->getAll(); // Note: If no company permissions have been defined ($modulepermissions is empty) // then all permissions will be displayed; i.e. default is to allow access to // all permissions if no company permissions override $permissions = new PermissionCollection(DataObjectFactory::Factory('Permission')); $this->view->set('items', $permissions->getPermissionTree($modulepermissions)); $this->view->set('permissions_tree', $this->getTemplateName('permissions_tree')); $sidebar = new SidebarController($this->view); $sidebar->addList('Actions', array('viewall' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name), 'tag' => 'View All Roles'))); if ($role->isLoaded()) { $hasrole = DataObjectFactory::Factory('hasRole'); $this->view->set('current_users', $hasrole->getUsers($role->{$role->idField})); $this->view->set('current', $role->getPermissions()); $sidebar->addList('Actions', array('View' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $role->{$role->idField}), 'tag' => 'View "' . $role->getIdentifierValue() . '" role"'))); } else { $this->view->set('current', array()); } $this->view->register('sidebar', $sidebar); $this->view->set('clickaction', 'view'); $this->view->set('sidebar', $sidebar); }
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')); }
public function _new() { $resource = $this->_uses[$this->modeltype]; if (!$resource->isLoaded()) { if (empty($this->_data['project_id'])) { $project = new Project(); $projects = $project->getAll(); $project_id = key($projects); } else { $project_id = $this->_data['project_id']; } $this->view->set('project_id', $project_id); $tasks = $this->getTaskList($project_id); $dates = $this->getStartEndDate($project_id); $this->view->set('start_date', $dates['start_date']['data']); $this->view->set('end_date', $dates['end_date']['data']); } else { $tasks = $this->getTaskList($resource->project_id); } $this->view->set('tasks', $tasks); $person = new Person(); $cc = new ConstraintChain(); $cc->add(new Constraint('company_id', '=', COMPANY_ID)); $this->view->set('people', $person->getAll($cc)); parent::_new(); }
public function _new() { parent::_new(); $policypermission = $this->_uses[$this->modeltype]; if ($policypermission->isLoaded()) { $this->_data['object_policies_id'] = $policypermission->object_policies_id; } }
public function _new() { parent::_new(); $sidebar = new SidebarController($this->view); $sidebar->addList('Actions', array('new' => array('link' => array('module' => $this->_modules['module'], 'controller' => $this->name, 'action' => 'index'), 'tag' => 'Return to Supplementary Complaint Codes'))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function _new() { // Set title when showing form after customer account stopped if ($this->_data['title'] == 'Account stopped') { $this->view->set('page_title', 'Enter reason for stopping account'); } parent::_new(); }
public function _new() { $flash = Flash::Instance(); // Get the Action $whaction = new WHAction(); $whactions = $whaction->getActions('T'); $this->view->set('transfer_actions', $whactions); // Display the New/Edit screen parent::_new(); }
public function _new() { parent::_new(); $access_list = $this->_uses[$this->modeltype]; $access_types = $access_list->getEnumOptions('access_type'); if (!$access_list->isLoaded()) { $access_list->access_type = key($access_types); } $this->view->set('access_types', $access_types); $this->view->set('options', $this->get_values($access_list->access_type)); }
public function _new() { if (ismoduleadmin()) { $employee = DataObjectFactory::Factory('Employee'); $employee->load($this->_data['employee_id']); $this->view->set('employee', $employee); parent::_new(); } else { $flash = Flash::Instance(); $flash->addError('You do not have permission to add a Holiday Extra Day!'); sendTo(); } }
public function _new() { parent::_new(); $projectequipmentallocation = $this->_uses[$this->modeltype]; $equipmentlist = $this->getOptions($this->_templateobject, 'project_equipment_id', 'getOptions', 'getOptions'); $data = isset($this->_data[$this->modeltype]) ? $this->_data[$this->modeltype] : array(); if (!empty($this->_data['project_id'])) { $data['project_id'] = $this->_data['project_id']; } if (!empty($this->_data['task_id'])) { $data['task_id'] = $this->_data['task_id']; } if (!empty($data['project_equipment_id'])) { // this is set if there has been error and we are redisplaying the screen $default_equipment = $this->_data['project_equipment_id']; } else { if (!$projectequipmentallocation->isLoaded()) { $default_equipment = $this->getDefaultValue($this->modeltype, 'project_equipment_id', ''); } else { $default_equipment = $projectequipmentallocation->project_equipment_id; } } if (empty($default_equipment)) { $default_equipment = key($equipmentlist); } $projectequipment = $this->getEquipmentDetail($default_equipment); $this->view->set('setup_charge', $projectequipment->setup_cost); $this->view->set('charge_rate', $projectequipment->hourly_cost); $project_id = !empty($this->_data['project_id']) ? $this->_data['project_id'] : ''; $task_id = !empty($this->_data['task_id']) ? $this->_data['task_id'] : ''; if (!$projectequipmentallocation->isLoaded()) { $projectequipmentallocation->project_equipment_id = $default_equipment; if (!empty($data['task_id']) && empty($data['project_id'])) { $task = new Task(); $task->load($data['task_id']); if ($task->isLoaded()) { $data['project_id'] = $projectequipmentallocation->project_id = $task->project_id; } } $projectequipmentallocation->project_id = $data['project_id']; $dates = $this->getStartEndDate($data['project_id'], $data['task_id']); $this->view->set('start_date', $dates['start_date']); $this->view->set('end_date', $dates['end_date']); } else { $dates['start_date'] = un_fix_date($projectequipmentallocation->start_date); $dates['end_date'] = un_fix_date($projectequipmentallocation->end_date); $project_id = $projectequipmentallocation->project_id; } $this->view->set('tasks', $this->getTaskList($project_id)); $this->getEquipmentAllocation($default_equipment, $dates['start_date'], $dates['end_date']); }
public function _new() { $flash = Flash::Instance(); parent::_new(); $ee_contract_detail = $this->_uses[$this->modeltype]; if ($ee_contract_detail->isLoaded()) { $this->_data['employee_id'] = $ee_contract_detail->employee_id; } if (!$this->checkParams('employee_id')) { $flash->addError('Invalid Data - no employee selected'); sendBack(); } $employee = DataObjectFactory::Factory('employee'); $employee->load($this->_data['employee_id']); if (!$employee->isLoaded()) { $flash->addError('Error loading employee details'); sendBack(); } if (!is_null($employee->finished_date) && $employee->finished_date < fix_date(date(DATE_FORMAT))) { $flash->addError('Employee has left'); sendBack(); } $collection = new EmployeeContractDetailCollection($this->_templateobject); $sh = $this->setSearchHandler($collection); $sh->addConstraint(new Constraint('employee_id', '=', $this->_data['employee_id'])); $this->view->set('clickaction', 'view'); parent::index($collection, $sh); if (!$ee_contract_detail->isLoaded()) { if ($collection->count() > 0) { $latest = $collection->current(); if (!is_null($latest->end_date)) { $ee_contract_detail->start_date = date(DATE_FORMAT, strtotime($latest->end_date . ' + 1 day')); } elseif ($start_date > fix_date(date(DATE_FORMAT))) { $ee_contract_detail->start_date = date(DATE_FORMAT, strtotime($latest->start_date . ' + 1 day')); } else { $ee_contract_detail->start_date = fix_date(date(DATE_FORMAT)); } } else { $ee_contract_detail->start_date = $employee->start_date; } $ee_contract_detail->end_date = $employee->finished_date; } if (!is_null($employee->finished_date) && $employee->finished_date < $start_date) { $flash->addError('Employee is leaving'); sendBack(); } }
public function _new() { $flash = Flash::Instance(); parent::_new(); if (isset($this->_data['ajax'])) { // only reason for ajaxing an edit is for dialog display unset($this->_data['ajax']); $ajax = true; if (isset($this->_data['dialog'])) { $this->view->set('dialog', true); } } // Get the Order Line Object - if loaded, this is an edit $expenseline = $this->_uses[$this->modeltype]; if (!$expenseline->isLoaded()) { if (empty($this->_data['expenses_header_id'])) { $flash->addError('No Expense Header supplied'); sendBack(); } $expenseline->expenses_header_id = $this->_data['expenses_header_id']; $this->view->set('awaitingAuth', TRUE); } else { $this->view->set('awaitingAuth', $expenseline->expense_header->awaitingAuthorisation()); } $expense = DataObjectFactory::Factory('Expense'); $expense->load($expenseline->expenses_header_id); $accounts = DataObjectFactory::Factory('GLAccount'); $accounts = $accounts->getAll(); $this->view->set('accounts', $accounts); if (isset($this->_data[$this->modeltype])) { // We've had an error so refresh the page $expenseline->line_number = $this->_data[$this->modeltype]['line_number']; $_glaccount_id = $this->_data[$this->modeltype]['glaccount_id']; $expenseline->currency = $expense->currency; } elseif ($expenseline->isLoaded()) { $_glaccount_id = $expenseline->glaccount_id; } else { $expenseline->currency = $expense->currency; $this->view->set('line_number', $expense->getNextLineNumber()); $_glaccount_id = key($accounts); } $this->view->set('centres', $this->getCentres($_glaccount_id)); $tax_rates = DataObjectFactory::Factory('TaxRate'); $tax_rates = $tax_rates->getAll(); $this->view->set('taxrates', $tax_rates); }
public function _new() { $flash = Flash::Instance(); parent::_new(); $ee_rate = $this->_uses[$this->modeltype]; if ($ee_rate->isLoaded()) { $this->_data['employee_id'] = $ee_rate->employee_id; $today = fix_date(date(DATE_FORMAT)); if ($ee_rate->start_date > $today) { $this->view->set('future_dated', TRUE); } elseif (!is_null($ee_rate->end_date) && $ee_rate->end_date <= $today) { $flash->addError('Editing this entry is not allowed'); sendBack(); } } if (!$this->checkParams('employee_id')) { $flash->addError('Invalid Data - no employee selected'); sendBack(); } $employee = DataObjectFactory::Factory('employee'); $employee->load($this->_data['employee_id']); if (!$employee->isLoaded()) { $flash->addError('Error loading employee details'); sendBack(); } if (!is_null($employee->finished_date) && $employee->finished_date < fix_date(date(DATE_FORMAT))) { $flash->addError('Employee has left'); sendBack(); } $pay_type = DataObjectFactory::Factory('EmployeePaymentType'); $payment_type_id = current(array_keys($pay_type->getAll())); $output = $this->getRateTypeData($employee, $payment_type_id); if (!$ee_rate->isLoaded()) { $ee_rate->start_date = $output['start_date']['data']; } if (!is_null($employee->finished_date)) { if (is_null($ee_rate->end_date) || $ee_rate->end_date > $employee->finished_date) { $ee_rate->end_date = $employee->finished_date; } } if (!is_null($employee->finished_date) && $employee->finished_date < $start_date) { $flash->addError('Employee is leaving'); sendBack(); } }
public function _new() { // $SystemcompanyCollection = new SystemcompanyCollection; // $this->view->set('options',$SystemcompanyCollection->getCompanies()); // $user = new User; // $this->view->set('users',$user->getAll()); $Systemcompany = new Systemcompany(); $users = $Systemcompany->getNonUsers(); $system = System::Instance(); if ($users) { $this->view->set('users', $users); } elseif (strtolower($system->action) != 'edit') { $flash = Flash::Instance(); $flash->addMessage('All users have been allocated to this company'); sendBack(); } parent::_new(); }
public function _new() { parent::_new(); $costcharge = $this->_uses[$this->modeltype]; if (!$costcharge->isLoaded()) { $costcharge->item_type = key($this->_templateobject->getEnumOptions('item_type')); $costcharge->source_type = key($this->_templateobject->getEnumOptions('source_type')); } if (isset($this->_data['project_id'])) { $costcharge->project_id = $this->_data['project_id']; } if (isset($this->_data['task_id'])) { $costcharge->task_id = $this->_data['task_id']; $task = new Task(); $task->load($this->_data['task_id']); $costcharge->project_id = $task->project_id; } if (!is_null($costcharge->project_id) && is_null($costcharge->task_id)) { $this->view->set('tasks', $this->getTaskList($costcharge->project_id)); } // switch ($costcharge->item_type) { // case 'PO': // $account=new PLSupplier(); // $this->view->set('account_type', 'Supplier'); // break; // case 'SI': // $account=new SLCustomer(); // $this->view->set('account_type', 'Customer'); // break; // } // $this->view->set('accounts', $account->getAll()); $sidebarlist['equipment_cost_charge'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_cost_charge', 'project_id' => $costcharge->project_id, 'task_id' => $costcharge->task_id, 'source_type' => 'E'), 'tag' => 'Equipment Usage'); $sidebarlist['resource_cost_charge'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_cost_charge', 'project_id' => $costcharge->project_id, 'task_id' => $costcharge->task_id, 'source_type' => 'R'), 'tag' => 'Timesheets'); $sidebarlist['expenses_cost_charge'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_cost_charge', 'project_id' => $costcharge->project_id, 'task_id' => $costcharge->task_id, 'source_type' => 'X'), 'tag' => 'Expenses'); $sidebarlist['material_cost_charge'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_cost_charge', 'project_id' => $costcharge->project_id, 'task_id' => $costcharge->task_id, 'source_type' => 'M'), 'tag' => 'Purchase Order'); $sidebar = new SidebarController($this->view); $sidebar->addList('Create Charge From', $sidebarlist); $sidebarlist = array(); $sidebarlist['budget_cost_charge'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new_cost_charge', 'project_id' => $costcharge->project_id, 'task_id' => $costcharge->task_id, 'source_type' => 'B'), 'tag' => 'Budget Cost'); $sidebar->addList('Create Cost From', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function _new() { parent::_new(); $header_id = FALSE; if ($this->_data['action'] === 'new') { $header = new ProjectIssueHeader(); $header->load($this->_data['header_id']); $header_id = $header->id; $header_title = $header->title; } else { $line = $this->_uses[$this->modeltype]; $line->load($this->_data['id']); $header_id = $line->header_id; $header_title = $line->header->title; } $sidebar = new SidebarController($this->view); $sidebar->addList('Issue', array('view_issue' => array('tag' => $header_title, 'link' => array('module' => 'projects', 'controller' => 'projectissues', 'action' => 'view', 'id' => $header_id)))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public function _new() { $flash = Flash::Instance(); parent::_new(); if (!empty($this->_data['work_schedule_id'])) { $workschedule = new WorkSchedule(); $workschedule->load($this->_data['work_schedule_id']); if ($workschedule->isLoaded()) { $this->view->set('workschedule', $workschedule); } } // TODO: parameterize this, and allow for multiple product groups $product = DataObjectFactory::Factory('POProductLineHeader'); $products = $product->getAll(); if (count($products) > 0) { $this->view->set('products', $products); } else { $flash->addError('No products found'); sendBack(); } }
public function _new() { parent::_new(); $budget = $this->_uses[$this->modeltype]; if (!$budget->isLoaded()) { if (!empty($this->_data['project_id'])) { $budget->project_id = $this->_data['project_id']; } $budget->budget_item_type = key($budget->getEnumOptions('budget_item_type')); } if (is_null($budget->project_id)) { $project = new Project(); $projects = $project->getAll(); $this->view->set('projects', $projects); $project_id = key($projects); } else { $project_id = $budget->project_id; } $this->view->set('tasks', $this->getTaskList($project_id)); $this->view->set('items', $this->getBudgetItemList($budget->budget_item_type)); }
public function _new() { $flash = Flash::Instance(); parent::_new(); $pay_period = $this->_uses[$this->modeltype]; if ($pay_period->isLoaded()) { $period_start_date = $pay_period->period_start_date; } else { // $pay_basis = key($pay_period->getEnumOptions('pay_basis')); // $pay_history->period_start_date = $period_start_date = $pay_period->getNextPeriodStart($pay_basis); // $pay_history->period_end_date = $this->getPeriodEndDate($pay_period->period_start_date, $pay_basis); $pay_period->getLatestPeriod(); if ($pay_period->isLoaded()) { $pay_period->{$pay_period->idField} = ''; $pay_period->period_start_date = $pay_period->period_end_date; $pay_period->period_end_date = $this->getPeriodEndDate($pay_period->period_start_date, $pay_period->pay_basis); $pay_period->tax_year = $pay_period->tax_year; $pay_period->tax_month = $pay_period->tax_month; $pay_period->tax_week = $pay_period->tax_week + 1; } } }
public function _new() { parent::_new(); $task = $this->_uses[$this->modeltype]; $project_id = ''; $task_id = ''; if (isset($this->_data['parent_id'])) { $parenttask = new Task(); $parenttask->load($this->_data['parent_id']); $project_id = $this->_data['project_id'] = $task->project_id = $parenttask->project_id; $task_id = $this->_data['parent_id']; } elseif (isset($this->_data['project_id'])) { $project_id = $this->_data['project_id']; } elseif ($task->isLoaded()) { $project_id = $task->project_id; $task_id = $task->id; } $this->view->set('readonly', false); if (!$task->isLoaded()) { $dates = $this->getStartEndDate($project_id, $task_id); $this->view->set('start_date', $dates['start_date']); $this->view->set('end_date', $dates['end_date']); } elseif (count($task->getChildren()) > 0) { $this->view->set('readonly', true); } $cc = new ConstraintChain(); $cc->add(new Constraint('milestone', '=', 'false')); if (isset($this->_data['id'])) { $cc->add(new Constraint('id', '<>', $this->_data['id'])); } if (!empty($project_id)) { $cc->add(new Constraint('project_id', '=', $project_id)); $this->_templateobject->project_id = $project_id; } $tasks = $task->getAll($cc); $this->view->set('parent_tasks', $tasks); }
public function _new() { parent::_new(); $holidayEntitlement = $this->_uses[$this->modeltype]; if ($holidayEntitlement->isLoaded()) { $employee_id = $holidayEntitlement->employee_id; } elseif ($this->_data['employee_id']) { $employee_id = $this->_data['employee_id']; } else { $flash = Flash::Instance(); $flash->addError('No employee selected'); sendBack(); } $employee = DataObjectFactory::Factory('Employee'); $employee->load($employee_id); $this->view->set('employee', $employee); $collection = new HolidayentitlementCollection($this->_templateobject); $sh = $this->setSearchHandler($collection); $sh->addConstraint(new Constraint('employee_id', '=', $employee_id)); parent::index($collection, $sh); if (!$holidayEntitlement->isLoaded()) { $holidayEntitlement->start_date = $holidayEntitlement->getNextStartDate($employee_id); } }
public function _new() { parent::_new(); $systempolicy = $this->_uses[$this->modeltype]; if ($systempolicy->isLoaded()) { $this->_data['module_components_id'] = $systempolicy->module_components_id; if (substr($systempolicy->value, -1) == ')') { $systempolicy->operator = $systempolicy->operator == 'IN' ? '=' : '!='; } } $module_component = DataObjectFactory::Factory('ModuleComponent'); $module_component->identifierField = 'title'; $module_component->orderby = 'title'; $cc = new ConstraintChain(); $cc->add(new Constraint('type', '=', 'M')); // Really need to identify the DataObject models $cc->add(new Constraint('name', 'not like', '%collection')); $cc->add(new Constraint('name', 'not like', '%search')); $components = $module_component->getAll($cc); if (isset($this->_data['module_components_id'])) { $module_component->load($this->_data['module_components_id']); } elseif (count($components) > 0) { $module_component->load(key($components)); } $this->view->set('components', $components); $fields = $this->get_fields($module_component); $key_field = array_search('key_field', $fields); if ($key_field !== FALSE) { $this->view->set('key_field', $key_field); } $this->view->set('fields', $fields); $current_field = is_null($systempolicy->fieldname) ? key($fields) : $systempolicy->fieldname; $output = $this->get_values($current_field, $module_components->id, $systempolicy->value); $this->view->set('operators', $output['operators']['data']); $this->view->set('input_value', $output['input_value']['data']); }
public function _new() { $flash = Flash::Instance(); parent::_new(); // Get the Order Line Object - if loaded, this is an edit $porderline = $this->_uses[$this->modeltype]; if (!$porderline->isLoaded()) { if (empty($this->_data['order_id'])) { $flash->addError('No Purchase Order supplied'); sendBack(); } $porderline->order_id = $this->_data['order_id']; $porderline->status = $porderline->newStatus(); } $porder = DataObjectFactory::Factory('POrder'); $porder->load($porderline->order_id); $_plmaster_id = $porder->plmaster_id; if (isset($this->_data[$this->modeltype])) { // We've had an error so refresh the page $_plmaster_id = $this->_data['POrder']['plmaster_id']; $porderline->line_number = $this->_data[$this->modeltype]['line_number']; $_product_search = $this->_data[$this->modeltype]['product_search']; if (!empty($this->_data[$this->modeltype]['productline_id'])) { $_productline_id = $this->_data[$this->modeltype]['productline_id']; } else { $_productline_id = ''; } $_glaccount_id = $this->_data[$this->modeltype]['glaccount_id']; } elseif ($porderline->isLoaded()) { // $_product_search=$porderline->description; $_productline_id = $porderline->productline_id; $_glaccount_id = $porderline->glaccount_id; } else { $_product_search = 'None'; $porderline->due_despatch_date = $porder->despatch_date; $porderline->due_delivery_date = $porder->due_date; } if ($porderline->lineAwaitingDelivery()) { $porderlines = new POrderLineCollection(); $porderlines->getAuthSummary($porder->id); if (EGS_USERNAME == $porder->checkAuthLimits($porderlines)) { $this->view->set('amend_qty', true); } } $display_fields = $porderline->getDisplayFields(); if (empty($_productline_id) && isset($display_fields['product_search'])) { if ($_product_search == 'None') { $productline_options = array('' => 'None'); } else { $productline_options = $this->getProductLines($_plmaster_id, $_product_search); } } else { $productline_options = $this->getProductLines($_plmaster_id); } if (empty($_productline_id)) { $_productline_id = key($productline_options); } $this->view->set('display_fields', $display_fields); $this->view->set('product_search', $_product_search); $this->view->set('productline_options', $productline_options); $data = $this->getProductLineData($_productline_id); $this->view->set('stuom_options', $data['stuom_id']); $this->view->set('glaccount_options', $data['glaccount_id']); if (empty($_glaccount_id)) { $_glaccount_id = key($data['glaccount_id']); } $this->view->set('glcentre_options', $this->getCentre($_glaccount_id, $_productline_id)); $this->view->set('taxrate_options', $data['tax_rate_id']); $this->view->set('porder', $porder); }
public function _new() { parent::_new(); $current_employee = $this->_uses[$this->modeltype]; $cc = new ConstraintChain(); $authoriser = DataObjectFactory::Factory('HRAuthoriser'); $this->view->set('authorisation_types', $authoriser->getEnumOptions('authorisation_type')); $cc1 = new ConstraintChain(); $cc2 = new ConstraintChain(); if ($current_employee->isLoaded()) { $this->view->set('person', $current_employee->person); $this->view->set('can_authorise', $authoriser->getTypesForEmployee($current_employee->{$current_employee->idField})); $this->view->set('expense_authorisers', $current_employee->getAuthorisers($current_employee->expense_model())); $this->view->set('holiday_authorisers', $current_employee->getAuthorisers($current_employee->holiday_model())); $cc1->add(new Constraint('employee_id', '<>', $current_employee->{$current_employee->idField})); $cc2->add(new Constraint('employee_id', '<>', $current_employee->{$current_employee->idField})); } $this->view->set('can_authorise_expenses', $authoriser->canAuthorise($cc1, $authoriser->expenses_type())); $this->view->set('can_authorise_holidays', $authoriser->canAuthorise($cc2, $authoriser->holidays_type())); // Get Current Employees by person_id=>name // Use person and list by hierarchy $person = DataObjectFactory::Factory('Person'); $cc = new ConstraintChain(); $cc->add(new Constraint('company_id', '=', COMPANY_ID)); $cc->add(new Constraint('id', 'IN ', '(select person_id from employees)')); $person->orderby = $person->identifierField = 'surname || \', \' || firstname'; $reports_to = $person->getAll($cc); $this->view->set('reports_to', $reports_to); // Get list of People who are not currently Employees // and are either current users or are not users $current_people = array('' => 'Select from list or enter new person below'); // Get list of people // 1) in current system company $cc = new ConstraintChain(); $cc->add(new Constraint('company_id', '=', COMPANY_ID)); // 2) who are not currently employees $cc->add(new Constraint('id', ' NOT IN ', '(select person_id from employees)')); // 3) who are still current $cc1 = new ConstraintChain(); $cc1->add(new Constraint('end_date', 'is', 'NULL')); $cc1->add(new Constraint('end_date', '>', fix_date(date(DATE_FORMAT))), 'OR'); $cc->add($cc1); $person->orderby = $person->identifierField = 'surname || \', \' || firstname'; $current_people += $person->getAll($cc, TRUE); $this->view->set('people', $current_people); $this->view->set('address', DataObjectFactory::Factory('address')); $addresses = $this->getAddresses($current_employee->person_id); $this->view->set('addresses', $addresses); }
public function add_response() { parent::_new(); $ticket = $this->_uses['Ticket']; $ticket->load($this->_data['id']); $ticketResponse = $this->_uses['TicketResponse']; $ticketResponse->ticket_id = $ticket->id; $responses = new TicketResponseCollection(new TicketResponse()); $sh = new SearchHandler($responses, false); $sh->AddConstraint(new Constraint('ticket_id', '=', $ticket->id)); $responses->load($sh); $this->view->set('responses', $responses->getContents()); }