Skip to content

Releases: xenroth/xen-inventory

v1.8.18 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 13:31

= 1.8.18 — 2026-06-02 =

== Added ==

  • [Item Detail Page — Full Transaction History]
    The borrow history table on the single-item detail page now shows ALL
    transactions for the item, including returned records. Previously, fully
    returned borrows (action changed to 'returned') and partial-return rows
    were invisible once a return was processed. The table now includes an
    "Action" column with a Borrowed/Returned badge, and partial returns are
    annotated with "Partial ← #N" referencing the original borrow log ID.
    Rows are ordered by most recent transaction (COALESCE date_returned,
    date_borrowed) descending.
    Affected: includes/models/class-inventory-log.php (get_public_logs_for_item),
    includes/frontend/views/page-item.php.

  • [Borrow History — Separate Borrow Notes and Return Remarks columns]
    The single "Notes" column in all borrow history views has been split
    into two distinct columns: "Borrow Notes" (notes recorded at the time
    of borrowing) and "Return Remarks" (notes recorded at the time of
    returning). This applies to the admin Borrow Log, the item meta-box
    borrow history, the single-item detail page history table, and all
    double-click detail modals across admin and frontend.
    Affected: includes/admin/views/borrow-log.php,
    includes/admin/views/meta-box-borrow-history.php,
    includes/frontend/views/page-item.php,
    assets/js/admin.js, assets/js/frontend.js.

== Fixed ==

  • [Return Log — Reverse Chronological Order]
    Confirmed and documented that the Return Log admin page orders entries
    by date_returned DESC (most recent return at the top), ensuring the
    most recent return transactions always appear first.
    Affected: includes/models/class-inventory-log.php (get_return_logs).

v1.8.17 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 13:07

= 1.8.17 — 2026-06-01 =

== Added ==

  • [Return Log — Return Type filter]
    New "Return Type" dropdown added to the Return Log filter bar (Full /
    Partial). Selecting "Partial" shows only partial-return rows
    (source_log_id IS NOT NULL); "Full" shows only full-return rows
    (source_log_id IS NULL). Submitting the filter resets pagination to page 1.
    Affected: includes/admin/views/return-log.php,
    includes/models/class-inventory-log.php,
    includes/core/class-ajax-handlers.php.

  • [Return Log — Top Pagination (tablenav)]
    Pagination links now appear above the table as well as below it,
    matching the standard WordPress admin list-table pattern.
    Affected: includes/admin/views/return-log.php.

  • [Return Log — Double-click Row Detail Modal]
    Double-clicking any row in the Return Log now opens a read-only detail
    modal showing: Item, Borrower (WP), Entity/Name, Contact, Tags, Return
    Type, Source Borrow #, Qty Returned, Condition, Return Remarks, Returned
    By, Borrow Date, Return Date, and Borrow Notes.
    Affected: includes/admin/views/return-log.php,
    assets/js/admin.js.

== Fixed ==

  • [Dashboard Recent Activity — Return ordering]
    The "Recent Activity" table on the Dashboard was ordering all rows by
    date_borrowed DESC. Returned items (especially partial returns, which
    insert a new row with the original borrow date) would not surface to the
    top of the list after being processed.
    Fix: Changed ORDER BY to COALESCE(date_returned, date_borrowed) DESC, id DESC. Rows with a return date now sort by that date; open borrows
    continue to sort by borrow date. Newly returned items appear at the top
    of Recent Activity immediately.
    Affected: includes/admin/views/dashboard.php.

