Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/contrat/list.php htdocs/fichinter/list.php
This commit is contained in:
commit
73c7aa378e
@ -353,8 +353,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
// TODO Copy file or ask to install package ?
|
// TODO Copy file or ask to install package ?
|
||||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||||
end;
|
end;
|
||||||
|
// Pb seems similar with msvcp110.dll
|
||||||
|
//vcredist_x64.exe
|
||||||
|
|
||||||
|
|
||||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
|
|||||||
@ -313,7 +313,7 @@ if ($resql)
|
|||||||
if (empty($search_name)) $search_name = $soc->name;
|
if (empty($search_name)) $search_name = $soc->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($sall != '') $param.='&sall='.$sall;
|
if ($sall != '') $param.='&sall='.$sall;
|
||||||
|
|||||||
@ -393,6 +393,7 @@ function dol_dir_is_emtpy($folder)
|
|||||||
*
|
*
|
||||||
* @param string $file Filename
|
* @param string $file Filename
|
||||||
* @return int <0 if KO, Number of lines in files if OK
|
* @return int <0 if KO, Number of lines in files if OK
|
||||||
|
* @see dol_nboflines
|
||||||
*/
|
*/
|
||||||
function dol_count_nb_of_line($file)
|
function dol_count_nb_of_line($file)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -624,18 +624,26 @@ function dol_buildpath($path, $type=0)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a clone of instance of object (new instance with same value for properties)
|
* Create a clone of instance of object (new instance with same value for properties)
|
||||||
* Property that are reference are also new object (true clone)
|
* With native = 0: Property that are reference are also new object (true clone). This means $this->db is not valid.
|
||||||
|
* With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db is still valid.
|
||||||
*
|
*
|
||||||
* @param object $object Object to clone
|
* @param object $object Object to clone
|
||||||
|
* @param int $native Native method or true method
|
||||||
* @return object Object clone
|
* @return object Object clone
|
||||||
* @see https://php.net/manual/language.oop5.cloning.php
|
* @see https://php.net/manual/language.oop5.cloning.php
|
||||||
*/
|
*/
|
||||||
function dol_clone($object)
|
function dol_clone($object, $native=0)
|
||||||
{
|
{
|
||||||
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
|
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
|
||||||
|
|
||||||
//$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable
|
if (empty($native))
|
||||||
$myclone=unserialize(serialize($object));
|
{
|
||||||
|
$myclone=unserialize(serialize($object));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable)
|
||||||
|
}
|
||||||
|
|
||||||
return $myclone;
|
return $myclone;
|
||||||
}
|
}
|
||||||
@ -4766,22 +4774,57 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
|||||||
* Return first line of text. Cut will depends if content is HTML or not.
|
* Return first line of text. Cut will depends if content is HTML or not.
|
||||||
*
|
*
|
||||||
* @param string $text Input text
|
* @param string $text Input text
|
||||||
|
* @param int $nboflines Nb of lines to get (default is 1 = first line only)
|
||||||
* @return string Output text
|
* @return string Output text
|
||||||
* @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag
|
* @see dol_nboflines_bis, dol_string_nohtmltag, dol_escape_htmltag
|
||||||
*/
|
*/
|
||||||
function dolGetFirstLineOfText($text)
|
function dolGetFirstLineOfText($text, $nboflines=1)
|
||||||
{
|
{
|
||||||
if (dol_textishtml($text))
|
if ($nboflines == 1)
|
||||||
{
|
{
|
||||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
if (dol_textishtml($text))
|
||||||
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
{
|
||||||
|
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||||
|
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$firstline=preg_replace('/[\n\r].*/','',$text);
|
||||||
|
}
|
||||||
|
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
$ishtml=0;
|
||||||
|
if (dol_textishtml($text))
|
||||||
|
{
|
||||||
|
$text=preg_replace('/\n/','',$text);
|
||||||
|
$ishtml=1;
|
||||||
|
$repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = strtr($text, $repTable);
|
||||||
|
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||||
|
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||||
|
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
|
$firstline='';
|
||||||
|
$i=0;
|
||||||
|
$nba = count($a); // 2x nb of lines in $a because $a contains also a line for each new line separator
|
||||||
|
while (($i < $nba) && ($i < ($nboflines * 2)))
|
||||||
|
{
|
||||||
|
if ($i % 2 == 0) $firstline .= $a[$i];
|
||||||
|
elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) $firstline .= ($ishtml?"<br>\n":"\n");
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
unset($a);
|
||||||
|
return $firstline.(($i < $nba)?'...':'');
|
||||||
}
|
}
|
||||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4943,7 +4986,7 @@ function dol_nboflines($s,$maxchar=0)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return nb of lines of a formated text with \n and <br> (we can't have both \n and br)
|
* Return nb of lines of a formated text with \n and <br> (WARNING: string must not have mixed \n and br separators)
|
||||||
*
|
*
|
||||||
* @param string $text Text
|
* @param string $text Text
|
||||||
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
||||||
@ -4979,6 +5022,8 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($a);
|
||||||
return $nblines;
|
return $nblines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -249,7 +249,9 @@ $sql.= $db->plimit($limit+1, $offset);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
@ -258,8 +260,6 @@ if ($resql)
|
|||||||
if (empty($search_company)) $search_company = $soc->name;
|
if (empty($search_company)) $search_company = $soc->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|||||||
@ -122,10 +122,75 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testDolGetFirstLineOfText
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testDolGetFirstLineOfText()
|
||||||
|
{
|
||||||
|
// Nb of line is same than entry text
|
||||||
|
|
||||||
|
$input="aaaa";
|
||||||
|
$result=dolGetFirstLineOfText($input);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa", $result);
|
||||||
|
|
||||||
|
$input="aaaa\nbbbbbbbbbbbb\n";
|
||||||
|
$result=dolGetFirstLineOfText($input, 2);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa\nbbbbbbbbbbbb", $result);
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>";
|
||||||
|
$result=dolGetFirstLineOfText($input, 2);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb", $result);
|
||||||
|
|
||||||
|
// Nb of line is lower
|
||||||
|
|
||||||
|
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||||
|
$result=dolGetFirstLineOfText($input);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa...", $result);
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||||
|
$result=dolGetFirstLineOfText($input);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa...", $result);
|
||||||
|
|
||||||
|
$input="aaaa\nbbbbbbbbbbbb\ncccccc\n";
|
||||||
|
$result=dolGetFirstLineOfText($input, 2);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa\nbbbbbbbbbbbb...", $result);
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||||
|
$result=dolGetFirstLineOfText($input, 2);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb...", $result);
|
||||||
|
|
||||||
|
// Nb of line is higher
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc";
|
||||||
|
$result=dolGetFirstLineOfText($input, 100);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 a');
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>";
|
||||||
|
$result=dolGetFirstLineOfText($input, 100);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 b');
|
||||||
|
|
||||||
|
$input="aaaa<br>bbbbbbbbbbbb<br>cccccc<br>\n";
|
||||||
|
$result=dolGetFirstLineOfText($input, 100);
|
||||||
|
print __METHOD__." result=".$result."\n";
|
||||||
|
$this->assertEquals("aaaa<br>\nbbbbbbbbbbbb<br>\ncccccc", $result, 'dolGetFirstLineOfText with nb 100 c');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDolBuildPath
|
* testDolBuildPath
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDolBuildPath()
|
public function testDolBuildPath()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user