/**
  * export inventoryItems
  * 
  * @param string $filter JSON encoded string with items ids for multi export or item filter
  * @param string $options format or export definition id
  */
 public function exportInventoryItems($filter, $options)
 {
     $decodedFilter = Zend_Json::decode($filter);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Export filter: ' . print_r($decodedFilter, TRUE));
     }
     if (!is_array($decodedFilter)) {
         $decodedFilter = array(array('field' => 'id', 'operator' => 'equals', 'value' => $decodedFilter));
     }
     $filter = new Inventory_Model_InventoryItemFilter($decodedFilter);
     parent::_export($filter, Zend_Json::decode($options), Inventory_Controller_InventoryItem::getInstance());
 }
 /**
  * import helper
  *
  * @param array $_options
  * @param string|Tinebase_Model_ImportExportDefinition $_definition
  * @param Inventory_Model_InventoryItemFilter $_exportFilter
  * @return array
  */
 protected function _doImport(array $_options, $_definition, Inventory_Model_InventoryItemFilter $_exportFilter = NULL)
 {
     $definition = $_definition instanceof Tinebase_Model_ImportExportDefinition ? $_definition : Tinebase_ImportExportDefinition::getInstance()->getByName($_definition);
     $this->_instance = Inventory_Import_Csv::createFromDefinition($definition, $_options);
     // export first
     if ($_exportFilter !== NULL) {
         $exporter = new Inventory_Export_Csv($_exportFilter, Inventory_Controller_InventoryItem::getInstance());
         $this->_filename = $exporter->generate();
     }
     // then import
     $result = $this->_instance->importFile($this->_filename);
     return $result;
 }
 /**
  * the constructor
  *
  */
 public function __construct()
 {
     $this->_applicationName = 'Inventory';
     $this->_controller = Inventory_Controller_InventoryItem::getInstance();
 }