# Sheduled Task

### ⏱️ Scheduled Task: LateFeeTask <a href="#geplanter-task-latefeetask" id="geplanter-task-latefeetask"></a>

The plugin includes an automatic scheduled task that regularly calculates late fees for items that have not been returned on time.

***

#### ⚙️ How It Works

1. The task searches for all reservations where:
   * returned\_date IS NULL
   * cancelled = 0
   * end\_date < CURDATE()
   * has\_late\_fee = 0
2. For each product, the value from customFields.rentalandreservations\_late\_fee is retrieved.
3. The late fee (late\_fee\_due) is calculated as:

   DaysLate × FeePerDay
4. The record is updated and the field has\_late\_fee (or jacket) is set to 1.
5. All results and errors are logged via the Shopware logger.

### &#x20;<a href="#geplanter-task-latefeetask" id="geplanter-task-latefeetask"></a>
