! Not all the parameters were passed properly between pages in mass-move between departments, causing infinite loops under some conditions.
gruffen

gruffen commited on 2011-07-06 01:07:50
Showing 1 changed files, with 7 additions and 7 deletions.

... ...
@@ -190,7 +190,7 @@ function shd_admin_maint_massdeptmove()
190 190
 		$clauses[] = 'AND last_updated < ' . (time() - ($_POST['movelast_more_days'] * 86400));
191 191
 
192 192
 	// OK, let's start. How many tickets are there to move?
193
-	if (empty($_SESSION['massdeptmove']))
193
+	if (empty($_POST['massdeptmove']))
194 194
 	{
195 195
 		$query = $smcFunc['db_query']('', '
196 196
 			SELECT COUNT(*)
... ...
@@ -204,7 +204,7 @@ function shd_admin_maint_massdeptmove()
204 204
 		$smcFunc['db_free_result']($query);
205 205
 
206 206
 		if (!empty($count))
207
-			$_SESSION['massdeptmove'] = $count;
207
+			$_POST['massdeptmove'] = $count;
208 208
 		else
209 209
 			$_GET['done'] = true;
210 210
 	}
... ...
@@ -212,9 +212,8 @@ function shd_admin_maint_massdeptmove()
212 212
 	// OK, so we know we're going to be doing some tickets, or do we?
213 213
 	$_POST['tickets_done'] = isset($_POST['tickets_done']) ? (int) $_POST['tickets_done'] : 0;
214 214
 
215
-	if (isset($_GET['done']) || $_POST['tickets_done'] >= $_SESSION['massdeptmove'])
215
+	if (isset($_GET['done']) || $_POST['tickets_done'] >= $_POST['massdeptmove'])
216 216
 	{
217
-		unset($_SESSION['massdeptmove']);
218 217
 		$context['sub_template'] = 'shd_admin_maint_massdeptmovedone';
219 218
 		return;
220 219
 	}
... ...
@@ -292,10 +291,11 @@ function shd_admin_maint_massdeptmove()
292 291
 	$context['continue_post_data'] = '
293 292
 		<input type="hidden" name="id_dept_from" value="' . $_POST['id_dept_from'] . '" />
294 293
 		<input type="hidden" name="id_dept_to" value="' . $_POST['id_dept_to'] . '" />
295
-		<input type="hidden" name="tickets_done" value="' . $_POST['tickets_done'] . '" />';
294
+		<input type="hidden" name="tickets_done" value="' . $_POST['tickets_done'] . '" />
295
+		<input type="hidden" name="massdeptmove" value="' . $_POST['massdeptmove'] . '" />';
296 296
 	if (!empty($_POST['moveopen']))
297 297
 		$context['continue_post_data'] .= '
298
-		<input type="hidden" name="moveclosed" value="' . $_POST['moveopen'] . '" />';
298
+		<input type="hidden" name="moveopen" value="' . $_POST['moveopen'] . '" />';
299 299
 	if (!empty($_POST['moveclosed']))
300 300
 		$context['continue_post_data'] .= '
301 301
 		<input type="hidden" name="moveclosed" value="' . $_POST['moveclosed'] . '" />';
... ...
@@ -312,7 +312,7 @@ function shd_admin_maint_massdeptmove()
312 312
 		<input type="hidden" name="movelast_more_days" value="' . $_POST['movelast_more_days'] . '" />';
313 313
 
314 314
 	$context['sub_template'] = 'not_done';
315
-	$context['continue_percent'] = $_POST['tickets_done'] > $_SESSION['massdeptmove'] ? 100 : floor($_POST['tickets_done'] / $_SESSION['massdeptmove'] * 100);
315
+	$context['continue_percent'] = $_POST['tickets_done'] > $_POST['massdeptmove'] ? 100 : floor($_POST['tickets_done'] / $_POST['massdeptmove'] * 100);
316 316
 }
317 317
 
318 318
 function shd_admin_maint_findrepair()
319 319