Skip to content

Commit

Permalink
New grima suggested by Aaron Krebeck: AddInternalNote
Browse files Browse the repository at this point in the history
Updates to item template. Some fixed field functionality.
Update github pages dependencies.
  • Loading branch information
zemkat committed Oct 18, 2018
1 parent 46b4998 commit 78f231c
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GEM
execjs
coffee-script-source (1.11.1)
colorator (1.1.0)
commonmarker (0.17.11)
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.0.5)
dnsruby (1.61.2)
Expand All @@ -25,15 +25,15 @@ GEM
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.15.2)
faraday (0.15.3)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
forwardable-extended (2.6.0)
gemoji (3.0.0)
github-pages (191)
github-pages (192)
activesupport (= 4.2.10)
github-pages-health-check (= 1.8.1)
jekyll (= 3.7.3)
jekyll (= 3.7.4)
jekyll-avatar (= 0.6.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.5)
Expand Down Expand Up @@ -87,7 +87,7 @@ GEM
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.3)
jekyll (3.7.4)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand Down Expand Up @@ -185,7 +185,7 @@ GEM
jekyll-seo-tag (~> 2.0)
jekyll-titles-from-headings (0.5.1)
jekyll (~> 3.3)
jekyll-watch (2.0.0)
jekyll-watch (2.1.0)
listen (~> 3.0)
jemoji (0.10.1)
gemoji (~> 3.0)
Expand All @@ -205,9 +205,9 @@ GEM
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
multipart-post (2.0.0)
nokogiri (1.8.4)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
octokit (4.10.0)
octokit (4.12.0)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
Expand All @@ -219,9 +219,9 @@ GEM
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
rubyzip (1.2.1)
rubyzip (1.2.2)
safe_yaml (1.0.4)
sass (3.5.7)
sass (3.6.0)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand Down
1 change: 1 addition & 0 deletions README-site.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ grimas below:
* [InsertOclcNo](grimas/InsertOclcNo/InsertOclcNo.php) -- insert OCLC number into 035
* [Boundwith](grimas/Boundwith/Boundwith.php) -- create boundwith in Alma using bib 501/774, holding 014
* [RemoveTempLocation](grimas/RemoveTempLocation/RemoveTempLocation.php) -- remove temporary location from item
* [AddInternalNote](grimas/AddInternalNote/AddInternalNote.php) -- add internal note 1 to an item record

### Add New Records
* [CreateBriefBib](grimas/CreateBriefBib/CreateBriefBib.php) -- create a brief bib with specified 245a
Expand Down
18 changes: 18 additions & 0 deletions grimas/AddInternalNote/AddInternalNote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# AddInternalNote - add an internal note to an item record
*Thanks to Aaron Krebeck for suggesting this grima!*

This grima sets Internal Note 1 to the specified note. If no
note is entered into the form, any existing Internal Note 1
field will be cleared.

## Input
* Text of note to add to item record
* Barcode of item record to have internal note added

## Output
This grima outputs a message indicating either:
* success - including the MMS ID of the new copy of the bib record
* error - including the error message from Alma

## API requirements
* Bibs - read/write
21 changes: 21 additions & 0 deletions grimas/AddInternalNote/AddInternalNote.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require_once("../grima-lib.php");

class AddInternalNote extends GrimaTask {

function do_task() {
$item = new Item();
$item->loadFromAlmaBarcode($this['barcode']);
$item['internal_note_1'] = $this['note'];
$item->updateAlma();
if ($this['note'] == "") {
$this->addMessage('success',"Internal note 1 cleared on {$this['barcode']}");
} else {
$this->addMessage('success',"Internal note 1 added to {$this['barcode']}");
}
}

}

