[open-ils-commits] r13658 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 21 09:03:57 EDT 2009
Author: erickson
Date: 2009-07-21 09:03:56 -0400 (Tue, 21 Jul 2009)
New Revision: 13658
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Log:
use the editor's allowed() method for checking perms. added context org to perm check. removed info/activity logs since editor logs queries at info and updates at activity already. changed 'record' param to 'record_id' for clarity. returning the new id on create instead of the editor object.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2009-07-21 05:39:31 UTC (rev 13657)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2009-07-21 13:03:56 UTC (rev 13658)
@@ -867,24 +867,20 @@
);
sub create_serial_record_xml {
- my( $self, $client, $login, $source, $owning_lib, $record, $xml ) = @_;
+ my( $self, $client, $login, $source, $owning_lib, $record_id, $xml ) = @_;
- my $override = 1 if $self->api_name =~ /override/;
+ my $override = 1 if $self->api_name =~ /override/; # not currently used
- my( $user_obj, $evt ) = $U->checksesperm($login, 'CREATE_MFHD_RECORD');
- return $evt if $evt;
-
- $logger->activity("user ".$user_obj->id." creating new MFHD record");
-
my $e = new_editor(xact=>1, authtoken=>$login);
return $e->die_event unless $e->checkauth;
+ return $e->die_event unless $e->allowed('CREATE_MFHD_RECORD', $owning_lib);
my $aou = $e->retrieve_actor_org_unit($owning_lib) or return $e->die_event;
my $mfhd = Fieldmapper::serial::record_entry->new;
- $mfhd->source(1) if $source;
- $mfhd->record($record);
+ $mfhd->source($source) if $source;
+ $mfhd->record($record_id);
$mfhd->creator($e->requestor->id);
$mfhd->editor($e->requestor->id);
$mfhd->create_date('now');
@@ -897,11 +893,10 @@
$mfhd->marc($U->entityize($marcxml->documentElement->toString));
- my $mfhd_record = $e->create_serial_record_entry($mfhd) or return $e->die_event;
- $logger->info("MFHD created new record ".$mfhd_record->id);
+ $e->create_serial_record_entry($mfhd) or return $e->die_event;
- $e->commit unless $U->event_code($e);
- return $e;
+ $e->commit;
+ return $mfhd->id;
}
__PACKAGE__->register_method(
@@ -920,25 +915,22 @@
sub delete_serial_record {
my( $self, $client, $login, $mfhd_id ) = @_;
- my $override = 1 if $self->api_name =~ /override/;
+ my $override = 1 if $self->api_name =~ /override/; # not currently used
- my( $user_obj, $evt ) = $U->checksesperm($login, 'DELETE_MFHD_RECORD');
- return $evt if $evt;
-
- $logger->activity("user ".$user_obj->id." deleting MFHD record " . $mfhd_id);
-
my $e = new_editor(xact=>1, authtoken=>$login);
return $e->die_event unless $e->checkauth;
my $record = $e->retrieve_serial_record_entry($mfhd_id)
or return $e->die_event;
+ return $e->die_event unless $e->allowed('DELETE_MFHD_RECORD', $record->owning_lib);
+
$record->deleted('t');
$record->edit_date('now');
$e->update_serial_record_entry($record) or return $e->die_event;
- $e->commit unless $U->event_code($e);
- return $e;
+ $e->commit;
+ return 1;
}
1;
More information about the open-ils-commits
mailing list