-
-
Save hectorrios/3a8f450eb4ff75d81ed76df15e19f6d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
//----------------------------------------------------------------------------- | |
if(!defined('sugarEntry'))define('sugarEntry', true); | |
require_once('include/entryPoint.php'); | |
//----------------------------------------------------------------------------- | |
$db = DBManagerFactory::getInstance(); | |
//-- TEMPLATE = birgit | |
$query = "SELECT id from users where user_name='birgit'"; | |
$result = $db->query($query, true,"Error fetching birgit: "); | |
if ($row = $db->fetchByAssoc($result)) | |
$birgit = $row['id']; | |
else | |
die("user_name birgit not found!"); | |
$query = "SELECT id from users where status='Active' and employee_status='Active' and portal_only=0 and is_group=0 and deleted=0 ". | |
//-- for test uncomment the following line | |
// "and user_name='tom' ". | |
"and user_name<>'birgit' "; | |
$result = $db->query($query, true,"Error fetching users: "); | |
while ($row = $db->fetchByAssoc($result)) | |
{ | |
$klaus = $row['id']; | |
print("Copy birgits dashlets to ".$klaus."\n"); | |
$sql = "DELETE from dashboards where assigned_user_id = '".$klaus."'"; | |
$res = $db->query($sql, true,"Error cleaning dashboards: "); | |
$sql = "INSERT INTO dashboards (id, name,date_entered,date_modified,modified_user_id,created_by,description,". | |
" deleted,assigned_user_id,dashboard_module,view,metadata) ". | |
"SELECT uuid(),name,date_entered,date_modified,'".$klaus."', '".$klaus."',description,". | |
" deleted,'".$klaus."', dashboard_module,view,metadata ". | |
"FROM dashboards ". | |
"WHERE assigned_user_id = '".$birgit."'"; | |
$res = $db->query($sql, true,"Error copying birgit dashboards: "); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment