<field reporter:label="Classification Scheme" name="label_class" reporter:datatype="link"/>
<field reporter:label="Prefix" name="prefix" reporter:datatype="link"/>
<field reporter:label="Suffix" name="suffix" reporter:datatype="link"/>
+ <field reporter:label="Dewey Classification" name="dewey" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="editor" reltype="has_a" key="id" map="" class="au"/>
<link field="label_class" reltype="has_a" key="id" map="" class="acnc"/>
<link field="prefix" reltype="has_a" key="id" map="" class="acnp"/>
<link field="suffix" reltype="has_a" key="id" map="" class="acns"/>
+ <link field="dewey" reltype="might_have" key="call_number" map="" class="racnd"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
</actions>
</permacrud>
</class>
+ <class id="racnd" controller="open-ils.cstore open-ils.reporter-store open-ils.pcrud" oils_obj:fieldmapper="reporter::asset_call_number_dewey" oils_persist:tablename="reporter.asset_call_number_dewey" reporter:label="Dewey Classification">
+ <fields oils_persist:primary="call_number">
+ <field reporter:label="Call Number" name="call_number" reporter:datatype="link" />
+ <field reporter:label="Dewey Number" name="dewey" reporter:datatype="text"/>
+ <field reporter:label="Dewey Range - Tens" name="dewey_range_tens" reporter:datatype="text"/>
+ <field reporter:label="Dewey Range - Hundreds" name="dewey_range_hundreds" reporter:datatype="text"/>
+ <field reporter:label="Dewey Block - Tens" name="dewey_block_tens" reporter:datatype="text"/>
+ <field reporter:label="Dewey Block - Hundreds" name="dewey_block_hundreds" reporter:datatype="text"/>
+ </fields>
+ <links>
+ <link field="call_number" reltype="has_a" key="id" map="" class="acn"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <retrieve/>
+ </actions>
+ </permacrud>
+ </class>
<class id="auri" controller="open-ils.cstore" oils_obj:fieldmapper="asset::uri" oils_persist:tablename="asset.uri" reporter:label="Electronic Access URI">
<fields oils_persist:primary="id" oils_persist:sequence="asset.uri_id_seq">
<field reporter:label="URI ID" name="id" reporter:datatype="id"/>
SELECT reporter.enable_materialized_simple_record_trigger();
$$ LANGUAGE SQL;
+CREATE OR REPLACE VIEW reporter.asset_call_number_dewey AS
+ SELECT id AS call_number,
+ call_number_dewey(label) AS dewey,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9.]$'::text
+ THEN btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text))
+ ELSE NULL::text
+ END AS dewey_block_tens,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text))
+ ELSE NULL::text
+ END AS dewey_block_hundreds,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN (btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) || '-'::text)
+ || btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision) + 9::double precision, '000'::text))
+ ELSE NULL::text
+ END AS dewey_range_tens,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN (btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) || '-'::text)
+ || btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision) + 99::double precision, '000'::text))
+ ELSE NULL::text
+ END AS dewey_range_hundreds
+ FROM asset.call_number
+ WHERE call_number_dewey(label) ~ '^[0-9]'::text;
+
CREATE OR REPLACE VIEW reporter.demographic AS
SELECT u.id,
u.dob,
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE VIEW reporter.asset_call_number_dewey AS
+ SELECT id AS call_number,
+ call_number_dewey(label) AS dewey,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9.]$'::text
+ THEN btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text))
+ ELSE NULL::text
+ END AS dewey_block_tens,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text))
+ ELSE NULL::text
+ END AS dewey_block_hundreds,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN (btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision), '000'::text)) || '-'::text)
+ || btrim(to_char(10::double precision * floor(call_number_dewey(label)::double precision / 10::double precision) + 9::double precision, '000'::text))
+ ELSE NULL::text
+ END AS dewey_range_tens,
+ CASE WHEN call_number_dewey(label) ~ '^[0-9]+.?[0-9]*$'::text
+ THEN (btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision), '000'::text)) || '-'::text)
+ || btrim(to_char(100::double precision * floor(call_number_dewey(label)::double precision / 100::double precision) + 99::double precision, '000'::text))
+ ELSE NULL::text
+ END AS dewey_range_hundreds
+ FROM asset.call_number
+ WHERE call_number_dewey(label) ~ '^[0-9]'::text;
+
+COMMIT;
--- /dev/null
+Add Dewey Call Number Blocks and Ranges to Reports
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+A new view is added to the reporter with links from Call Number that
+will allow users to display or filter on the Dewey 10's or 100's block
+or range that a call number falls within. They can be accessed by
+following the "Dewey Classification" link from Call Number.
+