2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Florian HENRY
2014-05-09 13:28:45 +02:00
12 changed files with 168 additions and 49 deletions

View File

@@ -14,7 +14,7 @@ Fix: Pb of records not correctly cleaned when module marge is
Fix: [ bug #1341 ] Lastname not added by file or direct input in mass e-mailing. Fix: [ bug #1341 ] Lastname not added by file or direct input in mass e-mailing.
Fix: [ bug #1357 ] Invoice creator state not printed in generated invoice documents. Fix: [ bug #1357 ] Invoice creator state not printed in generated invoice documents.
Fix: Suppliers invoice mask fails using {tttt} in numbering. Fix: Suppliers invoice mask fails using {tttt} in numbering.
Fix: pdf template name for typhon was not correctly et when enabling module. Fix: [ bug #1350 ] pdf template name for typhon was not correctly set when enabling module.
Fix: Navigation on notes for shipments was not working. Fix: Navigation on notes for shipments was not working.
Fix: [ bug #1353 ] Email notifications, wrong URL. Fix: [ bug #1353 ] Email notifications, wrong URL.
Fix: [ bug #1362 ] Note is not saved. Fix: [ bug #1362 ] Note is not saved.

View File

@@ -69,8 +69,6 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
// Description long of product line // Description long of product line
if ($desc && ($desc != $label)) if ($desc && ($desc != $label))
{ {
if ( $libelleproduitservice && empty($hidedesc) ) $libelleproduitservice.="\n";
if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except) if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
{ {
$discount=new DiscountAbsolute($db); $discount=new DiscountAbsolute($db);
@@ -83,18 +81,17 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
$discount->fetch($line->fk_remise_except); $discount->fetch($line->fk_remise_except);
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source); $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source);
// Add date of deposit // Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.=' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
} }
else else
{ {
if ($idprod) if ($idprod)
{ {
if (empty($hidedesc)) if (empty($hidedesc)) $libelleproduitservice=dol_concatdesc($libelleproduitservice, $desc);
$libelleproduitservice.=$desc;
} }
else else
{ {
$libelleproduitservice.=$desc; $libelleproduitservice=dol_concatdesc($libelleproduitservice, $desc);
} }
} }
} }
@@ -148,7 +145,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
$period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($line->date_end, $format, false, $outputlangs)).')'; $period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($line->date_end, $format, false, $outputlangs)).')';
} }
//print '>'.$outputlangs->charset_output.','.$period; //print '>'.$outputlangs->charset_output.','.$period;
$libelleproduitservice.="\n".$period; $libelleproduitservice=dol_concatdesc($libelleproduitservice, $period);
//print $libelleproduitservice; //print $libelleproduitservice;
} }

View File

