scottmk [Mon, 24 Aug 2009 16:14:36 +0000 (16:14 +0000)]
Add columns to acq.purchase_order: order_date and name.
Name defaults to the id, as text.
Name should be unique for a given ordering_agency and order
date (truncated to midnight), but only where order_date
is not null.
To change an existing table, run the following
through psql:
-- Add new columns; populate name
ALTER TABLE acq.purchase_order
ADD COLUMN order_date TIMESTAMP WITH TIME ZONE;
ALTER TABLE acq.purchase_order
ADD COLUMN name TEXT;
UPDATE acq.purchase_order
SET name = id::TEXT;
ALTER TABLE acq.purchase_order
ALTER COLUMN name SET NOT NULL;
-- Name should default to the id. We can't do that with a DEFAULT
-- clause but we can do it with a trigger.
CREATE OR REPLACE FUNCTION acq.purchase_order_name_default () RETURNS TRIGGER
AS $$
BEGIN
IF NEW.name IS NULL THEN
NEW.name := NEW.id::TEXT;
END IF;
RETURN NEW;
END;
$$ LANGUAGE PLPGSQL;
CREATE TRIGGER po_name_default_trg
BEFORE INSERT OR UPDATE ON acq.purchase_order
FOR EACH ROW EXECUTE PROCEDURE acq.purchase_order_name_default ();
-- Name should be unique for a given ordering_agency and day, where
-- order_date is not null. We can't do that with a check constraint
-- because it would require a subquery, so we use a trigger.
CREATE INDEX acq_po_org_name_order_date_idx
ON acq.purchase_order( ordering_agency, name, order_date );
CREATE OR REPLACE FUNCTION acq.po_org_name_date_unique () RETURNS TRIGGER
AS $$
DECLARE
collision INT;
BEGIN
--
-- If order_date is not null, then make sure we don't have a collision
-- on order_date (truncated to day), org, and name
--
IF NEW.order_date IS NULL THEN
RETURN NEW;
END IF;
--
-- In the WHERE clause, we compare the order_dates without regard to time of day.
-- We use a pair of inequalities instead of comparing truncated dates so that the
-- query can do an indexed range scan.
--
SELECT 1 INTO collision
FROM acq.purchase_order
WHERE
ordering_agency = NEW.ordering_agency
AND name = NEW.name
AND order_date >= date_trunc( 'day', NEW.order_date )
AND order_date < date_trunc( 'day', NEW.order_date ) + '1 day'::INTERVAL
AND id <> NEW.id;
--
IF collision IS NULL THEN
-- okay, no collision
RETURN NEW;
ELSE
-- collision; nip it in the bud
RAISE EXCEPTION 'Colliding purchase orders: ordering_agency %, date %, name ''%''',
NEW.ordering_agency, NEW.order_date, NEW.name;
END IF;
END;
$$ LANGUAGE PLPGSQL;
CREATE TRIGGER po_org_name_date_unique_trg
BEFORE INSERT OR UPDATE ON acq.purchase_order
FOR EACH ROW EXECUTE PROCEDURE acq.po_org_name_date_unique ();
erickson [Fri, 21 Aug 2009 15:33:02 +0000 (15:33 +0000)]
more work on pcrud filter dialog. added filter option to autogrid. repaired faulty linked object caching in autogrid. with caching repaired, made linked grid cell data fetching synchronous to prevent excessive network requests (1st instance of an object is cached)
erickson [Thu, 20 Aug 2009 16:04:35 +0000 (16:04 +0000)]
beginning of a filter dialog for pcrud requests. users select columns and values from autofieldwidgets. the eventual goal is to provide filter options for autogrid
miker [Thu, 20 Aug 2009 15:00:46 +0000 (15:00 +0000)]
moving the simple-rec synchronization out of the DB for insert/update, and as a new trigger for "delete". This should finally address the ingest issues seen at some sites through the 1.4 series
In our case, our generated function accidentally referenced a value dependent on the loop variable instead of the corresponding argument of the function generator.
So we had multiple async renewal calls that depending on the timing, could try to renew the same item. To further add insult to injury, this could potentially put the database in an inconsistent
state wtih duplicate circulations.
phasefx [Wed, 19 Aug 2009 03:07:41 +0000 (03:07 +0000)]
Have the Place Hold function in the Patron Holds interface update said interface upon successful hold placement.
Also, rework how the Patron Holds interface encourages the summary sidebar (and the label under the Holds button) to refresh itself with regard to holds.
phasefx [Tue, 18 Aug 2009 05:32:37 +0000 (05:32 +0000)]
fixed regression with default search field not being refocused after using the Clear Form button. Also have the default field come into focus when the whole tab leaves focus and is later revisited.
erickson [Mon, 17 Aug 2009 20:09:47 +0000 (20:09 +0000)]
turned on paging for po list. set up the state filter differently so that the browser won't choose a default value. no longer showing and fleshing the owner column since it was causing the render flickering... will reassess later.
erickson [Sun, 16 Aug 2009 15:49:12 +0000 (15:49 +0000)]
added support to autogrid for loading paged data via callback for UIs that load their own data. added paging to fund list page. added paging options to fund by org fetcher
lmcfarland [Fri, 14 Aug 2009 15:06:26 +0000 (15:06 +0000)]
show hold notices menu is now a hold details interface, soon to encompass all hold actions and details--added hold note functionality to this new/refactored UI
erickson [Thu, 13 Aug 2009 16:37:45 +0000 (16:37 +0000)]
create-hold call now only accepts a single hold arg. that's how it was being used and it makes the most since considering the return events are not hold-specific. now, return the new hold ID on successful creation. also tweaked potential copies count to use json_query count transform
erickson [Wed, 12 Aug 2009 17:18:50 +0000 (17:18 +0000)]
added ability to auto-override configured checkout/renewal events at selfcheck. also, pull in JS files directly so we're not unnecessarily running opac-only code
scottmk [Mon, 10 Aug 2009 16:14:58 +0000 (16:14 +0000)]
When defining a SELECT list for a given class: an empty
array no longer results in a default SELECT list. You get a
warning message (but not an error) and no fields from that
class. For a default SELECT list, use "*" or null.
erickson [Sun, 9 Aug 2009 14:35:19 +0000 (14:35 +0000)]
Patch from Galen Charlton to add Version to application.ini
==
The attached patch restores the Version key to the staff client's application.ini. This key is now required; without it, xulrunner-bin --install-app on OS X will silently crash, leading to an incomplete and non-functional installation of the client on that platform.
Note that when the client is built, the value of Version is replaced by the build ID.
scottmk [Wed, 5 Aug 2009 18:58:20 +0000 (18:58 +0000)]
In oils_cstore.c, function searchWHERE(): rewrote a loop to use an
index instead of a jsonIterator, to traverse a jsonObject that is
known to be a JSON_ARRAY. This change avoids the malloc and
free required to create and destroy a jsonIterator.
scottmk [Mon, 3 Aug 2009 03:02:48 +0000 (03:02 +0000)]
In the initialization routines of oils_cstore.c: recoded a couple
of loops to use an osrfHashIterator, instead of creating an
osrfStringArray of keys and then traversing that. This change
eliminates over 500 mallocs and frees. In addition, traversing
the osrfHash with an iterator just hops along a linked list,
which is almost certainly faster than calculating a hash total
for every key.
When a JSON query refers to a column qualified by a table alias using
the plus-class trick (e.g. "+aou":"opac_visible"): verify that the
column belongs to the indicated class. If it doesn't, return an error.
1. Issue a warning if the SELECT list is empty for a given table alias
(other than the core class). This happens when we try to do the
equivalent of SELECT * for a non-core class.
2. Return an error if the generated SELECT list is empty. This can happen
in a case like the following:
don't fulfill hold when patron checks out a like copy if the hold in question has a copy on the holds shelf. Use the power of cstore to find appropriate holds
for now, disable refresh of entire patron interface after penalty manipulation. What we're really avoiding is the stop-sign page. Want to revamp how the patron interface works here to make use of observers.
Staff initials for standing penalties. Looks for org setting ui.circ.standing_penalty.require_initials to enable this feature.
The Apply/Modify button will jump to the initials textbox if empty.
No dedicated initials field in actor.user_standing_penalty, so appending to the note field. Not parsing notes for initials when editing, though we may want to (I'd argue for a dedicated field in
this case).