29 June 2025

Display Discharge Warnings in Koha Based on Patron Fines and Checkouts

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8" />

  <title>Patron Discharge</title>

  <style>

    /* Basic styling similar to Koha intranet */

    body {

      font-family: Arial, sans-serif;

      margin: 20px;

    }

    .dialog.alert {

      border: 1px solid #f0ad4e;

      background-color: #fcf8e3;

      color: #8a6d3b;

      padding: 10px 15px;

      margin-bottom: 20px;

      border-radius: 4px;

    }

    .btn {

      padding: 8px 15px;

      font-size: 14px;

      cursor: pointer;

      border-radius: 4px;

      border: none;

    }

    .btn-primary {

      background-color: #337ab7;

      color: white;

    }

    .btn-primary:hover {

      background-color: #286090;

    }

    .btn-secondary {

      background-color: #ddd;

      color: #777;

      cursor: not-allowed;

    }

    h2 {

      margin-bottom: 10px;

    }

  </style>

</head>

<body>


  <h2>Discharge Information for [% patron.firstname %] [% patron.surname %]</h2>


  <!-- Warning Messages -->

  [% IF messages && messages.size > 0 %]

    <div class="dialog alert">

      [% FOREACH msg IN messages %]

        [% IF msg.code == 'fine_available' %]

          <p><strong>This patron has Fine Amount Available.</strong></p>

        [% ELSIF msg.code == 'active_checkouts' %]

          <p><strong>This patron has active checkouts.</strong></p>

        [% ELSIF msg.code == 'unable_to_generate_pdf' %]

          <p><strong>An error occurred while generating the discharge PDF.</strong></p>

        [% END %]

      [% END %]

    </div>

  [% END %]


  <!-- Discharge Button -->

  [% IF can_be_discharged %]

    <form method="post">

      <input type="hidden" name="op" value="cud-discharge" />

      <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" />

      <input type="submit" name="discharge" value="Generate Discharge PDF" class="btn btn-primary" />

    </form>

  [% ELSE %]

    <button class="btn btn-secondary" disabled>Discharge Not Available</button>

  [% END %]


  <!-- Additional patron details or discharge history can be added here -->


</body>

</html>


No comments:

Post a Comment

Customizing Overdue Fine Calculations in Koha: A Detailed Guide

Customizing Overdue Fine Calculations in Koha: A Detailed Guide Customizing Overdue Fine Calculations in Koha: A De...