mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-12 04:21:30 +01:00
FIX Fix and move dolGetFirstLine function into main
FIX Hang on ->client not defined
This commit is contained in:
@@ -2060,7 +2060,7 @@ class Form
|
|||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED))
|
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||||
{
|
{
|
||||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||||
}
|
}
|
||||||
@@ -2071,7 +2071,7 @@ class Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED))
|
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||||
{
|
{
|
||||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||||
|
|||||||
@@ -4285,6 +4285,29 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return first line of text. Cut will depends if content is HTML or not.
|
||||||
|
*
|
||||||
|
* @param string $text Input text
|
||||||
|
* @return string Output text
|
||||||
|
* @see dol_nboflines_bis
|
||||||
|
*/
|
||||||
|
function dolGetFirstLineOfText($text)
|
||||||
|
{
|
||||||
|
if (dol_textishtml($text))
|
||||||
|
{
|
||||||
|
$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))?'...':'');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace CRLF in string with a HTML BR tag
|
* Replace CRLF in string with a HTML BR tag
|
||||||
*
|
*
|
||||||
@@ -4292,6 +4315,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
|||||||
* @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
* @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||||
* @param bool $forxml false=Use <br>, true=Use <br />
|
* @param bool $forxml false=Use <br>, true=Use <br />
|
||||||
* @return string String encoded
|
* @return string String encoded
|
||||||
|
* @see dol_nboflines, dolGetFirstLineOfText
|
||||||
*/
|
*/
|
||||||
function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
|
function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
|
||||||
{
|
{
|
||||||
@@ -4429,7 +4453,7 @@ function dol_string_is_good_iso($s)
|
|||||||
* @param string $s String to check
|
* @param string $s String to check
|
||||||
* @param int $maxchar Not yet used
|
* @param int $maxchar Not yet used
|
||||||
* @return int Number of lines
|
* @return int Number of lines
|
||||||
* @see dol_nboflines_bis
|
* @see dol_nboflines_bis, dolGetFirstLineOfText
|
||||||
*/
|
*/
|
||||||
function dol_nboflines($s,$maxchar=0)
|
function dol_nboflines($s,$maxchar=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,26 +30,6 @@
|
|||||||
// Enable this line to trace path when function is called.
|
// Enable this line to trace path when function is called.
|
||||||
//print xdebug_print_function_stack('Functions2.lib was called');exit;
|
//print xdebug_print_function_stack('Functions2.lib was called');exit;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return first line of text. Cut will depends if content is HTML or not.
|
|
||||||
*
|
|
||||||
* @param string $text Input text
|
|
||||||
* @return string Output text
|
|
||||||
* @see dol_nboflines_bis
|
|
||||||
*/
|
|
||||||
function dolGetFirstLineOfText($text)
|
|
||||||
{
|
|
||||||
if (dol_textishtml($text))
|
|
||||||
{
|
|
||||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$firstline=preg_replace('/[\n\r].*/','',$text);
|
|
||||||
}
|
|
||||||
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same function than javascript unescape() function but in PHP.
|
* Same function than javascript unescape() function but in PHP.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
|||||||
} elseif ($thirdparty instanceof Contact) {
|
} elseif ($thirdparty instanceof Contact) {
|
||||||
$socname = $thirdparty->socname;
|
$socname = $thirdparty->socname;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException();
|
throw new InvalidArgumentException('Parameter 1=$thirdparty is not a Societe nor Contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $outputlangs->convToOutputCharset($socname);
|
return $outputlangs->convToOutputCharset($socname);
|
||||||
|
|||||||
@@ -615,12 +615,12 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||||
$thirdparty = $object->contact;
|
$thirdparty = $object->contact;
|
||||||
} else {
|
} else {
|
||||||
$thirdparty = $object->client;
|
$thirdparty = $object->thirdparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||||
|
|
||||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
|
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
|
||||||
|
|
||||||
// Show recipient
|
// Show recipient
|
||||||
$widthrecbox=100;
|
$widthrecbox=100;
|
||||||
|
|||||||
@@ -227,10 +227,11 @@ if ($result)
|
|||||||
$companystatic->client=$objp->client;
|
$companystatic->client=$objp->client;
|
||||||
print $companystatic->getNomUrl(1,'',44);
|
print $companystatic->getNomUrl(1,'',44);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).'</td>';
|
print '<td>'.dol_trunc(dolGetFirstLineOfText($objp->description),48).'</td>';
|
||||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||||
{
|
{
|
||||||
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).'</td>';
|
//print '<td>'.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($objp->descriptiondetail)),48).'</td>';
|
||||||
|
print '<td>'.dolGetFirstLineOfText($objp->descriptiondetail).'</td>';
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'dayhour')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'dayhour')."</td>\n";
|
||||||
print '<td align="right">'.convertSecondToTime($objp->duree).'</td>';
|
print '<td align="right">'.convertSecondToTime($objp->duree).'</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$productsupplier = new ProductFournisseur($db);
|
$productsupplier = new ProductFournisseur($db);
|
||||||
|
|
||||||
if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED))
|
if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ ArcticNumRefModelDesc1=Generic number model
|
|||||||
ArcticNumRefModelError=Failed to activate
|
ArcticNumRefModelError=Failed to activate
|
||||||
PacificNumRefModelDesc1=Return numero with format %syymm-nnnn where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
|
PacificNumRefModelDesc1=Return numero with format %syymm-nnnn where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
|
||||||
PacificNumRefModelError=An intervention card starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module.
|
PacificNumRefModelError=An intervention card starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module.
|
||||||
PrintProductsOnFichinter=Print products on intervention card
|
PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card
|
||||||
PrintProductsOnFichinterDetails=interventions generated from orders
|
PrintProductsOnFichinterDetails=interventions generated from orders
|
||||||
InterventionStatistics=Statistics of interventions
|
InterventionStatistics=Statistics of interventions
|
||||||
NbOfinterventions=Nb of intervention cards
|
NbOfinterventions=Nb of intervention cards
|
||||||
|
|||||||
Reference in New Issue
Block a user