@@ -3414,13 +3414,13 @@ function picto_required()
* Clean a string from all HTML tags and entities * Clean a string from all HTML tags and entities
* *
* @param string $StringHtml String to clean * @param string $StringHtml String to clean
* @param string $removelinefeed Replace also all lines feeds by a space * @param string $removelinefeed Replace also all lines feeds by a space, otherwise only last one are removed
* @param string $pagecodeto Encoding of input/output string * @param string $pagecodeto Encoding of input/output string
* @return string String cleaned * @return string String cleaned
*/ */
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8') function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
{ {
$pattern = "/<[^>]+>/"; $pattern = "/<[^<>]+>/";
$temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto); $temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto);
$temp = preg_replace($pattern,"",$temp); $temp = preg_replace($pattern,"",$temp);
@@ -3486,7 +3486,6 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
$newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__')); $newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__'));
$newstring=dol_htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding $newstring=dol_htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding
$newstring=strtr($newstring,array('__and__'=>'&','__lt__'=>'<','__gt__'=>'>','__dquot__'=>'"')); $newstring=strtr($newstring,array('__and__'=>'&','__lt__'=>'<','__gt__'=>'>','__dquot__'=>'"'));
//$newstring=strtr($newstring,array('__li__'=>"<li>\n")); // Restore <li>\n
} }
else else
{ {
@@ -3530,7 +3529,7 @@ function dol_htmlcleanlastbr($stringtodecode)
* Replace html_entity_decode functions to manage errors * Replace html_entity_decode functions to manage errors
* *
* @param string $a Operand a * @param string $a Operand a
* @param string $b Operand b * @param string $b Operand b (ENT_QUOTES=convert simple and double quotes)
* @param string $c Operand c * @param string $c Operand c
* @return string String decoded * @return string String decoded
*/ */
@@ -3670,17 +3669,10 @@ function dol_textishtml($msg,$option=0)
{ {
if (preg_match('/<html/i',$msg)) return true; if (preg_match('/<html/i',$msg)) return true;
elseif (preg_match('/<body/i',$msg)) return true; elseif (preg_match('/<body/i',$msg)) return true;
elseif (preg_match('/<b>/i',$msg)) return true; elseif (preg_match('/<(b|em|i)>/i',$msg)) return true;
elseif (preg_match('/<br/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true;
elseif (preg_match('/<div/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true;
elseif (preg_match('/<em>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true;
elseif (preg_match('/<font/i',$msg)) return true;
elseif (preg_match('/<img/i',$msg)) return true;
elseif (preg_match('/<i>/i',$msg)) return true;
elseif (preg_match('/<li/i',$msg)) return true;
elseif (preg_match('/<span/i',$msg)) return true;
elseif (preg_match('/<strong/i',$msg)) return true;
elseif (preg_match('/<table/i',$msg)) return true;
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
return false; return false;
@@ -3688,7 +3680,7 @@ function dol_textishtml($msg,$option=0)
} }
/** /**
* Concat 2 descriptions (second one after first one) * Concat 2 descriptions (second one after first one with a new line separator if required)
* text1 html + text2 html => text1 + '<br>' + text2 * text1 html + text2 html => text1 + '<br>' + text2
* text1 html + text2 txt => text1 + '<br>' + dol_nl2br(text2) * text1 html + text2 txt => text1 + '<br>' + dol_nl2br(text2)
* text1 txt + text2 html => dol_nl2br(text1) + '<br>' + text2 * text1 txt + text2 html => dol_nl2br(text1) + '<br>' + text2

View File

@@ -102,7 +102,7 @@ class modExpedition extends DolibarrModules
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment";
$this->const[$r][3] = ""; $this->const[$r][3] = "";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "LIVRAISON_ADDON_PDF"; $this->const[$r][0] = "LIVRAISON_ADDON_PDF";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";

View File

@@ -136,9 +136,15 @@ class Segment implements IteratorAggregate, Countable
if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) { if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) {
throw new SegmentException("var $key not found in {$this->getName()}"); throw new SegmentException("var $key not found in {$this->getName()}");
} }
$value=$this->odf->htmlToUTFAndPreOdf($value);
$value = $encode ? htmlspecialchars($value) : $value; $value = $encode ? htmlspecialchars($value) : $value;
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value; $value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
$this->vars[$this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')] = str_replace("\n", "<text:line-break/>", $value);
$value=$this->odf->preOdfToOdf($value);
$this->vars[$this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')] = $value;
return $this; return $this;
} }
/** /**

View File

@@ -122,12 +122,68 @@ class Odf
throw new OdfException("var $key not found in the document"); throw new OdfException("var $key not found in the document");
//} //}
} }
$value=$this->htmlToUTFAndPreOdf($value);
$value = $encode ? htmlspecialchars($value) : $value; $value = $encode ? htmlspecialchars($value) : $value;
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value; $value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
$this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
$value=$this->preOdfToOdf($value);
$this->vars[$tag] = $value;
return $this; return $this;
} }
/**
* Function to convert a HTML string into an ODT string
*
* @param string $value String to convert
*/
public function htmlToUTFAndPreOdf($value)
{
// We decode into utf8, entities
$value=dol_html_entity_decode($value, ENT_QUOTES);
// We convert html tags
$ishtml=dol_textishtml($value);
if ($ishtml)
{
// If string is "MYPODUCT - Desc <strong>bold</strong> with &eacute; accent<br />\n<br />\nUn texto en espa&ntilde;ol ?"
// Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en espa&ntilde;ol ?"
// We want to ignore \n and we want all <br> to be \n
$value=preg_replace('/(\r\n|\r|\n)/i','',$value);
$value=preg_replace('/<br>/i',"\n",$value);
$value=preg_replace('/<br\s+[^<>\/]*>/i',"\n",$value);
$value=preg_replace('/<br\s+[^<>\/]*\/>/i',"\n",$value);
//$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value);
//$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value);
$value=dol_string_nohtmltag($value, 0);
}
return $value;
}
/**
* Function to convert a HTML string into an ODT string
*
* @param string $value String to convert
*/
public function preOdfToOdf($value)
{
$value = str_replace("\n", "<text:line-break/>", $value);
//$value = str_replace("__lt__", "<", $value);
//$value = str_replace("__gt__", ">", $value);
//$value = str_replace("__quot__", '"', $value);
return $value;
}
/** /**
* Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code * Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
* *
@@ -422,25 +478,25 @@ IMG;
public function exportAsAttachedPDF($name="") public function exportAsAttachedPDF($name="")
{ {
global $conf; global $conf;
if( $name == "" ) $name = md5(uniqid()); if( $name == "" ) $name = md5(uniqid());
dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG);
$this->saveToDisk($name); $this->saveToDisk($name);
$execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 $execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2
$name=str_replace('.odt', '', $name); $name=str_replace('.odt', '', $name);
if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) { if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) {
$command = $conf->global->MAIN_DOL_SCRIPTS_ROOT.'/scripts/odt2pdf/odt2pdf.sh '.$name; $command = $conf->global->MAIN_DOL_SCRIPTS_ROOT.'/scripts/odt2pdf/odt2pdf.sh '.$name;
}else { }else {
$command = '../../scripts/odt2pdf/odt2pdf.sh '.$name; $command = '../../scripts/odt2pdf/odt2pdf.sh '.$name;
} }
//$dirname=dirname($name); //$dirname=dirname($name);
//$command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name.' '.$dirname; //$command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name.' '.$dirname;
dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command,LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command,LOG_DEBUG);
if ($execmethod == 1) if ($execmethod == 1)
{ {
@@ -482,7 +538,7 @@ IMG;
} else { } else {
dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr,true), LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr,true), LOG_DEBUG);
if ($retval==126) { if ($retval==126) {
throw new OdfException('Permission execute convert script : ' . $command); throw new OdfException('Permission execute convert script : ' . $command);
} }

View File

@@ -514,16 +514,16 @@ else
// Shipment // Shipment
if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0) if (($delivery->origin == 'shipment' || $delivery->origin == 'expedition') && $delivery->origin_id > 0)
{ {
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/liste.php">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>'; print '<tr><td width="20%">'.$langs->trans("RefSending").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
// Nav is hidden because on a delivery receipt of a shipment, if we go on next shipment, we may find no tab (a shipment may not have delivery receipt yet) // Nav is hidden because on a delivery receipt of a shipment, if we go on next shipment, we may find no tab (a shipment may not have delivery receipt yet)
//print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref'); //print $form->showrefnav($expedition, 'refshipment', $linkback, 1, 'ref', 'ref');
print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref'); print $form->showrefnav($expedition, 'refshipment', $linkback, 0, 'ref', 'ref');
print '</td></tr>'; print '</td></tr>';
} }
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';

View File

@@ -536,7 +536,7 @@ else
print '<td><input size="30" name="title" value="'.$object->title.'"></td></tr>'; print '<td><input size="30" name="title" value="'.$object->title.'"></td></tr>';
// Customer // Customer
print '<tr><td>'.$langs->trans("Thirdparty").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$text=$form->select_company($object->societe->id,'socid','',1,1); $text=$form->select_company($object->societe->id,'socid','',1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
@@ -607,7 +607,7 @@ else
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Third party // Third party
print '<tr><td>'.$langs->trans("Thirdparty").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($object->societe->id > 0) print $object->societe->getNomUrl(1); if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
else print'&nbsp;'; else print'&nbsp;';
print '</td></tr>'; print '</td></tr>';

View File

@@ -226,7 +226,7 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
$allmessage.= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n"); $allmessage.= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml?"<br>\n":"\n");
} }
$allmessage.= $message.($usehtml?"<br>\n":"\n"); $allmessage.= $message.($usehtml?"<br>\n":"\n");
$allmessage.= $langs->trans("Total")." = ".price($total,0,0,-1,$conf->currency).($usehtml?"<br>\n":"\n"); $allmessage.= $langs->trans("Total")." = ".price($total,0,$newlangs,0,0,-1,$conf->currency).($usehtml?"<br>\n":"\n");
if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) if (! empty($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER))
{ {
$allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER; $allmessage.=$conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER;

View File

@@ -36,7 +36,10 @@ if ($langs->defaultlang != 'en_US')
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit; exit;
} }
if (! empty($conf->google->enabled))
{
print "Warning: Google module should not be enabled.\n";
}
if (empty($user->id)) if (empty($user->id))
{ {
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";

View File

@@ -76,7 +76,10 @@ class FactureTest extends PHPUnit_Framework_TestCase
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! empty($conf->ecotaxdeee->enabled)) { print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n"; print __METHOD__."\n";
} }

View File

@@ -168,20 +168,35 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$input='xxx <b>yyy</b> zzz'; $input='xxx <b>yyy</b> zzz';
$after=dol_textishtml($input); $after=dol_textishtml($input);
$this->assertTrue($after); $this->assertTrue($after);
$input='xxx<br>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='text with <div>some div</div>'; $input='text with <div>some div</div>';
$after=dol_textishtml($input); $after=dol_textishtml($input);
$this->assertTrue($after); $this->assertTrue($after);
$input='text with HTML &nbsp; entities'; $input='text with HTML &nbsp; entities';
$after=dol_textishtml($input); $after=dol_textishtml($input);
$this->assertTrue($after); $this->assertTrue($after);
$input='xxx<br>';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='xxx<br >';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='xxx<br style="eee">';
$after=dol_textishtml($input);
$this->assertTrue($after);
$input='xxx<br style="eee" >';
$after=dol_textishtml($input);
$this->assertTrue($after);
// False // False
$input='xxx < br>'; $input='xxx < br>';
$after=dol_textishtml($input); $after=dol_textishtml($input);
$this->assertFalse($after); $this->assertFalse($after);
$input='xxx <email@email.com>'; // <em> is html, <em... is not
$after=dol_textishtml($input);
$this->assertFalse($after);
$input='xxx <brstyle="ee">';
$after=dol_textishtml($input);
$this->assertFalse($after);
} }
@@ -208,6 +223,53 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
return true; return true;
} }
/**
* testDolConcat
*
* @return boolean
*/
public function testDolConcat()
{
$text1="A string 1"; $text2="A string 2"; // text 1 and 2 are text, concat need only \n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A string 1\nA string 2",$after);
$text1="A<br>string 1"; $text2="A string 2"; // text 1 is html, concat need <br>\n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A<br>string 1<br>\nA string 2",$after);
$text1="A string 1"; $text2="A <b>string</b> 2"; // text 2 is html, concat need <br>\n
$after=dol_concatdesc($text1, $text2);
$this->assertEquals("A string 1<br>\nA <b>string</b> 2",$after);
return true;
}
/**
* testDolStringNohtmltag
*
* @return boolean
*/
public function testDolStringNohtmltag()
{
$text="A\nstring\n";
$after=dol_string_nohtmltag($text,0);
$this->assertEquals("A\nstring",$after,"test1");
$text="A <b>string<b>\n\nwith html tag and '<' chars<br>\n";
$after=dol_string_nohtmltag($text, 0);
$this->assertEquals("A string\n\nwith html tag and '<' chars",$after,"test2");
$text="A <b>string<b>\n\nwith tag with < chars<br>\n";
$after=dol_string_nohtmltag($text, 1);
$this->assertEquals("A string with tag with < chars",$after,"test3");
return true;
}
/** /**
* testDolHtmlEntitiesBr * testDolHtmlEntitiesBr
* *