From 80a33c2e59d81bfc4cc255530b73c50d8d467eaa Mon Sep 17 00:00:00 2001 From: Campbell Date: Wed, 16 Jul 2014 21:21:43 +0200 Subject: [PATCH 1/6] Fix dbw#80 Analyst widget default = logged in user The widget displays values in this order: 1 Analyst is set on Analysis 2 Analysis is assigned to a worksheet: Worksheet's assigned analyst is displayed. 3 Currently logged in user, if "Manager" or "Analyst" roles are present 4 Empty value. --- bika/lims/browser/analyses.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bika/lims/browser/analyses.py b/bika/lims/browser/analyses.py index ab9e52332b..24f6c1e86a 100644 --- a/bika/lims/browser/analyses.py +++ b/bika/lims/browser/analyses.py @@ -597,7 +597,11 @@ def folderitems(self): # Sets the analyst assigned to this analysis if can_edit_analysis: - items[i]['Analyst'] = obj.getAnalyst() + analyst = obj.getAnalyst() + # widget default: current user + if not analyst: + analyst = mtool.getAuthenticatedMember().getUserName() + items[i]['Analyst'] = analyst item['choices']['Analyst'] = self.getAnalysts() else: items[i]['Analyst'] = obj.getAnalystName() From edcfaf8220a39804e5556d3ba48ed900f47c7b77 Mon Sep 17 00:00:00 2001 From: Campbell Date: Wed, 16 Jul 2014 23:52:45 +0200 Subject: [PATCH 2/6] reapply e4f18de (LIMS-671) --- bika/lims/browser/js/ar_add.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bika/lims/browser/js/ar_add.js b/bika/lims/browser/js/ar_add.js index 4e0f012dd1..82d377c6c9 100644 --- a/bika/lims/browser/js/ar_add.js +++ b/bika/lims/browser/js/ar_add.js @@ -1343,6 +1343,10 @@ function fill_column(data) { } } +function expand_default_categories() { + $("th.prefill").click(); +} + $(document).ready(function() { // Only if the view is the Analysis Request Add View @@ -1361,6 +1365,7 @@ $(document).ready(function() { // dateFormat = 'yy-mm-dd'; // } + ar_rename_elements(); ar_referencewidget_lookups(); ar_set_tabindexes(); @@ -1370,6 +1375,7 @@ $(document).ready(function() { $(".copyButton").live("click", copyButton ); $("th[class^='analysiscategory']").click(clickAnalysisCategory); + expand_default_categories(); $("input[name^='Price']").live("change", recalc_prices ); From f71da7e92bfb280d6e58d8f8c32eb3eccf727f1f Mon Sep 17 00:00:00 2001 From: Campbell Date: Thu, 17 Jul 2014 03:13:32 +0200 Subject: [PATCH 3/6] reapply fix for LIMS-3010 --- bika/lims/browser/analysisrequest/templates/ar_add.pt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bika/lims/browser/analysisrequest/templates/ar_add.pt b/bika/lims/browser/analysisrequest/templates/ar_add.pt index e562eba160..631b5454e4 100644 --- a/bika/lims/browser/analysisrequest/templates/ar_add.pt +++ b/bika/lims/browser/analysisrequest/templates/ar_add.pt @@ -53,7 +53,7 @@ tal:attributes="EnableARSpecs python: 'true' if bika_setup.getEnableARSpecs() else ''; bika_samplepoints_uid python: bika_setup.bika_samplepoints.UID(); bika_artemplates_uid python: bika_setup.bika_artemplates.UID(); - bika_analysisprofiles_uid python: bika_setup.bika_analysisspecs.UID(); + bika_analysisprofiles_uid python: bika_setup.bika_analysisprofiles.UID(); bika_analysisspecs_uid python: bika_setup.bika_analysisspecs.UID(); bika_analysisspecs_path python:'/'.join(bika_setup.bika_analysisspecs.getPhysicalPath())"> From da6566256c3161bc1a92604d48d1377c714979ba Mon Sep 17 00:00:00 2001 From: Campbell Date: Thu, 17 Jul 2014 03:31:07 +0200 Subject: [PATCH 4/6] fix tests --- bika/lims/tests/test_Client.robot | 3 +- bika/lims/tests/test_OptionalAttributes.robot | 110 ++---------------- bika/lims/tests/test_bika_setup.robot | 5 - 3 files changed, 10 insertions(+), 108 deletions(-) diff --git a/bika/lims/tests/test_Client.robot b/bika/lims/tests/test_Client.robot index a32900d806..5e61e38d27 100644 --- a/bika/lims/tests/test_Client.robot +++ b/bika/lims/tests/test_Client.robot @@ -10,7 +10,7 @@ Resource plone/app/robotframework/saucelabs.robot Variables plone/app/testing/interfaces.py Variables bika/lims/tests/variables.py Suite Setup Start browser -#Suite Teardown Close All Browsers +Suite Teardown Close All Browsers *** Variables *** @@ -130,7 +130,6 @@ Client contact should not be able to see or access other clients Go to ${PLONEURL}/clients/client-2 Page should contain Insufficient Privileges - *** Keywords *** Start browser diff --git a/bika/lims/tests/test_OptionalAttributes.robot b/bika/lims/tests/test_OptionalAttributes.robot index c487ad8027..02e47ee306 100644 --- a/bika/lims/tests/test_OptionalAttributes.robot +++ b/bika/lims/tests/test_OptionalAttributes.robot @@ -28,6 +28,10 @@ Create AR with hidden attributes *** Keywords *** +Start browser + Open browser ${PLONEURL}/login_form + Set selenium speed ${SELENIUM_SPEED} + Hide Attributes Log in admin secret Wait until page contains You are now logged in @@ -40,10 +44,6 @@ Hide Attributes Click Button Save Log out -Start browser - Open browser ${PLONEURL}/login_form - Set selenium speed ${SELENIUM_SPEED} - Check hidden fields on AR Add Log in test_labmanager test_labmanager Go to ${PLONEURL}/clients/client-1 @@ -66,9 +66,13 @@ Create Primary AR Wait until page contains element css=body.portaltype-client Click Link Add Wait until page contains Request new analyses + sleep 1 + Select Date ar_0_SamplingDate @{time}[2] + sleep 1 Select from dropdown ar_0_Contact Rita + sleep 1 Select from dropdown ar_0_Template Bore - Select Date ar_0_SamplingDate @{time}[2] + sleep 1 Set Selenium Timeout 30 Click Button Save Set Selenium Timeout 10 @@ -96,104 +100,8 @@ Check hidden fields on AR invoice ${ar_id} Page should not contain Invoice Exclude Check hidden fields on Sample view -http://localhost:55001/plone/clients/client-1/H2O-0001 Go to http://localhost:55001/plone/clients/client-1/H2O-0001 Page should not contain Sample Point Page should not contain Sampling Deviation Page should not contain Client SID Page should not contain Ad-Hoc - -Receive sample - Select checkbox xpath=//input[@item_title="${ar_id}"] - Click button xpath=//input[@value="Receive sample"] - Wait until page contains saved - - -Complete ar_add form Without template - @{time} = Get Time year month day hour min sec - SelectDate ar_0_SamplingDate @{time}[2] - Select From Dropdown ar_0_SampleType Water - Select from dropdown ar_0_Contact Rita - Select from dropdown ar_0_Priority High - Click Element xpath=//th[@id='cat_lab_Water Chemistry'] - Select Checkbox xpath=//input[@title='Moisture' and @name='ar.0.Analyses:list:ignore_empty:record'] - Click Element xpath=//th[@id='cat_lab_Metals'] - Select Checkbox xpath=//input[@title='Calcium' and @name='ar.0.Analyses:list:ignore_empty:record'] - Select Checkbox xpath=//input[@title='Phosphorus' and @name='ar.0.Analyses:list:ignore_empty:record'] - Click Element xpath=//th[@id='cat_lab_Microbiology'] - Select Checkbox xpath=//input[@title='Clostridia' and @name='ar.0.Analyses:list:ignore_empty:record'] - Select Checkbox xpath=//input[@title='Ecoli' and @name='ar.0.Analyses:list:ignore_empty:record'] - Select Checkbox xpath=//input[@title='Enterococcus' and @name='ar.0.Analyses:list:ignore_empty:record'] - Select Checkbox xpath=//input[@title='Salmonella' and @name='ar.0.Analyses:list:ignore_empty:record'] - Set Selenium Timeout 60 - Click Button Save - Wait until page contains created - ${ar_id} = Get text //dl[contains(@class, 'portalMessage')][2]/dd - ${ar_id} = Set Variable ${ar_id.split()[2]} - [return] ${ar_id} - -Submit results with out of range tests - [Documentation] Complete all received analysis result entry fields - ... Do some out-of-range checking, too - - ${count} = Get Matching XPath Count //input[@type='text' and @field='Result'] - ${count} = Convert to integer ${count} - :FOR ${index} IN RANGE 1 ${count+1} - \ TestResultsRange xpath=(//input[@type='text' and @field='Result'])[${index}] 5 10 - Sleep 10s - Click Element xpath=//input[@value='Submit for verification'][1] - Wait Until Page Contains Changes saved. - -Submit results - [Documentation] Complete all received analysis result entry fields - - ${count} = Get Matching XPath Count //input[@type='text' and @field='Result'] - ${count} = Convert to integer ${count} - :FOR ${index} IN RANGE 1 ${count+1} - \ Input text xpath=(//input[@type='text' and @field='Result'])[${index}] 10 - Sleep 10s - Click Element xpath=//input[@value='Submit for verification'][1] - Wait Until Page Contains Changes saved. - -Add new ${service} analysis to ${ar_id} - Go to ${PLONEURL}/clients/client-1/${ar_id}/analyses - select checkbox xpath=//input[@alt='Select ${service}'] - click element save_analyses_button_transition - wait until page contains saved. - -${ar_id} state should be ${state_id} - Go to ${PLONEURL}/clients/client-1/${ar_id} - log span.state-${state_id} warn - Page should contain element css=span.state-${state_id} - -TestResultsRange - [Arguments] ${locator}= - ... ${badResult}= - ... ${goodResult}= - - # Log Testing Result Range for ${locator} -:- values: ${badResult} and ${goodResult} WARN - - Input Text ${locator} ${badResult} - Press Key ${locator} \\9 - Expect exclamation - Input Text ${locator} ${goodResult} - Press Key ${locator} \\9 - Expect no exclamation - -Expect exclamation - sleep .5 - Page should contain Image ${PLONEURL}/++resource++bika.lims.images/exclamation.png - -Expect no exclamation - sleep .5 - Page should not contain Image ${PLONEURL}/++resource++bika.lims.images/exclamation.png - -TestSampleState - [Arguments] ${locator}= - ... ${sample}= - ... ${expectedState}= - - ${VALUE} Get Value ${locator} - Should Be Equal ${VALUE} ${expectedState} ${sample} Workflow States incorrect: Expected: ${expectedState} - - # Log Testing Sample State for ${sample}: ${expectedState} -:- ${VALUE} WARN - diff --git a/bika/lims/tests/test_bika_setup.robot b/bika/lims/tests/test_bika_setup.robot index 8d180167c7..4ad4954569 100644 --- a/bika/lims/tests/test_bika_setup.robot +++ b/bika/lims/tests/test_bika_setup.robot @@ -47,11 +47,6 @@ Repetitive Bika Setup stuff Click link Accreditation Input Text Confidence 95 Select Checkbox LaboratoryAccredited - Input Text AccreditationBodyLong Accreditation Body Name - Input Text AccreditationBody ABBREVIATION - Input Text AccreditationBodyURL http://www.body.com - Input Text Accreditation Accreditation Type - Input Text AccreditationReference Reference Click Button Save Wait Until Page Contains Changes saved. From ff24f2bf36212c50cef3609b84bb97c210b565f1 Mon Sep 17 00:00:00 2001 From: Campbell Date: Thu, 17 Jul 2014 04:20:54 +0200 Subject: [PATCH 5/6] LIMS-1271 fix currency indicator --- bika/lims/browser/invoice.py | 5 +++++ bika/lims/browser/templates/invoice_content.pt | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bika/lims/browser/invoice.py b/bika/lims/browser/invoice.py index 1834b6de0a..fca624db65 100644 --- a/bika/lims/browser/invoice.py +++ b/bika/lims/browser/invoice.py @@ -2,6 +2,7 @@ from bika.lims.interfaces import IInvoiceView from Products.CMFCore.utils import getToolByName from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile +from zope.i18n.locales import locales from zope.interface import implements @@ -38,6 +39,10 @@ def __call__(self): self.clientFax = client.getFax() self.clientEmail = client.getEmailAddress() self.clientAccountNumber = client.getAccountNumber() + # currency info + locale = locales.getLocale('en') + self.currency = self.context.bika_setup.getCurrency() + self.symbol = locale.numbers.currencies[self.currency].symbol # Get an available client address in a preferred order self.clientAddress = None addresses = ( diff --git a/bika/lims/browser/templates/invoice_content.pt b/bika/lims/browser/templates/invoice_content.pt index 95ff445ae3..833ac3593e 100644 --- a/bika/lims/browser/templates/invoice_content.pt +++ b/bika/lims/browser/templates/invoice_content.pt @@ -65,15 +65,15 @@ - R + R 0.00 - R + R 0.00 - R + R 0.00 @@ -82,15 +82,15 @@ Total - R + R - R + R - R + R From 34eacf06227d1ccb9324753d25e60fb7f9e16e58 Mon Sep 17 00:00:00 2001 From: Campbell Date: Thu, 17 Jul 2014 04:34:38 +0200 Subject: [PATCH 6/6] Release 3.1.3 --- CHANGELOG.txt | 10 ++++++++++ bika/lims/profiles/default/structure/front-page | 4 ++-- setup.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 13c230ea06..977c269eaa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,13 @@ +3.1.3 (2014-07-17) +------------------ + +Missing fixes from 3.1.2 + +LIMS-671: Preferred/Restricted client categories +LIMS-1251: Supply order permission error +LIMS-1272: Currency in Price Lists +LIMS-1310: Broken AnalysisProfile selector in AR Add form. + 3.1.2 (2014-07-15) ------------------ diff --git a/bika/lims/profiles/default/structure/front-page b/bika/lims/profiles/default/structure/front-page index cd5c06aeb6..f6e02ebfd8 100644 --- a/bika/lims/profiles/default/structure/front-page +++ b/bika/lims/profiles/default/structure/front-page @@ -1,6 +1,6 @@ id: front-page title: Welcome to Gaob Bika LIMS 3 -description: This is version 3.1.2 +description: This is version 3.1.3 subject: relatedItems: location: @@ -8,7 +8,7 @@ language: effectiveDate: 2011/01/01 expirationDate: None creation_date: 2011/01/01 -modification_date: 2014/07/14 +modification_date: 2014/07/17 creators: admin contributors: rights: diff --git a/setup.py b/setup.py index 5d2316bfc2..ae16746684 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = '3.1.2' +version = '3.1.3' setup(name='bika.lims', version=version,