== Changed ==

  • [Dashboard What's New — trimmed to latest 3 versions]
    The What's New card now lists only v1.8.17 (current), v1.8.16, and
    v1.8.15 as collapsible details. All older version entries have been
    removed to keep the card concise.
    Affected: includes/admin/views/dashboard.php.

v1.8.16 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 12:48

= 1.8.16 — 2026-06-01 =

== Added ==

  • [Partial Return Traceability — source_log_id]
    When a borrowed item with multiple units is only partially returned, the
    newly-created 'returned' log row now records which original borrow it came
    from via a new source_log_id column in the database table.

    Previously, partial return rows appeared in the Return Log with no link
    back to the originating borrow — you could see that units were returned
    but not which borrow transaction they belonged to.

    Changes:

    • DB schema: source_log_id BIGINT(20) UNSIGNED DEFAULT NULL added to
      wp_xen_inventory_logs. dbDelta adds the column automatically on the
      next admin page load after updating.
      Affected: includes/core/class-activator.php.

    • Model — partial_return(): stores source_log_id = $log_id (the
      original open borrow row's primary key) on every partial-return insert.
      update_log() now accepts source_log_id as an editable field.
      Affected: includes/models/class-inventory-log.php.

    • Return Log admin page: new Return Type column.

      • Partial returns show an orange Partial badge and a
        ← Borrow #N link that opens the item's edit/history page.
      • Full returns (via close_log) show a green Full badge.
        Affected: includes/admin/views/return-log.php.
    • Item Borrow History meta box: 'returned' rows that carry a
      source_log_id now display Partial ← #N beneath the action badge so
      admins can immediately see the origin borrow ID without leaving the
      item edit screen.
      Affected: includes/admin/views/meta-box-borrow-history.php.

    • Return Log CSV export: two new columns added — Return Type
      (Partial / Full) and Source Borrow # (the originating log ID, or
      blank for full returns).
      Affected: includes/core/class-ajax-handlers.php.

    • CSS: added .xen-badge--partial (amber-orange) badge style.
      Affected: assets/css/admin.css.

v.1.8.15 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 11:22

= 1.8.15 — 2026-06-01 =

== Fixed ==

  • [Date/Time — Root Cause: Double UTC Conversion on Saved Return Dates]
    The real source of "June 2, 3:10 AM" when local time was 7:12 PM was a
    round-trip mismatch in how user-entered return datetimes are stored and
    read back:

    • date_borrowed is auto-generated with current_time('mysql', true) →
      stored as UTC.
    • date_returned entered via a datetime-local input is LOCAL time (the
      browser never sends a timezone), but was stored as-is without conversion.
    • PHP reads every date_returned back with strtotime( $value . ' UTC' ),
      which is correct for auto-generated UTC values but incorrect for
      user-entered local values — it treated 7:12 PM local as 7:12 PM UTC,
      then wp_date() added the +8h offset again → 3:12 AM next day.
      Fix: In return_item() and update_borrow() (class-ajax-handlers.php),
      after sanitising the submitted date_returned string, it is now converted
      from the site's local timezone to UTC (new DateTime($val, wp_timezone())
      → setTimezone('UTC')) before being passed to close_log() /
      update_log(). This ensures every date_returned row in the DB is UTC,
      consistent with the auto-generated fallback.
      Affected: includes/core/class-ajax-handlers.php.
  • [Date/Time — Edit Form Pre-fill Shows UTC Instead of Local Time]
    All three datetime-local inputs that pre-fill date_returned when editing
    a borrow record were calling plain string-reformat helpers that strip
    seconds and replace the space with "T" — no timezone conversion. Users
    editing a returned record would see the UTC time in the field (e.g.
    11:12 AM) instead of local time (7:12 PM), making edits confusing.
    Fix: New utcToDatetimeLocal() / utcToDatetimeLocalVal() helpers added
    to admin.js, frontend.js, and calendar.js. They apply
    xenInventoryAdmin.utcOffsetMinutes / xenInventory.utcOffsetMinutes /
    xenCalendar.utcOffsetMinutes to shift the UTC DB string to local time
    before populating the input. date_due pre-fills are unchanged (stored
    in local time already).
    utcOffsetMinutes added to the xenCalendar localised object in
    includes/frontend/class-assets.php (was already present in admin and
    frontend script objects).
    Affected: assets/js/admin.js, assets/js/frontend.js,
    assets/js/calendar.js, includes/frontend/class-assets.php.

v1.8.14 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 11:08

= 1.8.14 — 2026-06-01 =

== Fixed ==

  • [Date/Time Display — JavaScript Modals & Inline Edit] Three remaining
    UTC-as-local display bugs in admin.js:
    • Audit Log double-click detail modal — the "Date / Time" row was showing
      the raw UTC created_at string (d.createdAt) without any conversion.
      Fixed: now uses formatUtcDateAmPm( d.createdAt ) to display the correct
      local time with AM/PM format.
    • Borrower List double-click summary modal — the "Last Borrowed" row was
      showing the raw UTC last_borrowed string from data-last-borrowed.
      Fixed: now uses formatUtcDateAmPm( data.lastBorrowed ).
    • Borrow Log / Borrowers inline-edit save callback — after saving an edit
      that includes a return date, the "Returned" cell was updated inline with
      formatDisplay( dateReturned ) which calls formatDateAmPm and treats
      the UTC DB value as local time. Fixed: now uses
      formatUtcDateAmPm( dateReturned ) so the displayed time shifts to the
      correct local timezone.

v.1.8.13 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 10:57

= 1.8.13 — 2026-06-01 =

