Topic: Unhandled exception [0]: Call to undefined function | Same includes

Working on adding Batch Processing to FA:

I have two php scripts which have the identical includes (as below).
They are both located in the /batches/manage directory.
The first script calls two functions within the /batches/db/batches_db.inc file.
They both work without error.

The second script also calls two different functions also in the /batches/db/batches_db.inc file.
The first call to get_links($link_id) as seen below, works fine.
The second call to the function create_new_link() as seen below throws an error:
  Unhandled exception [0]: Call to undefined function
The error displayed shows that the script is trying to call that function from the /batches/manage directory.
The function exists correctly in the /batches/db/batches_db.inc file.

Any assistance appreciated.

//-------------------------------------------------------------

$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/batches/db/batches_db.inc");        // db handling functions for batches


link_id below comes from a another script calling this script:
//-------------------------------------------------------------

$link_id   = $_GET['link_id'];

// call to a function in /batches/db/batches.db.inc

$result = get_links($link_id);

// Results obtained without any problems.



NOTE: can_process() returns TRUE when the below is called.
//-------------------------------------------------------------------------------------

if ($Mode=='ADD_ITEM' && can_process())
{
    create_new_link($_POST['link_id'], $_POST['batch_ref'], $_POST['trans_id']);

    display_notification(_('New transaction link has been added to selected batch'));       
    $Mode = 'RESET';
}


routine to display the new link to be added
//------------------------------------------------------------

    if ($trans_id = $_GET['trans_id'])        // these come from calling script
    {
        $link_id   = $_GET['link_id'];
        $batch_ref = $_GET['batch_ref'];

        $_POST['link_id']   = $link_id;
        $_POST['batch_ref'] = $batch_ref;
        $_POST['trans_id']  = $trans_id;

        start_form($multi=false, $dummy=false, $action="POST", $name="newLink");

        start_table(TABLESTYLE2);

        $th = array(_("Batch ID"), _("Reference"), _("Transaction ID"), "", "");

        inactive_control_column($th);
        table_header($th);

        echo "<tr>";
        echo "<td>$link_id</td><td>$batch_ref</td><td>$trans_id</td><td></td><td></td>";
        echo "</tr>";
        echo "<br />";

        end_table(1);

        $msg = "Transaction " . $trans_id . " will be added to Batch " . $link_id . " " . $batch_ref;
        display_note($msg, 1, 1, "");

        submit_center('ADD_ITEM', _("Add"), true, '', 'default');

        end_form();

    }
//----------------------------------------------------------

Re: Unhandled exception [0]: Call to undefined function | Same includes

Update:

Changed the submit before the end_form (); to the following:

    submit_add_or_update_center($selected_id == -1, '', 'both');

Now I get no error, but a 'spinner' in the Preferences bar which spins for  6 or 7 seconds before becoming a yellow triangle with an exclamation mark.

I have sql debug on and also backtrace. Nothing erroneous displayed and no errors in /tmp.

Any thoughts?

Thanks.