https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23415

--- Comment #154 from Martin Renvoize (ashimema) 
<[email protected]> ---
Test Plan
## Add a syspref to allow a fine override for renewals

### Test Overview
This test plan focuses on verifying that staff are properly alerted when
patrons with excessive fines attempt to renew items, and that the optional
override functionality works correctly.

---

## Prerequisites

1. Apply all patches from Bug 23415
2. Run database updates: `perl installer/data/mysql/updatedatabase.pl`
3. Rebuild assets: `yarn build` (in KTD: `ktd --shell` then `yarn build`)
4. Restart services: `restart_all` (in KTD)
5. Have staff account with circulation permissions

---

## Test Scenario 1: Verify Fine Blocking Works

### Setup
1. Go to **Administration** > **System Preferences**
2. Search for **FineNoRenewals**
3. Set value to: **5.00**
4. Search for **AllowFineOverrideRenewing**
5. Set to: **Don't allow** (0)
6. Click **Save all Circulation Preferences**

### Create Test Patron with Fines
1. Go to **Patrons** > **New patron** (or use existing patron)
2. Create/select a patron
3. Note the patron's card number
4. Go to patron's **Fines** tab
5. Click **Create manual invoice**
   - Type: Choose "Overdue"
   - Amount: **10.00** (exceeds the 5.00 threshold)
   - Description: "Test fine for Bug 23415"
6. Click **Save**
7. Verify patron now has **$10.00 in fines**

### Check Out an Item to the Patron
1. Go to **Circulation** > **Check out**
2. Scan/enter patron card number
3. Check out any available item to the patron
4. Note the item barcode

### Test Renewal Blocking
1. Go to **Circulation** > **Renew**
2. Scan/enter the item barcode from above
3. Click **Submit** or press Enter

**Expected Results:**
- ❌ Renewal should be **BLOCKED**
- 🔴 You should see a **red alert/error message** stating:
  - "The patron has a debt of $10.00"
- ❌ You should **NOT** see any button to override or proceed with renewal
- The item should **NOT** be renewed

**PASS/FAIL:** _______

---

## Test Scenario 2: Verify Override Button Appears When Enabled

### Setup
1. Go to **Administration** > **System Preferences**
2. Search for **AllowFineOverrideRenewing**
3. Set to: **Allow** (1)
4. Click **Save all Circulation Preferences**

### Test Renewal with Override Available
1. Go to **Circulation** > **Renew**
2. Scan/enter the same item barcode from Scenario 1
3. Click **Submit** or press Enter

**Expected Results:**
- ❌ Renewal should initially be **BLOCKED**
- 🔴 You should see a **red alert/error message** stating:
  - "The patron has a debt of $10.00"
- ✅ You **SHOULD** now see a **"Renew checkout(s)" button**
  - The button should be clearly visible within or near the alert message
  - It should be styled as an action button (likely green or prominent)

**PASS/FAIL:** _______

---

## Test Scenario 3: Verify Override Functionality Works

### Test Using Override Button
1. Still on the renewal page with the alert showing
2. Click the **"Renew checkout(s)"** button

**Expected Results:**
- ✅ The renewal should **SUCCEED**
- ✅ You should see a **green success message** stating:
  - "Item renewed"
- 📅 The due date should be updated/extended
- The patron should **still have $10.00 in fines** (override doesn't remove
fines)

**PASS/FAIL:** _______

### Verify Renewal in Patron Record
1. Go to the patron's record
2. Click on **Checkouts** tab

**Expected Results:**
- ✅ The item should show an **updated/extended due date**
- ✅ The **Renewals count** should have increased by 1

**PASS/FAIL:** _______

---

## Test Scenario 4: Verify No Override When Preference Disabled

### Setup
1. Go to **Administration** > **System Preferences**
2. Search for **AllowFineOverrideRenewing**
3. Set to: **Don't allow** (0)
4. Click **Save all Circulation Preferences**

### Attempt Another Renewal
1. Go to **Circulation** > **Renew**
2. Scan/enter the same item barcode (should still be checked out)
3. Click **Submit** or press Enter

