Created
March 8, 2016 17:08
Revisions
-
chicks created this gist
Mar 8, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ <?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: "); } ?>