# Automatically close loan when returning all items

**URL:** <https://speciforum.org/t/automatically-close-loan-when-returning-all-items/2056>\
**Category:** Get Help\
**Created:** [October 24, 2024, 9:26pm UTC](https://speciforum.org/t/automatically-close-loan-when-returning-all-items/2056 "2024-10-24T21:26:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pverley](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/pverley/32/1413_2.png) [@pverley](https://speciforum.org/u/pverley)\
**Post date:** [October 24, 2024, 9:26pm UTC](https://speciforum.org/t/automatically-close-loan-when-returning-all-items/2056/1 "2024-10-24T21:26:44Z")

</div>

I’ve read carefully [Interactions in Specify-7](https://speciforum.org/t/interactions-in-specify/961) topic (🤥)

On returning all items, the [Loans section](https://speciforum.org/t/interactions-in-specify/961#loans-loan-7) says:

> When returning all of the items in a loan it is easiest to use the **Select All** button at the bottom of the Loan Return dialog. Clicking **Select All** will return and resolve the loan and close the loan by checking the **Is Closed** checkbox in the loan, thereby closing the loan. The **Return Loan** button on the form will also change to **All Returned**.

I gave it a try following these steps:

1. Created a new CO in our _Bac à Sable_ collection (Playground collection for testing purpose) with two preparations.
2. Created a new Loan interaction on that CO, with the two preparations as Loan preparations.
3. Clicked on `Return Loan` button, selected all and saved.

On the Loan view, both loan preparations are tagged as `resolved` (and `Loan Return Preparation` have been created), but the `Loan` itself does not close automatically:

- `isClosed` checkbox is not selected
- `Date closed` field remains empty (documentation does not says that date will be automatically filled though)
- **Return Loan** button does not change to **All Returned** (though a click on the button says that all preps have been returned)

Loan view:

 ![cay-sp7-resolved-loan-preps](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/7/796a2f0ffa6052665684b2027bf6ffa6a248bc52.png)

Query on the aforementioned loan:  
 ![cay-sp7-loan-not-closed](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/optimized/2X/5/5a54dac7bac4ec4f28895a8da7a0ed367bbd1549_2_690x37.png)

❓ **Faulty behavior? Outdated documentation? Or misunderstanding?**

---

<div class="post-metadata">

**Author:** ![Elizabeth](https://avatars.discourse-cdn.com/v4/letter/e/34f0e0/32.png) [@Elizabeth](https://speciforum.org/u/Elizabeth)\
**Post date:** [October 25, 2024, 3:02pm UTC](https://speciforum.org/t/automatically-close-loan-when-returning-all-items/2056/2 "2024-10-25T15:02:32Z")

</div>

Hi @pverley,

I added your report to the Github issue for this!

> <https://github.com/specify/specify7/issues/1583>
>
> \*\*Describe the bug\*\*
> Returning all preps in a loan should close the loan automa…tically by checking the Is Closed checkbox and entering today's date into Date closed field
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Go to Open loan
> 2. Return all preparations and save
> 3. See error
> 
> \*\*Expected behavior\*\*
> A clear and concise description of what you expected to happen.
> 
> \*\*Screenshots\*\*
> !\[Capture\](https://user-images.githubusercontent.com/7501989/168311584-cfda5a34-3dd6-4c01-8f5d-8ca600862cad.JPG)
> 
> 
> \*\*Desktop (please complete the following information):\*\*
> - OS: \[e.g. Windows 10\]
> - Browser \[e.g. Chrome, Safari\]
> - Specify 7 Version \[e.g. 7.6.1\]
> 
> \*\*Reported By\*\*
> Name of your institution
> 
> \*\*Additional context\*\*
> Add any other context about the problem here.

Currently there are two possible workarounds for this: either manually checking the ‘is closed’ box or going through the query builder.

To do it through queries, make a query with the base table ‘loan preparations’ and ensure the results are all the preparations you want to return, press the ‘return loan records’ button at the top of the screen, and then press ‘return’.

 ![Screenshot 2024-10-25 094626](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/c/c8ed9d03bf2b2ae364bee596bfd30f4aa3aa5747.png)

Doing it this way will check the ‘is closed’ checkbox, however, the date will not be updated to the current date so that would have to be done manually.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [January 13, 2025, 7:16pm UTC](https://speciforum.org/t/automatically-close-loan-when-returning-all-items/2056/3 "2025-01-13T19:16:33Z")

</div>


