Grima 2018-08
Whispering into Alma's ear
Public Member Functions | Public Attributes | List of all members
Item Class Reference

class Item More...

Inheritance diagram for Item:
AlmaObject

Public Member Functions

  fluff ()
  populates item record from Alma More...
 
  loadFromAlma ($mms_id, $holding_id, $item_pid)
  populates item record from Alma More...
 
  loadFromAlmaX ($item_pid)
  populates item record from Alma, only needs item_pid More...
 
  loadFromAlmaBarcode ($barcode)
  populates item record from Alma, using barcode More...
 
  loadFromAlmaBCorX ($id)
  populates item record from Alma using either identifier More...
 
  loadFromItemListNode ($node)
  populate item record from the information in an ItemList node More...
 
  addToAlmaHolding ($mms_id, $holding_id)
  add new item record to holding in Alma More...
 
  addToAlmaHoldingX ($holding_id)
  add new item record to holding in Alma More...
 
  updateAlma ()
  replace item record in Alma More...
 
  deleteFromAlma ($override="false", $holdings="retain")
  delete record from Alma More...
 
- Public Member Functions inherited from AlmaObject
  __construct ()
  create new blank Alma Object More...
 
  offsetExists ($offset)
 
  offsetGet ($offset)
 
  offsetSet ($offset, $value)
 
  offsetUnset ($offset)
 

Public Attributes

  $el_address
 
- Public Attributes inherited from AlmaObject
  $el_access = array()
 
  $xml
 
  $templateDir = __DIR__ . "/templates"
 

Detailed Description

class Item

Definition at line 3500 of file grima-lib.php.

Member Function Documentation

◆ addToAlmaHolding()

Item::addToAlmaHolding (   $mms_id,
  $holding_id 
)

add new item record to holding in Alma

Parameters
string $mms_id MMS ID of bib record
string $holding_id Holding ID of holding record to add item to
Returns
DomDocument item object as it now appears in Alma

Definition at line 3672 of file grima-lib.php.

3673 {
3674 global $grima;
3675 $this->mms_id = $mms_id;
3676 $this->holding_id = $holding_id;
3677 $this->xml = $grima->postItem($mms_id, $holding_id, $this->xml);
3678 return $this->xml;
3679 }
$grima
Definition: grima-lib.php:5143

References $grima, and AlmaObject\$xml.

Referenced by addToAlmaHoldingX().

◆ addToAlmaHoldingX()

Item::addToAlmaHoldingX (   $holding_id )

add new item record to holding in Alma

Parameters
string $holding_id Holding ID of holding record to add item to
Returns
DomDocument item object as it now appears in Alma

Definition at line 3689 of file grima-lib.php.

3690 {
3691 $this->addToAlmaHolding('X', $holding_id);
3692 return $this->xml;
3693 }
addToAlmaHolding($mms_id, $holding_id)
add new item record to holding in Alma
Definition: grima-lib.php:3672

References AlmaObject\$xml, and addToAlmaHolding().

◆ deleteFromAlma()

Item::deleteFromAlma (   $override = "false",
  $holdings = "retain" 
)

delete record from Alma

Parameters
string $override should the item be deleted even if warnings exist? (default false)
string $holdings method for handling holdings record left with no items (retain, delete, suppress)

Definition at line 3720 of file grima-lib.php.

3721 {
3722 global $grima;
3723 $grima->deleteItem($this['mms_id'], $this['holding_id'], $this['item_pid'], $override, $holdings);
3724 }

References $grima.

◆ fluff()

Item::fluff ( )

populates item record from Alma

Definition at line 3573 of file grima-lib.php.

3574 {
3575 $fields = array( # XXX: fill with the rest
3576 "pieces",
3577 "copy_id",
3578 "inventory_date",
3579 "inventory_number",
3580 );
3581 $xpath = new DomXpath($this->xml);
3582 $stem = $xpath->query("//item_data")[0];
3583 foreach($fields as $field) {
3584 $try = $xpath->query("//$field");
3585 if (sizeof($try) == 0) {
3586 # XXX add empty node with that name
3587 $node = $this->xml->createElement($field);
3588 $stem->appendChild($node);
3589 }
3590 }
3591 }

◆ loadFromAlma()

Item::loadFromAlma (   $mms_id,
  $holding_id,
  $item_pid 
)

populates item record from Alma

Parameters
string $mms_id MMS ID of bib record
string $holding_id Holding ID of holding record
string $item_pid Item ID of item record

Definition at line 3602 of file grima-lib.php.

3603 {
3604 global $grima;
3605 $this->xml = $grima->getItem($mms_id, $holding_id, $item_pid);
3606 }

References $grima.

◆ loadFromAlmaBarcode()

Item::loadFromAlmaBarcode (   $barcode )

populates item record from Alma, using barcode

Parameters
string $barcode barcode of record to load from Alma

Definition at line 3626 of file grima-lib.php.

3627 {
3628 global $grima;
3629 $this->xml = $grima->getItemBC($barcode);
3630 }

References $grima.

Referenced by loadFromAlmaBCorX().

◆ loadFromAlmaBCorX()

Item::loadFromAlmaBCorX (   $id )

populates item record from Alma using either identifier

Parameters
string $id identifer of record to load from Alma (can be barcode or item ID)

Definition at line 3640 of file grima-lib.php.

3641 {
3642 global $grima;
3643 if (preg_match("/^23.*/", $id)) { // item_pid
3644 // probably should know about suffix too
3645 $this->loadFromAlmaX($id);
3646 } else {
3647 $this->loadFromAlmaBarcode($id);
3648 }
3649 }
loadFromAlmaBarcode($barcode)
populates item record from Alma, using barcode
Definition: grima-lib.php:3626
loadFromAlmaX($item_pid)
populates item record from Alma, only needs item_pid
Definition: grima-lib.php:3614

References $grima, loadFromAlmaBarcode(), and loadFromAlmaX().

◆ loadFromAlmaX()

Item::loadFromAlmaX (   $item_pid )

populates item record from Alma, only needs item_pid

Parameters
string $item_pid item ID of record to load from Alma

Definition at line 3614 of file grima-lib.php.

3615 {
3616 global $grima;
3617 $this->xml = $grima->getItem('X', 'X', $item_pid);
3618 }

References $grima.

Referenced by loadFromAlmaBCorX().

◆ loadFromItemListNode()

Item::loadFromItemListNode (   $node )

populate item record from the information in an ItemList node

Parameters
DomNode $node node from an ItemList

Definition at line 3658 of file grima-lib.php.

3659 {
3660 $this->xml = new DomDocument();
3661 $this->xml->appendChild($this->xml->importNode($node, true));
3662 }

◆ updateAlma()

Item::updateAlma ( )

replace item record in Alma

Returns
DomDocument item object as it now appears in Alma

Definition at line 3701 of file grima-lib.php.

3702 {
3703 global $grima;
3704 return $grima->putItem(
3705 $this['mms_id'],
3706 $this['holding_id'],
3707 $this['item_pid'],
3708 $this->xml
3709 );
3710 }

References $grima.

Member Data Documentation

◆ $el_address

Item::$el_address

Definition at line 3503 of file grima-lib.php.


The documentation for this class was generated from the following file: