summaryrefslogtreecommitdiff
path: root/includes
AgeCommit message (Collapse)AuthorFilesLines
10 daysFix mContentTypeGuid never set after getLibertyObject loadHEADmasterLester Caine1-0/+1
registerContentType() set mType and mPackageGuid but skipped mContentTypeGuid, leaving it null throughout the object lifetime when loaded via getLibertyObject. This caused a TypeError in xrefType() -> LibertyXrefType::__construct(string, ...). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12loadContent: add linked_data alongside linked_title from lc_linked JOINLester Caine1-1/+2
Exposes liberty_content.data of the linked content item so BOM and other xref view templates can display description without a separate enrichment query. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12LibertyXref: propagate mPackageGuid so dual-guid types resolve correctly in ↵Lester Caine3-5/+28
load/verify; loadContent: add linked_title from joined liberty_content LibertyXref gains mPackageGuid; load() and verify() now use IN(contentTypeGuid,packageGuid) so package-level xref items (e.g. stock/supplier) are found when editing a sub-type record (e.g. stockcomponent). LibertyContent propagates mPackageGuid to LibertyXref in loadXref(), storeXref() and stepXref(). LibertyXrefType::loadContent() LEFT JOINs liberty_content on x.xref to expose linked_title for templates that display a linked content item's name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11Consolidate xref loading: LibertyXrefInfo → LibertyXrefContent + ↵Lester Caine6-184/+166
LibertyXrefType::loadContent() - Add LibertyXrefContent: thin data container (just $mGroups), replaces LibertyXrefInfo - Delete LibertyXrefInfo: constructor params and load() move to LibertyXrefType::loadContent() - LibertyXrefType::loadContent($contentId): loads all display groups and their xref rows, returns LibertyXrefContent; absorbs both LibertyXrefInfo::load() and LibertyXrefGroup::loadXrefs() - LibertyXrefGroup: pure value object — remove extends LibertyBase, remove loadXrefs(); mXrefs type changed to LibertyXref[] - LibertyXref: add ArrayAccess + fromRow() factory; templates keep {$xrefInfo.key} dot notation unchanged; load() also populates $mRow for consistency - LibertyContent: mXrefInfo type updated to LibertyXrefContent; loadXrefInfo() delegates to $this->xrefType()->loadContent(); xrefType() visibility private → protected (StockBase calls it from an override) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11LibertyXref: extend BitBase directly, not LibertyBaseLester Caine1-1/+1
Uses mDb and mErrors from BitBase; does not use any LibertyBase factory methods (getLibertyObject, getLibertyClass etc). BitBase is the correct base. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11LibertyContent: document xrefType() accessor and mXrefType propertyLester Caine1-2/+17
Explains the lazy-init/cache/reset lifecycle, why mPackageGuid is passed, how it enables the dual-guid IN() query, and that subclass/page code should not construct LibertyXrefType directly. Restores @see tags on the four thin delegate methods. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11LibertyXrefType: expand class docblock to cover dual-guid schema patternLester Caine1-2/+30
Documents the package-level vs content-type-level split, the IN() filter strategy, the self-consistent JOIN rule, and the stock reference implementation. Adds usage note directing callers via LibertyContent::xrefType(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11LibertyXrefType: convert to instance class; fix cross-guid xref joinLester Caine2-122/+123
- Remove extends LibertyBase (unused — all methods were static, no instance state needed from the hierarchy) - Add constructor(contentTypeGuid, packageGuid) so the type context is held on the object rather than threaded through every call - Runtime methods (getDisplayGroups, getTypeMarkers, getAvailableItems, getTemplateFormats, getContentTypeMarkers) become instance methods; guid params removed - Admin cross-type queries (getXrefTypeList, getContentTypeGuids, getGroupList) stay static - Fix getAvailableItems JOIN: use t.content_type_guid = s.content_type_guid so each item only joins its own group — prevents cross-matching when two guids share an x_group name (e.g. 'quantity' on stockcomponent vs stockassembly) - packageGuid IN() filter applied only in WHERE on s, not duplicated in JOIN LibertyContent: use LibertyXrefType instance via lazy xrefType() accessor - Add mXrefType property (reset to null in registerContentType) - Private xrefType() creates LibertyXrefType(mContentTypeGuid, mPackageGuid) on first call and caches it - Five delegate methods simplified to single-line instance calls Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08LibertyXref: guard xorder against null when item not in liberty_xref_itemLester Caine1-1/+1
(int) cast on $next prevents NULL overwriting the default xorder=0 when fAddXref is used for an item type that has no liberty_xref_item row. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07LibertyXrefInfo/LibertyXrefGroup: optional package-level guid supportLester Caine2-9/+28
Adds optional $packageGuid parameter to both constructors. When set, the liberty_xref_group and liberty_xref_item queries use IN (type, pkg) instead of = type, allowing package-level rows to be shared across multiple content types (e.g. 'stock' shared by stockassembly and stockcomponent). Also removes duplicate ipackage attributes from templates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06liberty: fix null mUserId in LibertyXrefType JOIN conditionsLester Caine1-4/+4
Same pattern as contact: direct mUserId string interpolation produces 'purm.user_id=' with no value for anonymous users (null mUserId), causing Firebird -104 Token unknown. Four occurrences fixed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06LibertyBase: replace placeholder with architecture docblock; tighten factory ↵Lester Caine1-30/+43
method docs Class docblock explains the intermediate role between BitBase and LibertyContent, and documents getLibertyObject() as the canonical entry point for loading any content by content_id. Factory method docblocks updated: getLibertyObject() resolution order, getLibertyClass() use case, getNewObject/ById() override intent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06xref: migrate query methods to LibertyXrefType; docblocks throughoutLester Caine5-152/+648
LibertyXrefType gains five runtime statics (getDisplayGroups, getTypeMarkers, getAvailableItems, getTemplateFormats, getContentTypeMarkers) — role-filtered, content-type-scoped. LibertyContent xref query methods become one-line delegates. LibertyXrefInfo added as new class (was missing from repo). Docblocks added to LibertyContent class, LibertyXref, LibertyXrefGroup, LibertyXrefInfo, LibertyXrefType. list_xref.tpl: remove dead legacy $source path; new path only. loadXrefList() removed from LibertyContent (stock fully migrated). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06xref group templates: drop Link column; tighten text item edit gatingLester Caine1-0/+87
- list_xref.tpl: remove dead Link <th>; add 30/30/40% column widths; fix colspan to conditional 6/3; support both LibertyXrefGroup and legacy $source paths - view_xref_text_item.tpl: remove &nbsp; Link cell; wrap date/updated/ edit cells under single {if $xrefAllowEdit|default:false} - LibertyXrefGroup: new class — loads xref rows for one x_group, separates expired rows into history Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01Guard null pFileHash type in preg_match/preg_split calls — PHP 8.x deprecationLester Caine1-3/+3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30Fix xref role guard and add xorder to loadXrefList SELECTLester Caine1-6/+6
Guard mRoles against null in all xref query methods to prevent TypeError and Firebird empty IN() syntax error for unauthenticated users; fall back to [-1] so the IN() clause is valid but matches nothing. Also add x.xorder to the SELECT in loadXrefList() so xorder values are available in fetched row data for sorting and display. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29Add enrichXrefDisplay hook and xkey_ext to value edit templateLester Caine1-0/+2
- LibertyContent: add enrichXrefDisplay() no-op hook; call it in edit_xref.php so packages can inject display-only data (e.g. component title) into xrefInfo - edit_xref_value_item.tpl: add Notes (xkey_ext) field alongside Value (xkey) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29Standardise xref templates to _item naming; add value and group templatesLester Caine1-12/+33
- Rename all view_xref_*_record.tpl → view_xref_*_item.tpl throughout - LibertyContent: getXrefRecordTemplate/ListTemplate/EditTemplate use _item naming with three-level fallback (pkg/guid subdir → pkg root → liberty); getXrefRecordTemplate falls back to text_item if template file not found; getXrefEditTemplate checks liberty _item before generic edit_xref.tpl - list_xref.tpl: assign _rowTpl before method call to avoid Smarty section variable resolution issue inside PHP method call arguments - New templates: view_xref_value_item.tpl, edit_xref_value_item.tpl for simple numeric xref items (xkey field, not data) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29BOM parts list support: xref template dispatch and LibertyXref fixesLester Caine2-3/+41
- LibertyContent: add getXrefListTemplate(), getXrefRecordTemplate(), getXrefEditTemplate() for package-aware template dispatch with liberty fallback - LibertyXref: explicit xorder passthrough in verify(); fix start_date/end_date to use time() instead of mDb->NOW() so BitDate::date() receives a timestamp - add_xref.php, edit_xref.php: redirect to getEditUrl() after save/cancel - list_xref.tpl: use getXrefRecordTemplate() instead of hardcoded liberty path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27Fix LibertyXref: public mContentTypeGuid, format dates for FirebirdLester Caine1-5/+5
- Make mContentTypeGuid public so LibertyContent::storeXref() can set it on a fresh LibertyXref instance - Format start_date/end_date Unix timestamps as Y-m-d H:i:s UTC strings before INSERT; Firebird rejects raw integers for TIMESTAMP columns - Use null instead of empty string for ignored date fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26Add liberty_xref cleanup to LibertyContent::expunge()Lester Caine1-0/+4
liberty_xref rows are owned by content_id but were never deleted during expunge, leaving orphaned xref records whenever any content type was deleted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26Fix stale column name source → item in getXrefTypeList num_entries queryLester Caine1-2/+2
liberty_xref.source was renamed to item; the count query in getXrefTypeList still referenced the old name causing a fatal error on the admin xref sources page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26Add liberty_xref subsystem: package-agnostic typed cross-referencesLester Caine4-52/+57
Replaces per-package xref tables with three shared liberty tables: liberty_xref_group (tab groups), liberty_xref_item (source definitions), liberty_xref (records). Column names: group→x_group (Firebird reserved word), source→item, multi→multiple throughout PHP classes and templates. - 5.0.1 upgrade creates the three tables + sequence + indexes for existing installs - schema_inc.php updated so fresh installs also get the tables - Admin UI: admin_xref_groups and admin_xref_sources pages with package filter - LibertyContent::loadXrefList / getXrefGroupList / getXrefTypeList updated - LibertyMime: skip attachment rendering during BIT_INSTALL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Add generic xref group/source admin pages to libertyLester Caine1-0/+42
LibertyXrefType: add getContentTypeGuids() and getGroupList() static methods. New admin pages with package filter (session-persisted content_type_guid dropdown): admin_xref_groups.php manages liberty_xref_type rows; admin_xref_sources.php manages liberty_xref_source rows. Both support add and delete (delete guarded by entry/source count). Wired into menu_liberty_admin.tpl as Xref Groups / Xref Sources links. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Add generic xref methods to LibertyContentLester Caine1-0/+217
Moves xref handling up from Contact so any LibertyContent subclass can use liberty_xref_type/source/xref tables scoped to its own content_type_guid. Added: getXrefGroupList, getXrefSourceList, getXrefTypeList, getXrefFormatList, loadXrefTypeList (uses protected $mXrefTypeKey, default 'xref_types'), loadXrefList, loadXref, storeXref, stepXref. loadXref/storeXref/stepXref use LibertyXref directly with mContentTypeGuid set before load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Add mContentTypeGuid scoping to LibertyXref for multi-package isolationLester Caine2-7/+12
LibertyXref gains a $mContentTypeGuid property (default empty) used to filter the liberty_xref_source JOIN in load() and the multi-check in verify(). Subclasses set it to scope queries to their content type without duplicating any logic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22Add liberty_xref package-agnostic cross-reference mechanismLester Caine2-0/+230
New tables: liberty_xref_type (text PK, package, sort_order), liberty_xref_source (package column for direct equality filtering), liberty_xref (data rows keyed by content_id, works for any package). Sequence liberty_xref_seq and indices on content_id and package columns. LibertyXref and LibertyXrefType classes provide the full store/load/step mechanism. Contact and stock register their own source types against the shared tables. Upgrade script 5.0.1.php creates the tables on existing installs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21Fix addHit() race condition and stuck Firebird transactionLester Caine1-10/+8
Replaced SELECT-then-INSERT/UPDATE with UPDATE-first pattern: attempt UPDATE and only INSERT if zero rows were affected. Eliminates the race window where two concurrent requests both see no row and both try to INSERT, which left an uncommitted Firebird transaction blocking reads. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18getLibertySql was never completed so roll back to the working getServicesSql ↵Lester Caine1-2/+1
functionality Used by blogs to pass extra info to search package
2026-05-18Tidy install process handling following other changesLester Caine1-4/+14
Missed from BIT_INSTALL fixes
2026-05-16Phantom ; removedLester Caine1-4/+3
2026-05-16Fix parseData corruption of raw 'data' elementLester Caine1-2/+3
2026-05-15Namespace fixesLester Caine1-1/+2
2026-05-15To simplyfy maintenence BitUser classes have been retired and active code ↵Lester Caine1-68/+14
base defaulted to ROLE_MODEL reducing complexity in LibertyContent
2026-05-14Move markdown library into the relevant package for easier maintenanceLester Caine1-0/+1691
2026-05-14php-cs-fixer tidies to php8.5 standardsLester Caine12-171/+132
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10Use BIT_INSTALL to block database access until database has been populatedLester Caine1-1/+1
2026-05-08Add default when no user active (PHP8)lsces1-1/+1
2026-04-16Style tidies for PHP8.4lsces2-17/+16
2026-04-16Default to html on new installlsces1-13/+5
2026-04-06Tidying links to bitweaver.org to avoid redirect from httplsces1-1/+1
2026-04-06Tidy a default setting holelsces1-0/+3
2026-04-05Solving a little chicken and egg situation when installing from scratch. ↵lsces2-10/+12
Once the database is created autoload is messing things up until the tables are also created. Need a tidier way of doing this but it works for now by check tables exist before using them.
2026-04-02static function calls, but still need to clear an errorlsces2-10/+10
2026-04-02Little hacky for firebird, need to identify correct pdo driver if pdo is ↵lsces1-3/+4
being used
2026-03-26Empty value correctionslsces2-6/+6
2026-02-01Tidy to php8.4, add default valueslsces1-2/+2
2025-09-10Preface function calls with Liberty namespacelsces1-0/+2
2025-09-10Short array formatlsces1-30/+36
2025-09-10Missing namespace stufflsces1-5/+5