Skip to content

Loan workflow (#238): camera scanner unblocked + copy-code identifies book, copy/subtitle in details & receipt#248

Merged
fabiodalez-dev merged 2 commits into
mainfrom
fix/nikola-loan-workflow
Jul 10, 2026
Merged

Loan workflow (#238): camera scanner unblocked + copy-code identifies book, copy/subtitle in details & receipt#248
fabiodalez-dev merged 2 commits into
mainfrom
fix/nikola-loan-workflow

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

Addresses the loan-workflow issues Nikola raised in discussion #238.

Camera scanner (urgent)

The Permissions-Policy response header denied the camera for the whole document (camera=()), so the in-browser copy-code scanner (zxing-wasm getUserMedia) was blocked outright. Now allowed on same-origin (camera=(self)); geolocation and microphone stay denied.

Loan workflow

  • Copy code identifies the book. On the create-loan form, entering or scanning an inventory code resolves the book automatically (via /admin/copies/by-code) and fills the book field. The operator no longer has to also search the title, and can't accidentally pick a book that doesn't match the scanned copy. A status line confirms the identified copy (and warns if it isn't available now).
  • Subtitle in book search. The create-loan book-search suggestions now show the subtitle.
  • Loan details show the physical copy inventory code and the subtitle.
  • Receipt PDF adds the subtitle and the copy inventory code — conditional, so loans predating copy-tracking render unchanged.

byCode and LoanRepository::getById also return the subtitle. New strings translated across it/en/de/fr (the noun "copy/subtitle", not the verb).

Tests

tests/nikola-loan-workflow.spec.js covers all four behaviours end-to-end as the operator sees them (copy-code auto-fill, subtitle in search, details, receipt PDF). Both tests pass locally.

…ner works

The Permissions-Policy header denied camera for the whole document
(camera=()), so the in-browser barcode scanner (zxing-wasm getUserMedia) was
blocked outright — "camera is not allowed in this document". Allow it on
same-origin (camera=(self)); geolocation and microphone stay denied.
…oan details/receipt (#238)

Improvements to the physical-copy loan workflow reported in discussion #238:

- Create-loan form: entering or scanning a copy inventory code now resolves
  the book automatically (via /admin/copies/by-code) and fills the book field,
  so the operator never has to separately search the title — and can no longer
  pick the wrong book for a scanned copy. A status line confirms the identified
  copy (and warns if it is not currently available).
- Book search suggestions on the create-loan form now show the subtitle.
- Loan details page shows the physical copy inventory code and the subtitle.
- Loan receipt PDF adds the subtitle and the copy inventory code (conditional:
  only when present, so pre-copy-tracking loans render unchanged).

byCode and LoanRepository::getById now also return the subtitle. New strings
translated across it/en/de/fr (the noun "copy/subtitle", not the verb).
Covered by tests/nikola-loan-workflow.spec.js (all four behaviours, as the
operator sees them).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f7869c26-1319-4db8-b6da-64f60f1dcaac

📥 Commits

Reviewing files that changed from the base of the PR and between f22c923 and c68aca2.

📒 Files selected for processing (12)
  • app/Controllers/CopyController.php
  • app/Controllers/PrestitiController.php
  • app/Models/LoanRepository.php
  • app/Support/LoanPdfGenerator.php
  • app/Views/prestiti/crea_prestito.php
  • app/Views/prestiti/dettagli_prestito.php
  • locale/de_DE.json
  • locale/en_US.json
  • locale/fr_FR.json
  • locale/it_IT.json
  • public/index.php
  • tests/nikola-loan-workflow.spec.js
 ______________________________________________________
< Your bugs are no match for my GPU-powered intellect. >
 ------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nikola-loan-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fabiodalez-dev fabiodalez-dev merged commit 199d9e8 into main Jul 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant