17 require_once SQ_SYSTEM_ROOT.
'/core/assets/system/tool/tool.inc';
45 $this->
Tool($assetid);
61 $tool_info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
62 $o->openSection($tool_info[
'name']);
64 $o->openField(translate(
'bm_tool_import_bmail_user_file_upload'));
65 file_upload($type_code.
'_file_upload');
66 $o->note(translate(
'bm_tool_import_bmail_user_file_upload_note'));
69 $o->openField(translate(
'bm_tool_import_bmail_user_file_upload_header'));
70 check_box($type_code.
'_csv_header');
71 $o->note(translate(
'bm_tool_import_bmail_user_file_upload_header_example'));
74 $o->openField(translate(
'bm_tool_import_bmail_user_create_in'));
75 asset_finder($type_code.
'_create_in_assetid', 0, Array(
'user_group' =>
'D'));
76 $o->note(translate(
'bm_tool_import_bmail_user_create_in_note'));
80 check_box($type_code.
'_new_link'); echo
'Link user with an existing email address?';
81 $o->note(
'The "email" attribute of a Bulkmail User is unique, so that the same user will not get multiple copies of the same mail out.<br />If an existing address is specified in the CSV file, the Bulkmail User will also be linked under the "Create Users in" folder, if this option is enabled.');
101 $file_info = get_file_upload_info($type_code.
'_file_upload');
102 if (empty($file_info)) {
103 trigger_localised_error(
'BML0011', E_USER_NOTICE);
108 if (!$_REQUEST[$type_code.
'_create_in_assetid'][
'assetid']) {
109 trigger_localised_error(
'BML0012', E_USER_NOTICE);
113 $vars[
'csv_header'] = 0;
114 if (isset($_REQUEST[$type_code.
'_csv_header'])) {
115 $vars[
'csv_header'] = 1;
119 $vars[
'file_info'] = $file_info;
120 $vars[
'create_in_assetid'] = $_REQUEST[$type_code.
'_create_in_assetid'][
'assetid'];
121 $vars[
'new_link'] = (isset($_REQUEST[$type_code.
'_new_link'])) ? $_REQUEST[$type_code.
'_new_link'] : FALSE;
124 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
125 $hh->queueHipo(
'hipo_job_tool_import_bmail_user', $vars,
'', SQ_PACKAGES_PATH.
'/bulkmail/hipo_jobs');
126 $url = $hh->runQueuedJobs();
127 if (!empty($url)) $o->setRedirect($url);