Example #1
0
 public function createSchema()
 {
     $data = $this->_data;
     if (isset($data['cancel'])) {
         $this->view->set('info_message', 'Database creation cancelled');
         sendTo($this->name, 'index', $this->_modules);
     }
     if (isset($data['createdb']) && isset($data['Schema'])) {
         set_config('DB_TYPE', $data['Schema']['database_type']);
         set_config('DB_USER', $data['Schema']['database_admin_username']);
         set_config('DB_HOST', $data['Schema']['database_host']);
         set_config('DB_PASSWORD', $data['Schema']['database_admin_password']);
         set_config('DB_CREATE', true);
         $db = DB::Instance();
         if ($db === null) {
             echo 'Unable to connect to database<br>';
         }
         $dict = NewDataDictionary($db);
         $sql = $dict->CreateDatabase($data['Schema']['database_name']);
         $result = $dict->ExecuteSQLArray($sql);
         if ($result != 2) {
             $this->view->set('message', $db->ErrorMsg());
             $this->setTemplateName('systemerror');
             $this->view->set('page_title', $this->getPageName('Creation Error', 'Database'));
         } else {
             $this->view->set('message', 'Database created');
             $this->setTemplateName('systemerror');
             $this->view->set('page_title', $this->getPageName('Created', 'Database'));
         }
     }
 }
Example #2
0
 public function view()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $id = $this->_data['id'];
     $transaction = $this->_uses[$this->modeltype];
     if ($transaction->bins->count() > 0) {
         sendTo('WHBins', 'index', $this->_modules, array('whlocation_id' => $this->_data['id']));
     }
     $this->view->set('transaction', $transaction);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array('modules' => $this->_modules, 'controller' => 'WHStores', 'action' => 'index'));
     $sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $transaction->whstore, 'link' => array('modules' => $this->_modules, 'controller' => 'WHStores', 'action' => 'view', 'id' => $transaction->whstore_id));
     $sidebar->addList('Show', $sidebarlist);
     if ($transaction->isBalanceEnabled()) {
         $sidebarlist = array();
         $sidebarlist['balances'] = array('tag' => 'Show Stock Balances', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'viewBalances', 'id' => $id));
         $sidebar->addList('This Location', $sidebarlist);
     }
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('page_title', $this->getPageName('Location'));
 }
