VbzCart/docs/tables/event vc ord hold: Difference between revisions

From Woozle Writes Code
< VbzCart‎ | docs‎ | tables
Jump to navigation Jump to search
imported>Woozle
(alert fields, SysUser)
m (Woozle moved page VbzCart/VbzCart/tables/event vc ord hold to VbzCart/docs/tables/event vc ord hold without leaving a redirect: part 4/5)
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
==About==
==About==
* '''Purpose''': for tracking all order-related events, especially those affecting the order's status
* '''Purpose''': EventPlex extension for tracking events (usually or always manually-invoked) which change the status of an order
* '''History''':
* '''Related''': {{l/vbzcart/table|orders}}, {{l/vbzcart/table|ord_hold_type}}
** '''2008-12-27''' Extracted from main "tables" page, but no documentation yet
==Rules==
** '''2009-07-12'''
This is a bit complicated, but not messy.
*** Preliminary documentation
*** Added '''isActive''' field (was in {{vbzcart|table|ord_event_type}}, didn't belong there)
*** Added '''VbzUser''' and '''Machine''' fields
*** Renamed to singular form
** '''2009-10-18'''
*** Replaced '''isActive''' field with '''do*''' fields
*** Added '''SysUser''', for consistency with other event log tables
* '''Fields''':
** <s>'''isActive''' represents</s> The '''do*''' flag fields represent the state of the order after this event, as determined by taking the order's previous flags and applying the event type's flags -- if no hold flags are active, then the order is active. This provides a record of the order's actual state over time, negating the need to follow the event history from the beginning in order to find the order's state at any given time.
** '''VbzUser''' will probably just be the username from the wiki, if we will be using the wiki to manage user log-ins and provide access to the ordering system. Not sure how to let wiki authentication work for vbzcart code, unless we move the wiki to the same domain instead of its own subdomain (...or actually have the wiki present vbzcart pages, eventually?).
** '''Machine''' hasn't been rigorously defined yet; it just needs to be some way we can tell what computer was being used (and it does not need to be authenticated; authentication records should be kept elsewhere). Ideally, it should be netname@[ip address], but various coding environments may not support both of those.
===backstory===
I apparently designed this and its "types" table ({{vbzcart|table|ord_event_type}}) sometime in 2008, but didn't document them; a note on the {{vbzcart|table|ord_event_type}} page dated 2008-12-27 says "Are we actually using this, or is it part of the future online ordering system redesign?"


As of 2009-07, though, it has become clear that a general order log seems necessary for the following reasons:
* A '''hold event''' is where a hold-type is '''invoked''' or '''released'''.
* To replace the {{vbzcart|table|ord_pull}} table
* Each '''hold event record''' indicates which type of hold is applicable and whether it was set ("hold invoke event") or released ("hold release event"), and also keeps track of the current hold-state for the order. This provides a log of the order's hold-state over time as well as a quick lookup of the current hold-state so we don't also have to store it in the order record.
* To make it unnecessary to track user details inside other order-related records
* If a hold-release event results in no flags being set, then the order's ID_Hold field can be set to NULL; otherwise it should always point to the most recent hold event record.
* To keep an automatic record of all changes made to an order and any significant processing events
==History==
 
* '''2008-12-27''' Extracted from main "tables" page, but no documentation yet
The system implemented here of defining event types which may or may not block certain things seems compatible with this goal, and we mainly just needed to add fields for user-tracking.
* '''{{l/sub|2009}}''' Summary: Added '''isActive''' but then replaced it with '''do*''' fields
* '''2017-06-01''' Renamed from {{l/vbzcart/table|ord_change}} to {{l/vbzcart/table|event_vc_ord_change}}; redesigning as EventPlex extension. Will need to import {{l/vbzcart/table|ord_pull}} data, if possible.
* '''2017-06-02''' Renaming from {{l/vbzcart/table|event_vc_ord_change}} to {{l/vbzcart/table|event_vc_ord_hold}}
** I decided "change" was too general, and could be about changing information in the order, or order events like packaging... but instead of "pull" let's call it a "hold", for consistency with field names and to avoid conflict with old "pull" tables/naming. Also, a "hold" is different from a "pull" in that an order can have multiple active "holds" but only one active "pull".
** Finally figured out that a release is a separate event from an invoke, and adjusted table design accordingly:
*** '''isRelease''' field
*** No need for separate NotesPull/NotesFree fields as in ord_pull, nor a WhenFreed timestamp.
** Made the Notes field larger.
** Oh hey, this is still MYISAM... Changed to InnoDB.
** Wrote out as clearly as possible how this is supposed to work, since it basically took me 2-3 hours to work back around to what I had apparently intended earlier (2009?) and explained in at least one place (but not prominently enough for me to notice it until I had almost worked the same thing out again).
==Fields==
* The '''do*''' flag fields (formerly '''isActive''') represent the ''state of the order after this event'', as determined by taking the flags from the previous hold-event and applying the flags belonging to the event-type for this hold-event. This provides a record of the order's actual state over time, negating the need to follow the event history from the beginning in order to determine the order's state at any given time.
* '''ID_Type''' -> {{l/vbzcart/table|ord_hold_type}}.ID
==SQL==
==SQL==
<section begin=sql /><mysql>CREATE TABLE `ord_event` (
<syntaxhighlight lang=mysql>CREATE TABLE `event_vc_ord_hold` (
   `ID`             INT       NOT NULL AUTO_INCREMENT,
   `ID_Event`   INT           NOT NULL AUTO_INCREMENT,
   `ID_Ord`         INT       NOT NULL COMMENT "core_orders.ID",
   `ID_Order`   INT           NOT NULL COMMENT "orders.ID",
   `ID_Type`       INT       NOT NULL COMMENT "ord_event_type.ID",
   `ID_Type`   INT           NOT NULL COMMENT "ord_hold_type.ID",
  `isRelease`  BOOL          NOT NULL COMMENT "TRUE = this is a release, not an invoke",
   `doHoldRstk` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not base restock request items on this order",
   `doHoldRstk` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not base restock request items on this order",
   `doHoldChrg` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not charge bank card for this order",
   `doHoldChrg` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not charge bank card for this order",
   `doContact`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = customer needs to be contacted about this order",
   `doContact`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = customer needs to be contacted about this order",
   `doExamine`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = this order needs further examination",
   `doExamine`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = this order needs further examination",
  `WhenDone`  DATETIME                COMMENT "when the event happened",
   `Notes`     MEDIUMTEXT DEFAULT NULL COMMENT "human-added notes about the hold event",
  `VbzUser`  VARCHAR(127)            COMMENT "VbzCart username of whoever initiated the event, if available",
   PRIMARY KEY(`ID_Event`)
  `SysUser`  VARCHAR(127)            COMMENT "who logged into the operating system, if available",
  `Machine`  VARCHAR(63)              COMMENT "network name or IP address of client",
   `Notes`     VARCHAR(255)            COMMENT "human-entered notes, if needed",
   PRIMARY KEY(`ID`)
)
)
ENGINE = MYISAM;</mysql>
ENGINE = InnoDB;</syntaxhighlight>
<section end=sql />

Latest revision as of 01:57, 25 February 2024

About

Rules

This is a bit complicated, but not messy.

  • A hold event is where a hold-type is invoked or released.
  • Each hold event record indicates which type of hold is applicable and whether it was set ("hold invoke event") or released ("hold release event"), and also keeps track of the current hold-state for the order. This provides a log of the order's hold-state over time as well as a quick lookup of the current hold-state so we don't also have to store it in the order record.
  • If a hold-release event results in no flags being set, then the order's ID_Hold field can be set to NULL; otherwise it should always point to the most recent hold event record.

History

  • 2008-12-27 Extracted from main "tables" page, but no documentation yet
  • 2009 Summary: Added isActive but then replaced it with do* fields
  • 2017-06-01 Renamed from Template:L/vbzcart/table to Template:L/vbzcart/table; redesigning as EventPlex extension. Will need to import Template:L/vbzcart/table data, if possible.
  • 2017-06-02 Renaming from Template:L/vbzcart/table to Template:L/vbzcart/table
    • I decided "change" was too general, and could be about changing information in the order, or order events like packaging... but instead of "pull" let's call it a "hold", for consistency with field names and to avoid conflict with old "pull" tables/naming. Also, a "hold" is different from a "pull" in that an order can have multiple active "holds" but only one active "pull".
    • Finally figured out that a release is a separate event from an invoke, and adjusted table design accordingly:
      • isRelease field
      • No need for separate NotesPull/NotesFree fields as in ord_pull, nor a WhenFreed timestamp.
    • Made the Notes field larger.
    • Oh hey, this is still MYISAM... Changed to InnoDB.
    • Wrote out as clearly as possible how this is supposed to work, since it basically took me 2-3 hours to work back around to what I had apparently intended earlier (2009?) and explained in at least one place (but not prominently enough for me to notice it until I had almost worked the same thing out again).

Fields

  • The do* flag fields (formerly isActive) represent the state of the order after this event, as determined by taking the flags from the previous hold-event and applying the flags belonging to the event-type for this hold-event. This provides a record of the order's actual state over time, negating the need to follow the event history from the beginning in order to determine the order's state at any given time.
  • ID_Type -> Template:L/vbzcart/table.ID

SQL

CREATE TABLE `event_vc_ord_hold` (
  `ID_Event`   INT            NOT NULL AUTO_INCREMENT,
  `ID_Order`   INT            NOT NULL COMMENT "orders.ID",
  `ID_Type`    INT            NOT NULL COMMENT "ord_hold_type.ID",
  `isRelease`  BOOL           NOT NULL COMMENT "TRUE = this is a release, not an invoke",
  `doHoldRstk` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not base restock request items on this order",
  `doHoldChrg` TINYINT(1) DEFAULT NULL COMMENT "TRUE = do not charge bank card for this order",
  `doContact`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = customer needs to be contacted about this order",
  `doExamine`  TINYINT(1) DEFAULT NULL COMMENT "TRUE = this order needs further examination",
  `Notes`      MEDIUMTEXT DEFAULT NULL COMMENT "human-added notes about the hold event",
  PRIMARY KEY(`ID_Event`)
)
ENGINE = InnoDB;