示例#1
0
 function populate()
 {
     $po_obj = new DataObject('po_no_auth_user');
     $po_obj->idField = 'id';
     $po_obj->identifierField = 'order_number';
     $po_col = new DataObjectCollection($po_obj);
     $po_col->setParams();
     $sh = new SearchHandler($po_col, false);
     $sh->setFields(array('id', 'order_number', 'supplier', 'status'));
     $sh->addConstraint(new Constraint('status', '!=', 'X'));
     $this->setSearchLimit($sh);
     $sh->setOrderby(array('order_date', 'due_date', 'order_number'));
     $po_col->load($sh);
     $this->contents = $po_col;
 }
示例#2
0
 function __construct($do = 'GLPeriod', $tablename = 'gl_periods')
 {
     parent::__construct($do, $tablename);
     $this->orderby = array('year', 'period');
     $this->direction = array('DESC', 'DESC');
     $this->_identifierField = 'year || \' - period \' || period';
 }
示例#3
0
 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);
 }
 function __construct($do = 'ProjectEquipment', $tablename = 'project_equipment_allocation_overview')
 {
     // Contruct the object
     parent::__construct($do, $tablename);
     // Set specific characteristics
     $this->identifierField = 'name';
     $this->orderby = array('start_date', 'equipment');
 }
