diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-30 11:41:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-30 11:41:16 +0000 |
commit | 914d1e6645fd5a9d4fb67387c1cdd4d55aed179f (patch) | |
tree | b9bc4d6f82be49c5b0bc37762f4e0648051ceed2 | |
parent | 5f346bbf2bd6a3750d3f22c6517ec8e61c9ed64a (diff) | |
download | redmine-914d1e6645fd5a9d4fb67387c1cdd4d55aed179f.tar.gz redmine-914d1e6645fd5a9d4fb67387c1cdd4d55aed179f.zip |
Merged r1379 to r1385 from trunk.
git-svn-id: http://redmine.rubyforge.org/svn/branches/0.7-stable@1387 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/query.rb | 12 | ||||
-rw-r--r-- | lang/th.yml | 623 | ||||
-rw-r--r-- | lib/redmine.rb | 6 | ||||
-rw-r--r-- | lib/redmine/core_ext/string/conversions.rb | 2 | ||||
-rw-r--r-- | public/javascripts/calendar/lang/calendar-th.js | 127 | ||||
-rw-r--r-- | public/javascripts/jstoolbar/lang/jstoolbar-th.js | 14 | ||||
-rw-r--r-- | test/fixtures/custom_fields.yml | 1 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 25 | ||||
-rw-r--r-- | test/unit/query_test.rb | 74 |
9 files changed, 867 insertions, 17 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 641c0d17b..d9a720812 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -125,7 +125,7 @@ class Query < ActiveRecord::Base filters.each_key do |field| errors.add label_for(field), :activerecord_error_blank unless # filter requires one or more values - (values_for(field) and !values_for(field).first.empty?) or + (values_for(field) and !values_for(field).first.blank?) or # filter doesn't require any value ["o", "c", "!*", "*", "t", "w"].include? operator_for(field) end if filters @@ -296,11 +296,13 @@ class Query < ActiveRecord::Base v = values_for(field).clone next unless v and !v.empty? - sql = '' + sql = '' + is_custom_filter = false if field =~ /^cf_(\d+)$/ # custom field db_table = CustomValue.table_name db_field = 'value' + is_custom_filter = true sql << "#{Issue.table_name}.id IN (SELECT #{Issue.table_name}.id FROM #{Issue.table_name} LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='Issue' AND #{db_table}.customized_id=#{Issue.table_name}.id AND #{db_table}.custom_field_id=#{$1} WHERE " else # regular field @@ -320,9 +322,11 @@ class Query < ActiveRecord::Base when "!" sql = sql + "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))" when "!*" - sql = sql + "#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} = ''" + sql = sql + "#{db_table}.#{db_field} IS NULL" + sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter when "*" - sql = sql + "#{db_table}.#{db_field} IS NOT NULL AND #{db_table}.#{db_field} <> ''" + sql = sql + "#{db_table}.#{db_field} IS NOT NULL" + sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter when ">=" sql = sql + "#{db_table}.#{db_field} >= #{v.first.to_i}" when "<=" diff --git a/lang/th.yml b/lang/th.yml new file mode 100644 index 000000000..2c506c664 --- /dev/null +++ b/lang/th.yml @@ -0,0 +1,623 @@ +_gloc_rule_default: '|n| n==1 ? "" : "_plural" ' + +actionview_datehelper_select_day_prefix: +actionview_datehelper_select_month_names: มกราคม,กุมภาพันธ์,มีนาคม,เมษายน,พฤษภาคม,มิถุนายน,กรกฎาคม,สิงหาคม,กันยายน,ตุลาคม,พฤศจิกายน,ธันวาคม +actionview_datehelper_select_month_names_abbr: ม.ค.,ก.พ.,มี.ค.,เม.ย.,พ.ค.,มิ.ย.,ก.ค.,ส.ค.,ก.ย.,ต.ค.,พ.ย.,ธ.ค. +actionview_datehelper_select_month_prefix: +actionview_datehelper_select_year_prefix: +actionview_datehelper_time_in_words_day: 1 วัน +actionview_datehelper_time_in_words_day_plural: %d วัน +actionview_datehelper_time_in_words_hour_about: ประมาณ 1 ชั่วโมง +actionview_datehelper_time_in_words_hour_about_plural: ประมาณ %d ชั่วโมง +actionview_datehelper_time_in_words_hour_about_single: ประมาณ 1 ชั่วโมง +actionview_datehelper_time_in_words_minute: 1 นาที +actionview_datehelper_time_in_words_minute_half: ครึ่งนาที +actionview_datehelper_time_in_words_minute_less_than: ไม่ถึงนาที +actionview_datehelper_time_in_words_minute_plural: %d นาที +actionview_datehelper_time_in_words_minute_single: 1 นาที +actionview_datehelper_time_in_words_second_less_than: ไม่ถึงวินาที +actionview_datehelper_time_in_words_second_less_than_plural: ไม่ถึง %d วินาที +actionview_instancetag_blank_option: กรุณาเลือก + +activerecord_error_inclusion: ไม่อยู่ในรายการ +activerecord_error_exclusion: ถูกสงวนไว้ +activerecord_error_invalid: ไม่ถูกต้อง +activerecord_error_confirmation: พิมพ์ไม่เหมือนเดิม +activerecord_error_accepted: ต้องยอมรับ +activerecord_error_empty: ต้องเติม +activerecord_error_blank: ต้องเติม +activerecord_error_too_long: ยาวเกินไป +activerecord_error_too_short: สั้นเกินไป +activerecord_error_wrong_length: ความยาวไม่ถูกต้อง +activerecord_error_taken: ถูกใช้ไปแล้ว +activerecord_error_not_a_number: ไม่ใช่ตัวเลข +activerecord_error_not_a_date: ไม่ใช่วันที่ ที่ถูกต้อง +activerecord_error_greater_than_start_date: ต้องมากกว่าวันเริ่ม +activerecord_error_not_same_project: ไม่ได้อยู่ในโครงการเดียวกัน +activerecord_error_circular_dependency: ความสัมพันธ์อ้างอิงเป็นวงกลม + +general_fmt_age: %d ปี +general_fmt_age_plural: %d ปี +general_fmt_date: %%d/%%B/%%Y +general_fmt_datetime: %%d/%%B/%%Y %%H:%%M +general_fmt_datetime_short: %%d %%b, %%H:%%M +general_fmt_time: %%H:%%M +general_text_No: 'ไม่' +general_text_Yes: 'ใช่' +general_text_no: 'ไม่' +general_text_yes: 'ใช่' +general_lang_name: 'Thai (ไทย)' +general_csv_separator: ',' +general_csv_encoding: Windows-874 +general_pdf_encoding: cp874 +general_day_names: จันทร์,อังคาร,พุธ,พฤหัสบดี,ศุกร์,เสาร์,อาทิตย์ +general_first_day_of_week: '1' + +notice_account_updated: บัญชีได้ถูกปรับปรุงแล้ว. +notice_account_invalid_creditentials: ชื้ผู้ใช้หรือรหัสผ่านไม่ถูกต้อง +notice_account_password_updated: รหัสได้ถูกปรับปรุงแล้ว. +notice_account_wrong_password: รหัสผ่านไม่ถูกต้อง +notice_account_register_done: บัญชีถูกสร้างแล้ว. กรุณาเช็คเมล์ แล้วคลิ๊กที่ลิงค์ในอีเมล์เพื่อเปิดใช้บัญชี +notice_account_unknown_email: ไม่มีผู้ใช้ที่ใช้อีเมล์นี้. +notice_can_t_change_password: บัญชีนี้ใช้การยืนยันตัวตนจากแหล่งภายนอก. ไม่สามารถปลี่ยนรหัสผ่านได้. +notice_account_lost_email_sent: เราได้ส่งอีเมล์พร้อมวิธีการสร้างรหัีสผ่านใหม่ให้คุณแล้ว กรุณาเช็คเมล์. +notice_account_activated: บัญชีของคุณได้เปิดใช้แล้ว. ตอนนี้คุณสามารถเข้าสู่ระบบได้แล้ว. +notice_successful_create: สร้างเสร็จแล้ว. +notice_successful_update: ปรับปรุงเสร็จแล้ว. +notice_successful_delete: ลบเสร็จแล้ว. +notice_successful_connection: ติดต่อสำเร็จแล้ว. +notice_file_not_found: หน้าที่คุณต้องการดูไม่มีอยู่จริง หรือถูกลบไปแล้ว. +notice_locking_conflict: ข้อมูลถูกปรับปรุงโดยผู้ใช้คนอื่น. +notice_not_authorized: คุณไม่มีสิทธิเข้าถึงหน้านี้. +notice_email_sent: อีเมล์ได้ถูกส่งถึง %s +notice_email_error: เกิดความผิดพลาดขณะกำส่งอีเมล์ (%s) +notice_feeds_access_key_reseted: RSS access key ของคุณถูก reset แล้ว. +notice_failed_to_save_issues: "%d ปัญหาจาก %d ปัญหาที่ถูกเลือกไม่สามารถจัดเก็บ: %s." +notice_no_issue_selected: "ไม่มีปัญหาที่ถูกเลือก! กรุณาเลือกปัญหาที่คุณต้องการแก้ไข." +notice_account_pending: "บัญชีของคุณสร้างเสร็จแล้ว ขณะนี้รอการอนุมัติจากผู้บริหารจัดการ." +notice_default_data_loaded: ค่าเริ่มต้นโหลดเสร็จแล้ว. + +error_can_t_load_default_data: "ค่าเริ่มต้นโหลดไม่สำเร็จ: %s" +error_scm_not_found: "ไม่พบรุ่นที่ต้องการในแหล่งเก็บต้นฉบับ." +error_scm_command_failed: "เกิดความผิดพลาดในการเข้าถึงแหล่งเก็บต้นฉบับ: %s" +error_scm_annotate: "entry ไม่มีอยู่จริง หรือไม่สามารถเขียนหมายเหตุประกอบ." +error_issue_not_found_in_project: 'ไม่พบปัญหานี้ หรือปัญหาไม่ได้อยู่ในโครงการนี้' + +mail_subject_lost_password: รหัสผ่าน %s ของคุณ +mail_body_lost_password: 'คลิ๊กที่ลิงค์ต่อไปนี้เพื่อเปลี่ยนรหัสผ่าน:' +mail_subject_register: เปิดบัญชี %s ของคุณ +mail_body_register: 'คลิ๊กที่ลิงค์ต่อไปนี้เพื่อเปลี่ยนรหัสผ่าน:' +mail_body_account_information_external: คุณสามารถใช้บัญชี "%s" เพื่อเข้าสู่ระบบ. +mail_body_account_information: ข้อมูลบัญชีของคุณ +mail_subject_account_activation_request: กรุณาเปิดบัญชี %s +mail_body_account_activation_request: 'ผู้ใช้ใหม่ (%s) ได้ลงทะเบียน. บัญชีของเขากำลังรออนุมัติ:' + +gui_validation_error: 1 ข้อผิดพลาด +gui_validation_error_plural: %d ข้อผิดพลาด + +field_name: ชื่อ +field_description: รายละเอียด +field_summary: สรุปย่อ +field_is_required: ต้องใส่ +field_firstname: ชื่อ +field_lastname: นามสกุล +field_mail: อีเมล์ +field_filename: แฟ้ม +field_filesize: ขนาด +field_downloads: ดาวน์โหลด +field_author: ผู้แต่ง +field_created_on: สร้าง +field_updated_on: ปรับปรุง +field_field_format: รูปแบบ +field_is_for_all: สำหรับทุกโครงการ +field_possible_values: ค่าที่เป็นไปได้ +field_regexp: Regular expression +field_min_length: สั้นสุด +field_max_length: ยาวสุด +field_value: ค่า +field_category: ประเภท +field_title: ชื่อเรื่อง +field_project: โครงการ +field_issue: ปัญหา +field_status: สถานะ +field_notes: บันทึก +field_is_closed: ปัญหาจบ +field_is_default: ค่าเริ่มต้น +field_tracker: การติดตาม +field_subject: เรื่อง +field_due_date: วันครบกำหนด +field_assigned_to: มอบหมายให้ +field_priority: ความสำคัญ +field_fixed_version: รุ่น +field_user: ผู้ใช้ +field_role: บทบาท +field_homepage: หน้าแรก +field_is_public: สาธารณะ +field_parent: โครงการย่อยของ +field_is_in_chlog: ปัญหาแสดงใน รายกาเปลี่ยนแปลง +field_is_in_roadmap: ปัญหาแสดงใน แผนงาน +field_login: ชื่อที่ใช้เข้าระบบ +field_mail_notification: การแจ้งเตือนทางอีเมล์ +field_admin: ผู้บริหารจัดการ +field_last_login_on: เข้าระบบครั้งสุดท้าย +field_language: ภาษา +field_effective_date: วันที่ +field_password: รหัสผ่าน +field_new_password: รหัสผ่านใหม่ +field_password_confirmation: ยืนยันรหัสผ่าน +field_version: รุ่น +field_type: ชนิด +field_host: โฮสต์ +field_port: พอร์ต +field_account: บัญชี +field_base_dn: Base DN +field_attr_login: เข้าระบบ attribute +field_attr_firstname: ชื่อ attribute +field_attr_lastname: นามสกุล attribute +field_attr_mail: อีเมล์ attribute +field_onthefly: สร้างผู้ใช้ทันที +field_start_date: เริ่ม +field_done_ratio: %% สำเร็จ +field_auth_source: วิธีการยืนยันตัวตน +field_hide_mail: ซ่อนอีเมล์ของฉัน +field_comments: ความเห็น +field_url: URL +field_start_page: หน้าเริ่มต้น +field_subproject: โครงการย่อย +field_hours: ชั่วโมง +field_activity: กิจกรรม +field_spent_on: วันที่ +field_identifier: ชื่อเฉพาะ +field_is_filter: ใช้เป็นตัวกรอง +field_issue_to_id: ปัญหาที่เกี่ยวข้อง +field_delay: เลื่อน +field_assignable: ปัญหาสามารถมอบหมายให้คนที่ทำบทบาทนี้ +field_redirect_existing_links: ย้ายจุดเชื่อมโยงนี้ +field_estimated_hours: เวลาที่ใช้โดยประมาณ +field_column_names: สดมภ์ +field_time_zone: ย่านเวลา +field_searchable: ค้นหาได้ +field_default_value: ค่าเริ่มต้น +field_comments_sorting: แสดงความเห็น + +setting_app_title: ชื่อโปรแกรม +setting_app_subtitle: ชื่อโปรแกรมรอง +setting_welcome_text: ข้อความต้อนรับ +setting_default_language: ภาษาเริ่มต้น +setting_login_required: ต้องป้อนผู้ใช้-รหัสผ่าน +setting_self_registration: ลงทะเบียนด้วยตนเอง +setting_attachment_max_size: ขนาดแฟ้มแนบสูงสุด +setting_issues_export_limit: การส่งออกปัญหาสูงสุด +setting_mail_from: อีเมล์ที่ใช้ส่ง +setting_bcc_recipients: ไม่ระบุชื่อผู้รับ (bcc) +setting_host_name: ชื่อโฮสต์ +setting_text_formatting: การจัดรูปแบบข้อความ +setting_wiki_compression: บีบอัดประวัติ Wiki +setting_feeds_limit: จำนวน Feed +setting_default_projects_public: โครงการใหม่มีค่าเริ่มต้นเป็น สาธารณะ +setting_autofetch_changesets: ดึง commits อัตโนมัติ +setting_sys_api_enabled: เปิดใช้ WS สำหรับการจัดการที่เก็บต้นฉบับ +setting_commit_ref_keywords: คำสำคัญ Referencing +setting_commit_fix_keywords: คำสำคัญ Fixing +setting_autologin: เข้าระบบอัตโนมัติ +setting_date_format: รูปแบบวันที่ +setting_time_format: รูปแบบเวลา +setting_cross_project_issue_relations: อนุญาตให้ระบุปัญหาข้ามโครงการ +setting_issue_list_default_columns: สดมภ์เริ่มต้นแสดงในรายการปัญหา +setting_repositories_encodings: การเข้ารหัสที่เก็บต้นฉบับ +setting_emails_footer: คำลงท้ายอีเมล์ +setting_protocol: Protocol +setting_per_page_options: ตัวเลือกจำนวนต่อหน้า +setting_user_format: รูปแบบการแสดงชื่อผู้ใช้ +setting_activity_days_default: จำนวนวันที่แสดงในกิจกรรมของโครงการ +setting_display_subprojects_issues: แสดงปัญหาของโครงการย่อยในโครงการหลัก + +project_module_issue_tracking: การติดตามปัญหา +project_module_time_tracking: การใช้เวลา +project_module_news: ข่าว +project_module_documents: เอกสาร +project_module_files: แฟ้ม +project_module_wiki: Wiki +project_module_repository: ที่เก็บต้นฉบับ +project_module_boards: กระดานข้อความ + +label_user: ผู้ใช้ +label_user_plural: ผู้ใช้ +label_user_new: ผู้ใช้ใหม่ +label_project: โครงการ +label_project_new: โครงการใหม่ +label_project_plural: โครงการ +label_project_all: โครงการทั้งหมด +label_project_latest: โครงการล่าสุด +label_issue: ปัญหา +label_issue_new: ปัญหาใหม่ +label_issue_plural: ปัญหา +label_issue_view_all: ดูปัญหาทั้งหมด +label_issues_by: ปัญหาโดย %s +label_issue_added: ปัญหาถูกเพิ่ม +label_issue_updated: ปัญหาถูกปรับปรุง +label_document: เอกสาร +label_document_new: เอกสารใหม่ +label_document_plural: เอกสาร +label_document_added: เอกสารถูกเพิ่ม +label_role: บทบาท +label_role_plural: บทบาท +label_role_new: บทบาทใหม่ +label_role_and_permissions: บทบาทและสิทธิ +label_member: สมาชิก +label_member_new: สมาชิกใหม่ +label_member_plural: สมาชิก +label_tracker: การติดตาม +label_tracker_plural: การติดตาม +label_tracker_new: การติดตามใหม่ +label_workflow: ลำดับงาน +label_issue_status: สถานะของปัญหา +label_issue_status_plural: สถานะของปัญหา +label_issue_status_new: สถานะใหม +label_issue_category: ประเภทของปัญหา +label_issue_category_plural: ประเภทของปัญหา +label_issue_category_new: ประเภทใหม่ +label_custom_field: เขตข้อมูลแบบระบุเอง +label_custom_field_plural: เขตข้อมูลแบบระบุเอง +label_custom_field_new: สร้างเขตข้อมูลแบบระบุเอง +label_enumerations: รายการ +label_enumeration_new: สร้างใหม่ +label_information: ข้อมูล +label_information_plural: ข้อมูล +label_please_login: กรุณาเข้าระบบก่อน +label_register: ลงทะเบียน +label_password_lost: ลืมรหัสผ่าน +label_home: หน้าแรก +label_my_page: หน้าของฉัน +label_my_account: บัญชีของฉัน +label_my_projects: โครงการของฉัน +label_administration: บริหารจัดการ +label_login: เข้าระบบ +label_logout: ออกระบบ +label_help: ช่วยเหลือ +label_reported_issues: ปัญหาที่แจ้งไว้ +label_assigned_to_me_issues: ปัญหาที่มอบหมายให้ฉัน +label_last_login: ติดต่อครั้งสุดท้าย +label_last_updates: ปรับปรุงครั้งสุดท้าย +label_last_updates_plural: %d ปรับปรุงครั้งสุดท้าย +label_registered_on: ลงทะเบียนเมื่อ +label_activity: กิจกรรม +label_activity_plural: กิจกรรม +label_activity_latest: กิจกรรมล่าสุด +label_overall_activity: กิจกรรมโดยรวม +label_new: ใหม่ +label_logged_as: เข้าระบบในชื่อ +label_environment: สภาพแวดล้อม +label_authentication: การยืนยันตัวตน +label_auth_source: วิธีการการยืนยันตัวตน +label_auth_source_new: สร้างวิธีการยืนยันตัวตนใหม่ +label_auth_source_plural: วิธีการ Authentication +label_subproject_plural: โครงการย่อย +label_min_max_length: สั้น-ยาว สุดที่ +label_list: รายการ +label_date: วันที่ +label_integer: จำนวนเต็ม +label_float: จำนวนจริง +label_boolean: ถูกผิด +label_string: ข้อความ +label_text: ข้อความขนาดยาว +label_attribute: คุณลักษณะ +label_attribute_plural: คุณลักษณะ +label_download: %d ดาวน์โหลด +label_download_plural: %d ดาวน์โหลด +label_no_data: จำนวนข้อมูลที่แสดง +label_change_status: เปลี่ยนสถานะ +label_history: ประวัติ +label_attachment: แฟ้ม +label_attachment_new: แฟ้มใหม่ +label_attachment_delete: ลบแฟ้ม +label_attachment_plural: แฟ้ม +label_file_added: แฟ้มถูกเพิ่ม +label_report: รายงาน +label_report_plural: รายงาน +label_news: ข่าว +label_news_new: เพิ่มข่าว +label_news_plural: ข่าว +label_news_latest: ข่าวล่าสุด +label_news_view_all: ดูข่าวทั้งหมด +label_news_added: ข่าวถูกเพิ่ม +label_change_log: บันทึกการเปลี่ยนแปลง +label_settings: ปรับแต่ง +label_overview: ภาพรวม +label_version: รุ่น +label_version_new: รุ่นใหม่ +label_version_plural: รุ่น +label_confirmation: ยืนยัน +label_export_to: 'รูปแบบอื่นๆ :' +label_read: อ่าน... +label_public_projects: โครงการสาธารณะ +label_open_issues: เปิด +label_open_issues_plural: เปิด +label_closed_issues: ปิด +label_closed_issues_plural: ปิด +label_total: จำนวนรวม +label_permissions: สิทธิ +label_current_status: สถานะปัจจุบัน +label_new_statuses_allowed: อนุญาตให้มีสถานะใหม่ +label_all: ทั้งหมด +label_none: ไม่มี +label_nobody: ไม่มีใคร +label_next: ต่อไป +label_previous: ก่อนหน้า +label_used_by: ถูกใช้โดย +label_details: รายละเอียด +label_add_note: เพิ่มบันทึก +label_per_page: ต่อหน้า +label_calendar: ปฏิทิน +label_months_from: เดือนจาก +label_gantt: Gantt +label_internal: ภายใน +label_last_changes: last %d เปลี่ยนแปลง +label_change_view_all: ดูการเปลี่ยนแปลงทั้งหมด +label_personalize_page: ปรับแต่งหน้านี้ +label_comment: ความเห็น +label_comment_plural: ความเห็น +label_comment_add: เพิ่มความเห็น +label_comment_added: ความเห็นถูกเพิ่ม +label_comment_delete: ลบความเห็น +label_query: แบบสอบถามแบบกำหนดเอง +label_query_plural: แบบสอบถามแบบกำหนดเอง +label_query_new: แบบสอบถามใหม่ +label_filter_add: เพิ่มตัวกรอง +label_filter_plural: ตัวกรอง +label_equals: คือ +label_not_equals: ไม่ใช่ +label_in_less_than: น้อยกว่า +label_in_more_than: มากกว่า +label_in: ในช่วง +label_today: วันนี้ +label_all_time: ตลอดเวลา +label_yesterday: เมื่อวาน +label_this_week: อาทิตย์นี้ +label_last_week: อาทิตย์ที่แล้ว +label_last_n_days: %d วันย้อนหลัง +label_this_month: เดือนนี้ +label_last_month: เดือนที่แล้ว +label_this_year: ปีนี้ +label_date_range: ช่วงวันที่ +label_less_than_ago: น้อยกว่าหนึ่งวัน +label_more_than_ago: มากกว่าหนึ่งวัน +label_ago: วันผ่านมาแล้ว +label_contains: มี... +label_not_contains: ไม่มี... +label_day_plural: วัน +label_repository: ที่เก็บต้นฉบับ +label_repository_plural: ที่เก็บต้นฉบับ +label_browse: เปิดหา +label_modification: %d เปลี่ยนแปลง +label_modification_plural: %d เปลี่ยนแปลง +label_revision: การแก้ไข +label_revision_plural: การแก้ไข +label_associated_revisions: การแก้ไขที่เกี่ยวข้อง +label_added: ถูกเพิ่ม +label_modified: ถูกแก้ไข +label_deleted: ถูกลบ +label_latest_revision: รุ่นการแก้ไขล่าสุด +label_latest_revision_plural: รุ่นการแก้ไขล่าสุด +label_view_revisions: ดูการแก้ไข +label_max_size: ขนาดใหญ่สุด +label_on: 'ใน' +label_sort_highest: ย้ายไปบนสุด +label_sort_higher: ย้ายขึ้น +label_sort_lower: ย้ายลง +label_sort_lowest: ย้ายไปล่างสุด +label_roadmap: แผนงาน +label_roadmap_due_in: ถึงกำหนดใน +label_roadmap_overdue: %s ช้ากว่ากำหนด +label_roadmap_no_issues: ไม่มีปัญหาสำหรับรุ่นนี้ +label_search: ค้นหา +label_result_plural: ผลการค้นหา +label_all_words: ทุกคำ +label_wiki: Wiki +label_wiki_edit: แก้ไข Wiki +label_wiki_edit_plural: แก้ไข Wiki +label_wiki_page: หน้า Wiki +label_wiki_page_plural: หน้า Wiki +label_index_by_title: เรียงตามชื่อเรื่อง +label_index_by_date: เรียงตามวัน +label_current_version: รุ่นปัจจุบัน +label_preview: ตัวอย่างก่อนจัดเก็บ +label_feed_plural: Feeds +label_changes_details: รายละเอียดการเปลี่ยนแปลงทั้งหมด +label_issue_tracking: ติดตามปัญหา +label_spent_time: เวลาที่ใช้ +label_f_hour: %.2f ชั่วโมง +label_f_hour_plural: %.2f ชั่วโมง +label_time_tracking: ติดตามการใช้เวลา +label_change_plural: เปลี่ยนแปลง +label_statistics: สถิติ +label_commits_per_month: Commits ต่อเดือน +label_commits_per_author: Commits ต่อผู้แต่ง +label_view_diff: ดูความแตกต่าง +label_diff_inline: inline +label_diff_side_by_side: side by side +label_options: ตัวเลือก +label_copy_workflow_from: คัดลอกลำดับงานจาก +label_permissions_report: รายงานสิทธิ +label_watched_issues: เฝ้าดูปัญหา +label_related_issues: ปัญหาที่เกี่ยวข้อง +label_applied_status: จัดเก็บสถานะ +label_loading: กำลังโหลด... +label_relation_new: ความสัมพันธ์ใหม่ +label_relation_delete: ลบความสัมพันธ์ +label_relates_to: สัมพันธ์กับ +label_duplicates: ซ้ำ +label_blocks: กีดกัน +label_blocked_by: กีดกันโดย +label_precedes: นำหน้า +label_follows: ตามหลัง +label_end_to_start: จบ-เริ่ม +label_end_to_end: จบ-จบ +label_start_to_start: เริ่ม-เริ่ม +label_start_to_end: เริ่ม-จบ +label_stay_logged_in: อยู่ในระบบต่อ +label_disabled: ไม่ใช้งาน +label_show_completed_versions: แสดงรุ่นที่สมบูรณ์ +label_me: ฉัน +label_board: สภากาแฟ +label_board_new: สร้างสภากาแฟ +label_board_plural: สภากาแฟ +label_topic_plural: หัวข้อ +label_message_plural: ข้อความ +label_message_last: ข้อความล่าสุด +label_message_new: เขียนข้อความใหม่ +label_message_posted: ข้อความถูกเพิ่มแล้ว +label_reply_plural: ตอบกลับ +label_send_information: ส่งรายละเอียดของบัญชีให้ผู้ใช้ +label_year: ปี +label_month: เดือน +label_week: สัปดาห์ +label_date_from: จาก +label_date_to: ถึง +label_language_based: ขึ้นอยู่กับภาษาของผู้ใช้ +label_sort_by: เรียงโดย %s +label_send_test_email: ส่งจดหมายทดสอบ +label_feeds_access_key_created_on: RSS access key สร้างเมื่อ %s ที่ผ่านมา +label_module_plural: ส่วนประกอบ +label_added_time_by: เพิ่มโดย %s %s ที่ผ่านมา +label_updated_time: ปรับปรุง %s ที่ผ่านมา +label_jump_to_a_project: ไปที่โครงการ... +label_file_plural: แฟ้ม +label_changeset_plural: กลุ่มการเปลี่ยนแปลง +label_default_columns: สดมภ์เริ่มต้น +label_no_change_option: (ไม่เปลี่ยนแปลง) +label_bulk_edit_selected_issues: แก้ไขปัญหาที่เลือกทั้งหมด +label_theme: ชุดรูปแบบ +label_default: ค่าเริ่มต้น +label_search_titles_only: ค้นหาจากชื่อเรื่องเท่านั้น +label_user_mail_option_all: "ทุกๆ เหตุการณ์ในโครงการของฉัน" +label_user_mail_option_selected: "ทุกๆ เหตุการณ์ในโครงการที่เลือก..." +label_user_mail_option_none: "เฉพาะสิ่งที่ฉันเลือกหรือมีส่วนเกี่ยวข้อง" +label_user_mail_no_self_notified: "ฉันไม่ต้องการได้รับการแจ้งเตือนในสิ่งที่ฉันทำเอง" +label_registration_activation_by_email: เปิดบัญชีผ่านอีเมล์ +label_registration_manual_activation: อนุมัติโดยผู้บริหารจัดการ +label_registration_automatic_activation: เปิดบัญชีอัตโนมัติ +label_display_per_page: 'ต่อหน้า: %s' +label_age: อายุ +label_change_properties: เปลี่ยนคุณสมบัติ +label_general: ทั่วๆ ไป +label_more: อื่น ๆ +label_scm: ตัวจัดการต้นฉบับ +label_plugins: ส่วนเสริม +label_ldap_authentication: การยืนยันตัวตนโดยใช้ LDAP +label_downloads_abbr: D/L +label_optional_description: รายละเอียดเพิ่มเติม +label_add_another_file: เพิ่มแฟ้มอื่นๆ +label_preferences: ค่าที่ชอบใจ +label_chronological_order: เรียงจากเก่าไปใหม่ +label_reverse_chronological_order: เรียงจากใหม่ไปเก่า +label_planning: การวางแผน + +button_login: เข้าระบบ +button_submit: จัดส่งข้อมูล +button_save: จัดเก็บ +button_check_all: เลือกทั้งหมด +button_uncheck_all: ไม่เลือกทั้งหมด +button_delete: ลบ +button_create: สร้าง +button_test: ทดสอบ +button_edit: แก้ไข +button_add: เพิ่ม +button_change: เปลี่ยนแปลง +button_apply: ประยุกต์ใช้ +button_clear: ล้างข้อความ +button_lock: ล็อค +button_unlock: ยกเลิกการล็อค +button_download: ดาวน์โหลด +button_list: รายการ +button_view: มุมมอง +button_move: ย้าย +button_back: กลับ +button_cancel: ยกเลิก +button_activate: เปิดใช้ +button_sort: จัดเรียง +button_log_time: บันทึกเวลา +button_rollback: ถอยกลับมาที่รุ่นนี้ +button_watch: เฝ้าดู +button_unwatch: เลิกเฝ้าดู +button_reply: ตอบกลับ +button_archive: เก็บเข้าโกดัง +button_unarchive: เอาออกจากโกดัง +button_reset: เริ่มใหมท +button_rename: เปลี่ยนชื่อ +button_change_password: เปลี่ยนรหัสผ่าน +button_copy: คัดลอก +button_annotate: หมายเหตุประกอบ +button_update: ปรับปรุง +button_configure: ปรับแต่ง + +status_active: เปิดใช้งานแล้ว +status_registered: รอการอนุมัติ +status_locked: ล็อค + +text_select_mail_notifications: เลือกการกระทำที่ต้องการให้ส่งอีเมล์แจ้ง. +text_regexp_info: ตัวอย่าง ^[A-Z0-9]+$ +text_min_max_length_info: 0 หมายถึงไม่จำกัด +text_project_destroy_confirmation: คุณแน่ใจไหมว่าต้องการลบโครงการและข้อมูลที่เกี่ยวข้่อง ? +text_subprojects_destroy_warning: 'โครงการย่อย: %s จะถูกลบด้วย.' +text_workflow_edit: เลือกบทบาทและการติดตาม เพื่อแก้ไขลำดับงาน +text_are_you_sure: คุณแน่ใจไหม ? +text_journal_changed: เปลี่ยนแปลงจาก %s เป็น %s +text_journal_set_to: ตั้งค่าเป็น %s +text_journal_deleted: ถูกลบ +text_tip_task_begin_day: งานที่เริ่มวันนี้ +text_tip_task_end_day: งานที่จบวันนี้ +text_tip_task_begin_end_day: งานที่เริ่มและจบวันนี้ +text_project_identifier_info: 'ภาษาอังกฤษตัวเล็ก(a-z), ตัวเลข(0-9) และขีด (-) เท่านั้น.<br />เมื่อจัดเก็บแล้ว, ชื่อเฉพาะไม่สามารถเปลี่ยนแปลงได้' +text_caracters_maximum: สูงสุด %d ตัวอักษร. +text_caracters_minimum: ต้องยาวอย่างน้อย %d ตัวอักษร. +text_length_between: ความยาวระหว่าง %d ถึง %d ตัวอักษร. +text_tracker_no_workflow: ไม่ได้บัญญัติลำดับงานสำหรับการติดตามนี้ +text_unallowed_characters: ตัวอักษรต้องห้าม +text_comma_separated: ใส่ได้หลายค่า โดยคั่นด้วยลูกน้ำ( ,). +text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages +text_issue_added: ปัญหา %s ถูกแจ้งโดย %s. +text_issue_updated: ปัญหา %s ถูกปรับปรุงโดย %s. +text_wiki_destroy_confirmation: คุณแน่ใจหรือว่าต้องการลบ wiki นี้พร้อมทั้งเนี้อหา? +text_issue_category_destroy_question: บางปัญหา (%d) อยู่ในประเภทนี้. คุณต้องการทำอย่างไร ? +text_issue_category_destroy_assignments: ลบประเภทนี้ +text_issue_category_reassign_to: ระบุปัญหาในประเภทนี้ +text_user_mail_option: "ในโครงการที่ไม่ได้เลือก, คุณจะได้รับการแจ้งเกี่ยวกับสิ่งที่คุณเฝ้าดูหรือมีส่วนเกี่ยวข้อง (เช่นปัญหาที่คุณแจ้งไว้หรือได้รับมอบหมาย)." +text_no_configuration_data: "บทบาท, การติดตาม, สถานะปัญหา และลำดับงานยังไม่ได้ถูกตั้งค่า.\nขอแนะนำให้โหลดค่าเริ่มต้น. คุณสามารถแก้ไขค่าได้หลังจากโหลดแล้ว." +text_load_default_configuration: โหลดค่าเริ่มต้น +text_status_changed_by_changeset: ประยุกต์ใช้ในกลุ่มการเปลี่ยนแปลง %s. +text_issues_destroy_confirmation: 'คุณแน่ใจไหมว่าต้องการลบปัญหา(ทั้งหลาย)ที่เลือกไว้?' +text_select_project_modules: 'เลือกส่วนประกอบที่ต้องการใช้งานสำหรับโครงการนี้:' +text_default_administrator_account_changed: ค่าเริ่มต้นของบัญชีผู้บริหารจัดการถูกเปลี่ยนแปลง +text_file_repository_writable: ที่เก็บต้นฉบับสามารถเขียนได้ +text_rmagick_available: RMagick มีให้ใช้ (เป็นตัวเลือก) +text_destroy_time_entries_question: %.02f ชั่วโมงที่ถูกแจ้งในปัญหานี้จะโดนลบ. คุณต้องการทำอย่างไร? +text_destroy_time_entries: ลบเวลาที่รายงานไว้ +text_assign_time_entries_to_project: ระบุเวลาที่ใช้ในโครงการนี้ +text_reassign_time_entries: 'ระบุเวลาที่ใช้ในโครงการนี่อีกครั้ง:' + +default_role_manager: ผู้จัดการ +default_role_developper: ผู้พัฒนา +default_role_reporter: ผู้รายงาน +default_tracker_bug: บั๊ก +default_tracker_feature: ลักษณะเด่น +default_tracker_support: สนับสนุน +default_issue_status_new: เกิดขึ้น +default_issue_status_assigned: รับมอบหมาย +default_issue_status_resolved: ดำเนินการ +default_issue_status_feedback: รอคำตอบ +default_issue_status_closed: จบ +default_issue_status_rejected: ยกเลิก +default_doc_category_user: เอกสารของผู้ใช้ +default_doc_category_tech: เอกสารทางเทคนิค +default_priority_low: ต่ำ +default_priority_normal: ปกติ +default_priority_high: สูง +default_priority_urgent: เร่งด่วน +default_priority_immediate: ด่วนมาก +default_activity_design: ออกแบบ +default_activity_development: พัฒนา + +enumeration_issue_priorities: ความสำคัญของปัญหา +enumeration_doc_categories: ประเภทเอกสาร +enumeration_activities: กิจกรรม (ใช้ในการติดตามเวลา) diff --git a/lib/redmine.rb b/lib/redmine.rb index 2697e8f5f..cef2615df 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -94,7 +94,7 @@ Redmine::AccessControl.map do |map| end Redmine::MenuManager.map :top_menu do |menu| - menu.push :home, :home_url, :html => { :class => 'home' } + menu.push :home, :home_path, :html => { :class => 'home' } menu.push :my_page, { :controller => 'my', :action => 'page' }, :html => { :class => 'mypage' }, :if => Proc.new { User.current.logged? } menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural, :html => { :class => 'projects' } menu.push :administration, { :controller => 'admin', :action => 'index' }, :html => { :class => 'admin' }, :if => Proc.new { User.current.admin? } @@ -102,10 +102,10 @@ Redmine::MenuManager.map :top_menu do |menu| end Redmine::MenuManager.map :account_menu do |menu| - menu.push :login, :signin_url, :html => { :class => 'login' }, :if => Proc.new { !User.current.logged? } + menu.push :login, :signin_path, :html => { :class => 'login' }, :if => Proc.new { !User.current.logged? } menu.push :register, { :controller => 'account', :action => 'register' }, :html => { :class => 'register' }, :if => Proc.new { !User.current.logged? && Setting.self_registration? } menu.push :my_account, { :controller => 'my', :action => 'account' }, :html => { :class => 'myaccount' }, :if => Proc.new { User.current.logged? } - menu.push :logout, :signout_url, :html => { :class => 'logout' }, :if => Proc.new { User.current.logged? } + menu.push :logout, :signout_path, :html => { :class => 'logout' }, :if => Proc.new { User.current.logged? } end Redmine::MenuManager.map :application_menu do |menu| diff --git a/lib/redmine/core_ext/string/conversions.rb b/lib/redmine/core_ext/string/conversions.rb index 7444445b0..41149f5ea 100644 --- a/lib/redmine/core_ext/string/conversions.rb +++ b/lib/redmine/core_ext/string/conversions.rb @@ -32,7 +32,7 @@ module Redmine #:nodoc: end # 2,5 => 2.5 s.gsub!(',', '.') - s.to_f + begin; Kernel.Float(s); rescue; nil; end end end end diff --git a/public/javascripts/calendar/lang/calendar-th.js b/public/javascripts/calendar/lang/calendar-th.js new file mode 100644 index 000000000..dc4809e52 --- /dev/null +++ b/public/javascripts/calendar/lang/calendar-th.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Gampol Thitinilnithi, <gampolt@gmail.com> +// Encoding: UTF-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("อาทิตย์", + "จันทร์", + "อังคาร", + "พุธ", + "พฤหัสบดี", + "ศุกร์", + "เสาร์", + "อาทิตย์"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("อา.", + "จ.", + "อ.", + "พ.", + "พฤ.", + "ศ.", + "ส.", + "อา."); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 1; + +// full month names +Calendar._MN = new Array +("มกราคม", + "กุมภาพันธ์", + "มีนาคม", + "เมษายน", + "พฤษภาคม", + "มิถุนายน", + "กรกฎาคม", + "สิงหาคม", + "กันยายน", + "ตุลาคม", + "พฤศจิกายน", + "ธันวาคม"); + +// short month names +Calendar._SMN = new Array +("ม.ค.", + "ก.พ.", + "มี.ค.", + "เม.ย.", + "พ.ค.", + "มิ.ย.", + "ก.ค.", + "ส.ค.", + "ก.ย.", + "ต.ค.", + "พ.ย.", + "ธ.ค."); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "เกี่ยวกับปฏิทิน"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "ปีที่แล้ว (ถ้ากดค้างจะมีเมนู)"; +Calendar._TT["PREV_MONTH"] = "เดือนที่แล้ว (ถ้ากดค้างจะมีเมนู)"; +Calendar._TT["GO_TODAY"] = "ไปที่วันนี้"; +Calendar._TT["NEXT_MONTH"] = "เดือนหน้า (ถ้ากดค้างจะมีเมนู)"; +Calendar._TT["NEXT_YEAR"] = "ปีหน้า (ถ้ากดค้างจะมีเมนู)"; +Calendar._TT["SEL_DATE"] = "เลือกวัน"; +Calendar._TT["DRAG_TO_MOVE"] = "กดแล้วลากเพื่อย้าย"; +Calendar._TT["PART_TODAY"] = " (วันนี้)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "แสดง %s เป็นวันแรก"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "ปิด"; +Calendar._TT["TODAY"] = "วันนี้"; +Calendar._TT["TIME_PART"] = "(Shift-)กดหรือกดแล้วลากเพื่อเปลี่ยนค่า"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a %e %b"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "เวลา:"; diff --git a/public/javascripts/jstoolbar/lang/jstoolbar-th.js b/public/javascripts/jstoolbar/lang/jstoolbar-th.js new file mode 100644 index 000000000..2e2f2b88e --- /dev/null +++ b/public/javascripts/jstoolbar/lang/jstoolbar-th.js @@ -0,0 +1,14 @@ +jsToolBar.strings = {}; +jsToolBar.strings['Strong'] = 'หนา'; +jsToolBar.strings['Italic'] = 'เอียง'; +jsToolBar.strings['Underline'] = 'ขีดเส้นใต้'; +jsToolBar.strings['Deleted'] = 'ขีดฆ่า'; +jsToolBar.strings['Code'] = 'โค๊ดโปรแกรม'; +jsToolBar.strings['Heading 1'] = 'หัวข้อ 1'; +jsToolBar.strings['Heading 2'] = 'หัวข้อ 2'; +jsToolBar.strings['Heading 3'] = 'หัวข้อ 3'; +jsToolBar.strings['Unordered list'] = 'รายการ'; +jsToolBar.strings['Ordered list'] = 'ลำดับเลข'; +jsToolBar.strings['Preformatted text'] = 'รูปแบบข้อความคงที่'; +jsToolBar.strings['Wiki link'] = 'เชื่อมโยงไปหน้า Wiki อื่น'; +jsToolBar.strings['Image'] = 'รูปภาพ'; diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml index 6be840fcc..3a9e79a29 100644 --- a/test/fixtures/custom_fields.yml +++ b/test/fixtures/custom_fields.yml @@ -4,6 +4,7 @@ custom_fields_001: min_length: 0
regexp: ""
is_for_all: true
+ is_filter: true
type: IssueCustomField
max_length: 0
possible_values: MySQL|PostgreSQL|Oracle
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 042a8f3f2..a6d2ca6e3 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -169,13 +169,15 @@ class IssuesControllerTest < Test::Unit::TestCase :issue => {:tracker_id => 1, :subject => 'This is the test_new issue', :description => 'This is the description', - :priority_id => 5}, + :priority_id => 5, + :estimated_hours => ''}, :custom_fields => {'2' => 'Value for field 2'} assert_redirected_to 'issues/show' issue = Issue.find_by_subject('This is the test_new issue') assert_not_nil issue assert_equal 2, issue.author_id + assert_nil issue.estimated_hours v = issue.custom_values.find_by_custom_field_id(2) assert_not_nil v assert_equal 'Value for field 2', v.value @@ -254,10 +256,13 @@ class IssuesControllerTest < Test::Unit::TestCase issue = Issue.find(1) assert_equal 1, issue.status_id @request.session[:user_id] = 2 - post :edit, - :id => 1, - :issue => { :status_id => 2, :assigned_to_id => 3 }, - :notes => 'Assigned to dlopper' + assert_difference('TimeEntry.count', 0) do + post :edit, + :id => 1, + :issue => { :status_id => 2, :assigned_to_id => 3 }, + :notes => 'Assigned to dlopper', + :time_entry => { :hours => '', :comments => '', :activity_id => Enumeration.get_values('ACTI').first } + end assert_redirected_to 'issues/show/1' issue.reload assert_equal 2, issue.status_id @@ -288,10 +293,12 @@ class IssuesControllerTest < Test::Unit::TestCase def test_post_edit_with_note_and_spent_time @request.session[:user_id] = 2 spent_hours_before = Issue.find(1).spent_hours - post :edit, - :id => 1, - :notes => '2.5 hours added', - :time_entry => { :hours => '2.5', :comments => '', :activity_id => Enumeration.get_values('ACTI').first } + assert_difference('TimeEntry.count') do + post :edit, + :id => 1, + :notes => '2.5 hours added', + :time_entry => { :hours => '2.5', :comments => '', :activity_id => Enumeration.get_values('ACTI').first } + end assert_redirected_to 'issues/show/1' issue = Issue.find(1) diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index d291018fb..e143e6fc2 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -29,6 +29,80 @@ class QueryTest < Test::Unit::TestCase assert_equal Issue.find(3), issues.first end + def test_operator_none + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('fixed_version_id', '!*', ['']) + query.add_filter('cf_1', '!*', ['']) + assert query.statement.include?("#{Issue.table_name}.fixed_version_id IS NULL") + assert query.statement.include?("#{CustomValue.table_name}.value IS NULL OR #{CustomValue.table_name}.value = ''") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_all + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('fixed_version_id', '*', ['']) + query.add_filter('cf_1', '*', ['']) + assert query.statement.include?("#{Issue.table_name}.fixed_version_id IS NOT NULL") + assert query.statement.include?("#{CustomValue.table_name}.value IS NOT NULL AND #{CustomValue.table_name}.value <> ''") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_greater_than + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('done_ratio', '>=', ['40']) + assert query.statement.include?("#{Issue.table_name}.done_ratio >= 40") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_in_more_than + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('due_date', '>t+', ['15']) + assert query.statement.include?("#{Issue.table_name}.due_date >=") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_in_less_than + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('due_date', '<t+', ['15']) + assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_today + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('due_date', 't', ['']) + assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_this_week_on_date + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('due_date', 'w', ['']) + assert query.statement.include?("#{Issue.table_name}.due_date BETWEEN") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_this_week_on_datetime + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('created_on', 'w', ['']) + assert query.statement.include?("#{Issue.table_name}.created_on BETWEEN") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_contains + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('subject', '~', ['string']) + assert query.statement.include?("#{Issue.table_name}.subject LIKE '%string%'") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + + def test_operator_does_not_contains + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('subject', '!~', ['string']) + assert query.statement.include?("#{Issue.table_name}.subject NOT LIKE '%string%'") + issues = Issue.find :all,:include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement + end + def test_default_columns q = Query.new assert !q.columns.empty? |