"Thru" is not an English word. The correct spelling is "Through".

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 6/1/2014 5:34 AM, jler...@apache.org wrote:
Author: jleroux
Date: Sun Jun  1 12:34:24 2014
New Revision: 1598977

URL: http://svn.apache.org/r1598977
Log:
A modified patch from Ankit Jain for "We should check that the thru date is not same 
or older than the from date" https://issues.apache.org/jira/browse/OFBIZ-3161

jleroux:
I reused Ankit's patch as a basis for this commit
I added an i18n label
Added a way to use alert() in showErrorAlertLoadUiLabel for generalising when 
no contentarea is present
Replaced $ call by jQuery
Used the <<name*='fromDate'>> and <<name*='thruDate'>> filters to get all cases 
(228 thruDate cases)
Still used only an alert, so it's only a warning, nothing coercive

There are other date couples like (estimatedStartDate, estimatedCompletionDate) 
and (actualStartDate, actualCompletionDate) but their values should not be 
enforced.
If ever someone wants to not let them free, then she just has to add the 
couples in FromThruDateCheck.js




Added:
     ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js   
(with props)
Modified:
     ofbiz/trunk/framework/common/config/CommonUiLabels.xml
     ofbiz/trunk/framework/common/widget/CommonScreens.xml
     ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1598977&r1=1598976&r2=1598977&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Sun Jun  1 12:34:24 
2014
@@ -4457,6 +4457,10 @@
          <value xml:lang="zh-CN">起始日期 / 终止日期</value>
          <value xml:lang="zh-TW">開始日/結束日</value>
      </property>
+    <property key="CommonFromDateThruDateCheck">
+        <value xml:lang="en">Thru date can't be same or smaller than from 
date</value>
+        <value xml:lang="fr">La date de fin ne peut être égale ou plus récente 
que la date de début</value>
+    </property>
      <property key="CommonFromDateTime">
          <value xml:lang="ar">تاريخ  و وقت البدء</value>
          <value xml:lang="cs">Od data a času</value>

Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1598977&r1=1598976&r2=1598977&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Jun  1 12:34:24 
2014
@@ -162,6 +162,7 @@ under the License.
                  <set field="layoutSettings.javaScripts[]" 
value="/images/miscAjaxFunctions.js" global="true" />
                  <set field="layoutSettings.javaScripts[]" 
value="/images/selectMultipleRelatedValues.js" global="true" />
                  <set field="layoutSettings.javaScripts[]" value="/images/util.js" 
global="true" />
+                <set field="layoutSettings.javaScripts[]" 
value="/images/date/FromThruDateCheck.js" global="true"/>
                  <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" 
global="true" />
                  <service service-name="getVisualThemeResources">
                      <field-map field-name="visualThemeId" />

Added: ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js?rev=1598977&view=auto
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js (added)
+++ ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js Sun 
Jun  1 12:34:24 2014
@@ -0,0 +1,17 @@
+//this code needs modifications yet its specific.
+
+jQuery(document).ready( function() {
+  jQuery("input[name*='fromDate']").bind('focusout', checkDate);
+  jQuery("input[name*='thruDate']").bind('focusout', checkDate);
+});
+
+function checkDate() {
+  var a = jQuery("input[name*='fromDate']");
+  var b = jQuery("input[name*='thruDate']");
+
+  if(a.val() !="" && b.val() !="") {
+    if (a.val() >= b.val()) {
+      showErrorAlertLoadUiLabel("", "", "CommonUiLabels", 
"CommonFromDateThruDateCheck")
+    }
+  }
+}

Propchange: ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js
------------------------------------------------------------------------------
     svn:eol-style = native

Propchange: ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js
------------------------------------------------------------------------------
     svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/framework/images/webapp/images/date/FromThruDateCheck.js
------------------------------------------------------------------------------
     svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1598977&r1=1598976&r2=1598977&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Sun Jun  1 12:34:24 
2014
@@ -915,6 +915,8 @@ function showErrorAlertLoadUiLabel(errBo
                  }
              }
          });
+    } else {
+      alert(labels[uiResource][0]);
      }
  }

@@ -985,4 +987,4 @@ function submitPagination(obj, url) {
              return true;
          }
      }
-}
\ No newline at end of file
+}


Reply via email to