Javascript bugfix in selecting orders as template