From de93c819f49fbac4e98a3c59a23a34d91efcde66 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 19 Sep 2012 12:02:06 +0200 Subject: [PATCH] correct some ajax bugs caused by tpl recent updates --- htdocs/core/tpl/objectline_edit.tpl.php | 8 ++-- .../tpl/predefinedproductline_create.tpl.php | 37 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d0f838c6b5f..4b079ef78d2 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -133,7 +133,7 @@ -service->enabled && $line->product_type == 1 && $dateSelector) { ?> +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> > trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> - margin->enabled)) { ?> - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product; ?>}, function(data) { - if (data.length > 0) { + margin->enabled)) { ?> + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product?$line->fk_product:0; ?>}, function(data) { + if (data && data.length > 0) { var options = ''; var trouve=false; $(data).each(function() { diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index f0c11c07f87..e10dc184ccb 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -32,7 +32,7 @@ global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> trans("AddNewLine").' - '; - if ($conf->service->enabled) + if (! empty($conf->service->enabled)) echo $langs->trans('RecordedProductsAndServices'); else echo $langs->trans('RecordedProducts'); @@ -46,9 +46,9 @@ if (! empty($conf->margin->enabled)) { ?> trans('BuyingPrice'); ?> global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -100,9 +100,9 @@ if (! empty($conf->margin->enabled)) { "> global->DISPLAY_MARGIN_RATES) + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -115,9 +115,10 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) else $colspan = 9; if (! empty($conf->margin->enabled)) { - if($conf->global->DISPLAY_MARGIN_RATES) + $colspan++; // For the buying price + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> @@ -139,10 +140,12 @@ if (! empty($conf->margin->enabled)) { ?>