Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/commonobject.class.php
This commit is contained in:
Laurent Destailleur 2017-10-04 16:08:22 +02:00
commit ded55f41fb
3 changed files with 21 additions and 17 deletions

View File

@ -308,7 +308,7 @@ abstract class CommonObject
* @var CommonObjectLine[]
*/
public $lines;
/**
* @var mixed Contains comments
* @see fetchComments()
@ -4644,13 +4644,19 @@ abstract class CommonObject
{
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
}
// Convert date into timestamp format
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attribute_type[$key],array('price','double')))
{
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
}
$labeltoshow = $langs->trans($label);
if($extrafields->attribute_required[$key])
{
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
@ -5294,7 +5300,7 @@ abstract class CommonObject
// TODO...
}
/**
* Load comments linked with current task
* @return boolean 1 if ok
@ -5302,12 +5308,12 @@ abstract class CommonObject
public function fetchComments()
{
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
$comment = new Comment($this->db);
$this->comments = Comment::fetchAllFor($this->element, $this->id);
return 1;
}
/**
* Return nb comments already posted
*

View File

@ -804,7 +804,7 @@ class ExtraFields
* Return HTML string to put an input field into a page
*
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format)
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
@ -927,11 +927,14 @@ class ExtraFields
}
elseif ($type == 'price')
{
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';

View File

@ -2554,15 +2554,10 @@ class SupplierInvoiceLine extends CommonObjectLine
}
// Clean parameters
if (empty($this->tva_tx)) {
$this->tva_tx = 0;
}
if (empty($this->localtax1_tx)) {
$this->localtax1_tx = 0;
}
if (empty($this->localtax2_tx)) {
$this->localtax2_tx = 0;
}
if (empty($this->remise_percent)) $this->remise_percent = 0;
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
$this->db->begin();