diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml index 51964507cb89ff0d3b9cf3d21ce1e490cd0141fb..3e23d16cb53cb09848cec7efe4646d41a95f8314 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValue.xml @@ -90,8 +90,8 @@ if validation_state is None:\n web_page_list = portal_catalog(reference=name,\n portal_type=valid_portal_type_list,\n validation_state=validation_state,\n - language=language,\n - sort_on=[(\'version\', \'descending\')],\n + language=(language, \'\'),\n + sort_on=[(\'language\', \'descending\'), (\'version\', \'descending\')],\n group_by=(\'reference\',),\n **kw)\n \n diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml index c306d3f61ca7f6fea7ff0fb48603257c529e7d8a..8fc59004005bb80dfd0791fc417165f13409ff5b 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_zGetDocumentValueList.xml @@ -95,7 +95,8 @@ kw</string> </value> catalog.creation_date,\n catalog.title,\n CONCAT(CASE my_versioning.language\n - WHEN <dtml-sqlvar language type="string"> THEN \'3\'\n + WHEN <dtml-sqlvar language type="string"> THEN \'4\'\n + WHEN \'\' THEN \'3\'\n WHEN \'en\' THEN \'2\'\n ELSE \'1\' END,\n my_versioning.version) AS priority\n @@ -118,7 +119,7 @@ kw</string> </value> \n <dtml-if all_languages>\n <dtml-else>\n - AND my_versioning.language = <dtml-sqlvar language type="string">\n + AND my_versioning.language IN (<dtml-sqlvar language type="string">, \'\')\n </dtml-if>\n \n <dtml-if is_translation_order_by>\n diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index a76eb9d7a55f7879077b17db4c0048e2d3e96273..03c4ecbc9364bfb3480a824cafa2db3a0d236f71 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -1043 \ No newline at end of file +1044 \ No newline at end of file diff --git a/product/ERP5/tests/testERP5Web.py b/product/ERP5/tests/testERP5Web.py index ced03004134b92bb7a4c679b191c4e8c02b333c3..fbdb3c27335bed93a9ac1b0eb7441f818ee4b1e7 100644 --- a/product/ERP5/tests/testERP5Web.py +++ b/product/ERP5/tests/testERP5Web.py @@ -432,12 +432,13 @@ Hé Hé Hé!""", page.asText().strip()) '13' : dict(language = 'en' , version = "3" , reference = "D"), '14' : dict(language = 'ja' , version = "2" , reference = "E"), '15' : dict(language = 'pt' , version = "2" , reference = "F"), + '16' : dict(language = '' , version = "1" , reference = "A"), } sequence_one = property_dict.keys() sequence_two = ['01', '13', '12', '09', '06', '15' , '04', '11', '02', '05', '03', - '07', '10', '08', '14' ] + '07', '10', '08', '14', '16'] sequence_three = ['05', '12', '13', '14', '06', '09', '10', '07', '03', '01', '02', - '11', '04', '08' , '15'] + '11', '04', '08' , '15', '16'] sequence_count = 0 for sequence in [ sequence_one , sequence_two , sequence_three ]: @@ -491,6 +492,11 @@ Hé Hé Hé!""", page.asText().strip()) self.assertEqual(['ja' , 'ja', 'ja', 'ja'], [ w.getLanguage() for w in ja_document_value_list]) + bg_document_value_list = websection.getDocumentValueList(language='bg') + self.assertEqual(1, len(bg_document_value_list)) + self.assertEqual([''], + [ w.getLanguage() for w in bg_document_value_list]) + # Testing for all_versions parameter en_document_value_list = websection.getDocumentValueList(all_versions=1) self.assertEqual(5, len(en_document_value_list)) @@ -551,6 +557,22 @@ Hé Hé Hé!""", page.asText().strip()) self.assertEqual(['3'], [ w.getVersion() for w in ja_document_value_list \ if w.getLanguage() == 'en']) + bg_document_value_list = websection.WebSection_getDocumentValueListBase(all_languages=1, + language='bg') + self.assertEqual(6, len(bg_document_value_list)) + self.assertEqual(0, len([ w.getLanguage() for w in bg_document_value_list \ + if w.getLanguage() == 'bg'])) + self.assertEqual(3, len([ w.getLanguage() for w in bg_document_value_list \ + if w.getLanguage() == 'en'])) + self.assertEqual(1, len([ w.getLanguage() for w in bg_document_value_list \ + if w.getLanguage() == 'pt'])) + self.assertEqual(['3'], [ w.getVersion() for w in bg_document_value_list \ + if w.getLanguage() == 'pt']) + self.assertEqual(1, len([ w.getLanguage() for w in bg_document_value_list \ + if w.getLanguage() == 'ja'])) + self.assertEqual(['3'], [ w.getVersion() for w in bg_document_value_list \ + if w.getLanguage() == 'ja']) + # Tests for all_languages and all_versions en_document_value_list = websection.WebSection_getDocumentValueListBase(all_languages=1, all_versions=1) @@ -566,7 +588,7 @@ Hé Hé Hé!""", page.asText().strip()) for document_value_list in [ en_document_value_list, pt_document_value_list , ja_document_value_list]: - self.assertEqual(15, len(document_value_list)) + self.assertEqual(16, len(document_value_list)) self.assertEqual(5, len([ w.getLanguage() for w in document_value_list \ if w.getLanguage() == 'en'])) self.assertEqual(5, len([ w.getLanguage() for w in en_document_value_list \