From 9de372d4b1e18fa66902eed1b72b38fce78ce573 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Sun, 2 Mar 2014 17:33:51 +0100 Subject: [PATCH 1/5] debug planned_workload loosing value on error --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 794a1198c35..b423abe25c4 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -314,7 +314,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie // planned workload print ''.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); + print $form->select_duration('planned_workload', $planned_workload?$planned_workload : $object->planned_workload,0,'text'); print ''; // Progress From d139009ef5ee410e4ca3e69e037127d550ed14e1 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 5 Mar 2014 15:29:28 +0100 Subject: [PATCH 2/5] bug on update service with service created in 3.4 --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e1fb258f11e..ac9381fbd9b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -338,7 +338,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished); + $sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int)$this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); @@ -474,7 +474,7 @@ class Product extends CommonObject $sql.= ", tosell = " . $this->status; $sql.= ", tobuy = " . $this->status_buy; - $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished); + $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int)$this->finished); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); From 06b2c646c3ef83b4d37c34dad1a8fdb5941befda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Mar 2014 18:31:02 +0100 Subject: [PATCH 3/5] Fix: Add a space after (int) for travis succes ;) --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ac9381fbd9b..a8d5c29efb0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -338,7 +338,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int)$this->finished); + $sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); @@ -474,7 +474,7 @@ class Product extends CommonObject $sql.= ", tosell = " . $this->status; $sql.= ", tobuy = " . $this->status_buy; - $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int)$this->finished); + $sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : (int) $this->finished); $sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); $sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ", length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); From 0a2a6357552b8cacb8a37a5781f25ed6a524f3d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Mar 2014 11:58:30 +0100 Subject: [PATCH 4/5] Fix: td balance. Fix: New price was not used when editing a line when margin module was on. --- htdocs/core/tpl/objectline_edit.tpl.php | 40 +++++++++++++++---------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 58ce0e6481f..d48abbc0aa1 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -30,14 +30,10 @@ global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay=2; -} else { - $coldisplay=0; -} - ?> +$coldisplay=-1; // We remove first td +?> > - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>global->MAIN_VIEW_LINE_NUMBER))?2:1; ?>
@@ -138,28 +134,29 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { - $margin_rate = (isset($_POST["marginRate"])?$_POST["marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx))); + $margin_rate = (isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx))); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$margin_rate.'%'; else - echo '%'; + echo '%'; $coldisplay++; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { - $mark_rate = (isset($_POST["markRate"])?$_POST["markRate"]:price($line->marque_tx)); + $mark_rate = (isset($_POST["np_markRate"])?$_POST["np_markRate"]:price($line->marque_tx)); // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$mark_rate.'%'; else - echo '%'; + echo '%'; $coldisplay++; } } } ?> - + + ">
"> @@ -383,6 +380,17 @@ if (! empty($conf->margin->enabled)) ?> jQuery(document).ready(function() { + /* Add rule to clear margin when we change price_ht or buying_price, so when we change sell or buy price, margin will be recalculated after submitting form */ + jQuery("#price_ht").keyup(function() { + jQuery("input[name='np_marginRate']:first").val(''); + jQuery("input[name='np_markRate']:first").val(''); + }); + jQuery("#buying_price").keyup(function() { + jQuery("input[name='np_marginRate']:first").val(''); + jQuery("input[name='np_markRate']:first").val(''); + }); + + /* Init field buying_price and fournprice */ $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product?$line->fk_product:0; ?>}, function(data) { if (data && data.length > 0) { var options = ''; @@ -419,6 +427,7 @@ if (! empty($conf->margin->enabled)) } }, 'json'); + /* Add rules to reset price_ht from margin info */ global->DISPLAY_MARGIN_RATES)) { @@ -446,15 +455,16 @@ if (! empty($conf->margin->enabled)) }); - // TODO This works for french numbers only + /* If margin rate field empty, do nothing. */ + /* Force content of price_ht to 0 or if a discount is set recalculate it from margin rate */ function checkEditLine(e, npRate) { var buying_price = $("input[name='buying_price']:first"); var remise = $("input[name='remise_percent']:first"); var rate = $("input[name='"+npRate+"']:first"); - if (rate.val() == '') - return true; + if (rate.val() == '') return true; + if (! $.isNumeric(rate.val().replace(',','.'))) { alert('trans("rateMustBeNumeric"); ?>'); From a6bb785b5fb34cdc08d137fb085bebb86b710673 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Mar 2014 14:06:01 +0100 Subject: [PATCH 5/5] Fix: Compatibility with v4 of ckeditor (for debian) --- htdocs/core/class/doleditor.class.php | 3 ++- htdocs/main.inc.php | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 9256e08318c..d79999ccdcb 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -169,7 +169,8 @@ class DolEditor //$skin='office2003'; //$skin='v2'; $skin='kama'; - + if (constant('JS_CKEDITOR')) $skin='moono'; // To use external ckeditor 4 js lib + if ($this->toolbarname=='dolibarr_mailings') {$htmlencode_force='true';} else {$htmlencode_force='false';} diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f51cf7b6bd3..6427cf25fd5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1051,14 +1051,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { print ''."\n"; $pathckeditor=DOL_URL_ROOT.'/includes/ckeditor/'; - if (constant('JS_CKEDITOR')) $pathckeditor=JS_CKEDITOR; // To use external ckeditor js lib + $jsckeditor='ckeditor_basic.js'; + if (constant('JS_CKEDITOR')) // To use external ckeditor 4 js lib + { + $pathckeditor=constant('JS_CKEDITOR'); + $jsckeditor='ckeditor.js'; + } print ''."\n"; - print ''."\n"; + print ''."\n"; } // jQuery Timepicker if (! empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER'))