View Categories

Sub-Rentals: settings, emails and developers

2 min read

You’ll find the settings under Rentals › Sub-rentals › Settings.

Covers #

  • A sub-rental covers a booking from: Requested (recommended), Confirmed or Draft. Until then the booking stays short.
  • Days to collect before the rental: where Collect by starts.
  • Days to give back after the rental: where Return by starts.
  • Show as return due this many hours ahead: when a return appears under Return due.
  • Look this many days ahead for shortages: how far the Short list reads.
  • Sending out units a supplier has not delivered: Warn, Block or Allow.

Numbers and emails #

  • Number prefix: the start of each sub-rental’s number.
  • Send manager emails to: leave it empty for the site admin. Separate several addresses with commas.
  • Daily digest of what is short and due, and Digest time.
  • Email when a return to a supplier is overdue.

Money #

  • Needs approval above: leave it empty if nothing needs approving.
  • Count sub-rental costs in WooCommerce cost of goods.

Emails #

Each email is a WooCommerce email, so you can edit it under WooCommerce › Settings › Emails. The supplier emails carry the store’s name and details, and never a customer’s.

  • Sub-rental request, Sub-rental changed and Sub-rental cancelled go to the supplier when you press Send.
  • Supplier answered goes to your managers when a supplier uses the answer link.
  • Return to supplier overdue and Sub-rentals morning digest go to your managers.

Their words can also be changed on the Text screen, along with the supplier’s answer page.

Permissions #

  • Create sub-rentals (sisubrent_create): the Sub-rent button and dialog.
  • Manage sub-rentals (sisubrent_manage): suppliers, settings and closing.
  • See costs (sisubrent_view_costs): every amount.
  • Approve (sisubrent_approve).

Anyone with manage_woocommerce has all four. Rental operators can see a sub-rental’s status and can mark units received and returned, but they never see money. They don’t get the PDF, the CSV export or your internal notes either.

The supplier’s answer link #

Anyone who has the link can answer, so treat it like a password. It’s built from your site’s home address and it stops working when the sub-rental closes. Links can end up in web server logs, so keep those private.

Wrong links are limited per visitor address. If your store sits behind a CDN or proxy, every visitor can look like the same address. Use the sibooking_client_ip filter to pass the visitor’s real address.

REST API #

The routes are under wc-sibooking/v1, with the same permissions as the screens:

  • GET, POST /subrentals, and GET, PUT /subrentals/{id}
  • POST /subrentals/{id}/status, /receive and /return
  • GET, POST /subrentals/{id}/charges
  • GET /subrentals/shortages
  • GET, POST /suppliers, and GET, PUT /suppliers/{id}

A cover that doesn’t fit answers 409, and so does a change to a finished sub-rental. The exception is POST /subrentals/{id}/charges: a late supplier bill on a Closed sub-rental, or a cancellation fee on a Cancelled one, is accepted with notes saying what it’s for (400 without them), and comes back with late_bill: true. A cancellation charge on anything else answers 409. Costs are only returned to staff who can see them.

Hooks #

The add-on fires sisubrent_status_changed with the sub-rental id, the old status, the new status and the context each time a status moves. The full list is in docs/hooks.md in the plugin.

Removing your data #

Deactivating the plugin keeps your data. Sub-rentals, suppliers and their settings are only removed when you uninstall with DELETE RENTAL DATA typed in Rentals & Bookings’ data removal setting.