// 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -308,6 +308,8 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
case 1:
|
||||
$line[2] = !empty($row['account']) ? $row['account'] :
|
||||
Configuration::get('default_account_number', NULL, NULL, $row['id_shop']);
|
||||
// Force an empty string if Configuration send false
|
||||
$line[2] = empty($line[2]) ? '' : $linep[2];
|
||||
$line[5] = $row['product_price_ht'];
|
||||
break;
|
||||
case 2:
|
||||
@@ -379,7 +381,7 @@ class AdminAccountingExportControllerCore extends AdminController
|
||||
WHEN (acc_zs.`account_number` != "" AND acc_zs.`account_number` IS NOT NULL) THEN acc_zs.`account_number`
|
||||
ELSE ""
|
||||
END AS account,
|
||||
CONCAT(\''.Configuration::get('PS_INVOICE_PREFIX').'\', LPAD(o.`invoice_number`, 6, 0)) AS invoice_number,
|
||||
CONCAT(\''.Configuration::get('PS_INVOICE_PREFIX').'\', LPAD(o.`invoice_number`, 6, "0")) AS invoice_number,
|
||||
o.`total_paid_real`,
|
||||
od.`product_price` AS product_price_ht,
|
||||
pcc.`transaction_id`,
|
||||
|
||||
@@ -1810,3 +1810,14 @@ ul.connectedSortable li.module_list {
|
||||
.formAccountingExport {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.input-error
|
||||
{
|
||||
color:#D8000C;
|
||||
font-size:12px;
|
||||
font-weight:normal;
|
||||
margin: 0 0 10px 0;
|
||||
line-height: 20px;
|
||||
padding: 10px 15px;
|
||||
display:none;
|
||||
}
|
||||
Reference in New Issue
Block a user