Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Can't display Current Location with ca_objects_location bundle in Pawtucket

Hi, I'm having trouble displaying the current location of a specific object in Pawtucket with the ca_objects_location bundle. (It seems to work okay in Providence, though.)

I added this line to pawtucket/themes/[mytheme]/views/Details/ca_objects_default_html.php, but the Pawtucket webpage just returns a blank line:
{{{<HR><H6>Current location [BETA]:</H6>^ca_objects.ca_objects_location<br/>}}}

I've also tried substituting "^ca_objects_location" in place of "^ca_objects.ca_objects_location", but I still get a blank line.

If I use "^ca_storage_locations.hierarchy.preferred_labels.name" instead, the Pawtucket webpage returns all past and current locations of the object. But, I just want to return the current location.

I've reviewed both this wiki article on Location tracking (http://docs.collectiveaccess.org/wiki/Location_tracking) and this forum thread on displaying ca_objects_location in reports (http://www.collectiveaccess.org/support/forum/index.php?p=/discussion/comment/318577), but wasn't able to solve my problem.

Any ideas? Thanks in advance for your help!

Comments

  • That value can't be gotten directly with tags at the moment. File a ticket for it and we'll sort it out. I think you're the first person who ever thought to show the current location in Pawtucket...

  • In the meantime, is there a workaround to grab that value indirectly without using tags? Maybe using some PHP?

    Thanks!
  • In PHP, assuming you're using something based off of the default theme which has $t_object set to an instance of the object being displayed, this will return an array with the current location in object history.

    $va_history = $t_item->getObjectHistory($va_bundle_settings, array('limit' => 1, 'currentOnly' => true));

    Do a print_r() on $va_history to see the structure.
  • edited September 2017
    Thanks for the quick tip!

    Do I have to initialize $va_bundle_settings with something? Right now, when I call print_r($va_history), it just returns an empty array. Here's what I'm doing:

    $va_history = $t_object->getObjectHistory($va_bundle_settings, array('limit' => 1, 'currentOnly' => true));
    print_r($va_history);

    FWIW, I also get an empty array if I simply try:
    $va_history = $t_object->getObjectHistory();
    print_r($va_history);
  • I ended up solving my issue by doing this:

    $current_loc = $t_object->get('ca_storage_locations.hierarchy.preferred_labels.name', array('returnAsArray'=>true, 'delimiter'=>'&nbsp;&#10141;&nbsp;', 'currentOnly'=>true));
    echo $current_loc[0] . "<br/>";

    The 'currentOnly' keyword was exactly what I needed! Thanks again.
Sign In or Register to comment.