';
$ret.='';
}
-
+
return $ret;
}
-
+
/**
* Output val field for an editable field
- *
+ *
* @param string $text Text of label (not used in this function)
* @param string $htmlname Name of select field
* @param string $value Value to show/edit
@@ -124,9 +124,9 @@ class Form
function editfieldval($text,$htmlname,$value,$object,$perm,$typeofdata='string',$editvalue='',$extObject=false)
{
global $conf,$langs,$db;
-
+
$ret='';
-
+
// When option to edit inline is activated
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
@@ -185,7 +185,7 @@ class Form
}
return $ret;
}
-
+
/**
* Output edit in place form
*
@@ -200,14 +200,14 @@ class Form
private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $extObject=false)
{
global $conf;
-
+
$out='';
-
+
// Check parameters
if ($inputType == 'textarea') $value = dol_nl2br($value);
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
else if ($inputType == 'datepicker') $value = dol_print_date($value, 'day');
-
+
if ($condition)
{
$element = false;
@@ -218,21 +218,21 @@ class Form
$ext_element = false;
//$ext_table_element = false;
//$ext_fk_element = false;
-
+
if (is_object($object))
{
$element = $object->element;
$table_element = $object->table_element;
$fk_element = $object->id;
}
-
+
if (is_object($extObject))
{
$ext_element = $extObject->element;
//$ext_table_element = $extObject->table_element;
//$ext_fk_element = $extObject->id;
}
-
+
if (preg_match('/^(string|email|numeric)/',$inputType))
{
$tmp=explode(':',$inputType);
@@ -244,7 +244,7 @@ class Form
$tmp=explode(':',$inputType);
$inputType=$tmp[0]; $inputOption=$tmp[1];
if (! empty($tmp[2])) $savemethod=$tmp[2];
-
+
$out.= ''."\n"; // Use for timestamp format
}
else if (preg_match('/^select/',$inputType))
@@ -260,7 +260,7 @@ class Form
if (! empty($tmp[2])) $width=$tmp[2];
if (! empty($tmp[3])) $heigth=$tmp[3];
if (! empty($tmp[4])) $savemethod=$tmp[4];
-
+
if (! empty($conf->fckeditor->enabled))
{
$out.= ''."\n";
@@ -270,7 +270,7 @@ class Form
$inputType = 'textarea';
}
}
-
+
$out.= ''."\n";
$out.= ''."\n";
$out.= ''."\n";
@@ -279,17 +279,17 @@ class Form
$out.= ''."\n";
//$out.= ''."\n";
//$out.= ''."\n";
-
+
$out.= '
'.$value.'
'."\n";
}
else
{
$out = $value;
}
-
+
return $out;
}
-
+
/**
* Show a text and picto with tooltip on text or picto
*
@@ -308,21 +308,21 @@ class Form
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$extracss='',$notabs=0,$incbefore='',$noencodehtmltext=0)
{
global $conf;
-
+
if ($incbefore) $text = $incbefore.$text;
if (! $htmltext) return $text;
-
+
// Sanitize tooltip
$htmltext=str_replace("\\","\\\\",$htmltext);
$htmltext=str_replace("\r","",$htmltext);
$htmltext=str_replace("\n","",$htmltext);
-
+
$htmltext=str_replace('"',""",$htmltext);
if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
-
+
$s="";
if (empty($notabs)) $s.='
';
if ($direction > 0)
@@ -346,7 +346,7 @@ class Form
}
}
if (empty($notabs)) $s.='
';
-
+
return $s;
}
@@ -2701,17 +2701,17 @@ class Form
/**
- * Show a select box with available absolute discounts
+ * Show a select box with available absolute discounts
*
- * @param page Page URL where form is shown
- * @param selected Value pre-selected
- * @param htmlname Nom du formulaire select. Si none, non modifiable
- * @param socid Third party id
- * @param amount Total amount available
- * @param filter SQL filter on discounts
- * @param maxvalue Max value for lines that can be selected
- * @param more More string to add
- * @return void
+ * @param string $page Page URL where form is shown
+ * @param int $selected Value pre-selected
+ * @param string $htmlname Nom du formulaire select. Si none, non modifiable
+ * @param int $socid Third party id
+ * @param float $amount Total amount available
+ * @param string $filter SQL filter on discounts
+ * @param int $maxvalue Max value for lines that can be selected
+ * @param string $more More string to add
+ * @return void
*/
function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid, $amount, $filter='', $maxvalue=0, $more='')
{
@@ -2725,10 +2725,9 @@ class Form
print '
';
if (! $filter || $filter=='fk_facture_source IS NULL') print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
else print $langs->trans("CompanyHasCreditNote",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
- // print $langs->trans("AvailableGlobalDiscounts").': ';
$newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
if ($filter) $newfilter.=' AND '.$filter;
- $nbqualifiedlines=$this->select_remises('',$htmlname,$newfilter,$socid,$maxvalue);
+ $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
print '
';
print '
';
if ($nbqualifiedlines > 0)
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index a1a452a939d..b76ed8c3724 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -439,12 +439,17 @@ class FormFile
$file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.($png?'|'.$png:''),'date',SORT_DESC);
// Affiche en-tete tableau si non deja affiche
- if (count($file_list) && ! $headershown && !$iconPDF)
+ if (! empty($file_list) && ! $headershown && ! $iconPDF)
{
$headershown=1;
$out.= '
'.$titletoshow.'
';
$out.= '
';
}
+ else if (empty($file_list) && ! empty($iconPDF))
+ {
+ // For ajax treatment
+ $out.= '
'.img_picto('', 'refresh').'
'."\n";
+ }
// Loop on each file found
foreach($file_list as $file)
@@ -458,15 +463,15 @@ class FormFile
if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; }
if ($modulepart == 'export') { $relativepath = $file["name"]; }
- if (!$iconPDF) $out.= "
";
+ if (! $iconPDF) $out.= "
";
// Show file name with link to download
- if (!$iconPDF) $out.= '
';
+ }
if ($delallowed)
{
@@ -489,7 +497,7 @@ class FormFile
$out.= '">'.img_delete().'';
}
- if (!$iconPDF) $out.= '
';
+ if (! $iconPDF) $out.= '';
$this->numoffiles++;
}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 4463a943486..341fe8529cc 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -752,11 +752,11 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
{
if ($idprod)
{
- if ( empty($hidedesc) ) $libelleproduitservice.=$desc;
+ if ( empty($hidedesc) ) $libelleproduitservice.=dol_htmlentitiesbr($desc,1);
}
else
{
- $libelleproduitservice.=$desc;
+ $libelleproduitservice.=dol_htmlentitiesbr($desc,1);
}
}
}
diff --git a/htdocs/langs/HOWTO-Translation.txt b/htdocs/langs/HOWTO-Translation.txt
old mode 100755
new mode 100644
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 5a214c0466c..f9408b2896b 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -73,7 +73,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
function test_sql_and_script_inject($val, $type)
{
$sql_inj = 0;
- // For SQL Injection (onyl GET and POST are used to be included into bad escaped SQL requests)
+ // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2)
{
$sql_inj += preg_match('/delete[\s]+from/i', $val);
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 2e00f12f5f9..f36853e6bae 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1217,17 +1217,18 @@ class Societe extends CommonObject
/**
* Add a discount for third party
- * @param remise Montant de la remise
- * @param user Utilisateur qui accorde la remise
- * @param desc Motif de l'avoir
- * @param tva_tx VAT rate
- * @return int <0 if KO, id or record if OK
+ *
+ * @param float $remise Amount of discount
+ * @param User $user User adding discount
+ * @param string $desc Reason of discount
+ * @param float $tva_tx VAT rate
+ * @return int <0 if KO, id of discount record if OK
*/
function set_remise_except($remise, $user, $desc, $tva_tx=0)
{
global $langs;
- // Nettoyage des parametres
+ // Clean parameters
$remise = price2num($remise);
$desc = trim($desc);
@@ -1269,11 +1270,12 @@ class Societe extends CommonObject
}
/**
- * \brief Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe
- * \param user Filtre sur un user auteur des remises
- * \param filter Filtre autre
- * \param maxvalue Filter on max value for discount
- * \return int <0 if KO, Credit note amount otherwise
+ * Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe
+ *
+ * @param User $user Filtre sur un user auteur des remises
+ * @param string $filter Filtre autre
+ * @param string $maxvalue Filter on max value for discount
+ * @return int <0 if KO, Credit note amount otherwise
*/
function getAvailableDiscounts($user='',$filter='',$maxvalue=0)
{
@@ -1294,6 +1296,7 @@ class Societe extends CommonObject
/**
* Return array of sales representatives
+ *
* @return array Array of sales representatives of third party
*/
function getSalesRepresentatives($user='')
@@ -1331,8 +1334,8 @@ class Societe extends CommonObject
/**
* Set the price level
*
- * @param $price_level
- * @param $user
+ * @param int $price_level Level of price
+ * @param User $user Use making change
*/
function set_price_level($price_level, $user)
{