grima icon indicating copy to clipboard operation
grima copied to clipboard

Adding ability to update inventory date

Open misilot opened this issue 5 years ago • 2 comments

Hi,

We are trying to update the inventory date in a Grima. We added the following to the $el_addresses array:

      'inventory_date' => '//inventory_date',

This appears to work and update the inventory_date if it already exists in the Alma record. However, if we want to set the inventory date for an item that never had data in that field, we get the following error:

[08-Jan-2020 09:06:53 America/Chicago] PHP Notice:  Indirect modification of overloaded element of DOMNodeList has no effect in /grima/grimas/grima-lib.php on line 1610
[08-Jan-2020 09:06:53 America/Chicago] PHP Warning:  Creating default object from empty value in /grima/grimas/grima-lib.php on line 1610

Do you have any suggestions on how we might resolve this error?

Thanks!

misilot avatar Jan 08 '20 20:01 misilot

I did add the following to the grimas/templates/Item.xml file

    <inventory_number/>
    <inventory_date/>

I am still seeing the same error though.

misilot avatar Jan 09 '20 17:01 misilot

This is what our Grima file looks like

...
function do_task() {
      $item = new Item();
      $item->loadFromAlmaBarcode($this['unboxed_barcode']);
      $item['inventory_date'] = date("Y-m-d");
      $item['internal_note_3'] = ('Inventory Date: ').date("m/d/Y");
      $item['inventory_number'] = ('Inventory Date: ').date("m/d/Y");
      $item->updateAlma();
}
...

I walked through the code and looked at updateAlma() and the XML that is being sent to Alma doesn't contain inventory_date.

<item link=".../items/2336743800002401">
<bib_data link=".../bibs/33212933402401">
<mms_id>993321293342401</mms_id>
<title>Top-bar beekeeping : organic practices for honeybee health /</title>
<author>Crowder, Les.</author>
<isbn>1603584617 (pbk.)</isbn>
<complete_edition>
</complete_edition>
<network_numbers>
<network_number>(OCoLC)123456789</network_number>
</network_numbers>
<place_of_publication>White River Junction, Vt. :</place_of_publication>
<date_of_publication>&copy;2012.</date_of_publication>
<publisher_const>Chelsea Green Pub</publisher_const>
</bib_data>
<holding_data link=".../60002401">
<holding_id>4760002401</holding_id>
<call_number_type desc="Library of Congress classification">0</call_number_type>
<call_number>SF523 .C858 2012</call_number>
<accession_number>
</accession_number>
<copy_id>0</copy_id>
<in_temp_location>false</in_temp_location>
<temp_library>
</temp_library>
<temp_location>
</temp_location>
<temp_call_number_type>
</temp_call_number_type>
<temp_call_number>
</temp_call_number>
<temp_policy>
</temp_policy>
</holding_data>
<item_data>
<pid>23310002401</pid>
<barcode>Fire-000013</barcode>
<creation_date>2020-01-09Z</creation_date>
<modification_date>2020-01-09Z</modification_date>
<base_status desc="Item in place">1</base_status>
<awaiting_reshelving>false</awaiting_reshelving>
<physical_material_type desc="Book">BOOK</physical_material_type>
<policy desc="book/ser">book/ser</policy>
<provenance>
</provenance>
<po_line>
</po_line>
<is_magnetic>false</is_magnetic>
<year_of_issue>
</year_of_issue>
<enumeration_a>1</enumeration_a>
<enumeration_b>2</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>3</chronology_i>
<chronology_j>4</chronology_j>
<chronology_k>
</chronology_k>
<chronology_l>
</chronology_l>
<chronology_m>
</chronology_m>
<description>1:2(3:4)</description>
<receiving_operator>import</receiving_operator>
<process_type>
</process_type>
<inventory_number>Inventory Date: 01/09/2020</inventory_number>
<inventory_price>
</inventory_price>
<library desc="WD">MISSING</library>
<location desc="wdmain">wdmain</location>
<alternative_call_number>
</alternative_call_number>
<alternative_call_number_type>
</alternative_call_number_type>
<storage_location_id>
</storage_location_id>
<pages>
</pages>
<pieces>1</pieces>
<public_note>
</public_note>
<fulfillment_note>
</fulfillment_note>
<internal_note_1>
</internal_note_1>
<internal_note_2>
</internal_note_2>
<internal_note_3>Inventory Date: 01/09/2020</internal_note_3>
<statistics_note_1>
</statistics_note_1>
<statistics_note_2>
</statistics_note_2>
<statistics_note_3>To be WITHDRAWN</statistics_note_3>
<requested>false</requested>
<physical_condition>
</physical_condition>
</item_data>
</item>

misilot avatar Jan 09 '20 18:01 misilot