mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2011-07-20 Tomas Palacios <tomas.palacios@artica.es>
* godmode/groups/modu_group_list.php: Fixed a bug regarding adition of module groups with a identical names. * godmode/agentes/planned_downtime.php: Fixed a bug regarding adition of planned downtimes with identical or blank "name" fields. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4596 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
62375eb291
commit
db8a398679
@ -96,6 +96,9 @@ if ($delete_downtime) {
|
|||||||
if ($create_downtime || $update_downtime) {
|
if ($create_downtime || $update_downtime) {
|
||||||
$description = (string) get_parameter ('description');
|
$description = (string) get_parameter ('description');
|
||||||
$name = (string) get_parameter ('name');
|
$name = (string) get_parameter ('name');
|
||||||
|
$check = db_get_value ('name', 'tplanned_downtime', 'name', $name);
|
||||||
|
$subcheck = db_get_value ('name', 'tplanned_downtime', 'id_group', $id_group);
|
||||||
|
|
||||||
$datetime_from = strtotime ($date_from.' '.$time_from);
|
$datetime_from = strtotime ($date_from.' '.$time_from);
|
||||||
$datetime_to = strtotime ($date_to.' '.$time_to);
|
$datetime_to = strtotime ($date_to.' '.$time_to);
|
||||||
|
|
||||||
@ -105,24 +108,44 @@ if ($create_downtime || $update_downtime) {
|
|||||||
else {
|
else {
|
||||||
$sql = '';
|
$sql = '';
|
||||||
if ($create_downtime) {
|
if ($create_downtime) {
|
||||||
$values = array(
|
if ($name) {
|
||||||
'name' => $name,
|
if (!$check) {
|
||||||
'description' => $description,
|
$values = array(
|
||||||
'date_from' => $datetime_from,
|
'name' => $name,
|
||||||
'date_to' => $datetime_to,
|
'description' => $description,
|
||||||
'id_group' => $id_group,
|
'date_from' => $datetime_from,
|
||||||
'only_alerts' => (int)$only_alerts);
|
'date_to' => $datetime_to,
|
||||||
$result = db_process_sql_insert('tplanned_downtime', $values);
|
'id_group' => $id_group,
|
||||||
|
'only_alerts' => (int)$only_alerts);
|
||||||
|
$result = db_process_sql_insert('tplanned_downtime', $values);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<h3 class='error'>".__('Each planned downtime must have a different name')."</h3>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo '<h3 class="error">'.__('Planned downtime must have a name').'</h3>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($update_downtime) {
|
else if ($update_downtime) {
|
||||||
$values = array(
|
if ($name) {
|
||||||
'name' => $name,
|
if (!$check || $subcheck == $name) {
|
||||||
'description' => $description,
|
$values = array(
|
||||||
'date_from' => $datetime_from,
|
'name' => $name,
|
||||||
'date_to' => $datetime_to,
|
'description' => $description,
|
||||||
'id_group' => $id_group,
|
'date_from' => $datetime_from,
|
||||||
'only_alerts' => (int)$only_alerts);
|
'date_to' => $datetime_to,
|
||||||
$result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime));
|
'id_group' => $id_group,
|
||||||
|
'only_alerts' => (int)$only_alerts);
|
||||||
|
$result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<h3 class='error'>".__('Each planned downtime must have a different name')."</h3>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo '<h3 class="error">'.__('Planned downtime must have a name').'</h3>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
@ -134,10 +157,10 @@ if ($create_downtime || $update_downtime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($create_downtime) {
|
if($create_downtime && $name && !$check) {
|
||||||
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
||||||
}
|
}
|
||||||
else {
|
else if ($update_downtime && $name && !$check || $subcheck == $name) {
|
||||||
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,15 +64,21 @@ if ($create_group) {
|
|||||||
$id_parent = (int) get_parameter ('id_parent');
|
$id_parent = (int) get_parameter ('id_parent');
|
||||||
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
|
$alerts_disabled = (bool) get_parameter ('alerts_disabled');
|
||||||
$custom_id = (string) get_parameter ('custom_id');
|
$custom_id = (string) get_parameter ('custom_id');
|
||||||
|
$check = db_get_value('name', 'tmodule_group', 'name', $name);
|
||||||
|
|
||||||
if ($name){
|
if ($name){
|
||||||
$result = db_process_sql_insert('tmodule_group', array('name' => $name));
|
if (!$check) {
|
||||||
|
$result = db_process_sql_insert('tmodule_group', array('name' => $name));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
echo "<h3 class='suc'>".__('Group successfully created')."</h3>";
|
echo "<h3 class='suc'>".__('Group successfully created')."</h3>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<h3 class='error'>".__('There was a problem creating group')."</h3>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<h3 class='error'>".__('There was a problem creating group')."</h3>";
|
echo "<h3 class='error'>".__('Each module group must have a different name')."</h3>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -88,15 +94,22 @@ if ($update_group) {
|
|||||||
$id_parent = (int) get_parameter ('id_parent');
|
$id_parent = (int) get_parameter ('id_parent');
|
||||||
$alerts_enabled = (bool) get_parameter ('alerts_enabled');
|
$alerts_enabled = (bool) get_parameter ('alerts_enabled');
|
||||||
$custom_id = (string) get_parameter ('custom_id');
|
$custom_id = (string) get_parameter ('custom_id');
|
||||||
|
$check = db_get_value('name', 'tmodule_group', 'name', $name);
|
||||||
|
$subcheck = db_get_value('name', 'tmodule_group', 'id_mg', $id_group);
|
||||||
|
|
||||||
if ($name) {
|
if ($name) {
|
||||||
$result = db_process_sql_update('tmodule_group', array('name' => $name), array('id_mg' => $id_group));
|
if (!$check || $subcheck == $name) {
|
||||||
|
$result = db_process_sql_update('tmodule_group', array('name' => $name), array('id_mg' => $id_group));
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
echo "<h3 class='suc'>".__('Group successfully updated')."</h3>";
|
echo "<h3 class='suc'>".__('Group successfully updated')."</h3>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<h3 class='error'>".__('There was a problem modifying group')."</h3>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<h3 class='error'>".__('There was a problem modifying group')."</h3>";
|
echo "<h3 class='error'>".__('Each module group must have a different name')."</h3>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user