Example #3
0
 public function _new()
 {
     $flash = Flash::Instance();
     parent::_new();
     $gl_params = $this->_uses[$this->modeltype];
     $unassigned = $gl_params->unassignedParams();
     if (count($unassigned) > 0) {
         $this->view->set('unassigned', $unassigned);
     } elseif (count($unassigned) == 0 && $this->_data['action'] == 'new') {
         $flash->addMessage('All parameters have been assigned');
         sendTo($this->name, 'index', $this->_modules);
     } elseif ($this->_data['action'] == 'new') {
         $flash->addError('Error getting Parameter List');
         sendback();
     }
     if (isset($_POST[$this->modeltype]['paramdesc'])) {
         $this->selectlist($_POST[$this->modeltype]['paramdesc']);
     } elseif ($gl_params->isLoaded()) {
         $this->selectlist($gl_params->paramdesc);
         $this->view->set('selected', $gl_params->paramvalue_id);
     } else {
         $this->selectlist(key($unassigned));
     }
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['view'] = array('tag' => 'View Parameters', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')));
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #4
0
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $db = DB::Instance();
     $db->StartTrans();
     if (isset($this->_data['permission'])) {
         $permissions = $this->_data['permission'];
         unset($this->_data['permission']);
     } else {
         $permissions = array();
     }
     if (isset($this->_data['admin'])) {
         $admin = $this->_data['admin'];
         unset($this->_data['admin']);
     } else {
         $admin = array();
     }
     if (parent::save('Role')) {
         $role = $this->saved_model;
         if (isset($this->_data['Role']['users']) && is_array($this->_data['Role']['users'])) {
             $users = $this->_data['Role']['users'];
             Role::setUsers($role, $users, $errors);
             $flash->addErrors($errors);
         }
         if ($role->setPermissions($permissions, $errors) && $role->setAdmin($admin)) {
             $db->CompleteTrans();
             sendTo('Roles', 'index', array('admin'));
         }
     }
     //	$db->FailTrans();
     //	$db->CompleteTrans();
     $this->refresh();
 }
 public function save()
 {
     if (parent::save('EmployeeTrainingPlan')) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
 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();
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ComplaintVolume')) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
Example #9
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Address')) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     }
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('CSFailureCode')) {
         sendTo($this->name, 'index', $this->_modules);
     } else {
         $this->refresh();
     }
 }
 public function save()
 {
     if (parent::save('ProjectIssueLine')) {
         sendTo('projectissues', 'view', array('projects'), array('id' => $this->saved_model->header_id));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function index()
 {
     if (isset($this->_data['data_definition_id'])) {
         $other = array('id' => $this->_data['data_definition_id']);
     } else {
         $other = array();
     }
     sendTo('datadefinitions', 'view', $this->_modules, $other);
 }
Example #13
0
 public function delete()
 {
     parent::delete('ProjectNote');
     if (isset($this->_data['project_id'])) {
         sendTo('projects', 'view', array('projects'), array('id' => $this->_data['project_id']));
     } else {
         sendTo('projects', 'index', array('projects'), array('a' => 'b'));
     }
 }
Example #14
0
 public function save()
 {
     $errors = array();
     $file = File::Factory($_FILES['file'], $errors, new File());
     $file->save();
     $ticketAttachment = TicketAttachment::Factory(array('ticket_id' => $this->_data['ticket_id'], 'file_id' => $file->id), $errors, new TicketAttachment());
     $ticketAttachment->save();
     sendTo('Attachments', 'view', array('ticketing'), array('id' => $ticketAttachment->id));
 }
 public function delete()
 {
     $flash = Flash::Instance();
     if (!isModuleAdmin()) {
         $flash->addError('Sorry, must be a module admin to delete resource templates.');
         sendBack();
     }
     parent::delete('Resourcetemplate');
     sendTo('resourcetemplate', 'index', 'projects');
 }
Example #16
0
 public function createperiods()
 {
     $flash = Flash::Instance();
     $errors = array();
     periodHandling::createPeriods($errors);
     if (count($errors) > 0) {
         $flash->addErrors($errors);
     }
     sendTo($this->name, 'index', $this->_modules);
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ProjectIssueHeader')) {
         sendTo('projectissues', 'view', array('projects'), array('id' => $this->saved_model->id));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
Example #18
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Campaign')) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('CompanyPermission')) {
         sendTo('CompanyPermissions', 'index', array('admin'));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('MFWOStructure')) {
         sendTo('Mfworkorders', 'reviewMaterials', $this->_modules, array('id' => $this->_data['MFWOStructure']['work_order_id']));
     }
     $this->_data['work_order_id'] = $this->_data['MFWOStructure']['work_order_id'];
     $this->_data['ststructure_id'] = $this->_data['MFWOStructure']['ststructure_id'];
     $this->refresh();
 }
Example #21
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo('HasRoles', 'index', array('admin'));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
Example #22
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo($this->name, 'view', $this->_modules, array('id' => $this->_data['id']));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     if (!$this->checkParams($this->modeltype)) {
         sendBack();
     }
     if (!parent::save($this->modeltype)) {
         $this->refresh();
     }
     sendTo($this->name, 'index', $this->_modules);
 }
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     if (parent::save($this->modeltype, '', $errors)) {
         sendTo('workschedules', 'view', $this->_modules, array('id' => $this->saved_model->work_schedule_id));
     } else {
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
Example #25
0
function callRoot($api, $payload, &$error)
{
    // Get a random root node:
    $root = randomRoot();
    $sendError;
    // Send now:
    $result = sendTo($root['Endpoint'], $api, $payload, $sendError);
    // Update error if there was one:
    $error = $sendError;
    return $result;
}
Example #26
0
 public function save()
 {
     if (!$this->CheckParams($this->modeltype)) {
         sendBack();
     }
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     }
     $this->refresh();
 }
Example #27
0
 public function Saveuser()
 {
     $user = User::Factory($this->_data['User'], $errors);
     $flash = Flash::Instance();
     if ($success !== false) {
         $user->save();
         $flash->addMessage('User saved successfully');
         sendTo('admin');
     } else {
         $flash->addErrors($errors);
         $this->Newuser();
     }
 }
 public function save()
 {
     if (!$this->checkParams($this->modeltype)) {
         sendBack();
     }
     $errors = array();
     //		echo 'SystempolicycontrollistsController::save data<pre>'.print_r($this->_data, true).'</pre><br>';
     //		exit;
     if (count($errors) > 0 || !parent::save($this->modeltype)) {
         $this->refresh();
     }
     sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
 }
Example #29
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ARGroup')) {
         if (strtolower($this->_data['saveform']) == 'save') {
             sendTo($this->name, 'index', $this->_modules);
         } else {
             sendTo($this->name, 'new', $this->_modules);
         }
     } else {
         $this->refresh();
     }
 }
 public function delete()
 {
     $flash = Flash::instance();
     $event = $this->_templateobject;
     $event->load($this->_data['id']);
     if ($event->delete()) {
         $flash->addMessage('Event deleted successfully');
         sendTo('crmcalendars', 'index', $this->_modules);
     } else {
         $flash->addError('Failed to delete event');
         sendBack();
     }
 }