[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5461c9bd045a29b25aa20391b1d5a56fa1bba582
Evergreen Git
git at git.evergreen-ils.org
Fri Mar 8 13:24:36 EST 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 5461c9bd045a29b25aa20391b1d5a56fa1bba582 (commit)
from b6fe6d973b937ab1069b918689446e82651c1b2e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5461c9bd045a29b25aa20391b1d5a56fa1bba582
Author: Jason Etheridge <jason at EquinoxInitiative.org>
Date: Wed Jan 16 08:57:26 2019 -0500
LP1794588 Web client edit single call number changes all when multiple items attached
This patch tweaks the behavior Cat.pm's fleshed_volume_update, aka
open-ils.cat.asset.volume.fleshed.batch.update
Previously, if a volume label was edited, all items attached to that
volume would be essentially affected. Now, if only a sub-set of items
for the original volume being edited are being edited along with the
volume, then a new volume is potentially created instead, leaving the
original volume (and its unedited copies) untouched. If no copies are
being edited along with a volume, then the volume itself is edited.
Auto-merging of volumes may still happen in all of these scenarios.
Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>
Signed-off-by: Janet Schrader <jschrader at cwmars.org>
Signed-off-by: Jason Stephenson <jason at sigio.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index dd8c730ccf..3fcd255e45 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -1176,9 +1176,50 @@ sub fleshed_volume_update {
} elsif( $vol->ischanged ) {
$logger->info("vol-update: update volume");
- my $resp = update_volume($vol, $editor, ($oargs->{all} or grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$oargs->{events}} or $auto_merge_vols));
- return $resp->{evt} if $resp->{evt};
- $vol = $resp->{merge_vol} if $resp->{merge_vol};
+
+ # Three cases here:
+ # 1) We're editing a volume, and not its copies.
+ # 2) We're editing a volume, and a subset of its copies.
+ # 3) We're editing a volume, and all of its copies.
+ #
+ # For 1) and 3), we definitely want to edit the volume
+ # itself (and possibly auto-merge), but for 2), we want
+ # to create a new volume (and possibly auto-merge).
+
+ if (scalar(@$copies) == 0) { # case 1
+
+ my $resp = update_volume($vol, $editor, ($oargs->{all} or grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$oargs->{events}} or $auto_merge_vols));
+ return $resp->{evt} if $resp->{evt};
+ $vol = $resp->{merge_vol} if $resp->{merge_vol};
+
+ } else {
+
+ my $resp = $editor->json_query({
+ select => {
+ acp => [
+ {transform => 'count', aggregate => 1, column => 'id', alias => 'count'}
+ ]
+ },
+ from => 'acp',
+ where => {
+ call_number => $vol->id,
+ deleted => 'f',
+ id => {'not in' => [ map { $_->id } @$copies ]}
+ }
+ });
+ if ($resp->[0]->{count} && $resp->[0]->{count} > 0) { # case 2
+
+ ($vol,$evt) = $assetcom->create_volume( $auto_merge_vols ? { all => 1} : $oargs, $editor, $vol );
+ return $evt if $evt;
+
+ } else { # case 3
+
+ my $resp = update_volume($vol, $editor, ($oargs->{all} or grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$oargs->{events}} or $auto_merge_vols));
+ return $resp->{evt} if $resp->{evt};
+ $vol = $resp->{merge_vol} if $resp->{merge_vol};
+ }
+
+ }
}
# now update any attached copies
-----------------------------------------------------------------------
Summary of changes:
.../src/perlmods/lib/OpenILS/Application/Cat.pm | 47 ++++++++++++++++++++--
1 file changed, 44 insertions(+), 3 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list