-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
513 changed files
with
147,258 additions
and
3,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
@@ -56,7 +56,7 @@ public function update_config() | |
{ | ||
|
||
// must be an admin to access this function | ||
if ($this->user->user_admin != 'y') { | ||
if ($this->user->admin != 'y') { | ||
if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] > "") { | ||
redirect($_SERVER['HTTP_REFERER']); | ||
} else { | ||
|
@@ -83,7 +83,7 @@ public function update_config() | |
$config_value = ''; | ||
} | ||
|
||
$this->m_oa_config->update_config($config_name, $config_value, $this->user->user_id, date('Y-m-d H:i:s')); | ||
$this->m_oa_config->update_config($config_name, $config_value, $this->user->id, date('Y-m-d H:i:s')); | ||
|
||
if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] > "") { | ||
redirect($_SERVER['HTTP_REFERER']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
@@ -50,6 +50,7 @@ public function index() | |
|
||
public function activate_group() | ||
{ | ||
$log_details = new stdClass(); | ||
if ($handle = opendir(BASEPATH.'../application/controllers/groups')) { | ||
$i = 0; | ||
$this->load->model("m_oa_group"); | ||
|
@@ -59,9 +60,14 @@ public function activate_group() | |
$file_handle = fopen(BASEPATH.'../application/controllers/groups/'.$file, "rb"); | ||
$contents = fread($file_handle, filesize(BASEPATH.'../application/controllers/groups/'.$file)); | ||
try { | ||
$xml = new SimpleXMLElement($contents); | ||
} catch (Exception $e) { | ||
echo $e; | ||
$xml = @new SimpleXMLElement($contents); | ||
} catch (Exception $error) { | ||
// $errors = libxml_get_errors(); | ||
// print_r($errors); | ||
$log_details->message = "Invalid XML for group in file " . BASEPATH.'../application/controllers/groups/'.$file; | ||
$log_details->file = 'system'; | ||
stdlog($log_details); | ||
continue; | ||
} | ||
$group_name = $xml->details->group_name; | ||
$group_icon = $xml->details->group_icon; | ||
|
@@ -312,6 +318,8 @@ public function process_add_group() | |
} | ||
if ($details->dynamic_other_table == 'sys_man_additional_fields' or $details->dynamic_other_table == 'sys_man_additional_fields_data') { | ||
$details->group_dynamic_select = "SELECT distinct(system.system_id) FROM ".$details->dynamic_other_table.$system_table." WHERE ".$details->dynamic_other_table.".system_id = system.system_id AND ".$details->dynamic_other_field." ".$condition." '".$like_wildcard.$selection.$like_wildcard."' AND system.man_status = 'production'"; | ||
} elseif ($details->dynamic_other_table == 'system') { | ||
$details->group_dynamic_select = "SELECT distinct(system.system_id) FROM system WHERE system.".$details->dynamic_other_field." ".$condition." '".$like_wildcard.$selection.$like_wildcard."' AND system.man_status = 'production'"; | ||
} else { | ||
$details->group_dynamic_select = "SELECT distinct(system.system_id) FROM ".$details->dynamic_other_table." LEFT JOIN system ON ".$details->dynamic_other_table.".system_id = system.system_id WHERE ".$details->dynamic_other_table.'.'.$details->dynamic_other_field." ".$condition." '".$like_wildcard.$selection.$like_wildcard."' AND system.man_status = 'production' AND ".$details->dynamic_other_table.".current = 'y'"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
@@ -62,26 +62,26 @@ public function delete_location() | |
{ | ||
$this->load->model("m_oa_location"); | ||
$this->load->model("m_oa_group"); | ||
$location_id = $this->data['id']; | ||
$id = $this->data['id']; | ||
// Delete the group. | ||
$group_id = $this->m_oa_location->get_group_id($location_id); | ||
$group_id = $this->m_oa_location->get_group_id($id); | ||
$this->m_oa_group->delete_group($group_id); | ||
// Delete the location. | ||
$this->m_oa_location->delete_location($location_id); | ||
$this->m_oa_location->delete_location($id); | ||
redirect('admin_location/list_locations'); | ||
} | ||
|
||
public function delete_group() | ||
{ | ||
$this->load->model("m_oa_group"); | ||
$this->load->model("m_oa_location"); | ||
// We have the location_id, need to get the correct group_id | ||
$location_id = $this->data['id']; | ||
$group_id = $this->m_oa_location->get_group_id($location_id); | ||
// We have the location id, need to get the correct group id | ||
$id = $this->data['id']; | ||
$group_id = $this->m_oa_location->get_group_id($id); | ||
// Delete the group | ||
$this->m_oa_group->delete_group($group_id); | ||
// Update the oa_org by removing the group_id | ||
$this->m_oa_location->set_group_id($location_id, '0'); | ||
$this->m_oa_location->set_group_id($id, '0'); | ||
redirect('admin_location/list_locations'); | ||
} | ||
|
||
|
@@ -94,24 +94,24 @@ public function add_location() | |
$this->load->view('v_template', $this->data); | ||
} else { | ||
# process the form | ||
$details = new stdClass(); | ||
$location = new stdClass(); | ||
foreach ($_POST as $key => $value) { | ||
$details->$key = $value; | ||
$location->$key = $value; | ||
} | ||
$details->picture = ''; | ||
$location->picture = ''; | ||
$this->load->model("m_oa_location"); | ||
if (is_null($this->m_oa_location->get_location_id($details->location_name))) { | ||
if (is_null($this->m_oa_location->get_location_id($location->name))) { | ||
#location does not exist - good | ||
$details->location_id = $this->m_oa_location->add_location($details); | ||
$location->id = $this->m_oa_location->add_location($location); | ||
} else { | ||
$this->data['error_message'] = "Location Name already exists."; | ||
$this->data['heading'] = 'Add Location'; | ||
$this->data['include'] = 'v_add_location'; | ||
$this->load->view('v_template', $this->data); | ||
} | ||
if ($details->location_group == 'on') { | ||
if ($location->group == 'on') { | ||
# activate the group | ||
redirect('admin_location/activate_group/'.$details->location_id); | ||
redirect('admin_location/activate_group/'.$location->id); | ||
} else { | ||
redirect('admin_location/list_locations'); | ||
} | ||
|
@@ -123,28 +123,28 @@ public function activate_group() | |
# insert a matching Group | ||
$this->load->model("m_oa_location"); | ||
$this->load->model("m_oa_group"); | ||
$location_id = $this->data['id']; | ||
$location_name = $this->m_oa_location->get_location_name($location_id); | ||
$location_group_id = $this->m_oa_location->get_group_id($location_id); | ||
$id = $this->data['id']; | ||
$name = $this->m_oa_location->get_location_name($id); | ||
$group_id = $this->m_oa_location->get_group_id($id); | ||
$group = new stdClass(); | ||
$group->group_id = ''; | ||
$group->group_name = "Items in ".$location_name; | ||
$group->group_name = "Items in ".$name; | ||
$group->group_padded_name = ''; | ||
$group->group_description = "Items in ".$location_name; | ||
$group->group_description = "Items in ".$name; | ||
$group->group_icon = 'location'; | ||
$group->group_category = 'location'; | ||
$group->group_dynamic_select = "SELECT distinct(system.system_id) FROM system WHERE (system.man_location_id = '".$this->data['id']."' OR LOWER(system.sysLocation) LIKE LOWER('%".str_replace("'", "\'", $location_name)."%')) AND system.man_status = 'production'"; | ||
$group->group_dynamic_select = "SELECT distinct(system.system_id) FROM system WHERE (system.man_location_id = '".$id."' OR LOWER(system.sysLocation) LIKE LOWER('%".str_replace("'", "\'", $name)."%')) AND system.man_status = 'production'"; | ||
$group->group_parent = ''; | ||
$group->group_display_sql = ''; | ||
if (isset($location_group_id) and $location_group_id != '' and $location_group_id != '0') { | ||
if (!empty($group_id)) { | ||
# update an existing group | ||
$group->group_id = $location_group_id; | ||
$group->group_id = $group_id; | ||
$this->m_oa_group->update_group($group); | ||
} else { | ||
# insert a new group | ||
$group->group_id = $this->m_oa_group->insert_group($group); | ||
# update the oa_org with the correct group_id | ||
$this->m_oa_location->set_group_id($location_id, $group->group_id); | ||
$this->m_oa_location->set_group_id($id, $group->group_id); | ||
} | ||
|
||
# and now update the group contents | ||
|
@@ -195,15 +195,15 @@ public function add_locations() | |
$details[$attributes[$cell_number]] = $cell->getValue(); | ||
$cell_number++; | ||
} | ||
if ($details['location_name'] != '') { | ||
if ($location_id = $this->m_oa_location->get_location_id($details['location_name'])) { | ||
if ($details['name'] != '') { | ||
if ($location_id = $this->m_oa_location->get_location_id($details['name'])) { | ||
// we need to update an existing location | ||
$sql = "UPDATE oa_location SET "; | ||
foreach ($details as $detail => $value) { | ||
$sql .= $detail." = '".mysql_real_escape_string($value)."', "; | ||
} | ||
$sql = mb_substr($sql, 0, mb_strlen($sql)-2); | ||
$sql .= " WHERE location_name = '".mysql_real_escape_string($details['location_name'])."'"; | ||
$sql .= " WHERE name = '".mysql_real_escape_string($details['name'])."'"; | ||
} else { | ||
// this is a new location (we don't have a name match) | ||
$sql = "INSERT INTO oa_location ( "; | ||
|
@@ -236,14 +236,14 @@ public function add_locations() | |
$this->load->model("m_oa_location"); | ||
$xml = new SimpleXMLElement(utf8_encode(str_replace('&', '&', $_POST['form_systemXML']))); | ||
foreach ($xml->children() as $child) { | ||
if ($location_id = $this->m_oa_location->get_location_id($child->location_name)) { | ||
if ($location_id = $this->m_oa_location->get_location_id($child->name)) { | ||
# we need to update an existing location | ||
$sql = "UPDATE oa_location SET "; | ||
foreach ($child->children() as $detail) { | ||
$sql .= $detail->getName()." = '".$detail."', "; | ||
} | ||
$sql = mb_substr($sql, 0, mb_strlen($sql)-2); | ||
$sql .= " WHERE location_name = '".$child->location_name."'"; | ||
$sql .= " WHERE name = '".$child->name."'"; | ||
} else { | ||
# this is a new location (we don't have a name match) | ||
$sql = "INSERT INTO oa_location ( "; | ||
|
@@ -258,7 +258,7 @@ public function add_locations() | |
$sql = mb_substr($sql, 0, mb_strlen($sql)-2); | ||
$sql .= ")"; | ||
} | ||
if ($child->location_name != '') { | ||
if ($child->name != '') { | ||
# run the query !!! | ||
$sql = '/* admin_location::add_locations */ ' . $sql; | ||
$query = $this->db->query($sql); | ||
|
@@ -285,22 +285,22 @@ public function edit_location() | |
# process the form | ||
$error = '0'; | ||
foreach ($_POST as $key => $value) { | ||
$details->$key = $value; | ||
$location->$key = $value; | ||
} | ||
$details->picture = ''; | ||
if ($this->m_oa_location->check_location_name($details->location_name, $details->location_id) == false) { | ||
$location->picture = ''; | ||
if ($this->m_oa_location->check_location_name($location->name, $location->id) == false) { | ||
$error = '1'; | ||
$this->data['error_message'] = "Location name already exists."; | ||
$this->data['location'] = $this->m_oa_location->get_location($details->location_id); | ||
$this->data['location'] = $this->m_oa_location->get_location($location->id); | ||
$this->data['heading'] = 'Edit Location'; | ||
$this->data['include'] = 'v_edit_location'; | ||
$this->load->view('v_template', $this->data); | ||
} | ||
|
||
if ($error == '0') { | ||
$this->m_oa_location->edit_location($details); | ||
if ($_POST['location_group'] == 'on') { | ||
redirect('admin_location/activate_group/'.$_POST['location_id']); | ||
$this->m_oa_location->edit_location($location); | ||
if ($_POST['group'] == 'on') { | ||
redirect('admin_location/activate_group/'.$_POST['id']); | ||
} else { | ||
redirect('admin_location/list_locations'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
/** | ||
* @author Mark Unwin <[email protected]> | ||
* | ||
* @version 1.12.4 | ||
* @version 1.12.6 | ||
* | ||
* @copyright Copyright (c) 2014, Opmantek | ||
* @license http://www.gnu.org/licenses/agpl-3.0.html aGPL v3 | ||
|
@@ -141,9 +141,7 @@ public function add_orgs() | |
$group->group_padded_name = ''; | ||
$group->group_icon = 'contact-new'; | ||
$group->group_category = 'owner'; | ||
$group->group_dynamic_select = "SELECT distinct(system.system_id) FROM | ||
system WHERE system.man_org_id = '".$group->org_id."' | ||
AND system.man_status = 'production'"; | ||
$group->group_dynamic_select = "SELECT distinct(system.system_id) FROM system WHERE system.man_org_id = '".$group->org_id."' AND system.man_status = 'production'"; | ||
$group->group_parent = ''; | ||
$group->group_display_sql = ''; | ||
$this->m_oa_group->insert_group($group); | ||
|
@@ -260,7 +258,7 @@ public function activate_group() | |
$group->group_padded_name = ''; | ||
$group->group_description = $org_name." owned items"; | ||
$group->group_icon = 'contact'; | ||
$group->group_category = 'owner'; | ||
$group->group_category = 'org'; | ||
$group->group_dynamic_select = "SELECT distinct(system.system_id) FROM system WHERE system.man_org_id = '".$this->data['id']."' AND system.man_status = 'production'"; | ||
$group->group_parent = ''; | ||
$group->group_display_sql = ''; | ||
|
@@ -294,9 +292,9 @@ public function add_org() | |
foreach ($_POST as $key => $value) { | ||
$details->$key = $value; | ||
} | ||
if (is_null($this->m_oa_org->select_org($details->org_name))) { | ||
if (is_null($this->m_oa_org->select_org($details->name))) { | ||
#org does not exist - good | ||
$details->org_id = $this->m_oa_org->add_org($details); | ||
$details->id = $this->m_oa_org->add_org($details); | ||
} else { | ||
$this->data['error_message'] = "Organisation name already exists."; | ||
$this->data['heading'] = 'Add Organisation'; | ||
|
@@ -330,10 +328,10 @@ public function edit_org() | |
foreach ($_POST as $key => $value) { | ||
$details->$key = $value; | ||
} | ||
if ($this->m_oa_org->check_org_name($details->org_name, $details->org_id) == false) { | ||
if ($this->m_oa_org->check_org_name($details->name, $details->id) == false) { | ||
$error = '1'; | ||
$this->data['error_message'] = "Organisation name already exists."; | ||
$this->data['org'] = $this->m_oa_org->get_org_details($details->org_id); | ||
$this->data['org'] = $this->m_oa_org->get_org_details($details->id); | ||
$this->data['heading'] = 'Edit Organisation'; | ||
$this->data['include'] = 'v_edit_org'; | ||
$this->load->view('v_template', $this->data); | ||
|
Oops, something went wrong.