# SheduledTask

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

Das Plugin enthält einen automatischen Scheduled Task, der regelmäßig **Verspätungsgebühren** bei nicht rechtzeitig zurückgegebenen Artikeln berechnet.

#### Funktionsweise <a href="#funktionsweise" id="funktionsweise"></a>

1. Der Task sucht nach allen Reservierungen, bei denen:
   * `returned_date IS NULL`
   * `cancelled = 0`
   * `end_date < CURDATE()`
   * `has_late_fee = 0`
2. Für jedes Produkt wird der Wert aus `customFields.rentalandreservations_late_fee` ausgelesen.
3. Die Gebühr (`late_fee_due`) wird berechnet:

   ```
   TageVerspätung × GebührProTag
   ```
4. Der Datensatz wird aktualisiert und das Feld `has_late_fee` (oder `jacket`) auf `1` gesetzt.
5. Alle Ergebnisse und Fehler werden über den **Shopware-Logger** protokolliert.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pixeleyes.de/anleitungen-instructions/deutsch/dokumentation-unserer-shopware-6-plugins/vermietung-and-reservierungen-fur-shopware-6/sheduledtask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
