[open-ils-commits] r11697 - trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 29 14:07:06 EST 2008
Author: erickson
Date: 2008-12-29 14:07:03 -0500 (Mon, 29 Dec 2008)
New Revision: 11697
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
can now pass in a list of source user id's to merge into the single master user. updated json query to use the more consise syntax
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-29 18:55:55 UTC (rev 11696)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2008-12-29 19:07:03 UTC (rev 11697)
@@ -3064,31 +3064,23 @@
);
sub merge_users {
- my($self, $conn, $auth, $src_id, $dest_id, $options) = @_;
+ my($self, $conn, $auth, $master_id, $options, @user_ids) = @_;
my $e = new_editor(xact => 1, authtoken => $auth);
return $e->die_event unless $e->checkauth;
- my $src_user = $e->retrieve_actor_user($src_id) or return $e->die_event;
- my $dest_user = $e->retrieve_actor_user($dest_id) or return $e->die_event;
+ for my $src_id (@user_ids) {
+ my $src_user = $e->retrieve_actor_user($src_id) or return $e->die_event;
+ my $master_user = $e->retrieve_actor_user($master_id) or return $e->die_event;
- return $e->die_event unless $e->allowed('MERGE_USERS', $src_user->home_ou);
- if($src_user->home_ou ne $dest_user->home_ou) {
- return $e->die_event unless $e->allowed('MERGE_USERS', $dest_user->home_ou);
+ return $e->die_event unless $e->allowed('MERGE_USERS', $src_user->home_ou);
+ if($src_user->home_ou ne $master_user->home_ou) {
+ return $e->die_event unless $e->allowed('MERGE_USERS', $master_user->home_ou);
+ }
+
+ return $e->die_event unless
+ $e->json_query({from => ['actor.usr_merge', $src_id, $master_id]});
}
- my $query = {
- select => {
- au => [ {
- transform => 'actor.usr_merge',
- params => [$dest_id],
- column => 'id',
- } ]
- },
- from => 'au',
- where => {id => $src_id},
- };
-
- return $e->die_event unless $e->json_query($query);
$e->commit;
return 1;
}
More information about the open-ils-commits
mailing list