<?php

global $app_list_strings;

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

// ~

/* 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(), $tmpBean->status, $app_list_strings['ecmfkvatregisters_status_dom'][1],$tmpBean->status < $app_list_strings['ecmfkvatregisters_status_dom'][1]);
    // exit;
    
    if($tmpBean->status < 1) {
        $tmpBean->status = 1;
        // $tmpBean->position_list = $tmpBean->getPositionList(true);
        
        $tmpBean->save();
        // $tmpBean->saveBooks();
        
        $beans[] = $tmpBean;
    }
}

handleRedirect();
exit;