// Update Accounting, handle errors for Date and fix bug when default_account_number isn't set at all
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10264 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -35,14 +35,17 @@
|
||||
<label for="clientPrefix">{l s='Client prefix:'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" value="{$clientPrefix}" name="clientPrefix" />
|
||||
<span class="input-error"></span>
|
||||
</div>
|
||||
|
||||
<label for="beginDate">{l s='Begin to:'}</label>
|
||||
<div class="margin-form">
|
||||
<input class="datepicker" id="beginDate_{$type}" type="text" name="beginDate" value="{$begin_date}" />
|
||||
<span class="input-error">{l s="The date has not the right format"}</span>
|
||||
</div>
|
||||
|
||||
<label for="endDate">{l s='End to:'}</label>
|
||||
<div class="margin-form">
|
||||
<input class="datepicker" id="endDate_{$type}" type="text" name="endDate" value="{$end_date}" />
|
||||
<span class="input-error">{l s="The date has not the right format"}</span>
|
||||
</div>
|
||||
|
||||
@@ -25,12 +25,42 @@
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function validateInputDate(input, displayError)
|
||||
{
|
||||
{literal}
|
||||
dateRegex = /^\d{4}-\d{1,2}-\d{1,2}$/
|
||||
{/literal}
|
||||
|
||||
if (!input.val().match(dateRegex))
|
||||
{
|
||||
input.parent().find('span.input-error').fadeIn('fast');
|
||||
return false;
|
||||
}
|
||||
input.parent().find('span.input-error').css('display','none');
|
||||
return true;
|
||||
}
|
||||
|
||||
function validateAccountingForm()
|
||||
{
|
||||
validation = true;
|
||||
|
||||
$('span.input-error').css('display', 'none');
|
||||
$('.datepicker:visible').each(function() {
|
||||
if (!(validateInputDate($(this), true)))
|
||||
validation = false;
|
||||
});
|
||||
|
||||
return validation;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#export_menu').find('a').each(function() {
|
||||
$(this).click(function() {
|
||||
blockID = 'block_' + $(this).attr('id');
|
||||
if (!$('#' + blockID).is(':visible'))
|
||||
{
|
||||
|
||||
$('.formAccountingExport:visible').each(function() {
|
||||
$(this).fadeOut('fast', function() {
|
||||
$('#' + blockID).fadeIn('fast');
|
||||
@@ -39,9 +69,13 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#' + '{$defaultType}').fadeIn('fast');
|
||||
|
||||
$('.datepicker').each(function() {
|
||||
$(this).change(function() {
|
||||
validateInputDate($(this), true);
|
||||
});
|
||||
$(this).datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
@@ -52,7 +86,7 @@
|
||||
$('.formAccountingExport form input[type="submit"]').each(function()
|
||||
{
|
||||
$(this).click(function() {
|
||||
// TODO : Handle errors
|
||||
return validateAccountingForm();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user