<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</links>
</class>
+ <class id="acsp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::curbside" oils_persist:tablename="action.curbside" reporter:label="Curbside Appointment Slot">
+ <fields oils_persist:primary="id" oils_persist:sequence="action.curbside_id_seq">
+ <field reporter:label="Appointment ID" name="id" reporter:datatype="id" />
+ <field reporter:label="Patron" name="patron" reporter:datatype="link"/>
+ <field reporter:label="Pickup Library" name="org" reporter:datatype="org_unit"/>
+ <field reporter:label="Appointment Date/Time" name="slot" reporter:datatype="timestamp"/>
+ <field reporter:label="Staged" name="staged" reporter:datatype="timestamp"/>
+ <field reporter:label="Staging Staff" name="stage_staff" reporter:datatype="link"/>
+ <field reporter:label="Arrival Date/Time" name="arrival" reporter:datatype="timestamp"/>
+ <field reporter:label="Delivery Date/Time" name="delivered" reporter:datatype="timestamp"/>
+ <field reporter:label="Delivery Staff" name="stage_staff" reporter:datatype="link"/>
+ <field reporter:label="Notes" name="notes" reporter:datatype="text"/>
+ </fields>
+ <links>
+ <link field="org" reltype="has_a" key="id" map="" class="aou"/>
+ <link field="patron" reltype="has_a" key="id" map="" class="au"/>
+ <link field="stage_staff" reltype="has_a" key="id" map="" class="au"/>
+ <link field="delivery_staff" reltype="has_a" key="id" map="" class="au"/>
+ </links>
+ </class>
<class id="circ" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::circulation" oils_persist:tablename="action.circulation" reporter:core="true" reporter:label="Circulation">
<fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
<field reporter:label="Check In Library" name="checkin_lib" reporter:datatype="org_unit"/>
--- /dev/null
+BEGIN;
+
+CREATE TABLE action.curbside (
+ id SERIAL PRIMARY KEY,
+ patron INT NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ org INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ slot TIMESTAMPTZ,
+ staged TIMESTAMPTZ,
+ stage_staff INT REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ arrival TIMESTAMPTZ,
+ delivered TIMESTAMPTZ,
+ delivery_staff INT REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ notes TEXT
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
+VALUES (
+ 'circ.curbside',
+ 'Allow patrons to select a curbside pickup time',
+ 'circ',
+ 'When set to TRUE patrons will have the ability to schedule curbside pickup of holds that become available for pickup.',
+ 'bool'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
+VALUES (
+ 'circ.curbside.granularity',
+ 'Time interval between curbside appointments',
+ 'circ',
+ 'Time interval between curbside appointments',
+ 'interval'
+);
+
+INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
+VALUES (
+ 'circ.curbside.max_concurrent',
+ 'Maximum number of patrons that may select a particular curbside pickup time',
+ 'circ',
+ 'Maximum number of patrons that may select a particular curbside pickup time',
+ 'integer'
+);
+
+INSERT INTO actor.org_unit_setting (org_unit, name, value)
+ SELECT id, 'circ.curbside', 'false' FROM actor.org_unit WHERE parent_ou IS NULL
+ UNION
+ SELECT id, 'circ.curbside.max_concurrent', '10' FROM actor.org_unit WHERE parent_ou IS NULL
+ UNION
+ SELECT id, 'circ.curbside.granularity', '"15 minutes"' FROM actor.org_unit WHERE parent_ou IS NULL
+;
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+VALUES (
+ 'hold.offer_curbside',
+ 'ahr',
+ oils_i18n_gettext(
+ 'hold.offer_curbside',
+ 'Hook used to trigger the notification of an offer of curbside pickup',
+ 'ath',
+ 'description'
+ ),
+ TRUE
+);
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+VALUES (
+ 'hold.confirm_curbside',
+ 'acsp',
+ oils_i18n_gettext(
+ 'hold.confirm_curbside',
+ 'Hook used to trigger the notification of the creation or update of a curbside pickup appointment with an arrival URL',
+ 'ath',
+ 'description'
+ ),
+ TRUE
+);
+
+INSERT INTO action_trigger.reactor (module, description) VALUES (
+ 'CurbsideSlot', 'Create a curbside pickup appointment slot when necessary'
+);
+
+INSERT INTO action_trigger.validator (module, description) VALUES (
+ 'Curbside', 'Confirm that curbside pickup is enabled for the hold pickup library'
+);
+
+COMMIT;