<?php

//Include the PS_Pagination class
require_once 'php/db_interface/autoload.php';
$login = new login(true);
if (isset($_GET['edit_id'])) {
    $holdingId = intval($_GET['edit_id']);
} else {
    if (isset($_GET['abandon_id'])) {
        $holdingId = intval($_GET['abandon_id']);
        $message = isset($_GET['message']) ? $_GET['message'] : "";
        holdings::AbandonAtClose($holdingId, $message, COMMS_MANUAL_ABANDON_AT_CLOSE);
        header('Location: admin.editallholdings.php');
    } else {
        if (isset($_POST['holding_id'])) {
            $holdingId = intval($_POST['holding_id']);
        } else {
            if (isset($_GET['history_id'])) {
                $holdingId = intval($_GET['history_id']);
                holdings::ADMIN_MarkAbandoned($holdingId);
                header('Location: admin.editallholdings.php');
            } else {
                header('Location: admin.editallholdings.php');
            }
        }
    }
}
// load holding data
$holdingItem = new holdings();
$holdingItem->set_variable('holdings_id', $holdingId);
if ($holdingItem->load()) {