$error = '';
$success = '';
if (is_null($template)) {
    $error = 'Cannot find the selected template.';
    $template = new Model_Message_Template(array('id' => 0));
} elseif (isset($_POST['submit'])) {
    $template->template = trim($_POST['template']);
    if (trim($template->template) == '') {
        $error = 'Please provide some text for the contect of this template.';
    } elseif ($template->save()) {
        $success = 'Successfully updated your template.';
    } else {
        $error = 'There was an error in updating this template.';
    }
}
Tracetec_Debt_Manager::setupMessageTemplates();
?>
<!DOCTYPE html>
<html lang="en">
  <head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <META HTTP-EQUIV="refresh" CONTENT="60">

    <title>Tracetec Debt Recovery - Reports</title>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>