# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!$gCms) {
    exit;
}
if (cmsms()->is_frontend_request()) {
    throw new \LogicException(__METHOD__ . ' cannot be used for frontend requests.');
}
$formdata = $mod = null;
try {
    $params = \cge_utils::decrypt_params($params);
    $module_name = cge_param::get_string($params, '_m');
    $class = cge_param::get_string($params, '_c');
    $item_id = cge_param::get_int($params, '_i');
    $mod = \cms_utils::get_module($module_name);
    if (!$mod) {
        throw new \LogicException("Could not get instance of module " . $module_name);
    }
    $formdata = $class::get_addedit_formdata();
    if (!$formdata instanceof \CGExtensions\lookup_form_data) {
        throw new \LogicException('Problem occurred getting form data for lookup table: ' . $class);
    }
    $formdata->validate();
    if ($item_id < 1) {
        throw new \LogicException('Invalid item id specified for move lookup item');
    }