Add: fonction permettant de compter le nombre de ligne dans un texte, ceci afin de dterminer le nombre de ligne dans une description produit pour ne plus avoir de dbordement dans les pdf
This commit is contained in:
parent
ac9826f3a2
commit
07a8ee6e28
@ -192,6 +192,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$tab_top_newpage = 50;
|
||||
$tab_height = 110;
|
||||
$tab_height_newpage = 150;
|
||||
$tab_height_middlepage = 190;
|
||||
|
||||
// Affiche notes
|
||||
if ($propale->note_public)
|
||||
@ -321,8 +322,13 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$this->tva[(string) $propale->lignes[$i]->tva_tx] += $tvaligne;
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
//on récupère la description du produit suivant
|
||||
$follow_descproduitservice = $propale->lignes[$i+1]->desc;
|
||||
//on compte le nombre de ligne afin de vérifier la place disponible
|
||||
$nblineFollowDesc = (num_lines($follow_descproduitservice)*4);
|
||||
|
||||
if ($nexY > ($tab_top+$tab_height) && $i < ($nblignes - 1))
|
||||
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
@ -330,7 +336,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs);
|
||||
}
|
||||
|
||||
$this->_pagefoot($pdf,$outputlangs);
|
||||
@ -355,8 +361,8 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top_newpage + $tab_height + 1;
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
|
||||
}
|
||||
|
||||
// Affiche zone infos
|
||||
|
||||
@ -2598,6 +2598,21 @@ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
|
||||
return $nbOpenDay;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction retournant le nombre de lignes dans un texte formaté
|
||||
\param texte Texte
|
||||
\return nblines Nombre de lignes
|
||||
*/
|
||||
function num_lines($texte)
|
||||
{
|
||||
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
$texte = strtr($texte, $repTable);
|
||||
$pattern = '/(<[^>]+>)/Uu';
|
||||
$a = preg_split($pattern, $texte, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
$nblines = ((count($a)+1)/2);
|
||||
return $nblines;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Récupère la valeur d'un champ, effectue un traitement Ajax et affiche le résultat
|
||||
\param htmlname nom et id du champ
|
||||
|
||||
Loading…
Reference in New Issue
Block a user