[open-ils-commits] r13664 - in branches/rel_1_6_0/Open-ILS: src/perlmods/OpenILS/Application web/js/dojo/openils/opac/nls web/opac/skin/default/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 21 10:09:44 EDT 2009
Author: dbs
Date: 2009-07-21 10:09:42 -0400 (Tue, 21 Jul 2009)
New Revision: 13664
Modified:
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
branches/rel_1_6_0/Open-ILS/web/js/dojo/openils/opac/nls/opac.js
branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/rdetail.js
Log:
Merge r13661 and r13662 from trunk: rely on pcrud to delete MFHD records, i18n-ize another string, and enable dojo.require() to work in rdetail.js
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2009-07-21 14:08:30 UTC (rev 13663)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2009-07-21 14:09:42 UTC (rev 13664)
@@ -858,8 +858,9 @@
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);
+ return $e->die_event unless $e->allowed('CREATE_MFHD_RECORD', $owning_lib);
+ # Auto-populate the location field of a placeholder MFHD record with the library name
my $aou = $e->retrieve_actor_org_unit($owning_lib) or return $e->die_event;
my $mfhd = Fieldmapper::serial::record_entry->new;
@@ -871,51 +872,24 @@
$mfhd->create_date('now');
$mfhd->edit_date('now');
$mfhd->owning_lib($owning_lib);
- $xml = "<record xsi:schemaLocation=\"http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/MARC21/slim\"> <leader>00307cy a22001094 4500</leader> <controlfield tag=\"001\">42153</controlfield> <controlfield tag=\"005\">20090601182414.0</controlfield> <controlfield tag=\"008\">051011 eng 090309</controlfield> <datafield tag=\"852\" ind1=\" \" ind2=\" \"> <subfield code=\"b\">" . $aou->name . "</subfield> </datafield></record>";
+
+ # If the caller did not pass in MFHD XML, create a placeholder record.
+ # The placeholder will only contain the name of the owning library.
+ # The goal is to generate common patterns for the caller in the UI that
+ # then get passed in here.
+ if (!$xml) {
+ $xml = "<record xsi:schemaLocation=\"http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.loc.gov/MARC21/slim\"> <leader>00307cy a22001094 4500</leader> <controlfield tag=\"001\">42153</controlfield> <controlfield tag=\"005\">20090601182414.0</controlfield> <controlfield tag=\"008\">051011 eng 090309</controlfield> <datafield tag=\"852\" ind1=\" \" ind2=\" \"> <subfield code=\"b\">" . $aou->name . "</subfield> </datafield></record>";
+ }
my $marcxml = XML::LibXML->new->parse_string($xml);
$marcxml->documentElement->setNamespace("http://www.loc.gov/MARC21/slim", "marc", 1 );
$marcxml->documentElement->setNamespace("http://www.loc.gov/MARC21/slim");
$mfhd->marc($U->entityize($marcxml->documentElement->toString));
- $e->create_serial_record_entry($mfhd) or return $e->die_event;
+ $e->create_serial_record_entry($mfhd) or return $e->die_event;
$e->commit;
return $mfhd->id;
}
-__PACKAGE__->register_method(
- method => "delete_serial_record",
- api_name => "open-ils.cat.serial.record.delete.override",
- signature => q/@see open-ils.cat.serial.record.delete/);
-
-__PACKAGE__->register_method(
- method => "delete_serial_record",
- api_name => "open-ils.cat.serial.record.delete",
- signature => q/
- Deletes a serial record with the given ID
- /
-);
-
-sub delete_serial_record {
- my( $self, $client, $login, $mfhd_id ) = @_;
-
- my $override = 1 if $self->api_name =~ /override/; # not currently used
-
- 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;
- return 1;
-}
-
1;
Modified: branches/rel_1_6_0/Open-ILS/web/js/dojo/openils/opac/nls/opac.js
===================================================================
--- branches/rel_1_6_0/Open-ILS/web/js/dojo/openils/opac/nls/opac.js 2009-07-21 14:08:30 UTC (rev 13663)
+++ branches/rel_1_6_0/Open-ILS/web/js/dojo/openils/opac/nls/opac.js 2009-07-21 14:09:42 UTC (rev 13664)
@@ -1,8 +1,9 @@
{
- "CREATE_MFHD": "Add MFHD record",
+ "CREATE_MFHD": "Add MFHD Record",
"CREATED_MFHD_RECORD": "Created MFHD record for ${0}",
+ "DELETE_MFHD": "Delete Record",
"DELETED_MFHD_RECORD": "Deleted MFHD record ${0}",
- "EDIT_MFHD_RECORD": "Edit MFHD Record",
+ "EDIT_MFHD_RECORD": "Edit Record",
"EDIT_MFHD_MENU": "Edit Holdings",
"EDIT_PROPERTIES": "Edit Propeties",
"HOLDINGS": "Previous volumes",
Modified: branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/rdetail.js 2009-07-21 14:08:30 UTC (rev 13663)
+++ branches/rel_1_6_0/Open-ILS/web/opac/skin/default/js/rdetail.js 2009-07-21 14:09:42 UTC (rev 13664)
@@ -44,10 +44,8 @@
/* serials are currently the only use of Dojo strings in the OPAC */
if (rdetailDisplaySerialHoldings) {
- if (isXUL()) {
- dojo.require("dijit.Menu");
- dojo.require("dijit.form.Button");
- }
+ dojo.require("dijit.Menu");
+ dojo.require("dijit.form.Button");
dojo.requireLocalization("openils.opac", "opac");
opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
}
@@ -304,10 +302,13 @@
var mfhd_edit = new dijit.Menu({});
new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first");
new dijit.MenuItem({onClick:function(){
- var req = new Request(DELETE_MFHD_RECORD, G.user.session, holdings.id());
- var res = req.send();
- alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()]));
- }, label:"Delete"}).placeAt(mfhd_edit, "last");
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var mfhd_rec = pcrud.retrieve("sre", holdings.id());
+ if (mfhd_rec) {
+ pcrud.delete(mfhd_rec);
+ alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()]));
+ }
+ }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last");
// new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last");
var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"});
mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last");
More information about the open-ils-commits
mailing list