{$mod_strings_users['LBL_REASS_SCRIPT_TITLE']}";
echo "{$mod_strings_users['LBL_REASS_DESC_PART1']}
";
// Include Metadata for processing
require_once("modules/Users/metadata/reassignScriptMetadata.php");
if(file_exists("custom/modules/Users/reassignScriptMetadata_override.php")){
include("custom/modules/Users/reassignScriptMetadata_override.php");
}
if(!empty($_GET['record'])){
unset($_SESSION['reassignRecords']);
$_SESSION['reassignRecords']['fromuser'] = $_GET['record'];
}
if(!isset($_POST['fromuser']) && !isset($_GET['execute'])){
///////////////////// BEGIN STEP 1 - Select users/modules /////////////////////////
$exclude_modules = array(
"ImportMap",
"UsersLastImport",
"Dashboard",
"SavedSearch",
"UserPreference",
);
if(isset($_GET['clear']) && $_GET['clear'] == 'true'){
unset($_SESSION['reassignRecords']);
}
?>
| \n";
if(! $workflow){
$affected_rows = $GLOBALS['db']->getAffectedRowCount();
echo "{$mod_strings_users['LBL_UPDATE_FINISH']}: $affected_rows {$mod_strings_users['LBL_AFFECTED']} \n"; } else{ $successarr = array(); $failarr = array(); require_once($beanFiles[$module]); while($row = $GLOBALS['db']->fetchByAssoc($res)){ $bean = new $module(); if(empty($row['id'])){ continue; } $bean->retrieve($row['id']); // So that we don't create new blank records. if(!isset($bean->id)){ continue; } $bean->assigned_user_id = $touser; if($bean->save()){ $linkname = "record with id {$bean->id}"; if(!empty($bean->name)){ $linkname = $bean->name; } else if(!empty($bean->last_name)){ $linkname = $locale->getLocaleFormattedName($bean->first_name, $bean->last_name); } else if(!empty($bean->document_name)){ $linkname = $bean->document_name; } $successstr = "{$mod_strings_users['LBL_REASS_SUCCESS_ASSIGN']} {$bean->object_name} \"module_dir}&action=DetailView&record={$bean->id}\">$linkname\" {$mod_strings_users['LBL_REASS_FROM']} $fromusername {$mod_strings_users['LBL_REASS_TO']} $tousername"; $successarr[] = $successstr; } else{ $failarr[] = "{$mod_strings_users['LBL_REASS_FAILED_SAVE']} \"module_dir}&action=DetailView&record={$bean->id}\">$linkname\"."; } } if(isset($_POST['verbose']) && $_POST['verbose'] == "on"){ echo " {$mod_strings_users['LBL_REASS_THE_FOLLOWING']} {$app_list_strings['moduleList'][$p_module]} {$mod_strings_users['LBL_REASS_HAVE_BEEN_UPDATED']}\n"; foreach($successarr as $ord){ echo "$ord\n\n"; } if(empty($successarr)) echo "{$mod_strings_users['LBL_REASS_NONE']}\n \n"; echo " {$mod_strings_users['LBL_REASS_THE_FOLLOWING']} {$app_list_strings['moduleList'][$p_module]} {$mod_strings_users['LBL_REASS_CANNOT_PROCESS']}\n"; foreach($failarr as $failure){ echo $failure."\n\n"; } if(empty($failarr)) echo "{$mod_strings_users['LBL_REASS_NONE']}\n \n"; } else{ echo "{$mod_strings_users['LBL_REASS_UPDATE_COMPLETE']}\n \n"; echo " ".count($successarr)." {$mod_strings_users['LBL_REASS_SUCCESSFUL']}\n \n"; echo " ".count($failarr)." {$mod_strings_users['LBL_REASS_FAILED']}\n"; } echo " \n"; } echo " |