== Fixed ==

  • [Date/Time Display — All Views] All PHP date rendering across the plugin was
    using strtotime() on UTC-stored datetime strings (date_borrowed,
    date_returned, created_at, last_borrowed) without a timezone indicator.
    This caused strtotime() to treat the UTC values as local PHP server time,
    displaying times offset by the UTC difference. Fix: appended UTC to all
    such strtotime() calls so PHP parses them correctly as UTC; wp_date()
    then converts the timestamp to the site's configured local timezone before
    display. Affected files: borrow-log.php, return-log.php, dashboard.php,
    borrowers.php, meta-box-borrow-history.php, audit-log.php,
    page-item.php, inventory-display.php, class-ajax-handlers.php.
  • [Date/Time Display — Missing Time Component] Several table columns showing
    date_borrowed, date_returned, and last_borrowed were formatted with
    date-only format (get_option('date_format')) omitting the time. Fix: added
    g:i A (12-hour AM/PM) to the format string for all those columns. Also
    added time to the inline "due" date shown on item cards in the inventory
    display and to the "Due Date" column in CSV exports.

v1.8.12 - Patch Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 10:50

= 1.8.12 — 2026-06-01 =

== Fixed ==

  • [Borrow Form — Item Single View — Expected Return Date] The "Expected Return
    Date" field in the Borrow modal on the single item detail page
    (/inventory-item/{slug}/) was a date-only input (type="date"), so the time
    component was never collected or stored for borrows initiated from that page.
    The equivalent field on the main inventory display page already used
    type="datetime-local" and the label "Expected Return Date & Time".
    Fix: changed the input in page-item.php to type="datetime-local", updated
    the min attribute format to Y-m-d\TH:i, and updated the label to
    "Expected Return Date & Time" to match inventory-display.php.
    Affected: includes/frontend/views/page-item.php.

v1.8.11 - Beta Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 10:46

= 1.8.11 — 2026-06-01 =

== Fixed ==

  • [Return Modal — Return Date & Time] The "Return Item" confirmation modal on
    the frontend inventory display page and the single item detail page was
    missing the "Return Date & Time" field, so returns always defaulted to the
    current server time with no way to record a past or specific return datetime.
    Root cause: the frontend Return Confirmation Modal HTML and the
    xen-return-confirm-submit AJAX handler in frontend.js omitted the
    date_returned field that the admin return modal already supports.
    Fix: a datetime-local input and an "⏱ Now" shortcut button are added to
    the Return modal in both inventory-display.php and page-item.php. The
    frontend.js submit handler now clears the field on modal open, handles the
    "Now" button click, and passes date_returned in the AJAX POST to
    xen_return_item (the backend already accepted this parameter).
    Affected: includes/frontend/views/inventory-display.php,
    includes/frontend/views/page-item.php, assets/js/frontend.js.

v1.8.10 - Beta Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 10:33

= 1.8.10 — 2026-06-01 =

== Fixed ==

  • [Borrow Record Views — Borrowed / Returned Time] The "Borrowed" and
    "Returned" datetime values shown in all detail modals (admin borrow-record
    dblclick modal, admin borrower overview modal, frontend borrow-detail modal)
    now display the correct local time instead of UTC.
    Root cause: date_borrowed and date_returned are auto-generated and
    stored as UTC in the database, but the JavaScript helpers (formatDateAmPm)
    were rendering the raw UTC string without any timezone conversion, showing
    the wrong time (offset by the site's UTC offset).
    Fix: a new formatUtcDateAmPm() JavaScript helper is introduced in both
    admin.js and frontend.js. It appends 'Z' to the UTC DB string so the
    browser parses it as UTC, then shifts by the site's UTC offset (passed from
    PHP as utcOffsetMinutes in the localised script objects) to produce the
    correct local display time. formatDateAmPm() is retained unchanged for
    date_due, which is stored in local time.
    Affected: PHP wp_localize_script calls in admin and frontend class-assets.php.

v1.8.9 - Beta Release

Choose a tag to compare

@xenroth xenroth released this 01 Jun 10:20

= 1.8.9 — 2026-06-01 =

== Fixed ==

  • [Borrow History — Due Date] Due dates displayed in all borrow history tables
    and detail modals were shifted by the site's UTC offset. The root cause was
    that date_due is stored in the site's local timezone (direct user input),
    but strtotime() treated it as UTC, causing wp_date() to apply the offset
    a second time. All 11 call sites now use
    (new DateTime($date_due, wp_timezone()))->getTimestamp() so the timestamp
    is computed correctly before formatting.
    Affected views: Admin Borrow Log, Admin Borrowers (detail table + overdue
    count), Admin Item Borrow History meta box, Admin Dashboard activity feed,
    Frontend Active Borrows list, Frontend My Borrow History table,
    Frontend Item Detail borrow history, and the CSV export.

== Changed ==

  • [All Borrow Record Views — Time Display] All datetime values shown in borrow
    record tables, detail modals, and the borrower overview modal now use
    12-hour AM/PM format (e.g. "2:30 PM") instead of military 24-hour format.
    Applies to: due date, returned date, and borrowed date columns and popups
    across the admin (Borrow Log, Borrowers, Borrow History meta box, Dashboard,
    Return Log, Audit Log) and the frontend (inventory display, item detail page,
    My Borrow History, My Active Borrows, and all read-only detail modals).