<?php
global $app_list_strings;

/* Requires. */
require_once 'include/formbase.php';
require_once 'modules/EcmFkVatRegisters/EcmFkVatRegister.php';

// ~

// dump(__FILE__);
// exit;

/* Misc preparation. */
$mass = @$_REQUEST ['mass'] ?  : array ();

// dump($mass);
// exit;

$beans = array ();

/* Loop trough selected registers. */
foreach ( $mass as $key => $value ) {
	$tmpBean = new EcmFkVatRegister ();
	$tmpBean->retrieve ( $value );

	// dump($tmpBean->ToArray());
	// exit;

// 	if ($tmpBean->status != '2') {
		$tmpBean->status = '2';
		// $tmpBean->position_list = $tmpBean->getPositionList(true);

		$tmpBean->save ();

		// dump($tmpBean->getPositionList(true));
		// exit;

// 		$tmpBean->saveBooks ();
		$tmpBean->updateRotations ();

		$beans [] = $tmpBean;
// 	}
}

// dump ( $beans );

handleRedirect();
exit ();