From 2d7a2c5d3205f3efe09f3e59f01f0f19c6901f16 Mon Sep 17 00:00:00 2001
From: Nathan Gray <nathangray.bsc@gmail.com>
Date: Wed, 9 Mar 2011 18:25:22 +0000
Subject: [PATCH] Automatically handle converting+adding text categories
 without explicit translation

---
 resources/inc/class.resources_import_csv.inc.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/resources/inc/class.resources_import_csv.inc.php b/resources/inc/class.resources_import_csv.inc.php
index 984b41af4d..7723820b69 100644
--- a/resources/inc/class.resources_import_csv.inc.php
+++ b/resources/inc/class.resources_import_csv.inc.php
@@ -139,10 +139,9 @@ class resources_import_csv implements importexport_iface_import_plugin  {
 			// don't import empty records
 			if( count( array_unique( $record ) ) < 2 ) continue;
 
-			if(!is_numeric($record['cat_id']) && strpos($record['cat_id'], ',') === False) {
-				$this->errors[$import_csv->get_current_position()] = lang('Bad category ID: %1.  Try cat(|[<field_index>]) in definition.', $record['cat_id']);
-				continue;
-			}
+			// Automatically handle text categories without explicit translation
+			$record['cat_id'] = importexport_helper_functions::cat_name2id($record['cat_id']);
+
 			if ( $_definition->plugin_options['conditions'] ) {
 				foreach ( $_definition->plugin_options['conditions'] as $condition ) {
 					switch ( $condition['type'] ) {