示例#5
0
 public function save()
 {
     $flash = Flash::Instance();
     if (strtolower($this->_data['saveform']) == 'cancel') {
         $flash->addMessage('Action cancelled');
         sendTo($this->name, 'index', $this->_modules);
     }
     $errors = array();
     $db = DB::Instance();
     $db->StartTrans();
     $header_data = $this->_data['WHTransfer'];
     $lines_data = array();
     if (isset($this->_data['WHTransferLine'])) {
         $lines_data = $this->_data['WHTransferLine'];
         $lines_data = DataObjectCollection::joinArray($lines_data);
     } else {
         $errors[] = 'No Transfer Lines entered';
     }
     if (isset($header_data['id']) && $header_data['id'] != '') {
         $action = 'updated';
         // delete any lines not submitted
         $update = array();
         foreach ($lines_data as $line) {
             $update[$line['id']] = $line['id'];
         }
         $whtransfer = new WHTransfer();
         $whtransfer->load($header_data['id']);
         if ($whtransfer) {
             foreach ($whtransfer->transfer_lines as $line) {
                 if (!isset($update[$line->id])) {
                     $whtransferline = new WHTransferline();
                     $whtransferline->delete($line->id);
                 }
             }
         }
     } else {
         $action = 'added';
     }
     $whtransfer = WHTransfer::Factory($header_data, $lines_data, $errors);
     if ($whtransfer && count($errors) == 0) {
         $whtransfer->save($errors);
     }
     if (count($errors) == 0 && $db->CompleteTrans()) {
         $flash->addMessage('Transfer Number ' . $whtransfer->transfer_number . ' ' . $action . ' successfully');
         sendTo($this->name, 'index', $this->_modules);
     } else {
         $db->FailTrans();
         $flash->addErrors($errors);
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
示例#6
0
 public function __construct(DataObjectCollection $collection, $use_session = TRUE, $use_system_company = TRUE, $search_id = '')
 {
     $tablename = $collection->getViewName();
     $this->tablename = $tablename;
     $this->use_session = $use_session;
     $this->search_id = $search_id;
     $this->constraints = new ConstraintChain();
     $this->use_system_company = $use_system_company;
     $this->setOrderby($collection->orderby, $collection->direction);
     if (strpos($tablename, ' ')) {
         $this->tablename = substr($tablename, strrpos($tablename, ' ') + 1);
     }
     $cache_id = array('searches', EGS_USERNAME, $this->tablename . '_' . $this->search_id);
     $cache = Cache::Instance();
     $cached_search = $cache->get($cache_id, 1800);
     if ($this->use_session && $cached_search !== FALSE) {
         foreach ($cached_search as $key => $val) {
             if ($key == 'constraints' || $key == 'fields') {
                 $this->{$key} = unserialize($val);
             } else {
                 $this->{$key} = $val;
             }
         }
         debug('SearchHandler::__construct ' . $tablename . ' ' . print_r($this, TRUE));
         //			echo 'SearchHandler::__construct<pre>'.print_r($this, true).'</pre>';
     } elseif ($this->use_system_company) {
         //if usercompanyid is a field, then it's always a constraint
         // TODO: Need to revisit this;
         //       gets added in DataObject(?)/DataObjectCollection(?)
         //       if the search is access controlled
         $model = $collection->getModel();
         if ($model->isField('usercompanyid')) {
             $this->constraints = new ConstraintChain();
             $this->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
         }
     }
     $this->collection = $collection;
 }
 public function save()
 {
     if (!$this->CheckParams($this->modeltype)) {
         sendBack();
     }
     if (!empty($this->_data['MFDowntimeCode']['id'])) {
         $mfdowntimecode = $this->_uses[$this->modeltype];
         $mfdowntimecode->load($this->_data['MFDowntimeCode']['id']);
         if ($mfdowntimecode->isLoaded()) {
             foreach ($mfdowntimecode->mf_centres as $mfcentredowntimecode) {
                 $mfcentredowntimecode->delete();
             }
         }
     }
     if (isset($this->_data['MFCentreDowntimeCode'])) {
         $mfcentredowntimecode = DataObjectCollection::joinarray($this->_data['MFCentreDowntimeCode']);
         unset($this->_data['MFCentreDowntimeCode']);
         foreach ($mfcentredowntimecode as $key => $data) {
             $this->_data[$key]['MFCentreDowntimeCode'] = $data;
         }
     }
     parent::save();
 }
示例#8
0
 function __construct($do = 'GLParams', $tablename = 'gl_params')
 {
     parent::__construct($do, $tablename);
     $this->_identifierField = "paramvalue";
 }
示例#9
0
 function __construct($do = 'PLPayment', $tablename = 'pl_payments_overview')
 {
     parent::__construct($do, $tablename);
 }
示例#10
0
 function __construct($do = 'ComplaintType')
 {
     parent::__construct($do);
 }
示例#11
0
 function __construct($do = 'TicketCategory')
 {
     parent::__construct($do);
 }
示例#12
0
 function __construct($do = 'MFResource')
 {
     parent::__construct($do);
 }
示例#13
0
 function __construct($do = 'SLAllocation', $tablename = 'sl_allocation_details_overview')
 {
     parent::__construct($do, $tablename);
 }
 function __construct($do = 'MFOutsideOperation', $tablename = 'mf_outside_opsoverview')
 {
     parent::__construct($do, $tablename);
 }
示例#15
0
 function __construct($do = 'Permission', $tablename = 'permissions')
 {
     parent::__construct($do, $tablename);
     $this->orderby = 'position';
 }
示例#16
0
 function __construct($do = 'TaskResource', $tablename = 'task_resources_overview')
 {
     parent::__construct($do, $tablename);
 }
示例#17
0
 function __construct($do = 'GLTransaction', $tablename = 'gltransactionsoverview')
 {
     parent::__construct($do, $tablename);
     $this->orderby = array('glperiod', 'account', 'cost_centre');
 }
示例#18
0
 function __construct($do = 'resourcetype')
 {
     parent::__construct($do);
 }
 function __construct($do = 'Opportunitytype')
 {
     parent::__construct($do);
 }
示例#20
0
 function __construct($do = 'CompanyRole', $tablename = 'companyrolesoverview')
 {
     parent::__construct($do, $tablename);
 }
示例#21
0
 function __construct($do = 'TicketResponse')
 {
     parent::__construct($do);
 }
 function __construct($do = 'SInvoiceLine', $tablename = 'customer_service')
 {
     parent::__construct($do, $tablename);
     $this->orderby = array('product_group', 'customer', 'stitem', 'due_despatch_date');
     $this->direction = array('ASC', 'ASC', 'ASC', 'DESC');
 }
示例#23
0
 function __construct($do = 'SOrder', $tablename = 'so_headeroverview')
 {
     parent::__construct($do, $tablename);
     $this->view = '';
 }
 function __construct($do = 'Usercompanyaccess', $tablename = 'user_company_accessoverview')
 {
     parent::__construct($do, $tablename);
 }
示例#25
0
 function __construct($do = 'TaxStatus')
 {
     parent::__construct($do);
     //		$this->_tablename="tax_statusesoverview";
 }
 function __construct($do = 'TicketReleaseVersion', $tablename = 'ticket_release_versions')
 {
     parent::__construct($do, $tablename);
 }
示例#27
0
 function __construct($do = 'DatasetField')
 {
     parent::__construct($do);
     $this->orderby = 'position';
 }
示例#28
0
 function __construct($do = 'Hour', $tablename = 'hoursoverview')
 {
     parent::__construct($do, $tablename);
 }
示例#29
0
 function __construct($do = 'ReportPart')
 {
     parent::__construct($do);
     $this->title = 'Report Parts';
 }
示例#30
0
 function __construct($do = 'Contactmethod')
 {
     parent::__construct($do);
 }