bug
changeset 5 131f3e87f9bf
parent 4 b3a6e3ad6dc5
child 6 0193c946ee18
equal deleted inserted replaced
4:b3a6e3ad6dc5 5:131f3e87f9bf
   117 	sed 's/\\t/\t/g ; s/\\n/\n/g'
   117 	sed 's/\\t/\t/g ; s/\\n/\n/g'
   118 }
   118 }
   119 
   119 
   120 function addfile
   120 function addfile
   121 {	
   121 {	
   122 	ID=`grep "^Id:" $1 | head -n 1 | cut -d : -f 2 | string2db`
   122 	ID=`grep "^Id:" $1 | head -n 1 | cut -d : -f 2- | string2db`
   123 	SUBJECT=`grep "^Subject:" $1 | head -n 1 | cut -d : -f 2 | string2db`
   123 	SUBJECT=`grep "^Subject:" $1 | head -n 1 | cut -d : -f 2- | string2db`
   124 	STATE=`grep "^State:" $1 | head -n 1 | cut -d : -f 2 | string2db`
   124 	STATE=`grep "^State:" $1 | head -n 1 | cut -d : -f 2- | string2db`
   125 	PRIORITY=`grep "^Priority:" $1 | head -n 1 | cut -d : -f 2 | string2db`
   125 	PRIORITY=`grep "^Priority:" $1 | head -n 1 | cut -d : -f 2- | string2db`
   126 
   126 
   127 	if ( [ "x$SUBJECT" == "" ] || [ "x$PRIORITY" == "" ] ); then
   127 	if ( [ "x$SUBJECT" == "" ] || [ "x$PRIORITY" == "" ] ); then
   128 		echo "Error in ticket: subject or priority." 2>&1
   128 		echo "Error in ticket: subject or priority." 2>&1
   129 		return 1
   129 		return 1
   130 	fi
   130 	fi
   134 	# Substract Id, Subject, State and Priority
   134 	# Substract Id, Subject, State and Priority
   135 	TOTAIL=$(( LINES - 5 ))
   135 	TOTAIL=$(( LINES - 5 ))
   136 	DESCRIPTION=`tail -n $TOTAIL $1 | text2db | trimlastdbNL`
   136 	DESCRIPTION=`tail -n $TOTAIL $1 | text2db | trimlastdbNL`
   137 
   137 
   138 	echo "$ID	$PRIORITY	$STATE	$SUBJECT	$DESCRIPTION" >> $BUG_PROJECT
   138 	echo "$ID	$PRIORITY	$STATE	$SUBJECT	$DESCRIPTION" >> $BUG_PROJECT
   139 	updatenext $((ID + 1))
   139 
       
   140 	# Update the next ID number
       
   141 	NEXT=`getnext`
       
   142 	if [ $NEXT -gt $ID ]; then
       
   143 		updatenext $((NEXT + 1))
       
   144 	else
       
   145 		updatenext $((ID + 1))
       
   146 	fi
       
   147 		
   140 	return 0
   148 	return 0
   141 }
   149 }
   142 
   150 
   143 function list
   151 function list
   144 {
   152 {
   281 	usage
   289 	usage
   282 	exit 1
   290 	exit 1
   283 fi
   291 fi
   284 
   292 
   285 case "$CMD" in
   293 case "$CMD" in
   286 	add)
   294 	a*)
   287 		add || exit 1
   295 		add || exit 1
   288 		;;
   296 		;;
   289 	list)
   297 	l*)
   290 		list || exit 1
   298 		list || exit 1
   291 		;;
   299 		;;
   292 	view)
   300 	v*)
   293 		view $2 || exit 1
   301 		view $2 || exit 1
   294 		;;
   302 		;;
   295 	project)
   303 	p*)
   296 		echo Project: $BUG_PROJECT
   304 		echo Project: $BUG_PROJECT
   297 		;;
   305 		;;
   298 	delete)
   306 	del*)
   299 		delete $2 || exit 1
   307 		delete $2 || exit 1
   300 		;;
   308 		;;
   301 	create)
   309 	create)
   302 		create || exit 1
   310 		create || exit 1
   303 		;;
   311 		;;
   304 	edit)
   312 	e*)
   305 		edit $2 || exit 1
   313 		edit $2 || exit 1
   306 		;;
   314 		;;
   307 	*)
   315 	*)
   308 		usage
   316 		usage
   309 		exit 1
   317 		exit 1