From ba4dcdd56abd51eda35aa51fe731cb3d362d014b Mon Sep 17 00:00:00 2001 From: Kathy Lussier Date: Tue, 4 Sep 2018 14:38:33 -0400 Subject: [PATCH] LP#1777675: Change table names to Latest Inventory Makes the backend code consistent with the new labels that have been added for the latest inventory date. Signed-off-by: Kathy Lussier Signed-off-by: Dan Wells --- Open-ILS/examples/fm_IDL.xml | 14 ++++---- .../perlmods/lib/OpenILS/Application/Circ.pm | 16 ++++----- .../lib/OpenILS/Application/Circ/Circulate.pm | 34 +++++++++---------- Open-ILS/src/sql/Pg/040.schema.asset.sql | 4 +-- Open-ILS/src/sql/Pg/800.fkeys.sql | 8 ++--- ...-create-inventory-workstation-and-date.sql | 12 +++---- .../staff/cat/bucket/copy/t_pending.tt2 | 4 +-- .../staff/cat/bucket/copy/t_view.tt2 | 4 +-- .../staff/cat/catalog/t_holdings.tt2 | 4 +-- .../src/templates/staff/cat/item/t_list.tt2 | 4 +-- .../staff/cat/item/t_summary_pane.tt2 | 4 +-- .../staff/circ/checkin/t_checkin_table.tt2 | 4 +-- .../web/js/ui/default/staff/cat/item/app.js | 8 ++--- .../ui/default/staff/cat/services/holdings.js | 2 +- .../js/ui/default/staff/circ/checkin/app.js | 4 +-- .../js/ui/default/staff/circ/services/circ.js | 12 +++---- .../js/ui/default/staff/circ/services/item.js | 8 ++--- 17 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 0819f504ce..a9213492ec 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -7393,7 +7393,7 @@ SELECT usr, - + @@ -7420,7 +7420,7 @@ SELECT usr, - + @@ -7443,11 +7443,11 @@ SELECT usr, - - - - - + + + + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index ddddbc83ae..2c987d909e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -371,10 +371,10 @@ sub new_set_circ_lost { } __PACKAGE__->register_method( - method => "update_last_copy_inventory", - api_name => "open-ils.circ.circulation.update_last_copy_inventory"); + method => "update_latest_inventory", + api_name => "open-ils.circ.circulation.update_latest_inventory"); -sub update_last_copy_inventory { +sub update_latest_inventory { my( $self, $conn, $auth, $args ) = @_; my $e = new_editor(authtoken=>$auth, xact=>1); return $e->die_event unless $e->checkauth; @@ -382,21 +382,21 @@ sub update_last_copy_inventory { my $copies = $$args{copy_list}; foreach my $copyid (@$copies) { my $copy = $e->retrieve_asset_copy($copyid); - my $alci = $e->search_asset_last_copy_inventory({copy => $copyid})->[0]; + my $alci = $e->search_asset_latest_inventory({copy => $copyid})->[0]; if($alci) { $alci->inventory_date('now'); $alci->inventory_workstation($e->requestor->wsid); - $e->update_asset_last_copy_inventory($alci) or return $e->die_event; + $e->update_asset_latest_inventory($alci) or return $e->die_event; } else { - my $alci = Fieldmapper::asset::last_copy_inventory->new; + my $alci = Fieldmapper::asset::latest_inventory->new; $alci->inventory_date('now'); $alci->inventory_workstation($e->requestor->wsid); $alci->copy($copy->id); - $e->create_asset_last_copy_inventory($alci) or return $e->die_event; + $e->create_asset_latest_inventory($alci) or return $e->die_event; } - $copy->last_copy_inventory($alci); + $copy->latest_inventory($alci); } $e->commit; return 1; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index deae8f1172..6f5433a836 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -419,7 +419,7 @@ my @AUTOLOAD_FIELDS = qw/ backdate reservation do_inventory_update - last_copy_inventory + latest_inventory copy copy_id copy_barcode @@ -2675,19 +2675,19 @@ sub do_checkin { $self->dont_change_lost_zero($dont_change_lost_zero); } - my $last_copy_inventory = Fieldmapper::asset::last_copy_inventory->new; + my $latest_inventory = Fieldmapper::asset::latest_inventory->new; if ($self->do_inventory_update) { - $last_copy_inventory->inventory_date('now'); - $last_copy_inventory->inventory_workstation($self->editor->requestor->wsid); - $last_copy_inventory->copy($self->copy->id()); + $latest_inventory->inventory_date('now'); + $latest_inventory->inventory_workstation($self->editor->requestor->wsid); + $latest_inventory->copy($self->copy->id()); } else { - my $alci = $self->editor->search_asset_last_copy_inventory( + my $alci = $self->editor->search_asset_latest_inventory( {copy => $self->copy->id} ); - $last_copy_inventory = $alci->[0] + $latest_inventory = $alci->[0] } - $self->last_copy_inventory($last_copy_inventory); + $self->latest_inventory($latest_inventory); if( $self->checkin_check_holds_shelf() ) { $self->bail_on_events(OpenILS::Event->new('NO_CHANGE')); @@ -3969,22 +3969,22 @@ sub checkin_flesh_events { ); } - if ($self->last_copy_inventory) { + if ($self->latest_inventory) { # flesh some workstation fields before returning - $self->last_copy_inventory->inventory_workstation( - $self->editor->retrieve_actor_workstation([$self->last_copy_inventory->inventory_workstation]) + $self->latest_inventory->inventory_workstation( + $self->editor->retrieve_actor_workstation([$self->latest_inventory->inventory_workstation]) ); } - if($self->last_copy_inventory && !$self->last_copy_inventory->id) { - my $alci = $self->editor->search_asset_last_copy_inventory( - {copy => $self->last_copy_inventory->copy} + if($self->latest_inventory && !$self->latest_inventory->id) { + my $alci = $self->editor->search_asset_latest_inventory( + {copy => $self->latest_inventory->copy} ); if($alci->[0]) { - $self->last_copy_inventory->id($alci->[0]->id); + $self->latest_inventory->id($alci->[0]->id); } } - $self->copy->last_copy_inventory($self->last_copy_inventory); + $self->copy->latest_inventory($self->latest_inventory); for my $evt (@{$self->events}) { @@ -3999,7 +3999,7 @@ sub checkin_flesh_events { $payload->{patron} = $self->patron; $payload->{reservation} = $self->reservation unless (not $self->reservation or $self->reservation->cancel_time); - $payload->{last_copy_inventory} = $self->last_copy_inventory; + $payload->{latest_inventory} = $self->latest_inventory; if ($self->do_inventory_update) { $payload->{do_inventory_update} = 1; } $evt->{payload} = $payload; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 374a1ec06f..9beed1d751 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -120,13 +120,13 @@ CREATE TABLE asset.copy_part_map ( ); CREATE UNIQUE INDEX copy_part_map_cp_part_idx ON asset.copy_part_map (target_copy, part); -CREATE TABLE asset.last_copy_inventory ( +CREATE TABLE asset.latest_inventory ( id SERIAL PRIMARY KEY, inventory_workstation INTEGER REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED, inventory_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), copy BIGINT NOT NULL ); -CREATE INDEX last_copy_inventory_copy_idx ON asset.last_copy_inventory (copy); +CREATE INDEX latest_inventory_copy_idx ON asset.latest_inventory (copy); CREATE TABLE asset.opac_visible_copies ( id BIGSERIAL primary key, diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 50d7927289..5eb87db706 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -169,7 +169,7 @@ BEGIN END; $f$ LANGUAGE PLPGSQL VOLATILE COST 50; -CREATE OR REPLACE FUNCTION evergreen.asset_last_copy_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$ +CREATE OR REPLACE FUNCTION evergreen.asset_latest_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$ BEGIN PERFORM 1 FROM asset.copy WHERE id = NEW.copy; IF NOT FOUND THEN @@ -189,9 +189,9 @@ CREATE CONSTRAINT TRIGGER inherit_asset_copy_tag_copy_map_copy_fkey AFTER UPDATE OR INSERT ON asset.copy_tag_copy_map DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_copy_tag_copy_map_copy_inh_fkey(); -CREATE CONSTRAINT TRIGGER inherit_asset_last_copy_inventory_copy_fkey - AFTER UPDATE OR INSERT ON asset.last_copy_inventory - DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_last_copy_inventory_copy_inh_fkey(); +CREATE CONSTRAINT TRIGGER inherit_asset_latest_inventory_copy_fkey + AFTER UPDATE OR INSERT ON asset.latest_inventory + DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_latest_inventory_copy_inh_fkey(); ALTER TABLE asset.copy_note ADD CONSTRAINT asset_copy_note_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql index 9465a6839b..8c6cea2672 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX-create-inventory-workstation-and-date.sql @@ -2,15 +2,15 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); -CREATE TABLE asset.last_copy_inventory ( +CREATE TABLE asset.latest_inventory ( id SERIAL PRIMARY KEY, inventory_workstation INTEGER REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED, inventory_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), copy BIGINT NOT NULL ); -CREATE INDEX last_copy_inventory_copy_idx ON asset.last_copy_inventory (copy); +CREATE INDEX latest_inventory_copy_idx ON asset.latest_inventory (copy); -CREATE OR REPLACE FUNCTION evergreen.asset_last_copy_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$ +CREATE OR REPLACE FUNCTION evergreen.asset_latest_inventory_copy_inh_fkey() RETURNS TRIGGER AS $f$ BEGIN PERFORM 1 FROM asset.copy WHERE id = NEW.copy; IF NOT FOUND THEN @@ -22,9 +22,9 @@ BEGIN END; $f$ LANGUAGE PLPGSQL VOLATILE COST 50; -CREATE CONSTRAINT TRIGGER inherit_asset_last_copy_inventory_copy_fkey - AFTER UPDATE OR INSERT ON asset.last_copy_inventory - DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_last_copy_inventory_copy_inh_fkey(); +CREATE CONSTRAINT TRIGGER inherit_asset_latest_inventory_copy_fkey + AFTER UPDATE OR INSERT ON asset.latest_inventory + DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_latest_inventory_copy_inh_fkey(); INSERT into config.workstation_setting_type (name, grp, datatype, label) VALUES ( diff --git a/Open-ILS/src/templates/staff/cat/bucket/copy/t_pending.tt2 b/Open-ILS/src/templates/staff/cat/bucket/copy/t_pending.tt2 index 60c1146242..431d2d4d46 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/copy/t_pending.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/copy/t_pending.tt2 @@ -58,7 +58,7 @@ {{item['call_number.record.simple_record.title']}} - - + + diff --git a/Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2 b/Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2 index 43f3ee0dea..99a3584ce5 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2 @@ -43,7 +43,7 @@ {{item['call_number.record.simple_record.title']}} - - + + diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 index 9241250a08..7865c94d49 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -123,8 +123,8 @@ {{item['copy_alert_count']}} - - + + diff --git a/Open-ILS/src/templates/staff/cat/item/t_list.tt2 b/Open-ILS/src/templates/staff/cat/item/t_list.tt2 index 58273423d5..245a229a3f 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_list.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_list.tt2 @@ -141,8 +141,8 @@ {{item['copy_alert_count']}} - - + + diff --git a/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 b/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 index e67ba11033..60797a7d12 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 @@ -178,10 +178,10 @@
[% l('Inventory Date') %]
-
{{copy.last_copy_inventory().inventory_date() | date:egDateAndTimeFormat}}
+
{{copy.latest_inventory().inventory_date() | date:egDateAndTimeFormat}}
[% l('Inventory Workstation') %]
-
{{copy.last_copy_inventory().inventory_workstation().name()}}
+
{{copy.latest_inventory().inventory_workstation().name()}}
diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 index aef321d4a6..2d0aa30bc5 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 @@ -121,7 +121,7 @@ - - + + diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index 24178d75ef..f797fecef6 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -610,8 +610,8 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore , // regardless of whether it matches the current item. if (!barcode && itemSvc.copy && itemSvc.copy.id() == copyId) { $scope.copy = itemSvc.copy; - if (itemSvc.last_copy_inventory && itemSvc.last_copy_inventory.copy() == copyId) { - $scope.last_copy_inventory = itemSvc.last_copy_inventory; + if (itemSvc.latest_inventory && itemSvc.latest_inventory.copy() == copyId) { + $scope.latest_inventory = itemSvc.latest_inventory; } $scope.copy_alert_count = itemSvc.copy.copy_alerts().filter(function(aca) { return !aca.ack_time(); @@ -645,11 +645,11 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore , var copy = res.copy; itemSvc.copy = copy; - if (res.last_copy_inventory) itemSvc.last_copy_inventory = res.last_copy_inventory; + if (res.latest_inventory) itemSvc.latest_inventory = res.latest_inventory; $scope.copy = copy; - $scope.last_copy_inventory = res.last_copy_inventory; + $scope.latest_inventory = res.latest_inventory; $scope.copy_alert_count = copy.copy_alerts().filter(function(aca) { return !aca.ack_time(); }).length; diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js index 37b8b07b48..476dbe2bf5 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js @@ -15,7 +15,7 @@ function(egCore , $q) { service.prototype.flesh = { flesh : 3, flesh_fields : { - acp : ['status','location','circ_lib','parts','age_protect','copy_alerts', 'last_copy_inventory'], + acp : ['status','location','circ_lib','parts','age_protect','copy_alerts', 'latest_inventory'], acn : ['prefix','suffix','copies'], alci : ['inventory_workstation'] } diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index 8d9eec416b..a030379e6a 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -210,8 +210,8 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg row_item['copy_barcode'] = row_item.acp.barcode(); - if (row_item.acp.last_copy_inventory() && row_item.acp.last_copy_inventory().inventory_date() == "now") - row_item.acp.last_copy_inventory().inventory_date(Date.now()); + if (row_item.acp.latest_inventory() && row_item.acp.latest_inventory().inventory_date() == "now") + row_item.acp.latest_inventory().inventory_date(Date.now()); if (row_item.mbts) { var amt = Number(row_item.mbts.balance_owed()); diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 465eaba6d1..c832c6051e 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -300,7 +300,7 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl data.record = payload.record; data.acp = payload.copy; data.acn = payload.volume ? payload.volume : payload.copy ? payload.copy.call_number() : null; - data.alci = egCore.idl.toHash(payload.last_copy_inventory, true); + data.alci = egCore.idl.toHash(payload.latest_inventory, true); data.au = payload.patron; data.transit = payload.transit; data.status = payload.status; @@ -314,10 +314,10 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl if (payload.circ) data.duration = payload.circ.duration(); if (payload.circ) data.circ_lib = payload.circ.circ_lib(); if (payload.do_inventory_update) { - if (payload.last_copy_inventory.id()) { - egCore.pcrud.update(payload.last_copy_inventory); + if (payload.latest_inventory.id()) { + egCore.pcrud.update(payload.latest_inventory); } else { - egCore.pcrud.create(payload.last_copy_inventory); + egCore.pcrud.create(payload.latest_inventory); } } @@ -1472,12 +1472,12 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl var final_resp = {evt : evt, params : params, options : options}; - var copy, hold, transit, last_copy_inventory; + var copy, hold, transit, latest_inventory; if (evt[0].payload) { copy = evt[0].payload.copy; hold = evt[0].payload.hold; transit = evt[0].payload.transit; - last_copy_inventory = evt[0].payload.last_copy_inventory; + latest_inventory = evt[0].payload.latest_inventory; } // track the barcode regardless of whether it's valid diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index 99f260cd77..9fc4e3f6dd 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -16,7 +16,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog flesh : 4, flesh_fields : { acp : ['call_number','location','status','location','floating','circ_modifier', - 'age_protect','circ_lib','copy_alerts', 'editor', 'circ_as_type', 'last_copy_inventory'], + 'age_protect','circ_lib','copy_alerts', 'editor', 'circ_as_type', 'latest_inventory'], acn : ['record','prefix','suffix','label_class'], bre : ['simple_record','creator','editor'], alci : ['inventory_workstation'] @@ -200,7 +200,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog if (copy_list.length == 0) return; return egCore.net.request( 'open-ils.circ', - 'open-ils.circ.circulation.update_last_copy_inventory', + 'open-ils.circ.circulation.update_latest_inventory', egCore.auth.token(), {copy_list: copy_list} ).then(function(res) { if (res) { @@ -212,8 +212,8 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog {alci: ['inventory_workstation']} }).then(function(alci) { //update existing grid rows - item["last_copy_inventory.inventory_date"] = alci.inventory_date(); - item["last_copy_inventory.inventory_workstation.name"] = + item["latest_inventory.inventory_date"] = alci.inventory_date(); + item["latest_inventory.inventory_workstation.name"] = alci.inventory_workstation().name(); }); } -- 2.43.2