protected function initLabelDefinitions($pa_options = null) { parent::initLabelDefinitions($pa_options); $this->BUNDLES['ca_object_representations'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Media representations')); $this->BUNDLES['ca_objects'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related objects')); $this->BUNDLES['ca_object_lots'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related lots')); $this->BUNDLES['ca_entities'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related entities')); $this->BUNDLES['ca_occurrences'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related occurrences')); $this->BUNDLES['ca_places'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related places')); $this->BUNDLES['ca_loans'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related loans')); $this->BUNDLES['ca_movements'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related movements')); $this->BUNDLES['ca_collections'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related collections')); $this->BUNDLES['ca_storage_locations'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related storage locations')); $this->BUNDLES['ca_list_items'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related vocabulary terms')); }
/** * Override BundleableLabelableBaseModelWithAttributes::saveBundlesForScreen() to create * related movement record when storage location is moved */ public function saveBundlesForScreen($pm_screen, $po_request, &$pa_options) { $vb_parent_changed = parent::saveBundlesForScreenWillChangeParent($pm_screen, $po_request, $pa_options) == __CA_PARENT_CHANGED__; if (($vn_rc = parent::saveBundlesForScreen($pm_screen, $po_request, $pa_options)) && $vb_parent_changed) { unset($pa_options['ui_instance']); // get list of objects currently associated with this storage location $va_object_ids = $this->getCurrentObjectIDs(); $vs_movement_storage_location_relationship_type = $this->getAppConfig()->get('movement_storage_location_tracking_relationship_type'); $vs_movement_object_relationship_type = $this->getAppConfig()->get('movement_object_tracking_relationship_type'); foreach ($_REQUEST as $vs_key => $vs_val) { if (preg_match('!^(.*)_movement_form_name$!', $vs_key, $va_matches)) { $vs_form_name = $po_request->getParameter($va_matches[1] . '_movement_form_name', pString); $vs_screen = $po_request->getParameter($va_matches[1] . '_movement_screen', pString); if (is_array($va_object_ids) && sizeof($va_object_ids)) { $t_movement = new ca_movements(); if ($this->inTransaction()) { $t_movement->setTransaction($this->getTransaction()); } $t_movement->set('type_id', $t_movement->getDefaultTypeID()); $va_movement_opts = array_merge($pa_options, array('formName' => $vs_form_name)); $t_movement->saveBundlesForScreen($vs_screen, $po_request, $va_movement_opts); if ($vs_movement_storage_location_relationship_type) { $t_movement->addRelationship('ca_storage_locations', $this->getPrimaryKey(), $vs_movement_storage_location_relationship_type); } if ($vs_movement_object_relationship_type) { foreach ($va_object_ids as $vn_object_id) { $t_movement->addRelationship('ca_objects', $vn_object_id, $vs_movement_object_relationship_type); } } } } } } return $vn_rc; }
protected function initLabelDefinitions($pa_options = null) { parent::initLabelDefinitions($pa_options); $this->BUNDLES['ca_object_representations'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Media representations')); $this->BUNDLES['ca_entities'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related entities')); $this->BUNDLES['ca_objects'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related objects')); $this->BUNDLES['ca_object_lots'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related lot')); $this->BUNDLES['ca_occurrences'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related occurrences')); $this->BUNDLES['ca_collections'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related collections')); $this->BUNDLES['ca_places'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related places')); $this->BUNDLES['ca_storage_locations'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related storage locations')); $this->BUNDLES['ca_loans'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related loans')); $this->BUNDLES['ca_movements'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related movements')); $this->BUNDLES['ca_tour_stops'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related tour stops')); $this->BUNDLES['ca_list_items'] = array('type' => 'related_table', 'repeating' => true, 'label' => _t('Related vocabulary terms')); $this->BUNDLES['ca_sets'] = array('type' => 'special', 'repeating' => true, 'label' => _t('Sets')); $this->BUNDLES['authority_references_list'] = array('type' => 'special', 'repeating' => false, 'label' => _t('References')); $this->BUNDLES['hierarchy_navigation'] = array('type' => 'special', 'repeating' => false, 'label' => _t('Hierarchy navigation')); $this->BUNDLES['hierarchy_location'] = array('type' => 'special', 'repeating' => false, 'label' => _t('Location in hierarchy')); }
/** * Override BaseModel::removeRelationships() to update current location fields in ca_objects * * @param mixed $pm_rel_table_name_or_num * @param mixed $pm_type_id * * @return int */ public function removeRelationships($pm_rel_table_name_or_num, $pm_type_id = null) { if ($vn_rc = parent::removeRelationships($pm_rel_table_name_or_num, $pm_type_id)) { if ($this->relationshipChangeMayAffectCurrentLocation($pm_rel_table_name_or_num, null, $pm_type_id)) { $this->deriveCurrentLocationForBrowse(); } } return $vn_rc; }