[open-ils-commits] r17003 - in branches/seials-integration/Open-ILS: examples src/perlmods/OpenILS/Application src/sql/Pg xul/staff_client/server/serial (dbwells)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 21 16:35:43 EDT 2010
Author: dbwells
Date: 2010-07-21 16:35:37 -0400 (Wed, 21 Jul 2010)
New Revision: 17003
Modified:
branches/seials-integration/Open-ILS/examples/fm_IDL.xml
branches/seials-integration/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
branches/seials-integration/Open-ILS/src/sql/Pg/210.schema.serials.sql
branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.js
branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.xul
Log:
- Add 'status' to serial.item table, other small schema edits
- Updated and functional receive/bind method
- Minor changes to 'Items' tab
Modified: branches/seials-integration/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/seials-integration/Open-ILS/examples/fm_IDL.xml 2010-07-21 20:06:56 UTC (rev 17002)
+++ branches/seials-integration/Open-ILS/examples/fm_IDL.xml 2010-07-21 20:35:37 UTC (rev 17003)
@@ -3052,6 +3052,9 @@
<field reporter:label="Unit Label Suffix" name="unit_label_suffix" reporter:datatype="text"/>
<field reporter:label="Streams" name="streams" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Basic Issue Summary" name="basic_summary" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Supplemental Issue Summary" name="supplement_summary" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Index Issue Summary" name="index_summary" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="record_entry" reltype="has_a" key="id" map="" class="sre"/>
@@ -3063,6 +3066,9 @@
<link field="bind_unit_template" reltype="has_a" key="id" map="" class="act"/>
<link field="streams" reltype="has_many" key="distribution" map="" class="sstr"/>
<link field="notes" reltype="has_many" key="distribution" map="" class="sdistn"/>
+ <link field="basic_summary" reltype="might_have" key="distribution" map="" class="sbsum"/>
+ <link field="supplement_summary" reltype="might_have" key="distribution" map="" class="sssum"/>
+ <link field="index_summary" reltype="might_have" key="distribution" map="" class="sisum"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
@@ -3241,6 +3247,7 @@
<field reporter:label="URI" name="uri" reporter:datatype="link"/>
<field reporter:label="Date Expected" name="date_expected" reporter:datatype="timestamp"/>
<field reporter:label="Date Received" name="date_received" reporter:datatype="timestamp"/>
+ <field reporter:label="Status" name="status" reporter:datatype="text"/>
<field reporter:label="Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
@@ -3286,8 +3293,8 @@
</permacrud>
</class>
- <class id="sbsum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::bib_summary" oils_persist:tablename="serial.bib_summary" reporter:label="Bib Summary">
- <fields oils_persist:primary="id" oils_persist:sequence="serial.bib_summary_id_seq">
+ <class id="sbsum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::basic_summary" oils_persist:tablename="serial.basic_summary" reporter:label="Basic Issue Summary">
+ <fields oils_persist:primary="id" oils_persist:sequence="serial.basic_summary_id_seq">
<field name="id" reporter:datatype="id" />
<field name="distribution" reporter:datatype="link"/>
<field name="generated_coverage" reporter:datatype="text"/>
@@ -3306,7 +3313,7 @@
</permacrud>
</class>
- <class id="sssum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::sup_summary" oils_persist:tablename="serial.sup_summary" reporter:label="Supplemental Issue Summary">
+ <class id="sssum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::supplement_summary" oils_persist:tablename="serial.supplement_summary" reporter:label="Supplemental Issue Summary">
<fields oils_persist:primary="id" oils_persist:sequence="serial.sup_summary_id_seq">
<field name="id" reporter:datatype="id" />
<field name="distribution" reporter:datatype="link"/>
@@ -3326,7 +3333,7 @@
</permacrud>
</class>
- <class id="sisum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::index_summary" oils_persist:tablename="serial.index_summary" reporter:label="Index Summary">
+ <class id="sisum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::index_summary" oils_persist:tablename="serial.index_summary" reporter:label="Index Issue Summary">
<fields oils_persist:primary="id" oils_persist:sequence="serial.index_summary_id_seq">
<field name="id" reporter:datatype="id" />
<field name="distribution" reporter:datatype="link"/>
Modified: branches/seials-integration/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
===================================================================
--- branches/seials-integration/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm 2010-07-21 20:06:56 UTC (rev 17002)
+++ branches/seials-integration/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm 2010-07-21 20:35:37 UTC (rev 17003)
@@ -119,7 +119,7 @@
$item->edit_date('now');
if( $item->isdeleted ) {
- $evt = _delete_item( $editor, $override, $item);
+ $evt = _delete_sitem( $editor, $override, $item);
} elsif( $item->isnew ) {
# TODO: reconsider this
# if the item has a new issuance, create the issuance first
@@ -127,10 +127,10 @@
fleshed_issuance_alter($self, $conn, $auth, [$item->issuance]);
}
_cleanse_dates($item, ['date_expected','date_received']);
- $evt = _create_item( $editor, $item );
+ $evt = _create_sitem( $editor, $item );
} else {
_cleanse_dates($item, ['date_expected','date_received']);
- $evt = _update_item( $editor, $override, $item );
+ $evt = _update_sitem( $editor, $override, $item );
}
}
@@ -145,14 +145,14 @@
return 1;
}
-sub _delete_item {
+sub _delete_sitem {
my ($editor, $override, $item) = @_;
$logger->info("item-alter: delete item ".OpenSRF::Utils::JSON->perl2JSON($item));
return $editor->event unless $editor->delete_serial_item($item);
return 0;
}
-sub _create_item {
+sub _create_sitem {
my ($editor, $item) = @_;
$item->creator($editor->requestor->id);
@@ -163,7 +163,7 @@
return 0;
}
-sub _update_item {
+sub _update_sitem {
my ($editor, $override, $item) = @_;
$logger->info("item-alter: retrieving item ".$item->id);
@@ -241,13 +241,13 @@
$issuance->edit_date('now');
if( $issuance->isdeleted ) {
- $evt = _delete_issuance( $editor, $override, $issuance);
+ $evt = _delete_siss( $editor, $override, $issuance);
} elsif( $issuance->isnew ) {
_cleanse_dates($issuance, ['date_published']);
- $evt = _create_issuance( $editor, $issuance );
+ $evt = _create_siss( $editor, $issuance );
} else {
_cleanse_dates($issuance, ['date_published']);
- $evt = _update_issuance( $editor, $override, $issuance );
+ $evt = _update_siss( $editor, $override, $issuance );
}
}
@@ -262,14 +262,14 @@
return 1;
}
-sub _delete_issuance {
+sub _delete_siss {
my ($editor, $override, $issuance) = @_;
$logger->info("issuance-alter: delete issuance ".OpenSRF::Utils::JSON->perl2JSON($issuance));
return $editor->event unless $editor->delete_serial_issuance($issuance);
return 0;
}
-sub _create_issuance {
+sub _create_siss {
my ($editor, $issuance) = @_;
$issuance->creator($editor->requestor->id);
@@ -280,7 +280,7 @@
return 0;
}
-sub _update_issuance {
+sub _update_siss {
my ($editor, $override, $issuance) = @_;
$logger->info("issuance-alter: retrieving issuance ".$issuance->id);
@@ -612,7 +612,7 @@
}
__PACKAGE__->register_method(
- method => 'receive_items',
+ method => 'unitize_items',
api_name => 'open-ils.serial.receive_items',
api_level => 1,
argc => 1,
@@ -631,91 +631,275 @@
}
);
-sub receive_items {
+sub unitize_items {
my ($self, $conn, $auth, $items) = @_;
- my $last_distribution;
- my $last_mfhd;
- my %sres_to_save;
- my %mfhds_to_save;
my( $reqr, $evt ) = $U->checkses($auth);
return $evt if $evt;
my $editor = new_editor(requestor => $reqr, xact => 1);
+ $self->api_name =~ /serial\.(\w*)_items/;
+ my $mode = $1;
+
+ my %found_unit_ids;
+ my %found_stream_ids;
+ my %found_types;
+
+ my %stream_ids_by_unit_id;
+
+ my %unit_map;
+ my %sdist_by_unit_id;
+ my %sdist_by_stream_id;
+
+ my $new_unit_id; # id for '-2' units to share
foreach my $item (@$items) {
- # unflesh unit if fleshed
- $item->unit( $item->unit->id ) if ref($item->unit);
+ # for debugging only, TODO: delete
+ if (!ref $item) { # hopefully we got an id instead
+ $item = $editor->retrieve_serial_item($item);
+ }
+ # get ids
+ my $unit_id = ref($item->unit) ? $item->unit->id : $item->unit;
+ my $stream_id = ref($item->stream) ? $item->stream->id : $item->stream;
+ my $issuance_id = ref($item->issuance) ? $item->issuance->id : $item->issuance;
+ #TODO: evt on any missing ids
- $item->date_received('now');
+ if ($mode eq 'receive') {
+ $item->date_received('now');
+ $item->status('Received');
+ } else {
+ $item->status('Bindery');
+ }
+ # check for types to trigger summary updates
+ my $scap;
+ if (!ref $item->issuance) {
+ my $scaps = $editor->search_serial_caption_and_pattern([{"+siss" => {"id" => $issuance_id}}, { "join" => {"siss" => {}} }]);
+ $scap = $scaps->[0];
+ } elsif (!ref $item->issuance->caption_and_pattern) {
+ $scap = $editor->retrieve_serial_caption_and_pattern($item->issuance->caption_and_pattern);
+ } else {
+ $scap = $editor->issuance->caption_and_pattern;
+ }
+ if (!exists($found_types{$stream_id})) {
+ $found_types{$stream_id} = {};
+ }
+ $found_types{$stream_id}->{$scap->type} = 1;
+
# create unit if needed
- if ($item->unit == -1) { # create by "volume" (first item division)
- #TODO
- } elsif ($item->unit == -2) { # create by "issue" (second item division)
- #TODO
+ if ($unit_id == -1 or (!$new_unit_id and $unit_id == -2)) { # create unit per item
+ my $unit;
+ my $sdists = $editor->search_serial_distribution([{"+sstr" => {"id" => $stream_id}}, { "join" => {"sstr" => {}} }]);
+ $unit = _build_unit($editor, $sdists->[0], $mode);
+ my $evt = _create_sunit($editor, $unit);
+ return $evt if $evt;
+ if ($unit_id == -2) {
+ $new_unit_id = $unit->id;
+ $unit_id = $new_unit_id;
+ } else {
+ $unit_id = $unit->id;
+ }
+ $item->unit($unit_id);
+
+ # get unit with 'DEFAULT's and save unit and sdist for later use
+ $unit = $editor->retrieve_serial_unit($unit->id);
+ $unit_map{$unit_id} = $unit;
+ $sdist_by_unit_id{$unit_id} = $sdists->[0];
+ $sdist_by_stream_id{$stream_id} = $sdists->[0];
+ } elsif ($unit_id == -2) { # create one unit for all '-2' items
+ $unit_id = $new_unit_id;
}
- my $mfhd;
- my $sre;
- if ($item->distribution == $last_distribution) {
- # use cached record
- $mfhd = $last_mfhd;
- } else { # get MFHD record
- my $sdist = $editor->retrieve_serial_distribution([$item->distribution]);
- $sre = $editor->retrieve_serial_record_entry([$sdist->record_entry]);
+ $found_unit_ids{$unit_id} = 1;
+ $found_stream_ids{$stream_id} = 1;
- #convert from marc_xml to marc
- my $marc = MARC::Record->new_from_xml($sre->marc);
+ # save the stream_id for this unit_id
+ # TODO: prevent items from different streams in same unit? (perhaps in interface)
+ $stream_ids_by_unit_id{$unit_id} = $stream_id;
- #turn into MFHD record object
- $mfhd = MFHD->new($marc);
- $sres_to_save{$sre->id} = $sre;
- $mfhds_to_save{$sre->id} = $mfhd;
+ my $evt = _update_sitem($editor, undef, $item);
+ return $evt if $evt;
+ }
+
+ # deal with unit level labels
+ foreach my $unit_id (keys %found_unit_ids) {
+
+ # get all the needed issuances for unit
+ my $issuances = $editor->search_serial_issuance([ {"+sitem" => {"unit" => $unit_id, "status" => "Received"}}, {"join" => {"sitem" => {}}, "order_by" => {"siss" => "date_published"}} ]);
+ #TODO: evt on search failure
+
+ my ($mfhd, $formatted_parts) = _summarize_contents($editor, $issuances);
+
+ # special case for single formatted_part (may have summarized version)
+ if (@$formatted_parts == 1) {
+ #TODO: MFHD.pm should have a 'format_summary' method for this
}
- my $item_holding = _revive_holding($mfhd, $item->holding_code);
+ # retrieve and update unit contents
+ my $sunit;
+ my $sdist;
+
+ # if we just created the unit, we will already have it and the distribution stored
+ if (exists $unit_map{$unit_id}) {
+ $sunit = $unit_map{$unit_id};
+ $sdist = $sdist_by_unit_id{$unit_id};
+ } else {
+ $sunit = $editor->retrieve_serial_unit($unit_id);
+ $sdist = $editor->search_serial_distribution([{"+sstr" => {"id" => $stream_ids_by_unit_id{$unit_id}}}, { "join" => {"sstr" => {}} }]);
+ $sdist = $sdist->[0];
+ }
+
+ $sunit->detailed_contents($sdist->unit_label_prefix . ' '
+ . join(', ', @$formatted_parts) . ' '
+ . $sdist->unit_label_suffix);
+
+ $sunit->summary_contents($sunit->detailed_contents); #TODO: change this when real summary contents are available
+
+ # create sort_key by left padding numbers to 6 digits
+ my $sort_key = $sunit->detailed_contents;
+ $sort_key =~ s/(\d+)/sprintf '%06d', $1/eg; # this may need improvement
+ $sunit->sort_key($sort_key);
- # get all current holdings for this linked caption
- my @curr_holdings = $mfhd->holdings($item_holding->tag, $item_holding->caption->link_id);
- # short-circuit logic : if holding is the next one, increment the last current holding
- my $next_holding_values = $curr_holdings[-1]->next;
- if ($next_holding_values and $item_holding->matches($next_holding_values)) {
- $curr_holdings[-1]->extend;
- } else { # not the next expected, do full replacement
- $mfhd->append_fields($item_holding);
-# my @updated_holdings = $mfhd->get_compressed_holdings($captions_ref->{$link_id});
- my @updated_holdings = $mfhd->get_compressed_holdings($item_holding->caption);
- # set reference point to top of current holdings
- my $marker_field = MARC::Field->new(500, '', '','a' => 'Temporary Marker');
- $mfhd->insert_fields_before($curr_holdings[0], $marker_field);
- foreach my $holding (@curr_holdings) {
- $mfhd->delete_field($holding);
- }
- $mfhd->delete_field($item_holding);
- $mfhd->insert_fields_before($marker_field, @updated_holdings);
- # delete reference point
- $mfhd->delete_field($marker_field);
- }
+ if ($mode eq 'bind') {
+ $sunit->status(2); # set to 'Bindery' status
+ }
- $last_distribution = $item->distribution;
- $last_mfhd = $mfhd;
- _update_item($editor, undef, $item);
+ my $evt = _update_sunit($editor, undef, $sunit);
+ return $evt if $evt;
}
- foreach my $sre_id (keys %sres_to_save) {
- #TODO: update '005' to current date
- my $sre = $sres_to_save{$sre_id};
- (my $xml = $mfhds_to_save{$sre_id}->as_xml_record()) =~ s/\n//sog;
- $xml =~ s/^<\?xml.+\?\s*>//go;
- $sre->marc($xml);
- $sre->ischanged(1);
- $editor->update_serial_record_entry($sre);
+ # TODO: cleanup 'dead' units (units which are now emptied of their items)
+
+ if ($mode eq 'receive') { # the summary holdings do not change when binding
+ # deal with stream level summaries
+ # summaries will be built from the "primary" stream only, that is, the stream with the lowest ID per distribution
+ # (TODO: consider direct designation)
+ my %primary_streams_by_sdist;
+ my %streams_by_sdist;
+
+ # see if we have primary streams, and if so, associate them with their distributions
+ foreach my $stream_id (keys %found_stream_ids) {
+ my $sdist;
+ if (exists $sdist_by_stream_id{$stream_id}) {
+ $sdist = $sdist_by_stream_id{$stream_id};
+ } else {
+ $sdist = $editor->search_serial_distribution([{"+sstr" => {"id" => $stream_id}}, { "join" => {"sstr" => {}} }]);
+ $sdist = $sdist->[0];
+ }
+ my $streams;
+ if (!exists($streams_by_sdist{$sdist->id})) {
+ $streams = $editor->search_serial_stream([{"distribution" => $sdist->id}, {"order_by" => {"sstr" => "id"}}]);
+ $streams_by_sdist{$sdist->id} = $streams;
+ } else {
+ $streams = $streams_by_sdist{$sdist->id};
+ }
+ $primary_streams_by_sdist{$sdist->id} = $streams->[0] if ($stream_id == $streams->[0]->id);
+ }
+
+ # retrieve and update summaries for each affected primary stream's distribution
+ foreach my $sdist_id (keys %primary_streams_by_sdist) {
+ my $stream = $primary_streams_by_sdist{$sdist_id};
+ my $stream_id = $stream->id;
+ # get all the needed issuances for stream
+ # FIXME: search in Bindery/Bound/Not Published? as well as Received
+ foreach my $type (keys %{$found_types{$stream_id}}) {
+ my $issuances = $editor->search_serial_issuance([ {"+sitem" => {"stream" => $stream_id, "status" => "Received"}, "+scap" => {"type" => $type}}, {"join" => {"sitem" => {}, "scap" => {}}, "order_by" => {"siss" => "date_published"}} ]);
+ #TODO: evt on search failure
+
+ my ($mfhd, $formatted_parts) = _summarize_contents($editor, $issuances);
+
+ # retrieve and update the generated_coverage of the summary
+ my $search_method = "search_serial_${type}_summary";
+ my $summary = $editor->$search_method([{"distribution" => $sdist_id}]);
+ $summary = $summary->[0];
+ $summary->generated_coverage(join(', ', @$formatted_parts));
+ my $update_method = "update_serial_${type}_summary";
+ return $editor->event unless $editor->$update_method($summary);
+ }
+ }
}
$editor->commit;
return scalar @$items;
}
+sub _build_unit {
+ my $editor = shift;
+ my $sdist = shift;
+ my $mode = shift;
+ my $attr = $mode . '_unit_template';
+ my $template = $editor->retrieve_asset_copy_template($sdist->$attr);
+
+ my @parts = qw( circ_lib status location loan_duration fine_level age_protect circulate deposit ref holdable deposit_amount price circ_modifier circ_as_type alert_message opac_visible floating mint_condition );
+
+ my $unit = new Fieldmapper::serial::unit;
+ foreach my $part (@parts) {
+ my $value = $template->$part;
+ next if !defined($value);
+ $unit->$part($value);
+ }
+ if (!$template->circ_lib) {
+ $unit->circ_lib($sdist->holding_lib);
+ }
+ $unit->creator($editor->requestor->id);
+ $unit->editor($editor->requestor->id);
+ $attr = $mode . '_call_number';
+ $unit->call_number($sdist->$attr);
+ $unit->barcode('AUTO');
+ $unit->sort_key('');
+ $unit->summary_contents('');
+ $unit->detailed_contents('');
+
+ return $unit;
+}
+
+
+sub _summarize_contents {
+ my $editor = shift;
+ my $issuances = shift;
+
+ # create MFHD record
+ my $mfhd = MFHD->new(MARC::Record->new());
+ my %scaps;
+ my %scap_fields;
+ my @scap_fields_ordered;
+ my $seqno = 1;
+ my $link_id = 1;
+ foreach my $issuance (@$issuances) {
+ my $scap_id = $issuance->caption_and_pattern;
+ next if (!$scap_id); # skip issuances with no caption/pattern
+
+ my $scap;
+ my $scap_field;
+ # if this is the first appearance of this scap, retrieve it and add it to the temporary record
+ if (!exists $scaps{$issuance->caption_and_pattern}) {
+ $scaps{$scap_id} = $editor->retrieve_serial_caption_and_pattern($scap_id);
+ $scap = $scaps{$scap_id};
+ $scap_field = _revive_caption($scap);
+ $scap_fields{$scap_id} = $scap_field;
+ push(@scap_fields_ordered, $scap_field);
+ $scap_field->update('8' => $link_id);
+ $mfhd->append_fields($scap_field);
+ $link_id++;
+ } else {
+ $scap = $scaps{$scap_id};
+ $scap_field = $scap_fields{$scap_id};
+ }
+
+ $mfhd->append_fields(_revive_holding($issuance->holding_code, $scap_field, $seqno));
+ $seqno++;
+ }
+
+ my @formatted_parts;
+ foreach my $scap_field (@scap_fields_ordered) { #TODO: use generic MFHD "summarize" method, once available
+ my @updated_holdings = $mfhd->get_compressed_holdings($scap_field);
+ foreach my $holding (@updated_holdings) {
+ push(@formatted_parts, $holding->format);
+ }
+ }
+
+ return ($mfhd, \@formatted_parts);
+}
+
##########################################################################
# note methods
#
@@ -1225,6 +1409,18 @@
$logger->info("distribution-alter: new distribution ".OpenSRF::Utils::JSON->perl2JSON($sdist));
return $editor->event unless $editor->create_serial_distribution($sdist);
+
+ # create summaries too
+ my $summary = new Fieldmapper::serial::basic_summary;
+ $summary->distribution($sdist->id);
+ return $editor->event unless $editor->create_serial_basic_summary($summary);
+ $summary = new Fieldmapper::serial::supplement_summary;
+ $summary->distribution($sdist->id);
+ return $editor->event unless $editor->create_serial_supplement_summary($summary);
+ $summary = new Fieldmapper::serial::index_summary;
+ $summary->distribution($sdist->id);
+ return $editor->event unless $editor->create_serial_index_summary($summary);
+
return 0;
}
Modified: branches/seials-integration/Open-ILS/src/sql/Pg/210.schema.serials.sql
===================================================================
--- branches/seials-integration/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-07-21 20:06:56 UTC (rev 17002)
+++ branches/seials-integration/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-07-21 20:35:37 UTC (rev 17003)
@@ -219,6 +219,10 @@
DEFERRABLE INITIALLY DEFERRED,
date_expected TIMESTAMP WITH TIME ZONE,
date_received TIMESTAMP WITH TIME ZONE
+ status TEXT CONSTRAINT valid_status CHECK
+ (
+ status IN ('Bindery', 'Bound', 'Claimed', 'Discarded', 'Expected', 'Not Held', 'Not Published', 'Received')
+ ) DEFAULT 'Expected'
);
CREATE TABLE serial.item_note (
@@ -236,7 +240,7 @@
value TEXT NOT NULL
);
-CREATE TABLE serial.bib_summary (
+CREATE TABLE serial.basic_summary (
id SERIAL PRIMARY KEY,
distribution INT NOT NULL
REFERENCES serial.distribution (id)
@@ -246,7 +250,7 @@
textual_holdings TEXT
);
-CREATE TABLE serial.sup_summary (
+CREATE TABLE serial.supplement_summary (
id SERIAL PRIMARY KEY,
distribution INT NOT NULL
REFERENCES serial.distribution (id)
Modified: branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.js
===================================================================
--- branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.js 2010-07-21 20:06:56 UTC (rev 17002)
+++ branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.js 2010-07-21 20:35:37 UTC (rev 17003)
@@ -83,7 +83,7 @@
// get latest sdist id list based on library drowdown
obj.set_sdist_ids();
obj.refresh_list('main');
- obj.refresh_list('sunit');
+ obj.refresh_list('workarea');
},
false
);
@@ -228,12 +228,11 @@
var list = util.functional.map_list(
obj.retrieve_ids,
function (o) {
- return obj.list_sitem_map[o.sitem_id];
+ var item = obj.list_sitem_map[o.sitem_id];
+ item.unit('-1'); //FIXME: hard-coded unit (-1 is AUTO)
+ return item;
}
);
- for (var i = 0; i < list.length; i++) {
- list[i].unit('1'); //FIXME: hard-coded unit
- }
var robj = obj.network.request(
'open-ils.serial',
@@ -244,7 +243,7 @@
alert('Successfully received '+robj+' item(s)');
obj.refresh_list('main');
- obj.refresh_list('sunit');
+ obj.refresh_list('workarea');
} catch(E) {
obj.error.standard_unexpected_error_alert('cmd_receive_items failed!',E);
@@ -275,13 +274,13 @@
'cmd_items_print' : [ ['command'], function() { obj.items_print(obj.selected_list); } ],
'cmd_items_export' : [ ['command'], function() { obj.items_export(obj.selected_list); } ],
- 'cmd_refresh_list' : [ ['command'], function() { obj.refresh_list('main'); obj.refresh_list('sunit'); } ]
+ 'cmd_refresh_list' : [ ['command'], function() { obj.refresh_list('main'); obj.refresh_list('workarea'); } ]
}
}
);
obj.retrieve('main'); // retrieve main list
- obj.retrieve('sunit'); // retrieve shelving unit list
+ obj.retrieve('workarea'); // retrieve shelving unit list
obj.controller.view.sel_clip.setAttribute('disabled','true');
@@ -317,7 +316,7 @@
JSAN.use('circ.util');
var columns = item_columns({});
-
+
function retrieve_row(params) {
try {
var row = params.row;
@@ -380,18 +379,18 @@
}
);
obj.lists.main.sitem_retrieve_params = {'date_received' : null };
- obj.lists.main.sitem_sort_params ={'order_by' : {'sitem' : 'date_expected ASC'}};
+ obj.lists.main.sitem_extra_params ={'order_by' : {'sitem' : 'date_expected ASC, stream ASC'}};
- obj.lists.sunit = new util.list('sunit_tree');
- obj.lists.sunit.init(
+ obj.lists.workarea = new util.list('workarea_tree');
+ obj.lists.workarea.init(
{
'columns' : columns,
'map_row_to_columns' : circ.util.std_map_row_to_columns(),
'retrieve_row' : retrieve_row,
'on_select' : function(ev) {
- obj.selected_list = 'sunit';
+ obj.selected_list = 'workarea';
JSAN.use('util.functional');
- var sel = obj.lists.sunit.retrieve_selection();
+ var sel = obj.lists.workarea.retrieve_selection();
obj.controller.view.sel_clip.setAttribute('disabled',sel.length < 1);
var list = util.functional.map_list(
sel,
@@ -409,8 +408,8 @@
}
}
);
- obj.lists.sunit.sitem_retrieve_params = {'unit' : 1, 'date_received' : {"!=" : null}}; //FIXME: hard-coded shelving unit
- obj.lists.sunit.sitem_sort_params ={'order_by' : {'sitem' : 'date_received DESC'}};
+ obj.lists.workarea.sitem_retrieve_params = {'date_received' : {"!=" : null}};
+ obj.lists.workarea.sitem_extra_params ={'order_by' : {'sitem' : 'date_received DESC'}, 'limit' : 30};
},
'refresh_list' : function(list_name) {
@@ -431,35 +430,31 @@
'retrieve' : function(list_name) {
var obj = this;
var list = obj.lists[list_name];
- if (window.xulG && window.xulG.items) {
- obj.items = window.xulG.items;
- } else {
- obj.items = []; //FIXME: not using this
+
+ if (!obj.sdist_ids.length) { // no sdists to retrieve items for
+ return;
+ }
- var rparams = list.sitem_retrieve_params;
- var robj;
- if (obj.sdist_ids.length > 0) {
- rparams['+sstr'] = { "distribution" : {"in" : obj.sdist_ids} };
- var other_params = list.sitem_sort_params;
- other_params.join = 'sstr';
+ var rparams = list.sitem_retrieve_params;
+ var robj;
+ rparams['+sstr'] = { "distribution" : obj.sdist_ids };
+ var other_params = list.sitem_extra_params;
+ other_params.join = 'sstr';
- robj = obj.network.simple_request(
- 'FM_SITEM_ID_LIST',
- [ ses(), rparams, other_params ]
- );
- }
-/* if (typeof robj.ilsevent!='undefined') {
- obj.error.standard_unexpected_error_alert('FIXME: Catch edit control with no distribution',E);
- }*/
- }
+ robj = obj.network.simple_request(
+ 'FM_SITEM_ID_LIST',
+ [ ses(), rparams, other_params ]
+ );
+ if (typeof robj.ilsevent!='undefined') {
+ obj.error.standard_unexpected_error_alert('Failed to retrieve serial item ID list',E);
+ }
if (!robj) {
robj = [];
- }else if (!robj.length) {
+ } else if (!robj.length) {
robj = [robj];
}
list.clear();
-
for (i = 0; i < robj.length; i++) {
list.append( { 'row' : { 'my' : { 'sitem_id' : robj[i] } }, 'to_bottom' : true, 'no_auto_select' : true } );
}
@@ -471,6 +466,9 @@
var obj = this;
+ /*obj.controller.view.cmd_items_claimed_returned.setAttribute('disabled','false');
+ obj.controller.view.sel_mark_items_missing.setAttribute('disabled','false');*/
+
obj.retrieve_ids = list;
}
}
@@ -491,69 +489,33 @@
'persist' : 'hidden width ordinal'
},
{
- 'id' : 'creator',
- 'label' : 'Creator',
+ 'id' : 'label',
+ 'label' : 'Issuance Label',
'flex' : 1,
'primary' : false,
- 'hidden' : true,
- 'persist' : 'hidden width ordinal',
- 'render' : function(my) { return my.sitem.creator().usrname(); }
- },
- {
- 'id' : 'create_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : true,
- 'persist' : 'hidden width ordinal',
- 'render' : function(my) { return my.sitem.create_date().substr(0,10); }
- },
- {
- 'id' : 'editor',
- 'label' : 'Editor',
- 'flex' : 1,
- 'primary' : false,
'hidden' : false,
- 'persist' : 'hidden width ordinal',
- 'render' : function(my) { return my.sitem.editor().usrname(); }
+ 'render' : function(my) { return my.sitem.issuance().label(); },
+ 'persist' : 'hidden width ordinal'
},
{
- 'id' : 'edit_date',
- 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'persist' : 'hidden width ordinal',
- 'render' : function(my) { return my.sitem.edit_date().substr(0,10); }
- },
- {
'id' : 'distribution',
'label' : 'Distribution',
'flex' : 1,
'primary' : false,
- 'hidden' : true,
+ 'hidden' : false,
'persist' : 'hidden width ordinal',
'render' : function(my) { return my.sitem.stream().distribution().label(); }
},
{
- 'id' : 'unit',
- 'label' : 'Unit',
+ 'id' : 'stream_id',
+ 'label' : 'Stream ID',
'flex' : 1,
'primary' : false,
'hidden' : false,
'persist' : 'hidden width ordinal',
- 'render' : function(my) { return my.sitem.unit().call_number().label(); }
+ 'render' : function(my) { return my.sitem.stream().id(); }
},
{
- 'id' : 'label',
- 'label' : 'Issuance Label',
- 'flex' : 1,
- 'primary' : false,
- 'hidden' : false,
- 'render' : function(my) { return my.sitem.issuance().label(); },
- 'persist' : 'hidden width ordinal'
- },
- {
'id' : 'date_published',
'label' : 'Date Published',
'flex' : 1,
@@ -590,6 +552,60 @@
'persist' : 'hidden width ordinal'
},
{
+ 'id' : 'call_number',
+ 'label' : 'Call Number',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'persist' : 'hidden width ordinal',
+ 'render' : function(my) { return my.sitem.unit().call_number().label(); }
+ },
+ {
+ 'id' : 'unit_id_contents',
+ 'label' : 'Unit ID / Contents',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'render' : function(my) { return '[' + my.sitem.unit().id() + '] ' + my.sitem.unit().summary_contents() ; },
+ 'persist' : 'hidden width ordinal'
+ },
+ {
+ 'id' : 'creator',
+ 'label' : 'Creator',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'persist' : 'hidden width ordinal',
+ 'render' : function(my) { return my.sitem.creator().usrname(); }
+ },
+ {
+ 'id' : 'create_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.create_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'persist' : 'hidden width ordinal',
+ 'render' : function(my) { return my.sitem.create_date().substr(0,10); }
+ },
+ {
+ 'id' : 'editor',
+ 'label' : 'Editor',
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : true,
+ 'persist' : 'hidden width ordinal',
+ 'render' : function(my) { return my.sitem.editor().usrname(); }
+ },
+ {
+ 'id' : 'edit_date',
+ 'label' : document.getElementById('circStrings').getString('staff.circ.utils.edit_date'),
+ 'flex' : 1,
+ 'primary' : false,
+ 'hidden' : false,
+ 'persist' : 'hidden width ordinal',
+ 'render' : function(my) { return my.sitem.edit_date().substr(0,10); }
+ },
+ {
'id' : 'holding_code',
'label' : 'Holding Code',
'flex' : 1,
Modified: branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.xul
===================================================================
--- branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.xul 2010-07-21 20:06:56 UTC (rev 17002)
+++ branches/seials-integration/Open-ILS/xul/staff_client/server/serial/manage_items.xul 2010-07-21 20:35:37 UTC (rev 17003)
@@ -83,53 +83,30 @@
<tree id="item_tree" flex="2" enableColumnDrag="true" context="serial_manage_items_popup"/>
<splitter state="open" collapse="after" resizebefore="closest" resizeafter="farthest"/>
<hbox align="center">
- <description value="Current Unit"/>
+ <label style="font-weight: bold" value="Workarea"/>
+ <label id="serial_workarea_type_label" value="Recently Received"/>
<spacer flex="1"/>
- <!--<description value="Copy"/>
- <menulist editable="true">
- <menupopup>
- <menuitem label="Auto Copy" value="AUTO"/>
- <menuitem label="New Copy" value="NEW"/>
- <menuitem label="(list copies) ######"/>
- </menupopup>
- </menulist>-->
<button label="Receive/Move Selected ↓" command="cmd_receive_items"/>
<description value="into"/>
- <description value="[V.135]"/>
- <!--<menulist label="Auto - Top Level">
- <menupopup>
- <menuitem label="Auto per Volume" selected="true"/>
- <menuitem label="Auto per Issue"/>
- <menuitem label="TEST1234"/>
- </menupopup>
- </menulist>-->
+ <description id="serial_workarea_unit_desc" value="[**AUTO**]"/>
<menubar>
<menu label="Set Current Unit">
<menupopup>
+ <menuitem command="cmd_broken" label="New Unit"/>
+ <menuitem command="cmd_broken" label="Auto per Item"/>
<menu label="Recent">
<menupopup>
<menuitem command="cmd_broken" label="V.1"/>
<menuitem command="cmd_broken" label="V.2"/>
</menupopup>
</menu>
- <menu label="Frequent">
- <menupopup>
- <menuitem command="cmd_broken" label="V.1"/>
- <menuitem command="cmd_broken" label="V.2"/>
- </menupopup>
- </menu>
<menuitem command="cmd_broken" label="Other..."/>
</menupopup>
</menu>
- <menu label="Actions for Units">
- <menupopup>
- <menuitem command="cmd_edit_sunit" label="Edit Current Unit..."/>
- <menuitem command="cmd_broken" label="Manage Units..."/>
- </menupopup>
- </menu>
+ <button command="cmd_broken" label="Edit Current Unit..."/>
</menubar>
</hbox>
- <tree id="sunit_tree" flex="1" enableColumnDrag="true" context="serial_manage_items_popup"/>
+ <tree id="workarea_tree" flex="1" enableColumnDrag="true" context="serial_manage_items_popup"/>
</tabpanel>
</overlay>
More information about the open-ils-commits
mailing list