**Expected Results:**
- ❌ Renewal should be **BLOCKED**
- 🔴 You should see the error message about patron debt
- ❌ You should **NOT** see the "Renew checkout(s)" button
- The override button should have **disappeared** since the preference is
disabled

**PASS/FAIL:** _______

---

## Test Scenario 5: Verify Renewal Allowed When Fines Below Threshold

### Setup - Pay Down Fines
1. Go to the patron's record
2. Click on **Fines** tab
3. Find the $10.00 fine
4. Click **Pay** or **Pay amount**
5. Pay **$7.00** (leaving $3.00 outstanding)
6. Verify patron now has **$3.00 in fines** (below the 5.00 threshold)

### Test Renewal with Low Fines
1. Go to **Circulation** > **Renew**
2. Scan/enter the item barcode
3. Click **Submit** or press Enter

**Expected Results:**
- ✅ Renewal should **SUCCEED** immediately
- ✅ You should see a **green success message**: "Item renewed"
- ❌ You should **NOT** see any error about fines
- ❌ You should **NOT** need to override anything

**PASS/FAIL:** _______

---

## Test Scenario 6: Verify Checkout Page Behavior

### Test from Patron Checkout Page
1. Go to **Circulation** > **Check out**
2. Search for and load the patron (who still has $3.00 in fines)
3. Look at the patron details section and checkout summary

**Expected Results:**
- The patron's outstanding fines should be **displayed**
- There should be **no blocking message** (since $3.00 < $5.00 threshold)

**PASS/FAIL:** _______

### Increase Fines Above Threshold Again
1. While on the checkout page, open a new tab
2. Go to the patron's record > **Fines** tab
3. Click **Create manual invoice**
   - Type: "Overdue"
   - Amount: **5.00**
   - Description: "Additional test fine"
4. Click **Save**
5. Return to the checkout page tab
6. Refresh the page or re-scan patron card number

**Expected Results:**
- The patron now has **$8.00 in fines** (above threshold)
- When attempting to check out a new item, you should see appropriate warnings
- Existing checkouts should show renewal is blocked for this patron

**PASS/FAIL:** _______

---

## Test Scenario 7: Test Both Renewal Endpoints

### Test from Patron Checkouts Tab
1. Go to patron's record > **Checkouts** tab
2. Find the checked-out item
3. Click the **Renew** button in the checkouts table

**Expected Results (if AllowFineOverrideRenewing = Don't allow):**
- ❌ Should see error message about patron debt
- ❌ Renewal should fail

**PASS/FAIL:** _______

### Enable Override and Test Again
1. Set **AllowFineOverrideRenewing** to **Allow**
2. Return to patron's **Checkouts** tab
3. Click **Renew** button again

**Expected Results:**
- Should see the override option
- Should be able to complete renewal with override

**PASS/FAIL:** _______

---

## Edge Case Testing

### Test Scenario 8: Verify Auto-Renewal Blocking (OPAC)

**Note:** This requires the patron to have the item checked out and
auto-renewal enabled

1. Set **AllowFineOverrideRenewing** to **Allow**
2. Ensure patron has fines > $5.00
3. Ensure **OPACFineNoRenewalsBlockAutoRenew** is set to **Allow**
4. Log into **OPAC** as the patron
5. Go to patron's account > **Checked out items**
6. Find the item and look for renewal options

**Expected Results:**
- If auto-renewals are enabled, they should be blocked
- Manual renewal from OPAC should also be blocked
- The **override functionality is NOT available in OPAC** (staff interface
only)

**PASS/FAIL:** _______

---

## Test Scenario 9: Verify Error Codes

### Test API Error Codes (Optional - Advanced Testing)
If you have API access configured:

1. Set **FineNoRenewals** to **5.00**
2. Set **AllowFineOverrideRenewing** to **Don't allow**
3. Attempt renewal via REST API without override header
   - Should return error code: `too_much_owing` or `auto_too_much_owing`
4. Set **AllowFineOverrideRenewing** to **Allow**
5. Attempt renewal with `x-koha-override: debt_limit` header
   - Should succeed (201 status)

**PASS/FAIL:** _______

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to