// Update Accounting, handle errors for Date and fix bug when default_account_number isn't set at all
This commit is contained in:
@@ -35,14 +35,17 @@
|
|||||||
<label for="clientPrefix">{l s='Client prefix:'}</label>
|
<label for="clientPrefix">{l s='Client prefix:'}</label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
<input type="text" value="{$clientPrefix}" name="clientPrefix" />
|
<input type="text" value="{$clientPrefix}" name="clientPrefix" />
|
||||||
|
<span class="input-error"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label for="beginDate">{l s='Begin to:'}</label>
|
<label for="beginDate">{l s='Begin to:'}</label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
<input class="datepicker" id="beginDate_{$type}" type="text" name="beginDate" value="{$begin_date}" />
|
<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>
|
</div>
|
||||||
|
|
||||||
<label for="endDate">{l s='End to:'}</label>
|
<label for="endDate">{l s='End to:'}</label>
|
||||||
<div class="margin-form">
|
<div class="margin-form">
|
||||||
<input class="datepicker" id="endDate_{$type}" type="text" name="endDate" value="{$end_date}" />
|
<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>
|
</div>
|
||||||
|
|||||||
@@ -25,12 +25,42 @@
|
|||||||
*}
|
*}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<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() {
|
$(document).ready(function() {
|
||||||
$('#export_menu').find('a').each(function() {
|
$('#export_menu').find('a').each(function() {
|
||||||
$(this).click(function() {
|
$(this).click(function() {
|
||||||
blockID = 'block_' + $(this).attr('id');
|
blockID = 'block_' + $(this).attr('id');
|
||||||
if (!$('#' + blockID).is(':visible'))
|
if (!$('#' + blockID).is(':visible'))
|
||||||
{
|
{
|
||||||
|
|
||||||
$('.formAccountingExport:visible').each(function() {
|
$('.formAccountingExport:visible').each(function() {
|
||||||
$(this).fadeOut('fast', function() {
|
$(this).fadeOut('fast', function() {
|
||||||
$('#' + blockID).fadeIn('fast');
|
$('#' + blockID).fadeIn('fast');
|
||||||
@@ -39,9 +69,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#' + '{$defaultType}').fadeIn('fast');
|
$('#' + '{$defaultType}').fadeIn('fast');
|
||||||
|
|
||||||
$('.datepicker').each(function() {
|
$('.datepicker').each(function() {
|
||||||
|
$(this).change(function() {
|
||||||
|
validateInputDate($(this), true);
|
||||||
|
});
|
||||||
$(this).datepicker({
|
$(this).datepicker({
|
||||||
prevText: '',
|
prevText: '',
|
||||||
nextText: '',
|
nextText: '',
|
||||||
@@ -52,7 +86,7 @@
|
|||||||
$('.formAccountingExport form input[type="submit"]').each(function()
|
$('.formAccountingExport form input[type="submit"]').each(function()
|
||||||
{
|
{
|
||||||
$(this).click(function() {
|
$(this).click(function() {
|
||||||
// TODO : Handle errors
|
return validateAccountingForm();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -308,6 +308,8 @@ class AdminAccountingExportControllerCore extends AdminController
|
|||||||
case 1:
|
case 1:
|
||||||
$line[2] = !empty($row['account']) ? $row['account'] :
|
$line[2] = !empty($row['account']) ? $row['account'] :
|
||||||
Configuration::get('default_account_number', NULL, NULL, $row['id_shop']);
|
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'];
|
$line[5] = $row['product_price_ht'];
|
||||||
break;
|
break;
|
||||||
case 2:
|
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`
|
WHEN (acc_zs.`account_number` != "" AND acc_zs.`account_number` IS NOT NULL) THEN acc_zs.`account_number`
|
||||||
ELSE ""
|
ELSE ""
|
||||||
END AS account,
|
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`,
|
o.`total_paid_real`,
|
||||||
od.`product_price` AS product_price_ht,
|
od.`product_price` AS product_price_ht,
|
||||||
pcc.`transaction_id`,
|
pcc.`transaction_id`,
|
||||||
|
|||||||
@@ -1810,3 +1810,14 @@ ul.connectedSortable li.module_list {
|
|||||||
.formAccountingExport {
|
.formAccountingExport {
|
||||||
display: none;
|
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