Add transaction support to menu and users app_defaults.php.
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
$result_count = count($result);
|
$result_count = count($result);
|
||||||
|
$db->beginTransaction();
|
||||||
foreach($result as $field) {
|
foreach($result as $field) {
|
||||||
//get the menu_uuid
|
//get the menu_uuid
|
||||||
$menu_uuid = $field['menu_uuid'];
|
$menu_uuid = $field['menu_uuid'];
|
||||||
@@ -116,6 +117,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->commit();
|
||||||
unset($prep_statement);
|
unset($prep_statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +131,7 @@
|
|||||||
$result_count = count($result);
|
$result_count = count($result);
|
||||||
unset($prep_statement);
|
unset($prep_statement);
|
||||||
if ($result_count > 0) {
|
if ($result_count > 0) {
|
||||||
|
$db->beginTransaction();
|
||||||
foreach($result as $field) {
|
foreach($result as $field) {
|
||||||
$menu_item_group_uuid = uuid();
|
$menu_item_group_uuid = uuid();
|
||||||
$sql = "update v_menu_item_groups ";
|
$sql = "update v_menu_item_groups ";
|
||||||
@@ -141,6 +144,7 @@
|
|||||||
$count = $db->exec(check_sql($sql));
|
$count = $db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
|
$db->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ if ($domains_processed == 1) {
|
|||||||
$tmp[$x]['group_name'] = 'agent';
|
$tmp[$x]['group_name'] = 'agent';
|
||||||
$tmp[$x]['group_description'] = 'Call Center Agent Group';
|
$tmp[$x]['group_description'] = 'Call Center Agent Group';
|
||||||
$tmp[$x]['group_protected'] = 'false';
|
$tmp[$x]['group_protected'] = 'false';
|
||||||
|
$db->beginTransaction();
|
||||||
foreach($tmp as $row) {
|
foreach($tmp as $row) {
|
||||||
if (strlen($row['group_name']) > 0) {
|
if (strlen($row['group_name']) > 0) {
|
||||||
$sql = "insert into v_groups ";
|
$sql = "insert into v_groups ";
|
||||||
@@ -76,6 +77,7 @@ if ($domains_processed == 1) {
|
|||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->commit();
|
||||||
}
|
}
|
||||||
unset($prep_statement, $sub_result);
|
unset($prep_statement, $sub_result);
|
||||||
}
|
}
|
||||||
@@ -131,6 +133,7 @@ if ($domains_processed == 1) {
|
|||||||
if ($prep_statement) {
|
if ($prep_statement) {
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
$db->beginTransaction();
|
||||||
foreach($result as $row) {
|
foreach($result as $row) {
|
||||||
if (strlen($row['group_name']) > 0) {
|
if (strlen($row['group_name']) > 0) {
|
||||||
//get the group_uuid
|
//get the group_uuid
|
||||||
@@ -149,6 +152,7 @@ if ($domains_processed == 1) {
|
|||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$db->commit();
|
||||||
unset ($prep_statement);
|
unset ($prep_statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +165,8 @@ if ($domains_processed == 1) {
|
|||||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||||
unset ($prep_statement);
|
unset ($prep_statement);
|
||||||
if ($sub_result['count'] > 0) {
|
if ($sub_result['count'] > 0) {
|
||||||
|
//begin the transaction
|
||||||
|
$db->beginTransaction();
|
||||||
//send output
|
//send output
|
||||||
if ($display_type == "text") {
|
if ($display_type == "text") {
|
||||||
echo " Users: set enabled=true\n";
|
echo " Users: set enabled=true\n";
|
||||||
@@ -170,6 +176,8 @@ if ($domains_processed == 1) {
|
|||||||
$sql .= "user_enabled = 'true' ";
|
$sql .= "user_enabled = 'true' ";
|
||||||
$db->exec($sql);
|
$db->exec($sql);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
//end the transaction
|
||||||
|
$db->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user