AddInternalNote::RunIt();
19 changes: 19 additions & 0 deletions grimas/AddInternalNote/AddInternalNote.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<GrimaForm>
<Title>Grima: Add Internal Note 1</Title>
<Field
name="note"
label="Internal Note 1"
shortname="n"
autocomplete="on"
required="no"
placeholder="Note to add to item..."
/>
<Field
name="barcode"
label="Barcode"
shortname="b"
autocomplete="off"
required="yes"
placeholder="Barcode of item to modify..."
/>
</GrimaForm>
52 changes: 51 additions & 1 deletion grimas/grima-lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,7 @@ class Bib extends AlmaObjectWithMARC {

protected $el_address = array(
'mms_id' => '//mms_id',
'leader' => '//leader',
'record_format' => '//record_format',
'title' => '//title',
'author' => '//author',
Expand All @@ -1725,6 +1726,26 @@ class Bib extends AlmaObjectWithMARC {
'publisher' => '//publisher_const'
);

function offsetGet($offset) {
if ($offset == 'Type') {
$leader = $this['leader'];
return $leader[6];
}
if ($offset == 'BLvl') {
$leader = $this['leader'];
return $leader[7];
}
if ($offset == 'ELvl') {
$leader = $this['leader'];
return $leader[17];
}
if ($offset == 'Desc') {
$leader = $this['leader'];
return $leader[18];
}
return parent::offsetGet($offset);
}

# override because these go multiple places
function offsetSet($offset,$value) {
parent::offsetSet($offset,$value);
Expand Down Expand Up @@ -2284,6 +2305,10 @@ class Item extends AlmaObject {
'base_status' => '//base_status',
'physical_material_type_code' => '//physical_material_type',
'physical_material_type' => '//physical_material_type/@desc',
'location' => '//location/@desc',
'location_code' => '//location',
'library' => '//location/@desc',
'library_code' => '//location',
'policy' => '//policy',
'item_policy' => '//policy',
'provenance' => '//provenance',
Expand All @@ -2293,15 +2318,40 @@ class Item extends AlmaObject {
'year_of_issue' => '//year_of_issue',
'enumeration_a' => '//enumeration_a',
'enumeration_b' => '//enumeration_b',
'enumeration_c' => '//enumeration_c',
'enumeration_d' => '//enumeration_d',
'enumeration_e' => '//enumeration_e',
'enumeration_f' => '//enumeration_f',
'enumeration_g' => '//enumeration_g',
'enumeration_h' => '//enumeration_h',
'chronology_i' => '//chronology_i',
'chronology_j' => '//chronology_j',
'chronology_k' => '//chronology_k',
'chronology_l' => '//chronology_l',
'chronology_m' => '//chronology_m',
'description' => '//description',
'alternative_call_number' => '//alternative_call_number',
'alternative_call_number_type' => '//alternative_call_number_type',
'storage_location_id' => '//storage_location_id',
'receiving_operator' => '//receiving_operator',
'process_type' => '//process_type',
'in_temp_location' => '//in_temp_location',
'mms_id' => '//mms_id',
'holding_id' => '//holding_id',
'title' => '//title',
'location' => '//location/@desc',
'call_number' => '//call_number',
'pages' => '//pages',
'pieces' => '//pieces',
'public_note' => '//public_note',
'fulfillment_note' => '//fulfillment_note',
'internal_note_1' => '//internal_note_1',
'internal_note_2' => '//internal_note_2',
'internal_note_3' => '//internal_note_3',
'statistics_note_1' => '//statistics_note_1',
'statistics_note_2' => '//statistics_note_2',
'statistics_note_3' => '//statistics_note_3',
'requested' => '//requested',
'physical_condition' => '//physical_condition',
);

// {{{ loadFromAlma (get)
Expand Down
21 changes: 20 additions & 1 deletion grimas/templates/Item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@
<item>
<item_data>
<barcode></barcode>
<base_status desc="Item not in place">0</base_status>
<base_status desc="Item in place">1</base_status>
<physical_material_type desc="Book">BOOK</physical_material_type>
<policy/>
<provenance/>
<po_line/>
<receiving_operator/>
<is_magnetic>false</is_magnetic>
<process_type/>
<arrival_date/>
<year_of_issue/>
<library/>
<location/>
<enumeration_a/>
<enumeration_b/>
<enumeration_c/>
<enumeration_d/>
<enumeration_e/>
<enumeration_f/>
<enumeration_g/>
<enumeration_h/>
<chronology_i/>
<chronology_j/>
<chronology_k/>
<chronology_l/>
<chronology_m/>
<description/>
<alternative_call_number/>
<alternative_call_number_type/>
Expand All @@ -24,5 +41,7 @@
<statistics_note_1/>
<statistics_note_2/>
<statistics_note_3/>
<requested/>
<physical_condition/>
</item_data>
</item>

0 comments on commit 78f231c

Please sign in to comment.