';
print "\n";
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 3cd4c16ac3a..44c87c56cc8 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -30,6 +30,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formproduct.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/sendings.lib.php");
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 10652319fc4..630a458f1ab 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -2613,10 +2613,18 @@ class Form
print ''."\n";
print ''."\n";
print ''."\n";
- if($form_name =="")
- print ''.img_cal().'';
+ if ($form_name =="")
+ {
+ print '';
+ print '';
+ print '';
+ }
else
- print ''.img_cal().'';
+ {
+ print '';
+ print '';
+ print '';
+ }
}
}
diff --git a/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN b/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN
index 2e2ddf085d0..bd02d70b0a6 100644
--- a/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN
+++ b/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN
@@ -14,22 +14,22 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
*/
/**
- \file htdocs/includes/triggers/interface_modCommande_fraisport.class.php
- \ingroup core
- \brief Fichier trigger pour ajout frais port
+ \file htdocs/includes/triggers/interface_modCommande_fraisport.class.php
+ \ingroup core
+ \brief Fichier trigger pour ajout frais port
+ \version $Id$
*/
+include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
+
/**
\class InterfaceFraisport
\brief Classe des fonctions triggers des actions personalisées du workflow
*/
-
class InterfaceFraisport
{
var $db;
diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php
index 599630175b7..5e7bd2bfa77 100644
--- a/htdocs/lib/files.lib.php
+++ b/htdocs/lib/files.lib.php
@@ -18,22 +18,22 @@
*/
/**
- \file htdocs/lib/files.lib.php
- \brief Library for file managing functions
- \version $Id$
-*/
+ * \file htdocs/lib/files.lib.php
+ * \brief Library for file managing functions
+ * \version $Id$
+ */
/**
- \brief Scan a directory and return a list of files/directories
- \param $path Starting path from which to search
- \param $types Can be "directories", "files", or "all"
- \param $recursive Determines whether subdirectories are searched
- \param $filter Regex for filter
- \param $exludefilter Regex for exclude filter (example: '\.meta$')
- \param $sortcriteria Sort criteria ("name","date","size")
- \param $sortorder Sort order (SORT_ASC, SORT_DESC)
- \param $mode 0=Return array with only keys needed, 1=Force all keys to be loaded
- \return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
+ * \brief Scan a directory and return a list of files/directories
+ * \param $path Starting path from which to search
+ * \param $types Can be "directories", "files", or "all"
+ * \param $recursive Determines whether subdirectories are searched
+ * \param $filter Regex for filter
+ * \param $exludefilter Regex for exclude filter (example: '\.meta$')
+ * \param $sortcriteria Sort criteria ("name","date","size")
+ * \param $sortorder Sort order (SORT_ASC, SORT_DESC)
+ * \param $mode 0=Return array with only keys needed, 1=Force all keys to be loaded
+ * \return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
{
@@ -181,4 +181,32 @@ function dol_mimetype($file)
if (eregi('\.(zip|rar|gz|tgz|z|cab|bz2)$',$file)) $mime='archive';
return $mime;
}
+
+
+/**
+ * \brief Test if a folder is empty
+ * \return true is empty or non-existing, false if it contains files
+ */
+function dol_dir_is_emtpy($folder)
+{
+ if (is_dir($folder))
+ {
+ $handle = opendir($folder);
+ while( (gettype( $name = readdir($handle)) != "boolean")){
+ $name_array[] = $name;
+ }
+ foreach($name_array as $temp)
+ $folder_content .= $temp;
+
+ if($folder_content == "...")
+ return true;
+ else
+ return false;
+
+ closedir($handle);
+ }
+ else
+ return true; // Le repertoire n'existe pas
+}
+
?>
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 865c9a3c147..9d6b6ce65a5 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -26,7 +26,8 @@
/**
* \file htdocs/lib/functions.lib.php
- * \brief Ensemble de fonctions de base de dolibarr sous forme d'include
+ * \brief A set of functions for Dolibarr
+ * This file contains all frequently used functions.
* \version $Id$
*/
@@ -926,12 +927,12 @@ function img_object($alt, $object)
}
/**
- \brief Affiche picto (fonction g�n�rique)
- \param alt Texte sur le alt de l'image
- \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
- \param options Attribut supplementaire a la balise img
- \param pictoisfullpath If 1, image path is a full path
- \return string Retourne tag img
+ * \brief Affiche picto (fonction generique)
+ * \param alt Texte sur le alt de l'image
+ * \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
+ * \param options Attribut supplementaire a la balise img
+ * \param pictoisfullpath If 1, image path is a full path
+ * \return string Retourne tag img
*/
function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
{
@@ -1002,9 +1003,9 @@ function img_refresh($alt = "default")
}
/**
- \brief Affiche logo dossier
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
+ * \brief Affiche logo dossier
+ * \param alt Texte sur le alt de l'image
+ * \return string Retourne tag img
*/
function img_folder($alt = "default")
{
@@ -1014,9 +1015,9 @@ function img_folder($alt = "default")
}
/**
- \brief Affiche logo nouveau fichier
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
+ * \brief Affiche logo nouveau fichier
+ * \param alt Texte sur le alt de l'image
+ * \return string Retourne tag img
*/
function img_file_new($alt = "default")
{
@@ -1039,21 +1040,9 @@ function img_pdf($alt = "default",$size=3)
}
/**
- \brief Affiche logo vcard
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
- */
-function img_vcard($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("VCard");
- return '';
-}
-
-/**
- \brief Affiche logo +
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
+ * \brief Affiche logo +
+ * \param alt Texte sur le alt de l'image
+ * \return string Retourne tag img
*/
function img_edit_add($alt = "default")
{
@@ -1062,9 +1051,9 @@ function img_edit_add($alt = "default")
return '';
}
/**
- \brief Affiche logo -
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
+ * \brief Affiche logo -
+ * \param alt Texte sur le alt de l'image
+ * \return string Retourne tag img
*/
function img_edit_remove($alt = "default")
{
@@ -1074,10 +1063,10 @@ function img_edit_remove($alt = "default")
}
/**
- \brief Affiche logo editer/modifier fiche
- \param alt Texte sur le alt de l'image
- \param float Si il faut y mettre le style "float: right"
- \return string Retourne tag img
+ * \brief Affiche logo editer/modifier fiche
+ * \param alt Texte sur le alt de l'image
+ * \param float Si il faut y mettre le style "float: right"
+ * \return string Retourne tag img
*/
function img_edit($alt = "default", $float=0, $other='')
{
@@ -1091,10 +1080,10 @@ function img_edit($alt = "default", $float=0, $other='')
}
/**
- \brief Affiche logo voir fiche
- \param alt Texte sur le alt de l'image
- \param float Si il faut y mettre le style "float: right"
- \return string Retourne tag img
+ * \brief Affiche logo voir fiche
+ * \param alt Texte sur le alt de l'image
+ * \param float Si il faut y mettre le style "float: right"
+ * \return string Retourne tag img
*/
function img_view($alt = "default", $float=0, $other='')
{
@@ -1119,22 +1108,10 @@ function img_delete($alt = "default")
return '';
}
-/**
- \brief Affiche logo d�sactiver
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
- */
-function img_disable($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Disable");
- return '';
-}
-
/**
- \brief Affiche logo help avec curseur "?"
- \return string Retourne tag img
+ * \brief Affiche logo help avec curseur "?"
+ * \return string Retourne tag img
*/
function img_help($usehelpcursor=1,$usealttitle=1)
{
@@ -1148,19 +1125,9 @@ function img_help($usehelpcursor=1,$usealttitle=1)
}
/**
- \brief Affiche picto calendrier "?"
- \return string Retourne tag img
- */
-function img_cal()
-{
- global $conf,$langs;
- return '';
-}
-
-/**
- \brief Affiche logo info
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
+ * \brief Affiche logo info
+ * \param alt Texte sur le alt de l'image
+ * \return string Retourne tag img
*/
function img_info($alt = "default")
{
@@ -1170,22 +1137,10 @@ function img_info($alt = "default")
}
/**
- \brief Affiche logo calculatrice
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
- */
-function img_calc($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Calculate");
- return '';
-}
-
-/**
- \brief Affiche logo warning
- \param alt Texte sur le alt de l'image
- \param float Si il faut afficher le style "float: right"
- \return string Retourne tag img
+ * \brief Affiche logo warning
+ * \param alt Texte sur le alt de l'image
+ * \param float Si il faut afficher le style "float: right"
+ * \return string Retourne tag img
*/
function img_warning($alt = "default",$float=0)
{
@@ -1199,7 +1154,7 @@ function img_warning($alt = "default",$float=0)
}
/**
- \brief Affiche logo warning
+ \brief Affiche logo error
\param alt Texte sur le alt de l'image
\return string Retourne tag img
*/
@@ -1211,22 +1166,10 @@ function img_error($alt = "default")
}
/**
- \brief Affiche logo alerte
- \param alt Texte sur le alt de l'image
- \return string Retourne tag img
- */
-function img_alerte($alt = "default")
-{
- global $conf,$langs;
- if ($alt=="default") $alt=$langs->trans("Alert");
- return '';
-}
-
-/**
- \brief Affiche logo t�l�phone
- \param alt Texte sur le alt de l'image
- \param option Choose of logo
- \return string Retourne tag img
+ * \brief Affiche logo telephone
+ * \param alt Texte sur le alt de l'image
+ * \param option Choose of logo
+ * \return string Retourne tag img
*/
function img_phone($alt = "default",$option=0)
{
@@ -1381,40 +1324,10 @@ function img_mime($file,$alt='')
/**
- \brief Return if a filename is file name of a supported image format
- \param file Filename
- \return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported
- */
-function image_format_supported($file)
-{
- // Case filename is not a format image
- if (! eregi('(\.gif|\.jpg|\.jpeg|\.png|\.bmp)$',$file,$reg)) return -1;
-
- // Case filename is a format image but not supported by this PHP
- $imgfonction='';
- if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
- if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
- if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
- if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
- if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
- if ($imgfonction)
- {
- if (! function_exists($imgfonction))
- {
- // Fonctions de conversion non presente dans ce PHP
- return 0;
- }
- }
-
- // Filename is a format image and supported by this PHP
- return 1;
-}
-
-/**
- \brief Affiche info admin
- \param text Text info
- \param infoonimgalt Info is shown on alt of star picto
- \return string String with info text
+ * \brief Affiche info admin
+ * \param text Text info
+ * \param infoonimgalt Info is shown on alt of star picto
+ * \return string String with info text
*/
function info_admin($texte,$infoonimgalt=0)
{
@@ -2246,18 +2159,18 @@ function get_product_vat_for_country($idprod, $countrycode)
/**
- \brief Fonction qui renvoie la tva d'une ligne (en fonction du vendeur, acheteur et taux du produit)
- \remarks Si vendeur non assujeti a TVA, TVA par d�faut=0. Fin de r�gle.
- Si le (pays vendeur = pays acheteur) alors TVA par d�faut=TVA du produit vendu. Fin de r�gle.
- Si (vendeur et acheteur dans Communaut� europ�enne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par d�faut=0 (La TVA doit �tre pay� par acheteur au centre d'impots de son pays et non au vendeur). Fin de r�gle.
- Si (vendeur et acheteur dans Communaut� europ�enne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par d�faut=TVA du produit vendu. Fin de r�gle
- Si (vendeur et acheteur dans Communaut� europ�enne) et (acheteur = entreprise avec num TVA) intra alors TVA par d�faut=0. Fin de r�gle
- Sinon TVA propos�e par d�faut=0. Fin de r�gle.
- \param societe_vendeuse Objet soci�t� vendeuse
- \param societe_acheteuse Objet soci�t� acheteuse
- \param taux_produit Taux par defaut du produit vendu (old way to get product vat rate)
- \param idprod Id product (new way to get product vat rate)
- \return float Taux de tva a appliquer, -1 si ne peut etre d�termin�
+ * \brief Fonction qui renvoie la tva d'une ligne (en fonction du vendeur, acheteur et taux du produit)
+ * \remarks Si vendeur non assujeti a TVA, TVA par d�faut=0. Fin de r�gle.
+ * Si le (pays vendeur = pays acheteur) alors TVA par d�faut=TVA du produit vendu. Fin de r�gle.
+ * Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par d�faut=0 (La TVA doit �tre pay� par acheteur au centre d'impots de son pays et non au vendeur). Fin de r�gle.
+ * Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par d�faut=TVA du produit vendu. Fin de r�gle
+ * Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise avec num TVA) intra alors TVA par d�faut=0. Fin de r�gle
+ * Sinon TVA proposee par defaut=0. Fin de regle.
+ * \param societe_vendeuse Objet societe vendeuse
+ * \param societe_acheteuse Objet societe acheteuse
+ * \param taux_produit Taux par defaut du produit vendu (old way to get product vat rate)
+ * \param idprod Id product (new way to get product vat rate)
+ * \return float Taux de tva a appliquer, -1 si ne peut etre d�termin�
*/
function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit, $idprod=0)
{
@@ -2349,43 +2262,10 @@ function yn($yesno, $case=1, $color=0)
/**
- \brief Fonction pour qui retourne le rowid d'un departement par son code
- \param db handler d'acc�s base
- \param code Code r�gion
- \param pays_id Id du pays
- */
-function departement_rowid($db,$code, $pays_id)
-{
- $sql = "SELECT c.rowid FROM ".MAIN_DB_PREFIX."c_departements as c,".MAIN_DB_PREFIX."c_regions as r";
- $sql .= " WHERE c.code_departement=". $code;
- $sql .= " AND c.fk_region = r.code_region";
- $sql .= " AND r.fk_pays =".$pays_id;
-
- if ($db->query($sql))
- {
- $num = $db->num_rows();
- if ($num)
- {
- $obj = $db->fetch_object();
- return $obj->rowid;
- }
- else
- {
- return 0;
- }
- $db->free();
- }
- else
- {
- return 0;
- }
-}
-
-/**
- \brief Renvoi un chemin de classement r�pertoire en fonction d'un i
- \remarks Examples: 1->"0/0/1/", 15->"0/1/5/"
- \param $num Id a d�composer
- \param $level Niveau de decoupage (1, 2 ou 3 niveaux)
+ * \brief Return a path to class a directory according to an id
+ * \remarks Examples: 1->"0/0/1/", 15->"0/1/5/"
+ * \param $num Id to develop
+ * \param $level Level of development (1, 2 or 3 level)
*/
function get_exdir($num,$level=3)
{
@@ -2456,177 +2336,21 @@ function create_exdir($dir)
}
-
-
/**
- \brief Retourne le numero de la semaine par rapport a une date
- \param time Date au format 'timestamp'
- \return int Numero de semaine
- */
-function numero_semaine($time)
-{
- $stime = strftime('%Y-%m-%d',$time);
-
- if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?',$stime,$reg))
- {
- // Date est au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
- $annee = $reg[1];
- $mois = $reg[2];
- $jour = $reg[3];
- }
-
- /*
- * Norme ISO-8601:
- * - La semaine 1 de toute ann�e est celle qui contient le 4 janvier ou que la semaine 1 de toute ann�e est celle qui contient le 1er jeudi de janvier.
- * - La majorit� des ann�es ont 52 semaines mais les ann�es qui commence un jeudi et les ann�es bissextiles commen�ant un mercredi en poss�de 53.
- * - Le 1er jour de la semaine est le Lundi
- */
-
- // D�finition du Jeudi de la semaine
- if (date("w",mktime(12,0,0,$mois,$jour,$annee))==0) // Dimanche
- $jeudiSemaine = mktime(12,0,0,$mois,$jour,$annee)-3*24*60*60;
- else if (date("w",mktime(12,0,0,$mois,$jour,$annee))<4) // du Lundi au Mercredi
- $jeudiSemaine = mktime(12,0,0,$mois,$jour,$annee)+(4-date("w",mktime(12,0,0,$mois,$jour,$annee)))*24*60*60;
- else if (date("w",mktime(12,0,0,$mois,$jour,$annee))>4) // du Vendredi au Samedi
- $jeudiSemaine = mktime(12,0,0,$mois,$jour,$annee)-(date("w",mktime(12,0,0,$mois,$jour,$annee))-4)*24*60*60;
- else // Jeudi
- $jeudiSemaine = mktime(12,0,0,$mois,$jour,$annee);
-
- // D�finition du premier Jeudi de l'ann�e
- if (date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))==0) // Dimanche
- {
- $premierJeudiAnnee = mktime(12,0,0,1,1,date("Y",$jeudiSemaine))+4*24*60*60;
- }
- else if (date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))<4) // du Lundi au Mercredi
- {
- $premierJeudiAnnee = mktime(12,0,0,1,1,date("Y",$jeudiSemaine))+(4-date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine))))*24*60*60;
- }
- else if (date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))>4) // du Vendredi au Samedi
- {
- $premierJeudiAnnee = mktime(12,0,0,1,1,date("Y",$jeudiSemaine))+(7-(date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))-4))*24*60*60;
- }
- else // Jeudi
- {
- $premierJeudiAnnee = mktime(12,0,0,1,1,date("Y",$jeudiSemaine));
- }
-
- // D�finition du num�ro de semaine: nb de jours entre "premier Jeudi de l'ann�e" et "Jeudi de la semaine";
- $numeroSemaine = (
- (
- date("z",mktime(12,0,0,date("m",$jeudiSemaine),date("d",$jeudiSemaine),date("Y",$jeudiSemaine)))
- -
- date("z",mktime(12,0,0,date("m",$premierJeudiAnnee),date("d",$premierJeudiAnnee),date("Y",$premierJeudiAnnee)))
- ) / 7
- ) + 1;
-
- // Cas particulier de la semaine 53
- if ($numeroSemaine==53)
- {
- // Les ann�es qui commence un Jeudi et les ann�es bissextiles commen�ant un Mercredi en poss�de 53
- if (date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))==4 || (date("w",mktime(12,0,0,1,1,date("Y",$jeudiSemaine)))==3 && date("z",mktime(12,0,0,12,31,date("Y",$jeudiSemaine)))==365))
- {
- $numeroSemaine = 53;
- }
- else
- {
- $numeroSemaine = 1;
- }
- }
-
- //echo $jour."-".$mois."-".$annee." (".date("d-m-Y",$premierJeudiAnnee)." - ".date("d-m-Y",$jeudiSemaine).") -> ".$numeroSemaine." ";
-
- return sprintf("%02d",$numeroSemaine);
-}
-
-
-/**
- \brief Retourne le picto champ obligatoire
- \return string Chaine avec picto obligatoire
+ * \brief Retourne le picto champ obligatoire
+ * \return string Chaine avec picto obligatoire
*/
function picto_required()
{
return '*';
}
-/**
- \brief Convertit une masse d'une unite vers une autre unite
- \param weight float Masse a convertir
- \param from_unit int Unite originale en puissance de 10
- \param to_unit int Nouvelle unite en puissance de 10
- \return float Masse convertie
- */
-function weight_convert($weight,&$from_unit,$to_unit)
-{
- /* Pour convertire 320 gr en Kg appeler
- * $f = -3
- * weigh_convert(320, $f, 0) retournera 0.32
- *
- */
- while ($from_unit <> $to_unit)
- {
- if ($from_unit > $to_unit)
- {
- $weight = $weight * 10;
- $from_unit = $from_unit - 1;
- $weight = weight_convert($weight,$from_unit, $to_unit);
- }
- if ($from_unit < $to_unit)
- {
- $weight = $weight / 10;
- $from_unit = $from_unit + 1;
- $weight = weight_convert($weight,$from_unit, $to_unit);
- }
- }
- return $weight;
-}
/**
- \brief Renvoi le texte d'une unite
- \param int Unit
- \param measuring_style Le style de mesure : weight, volume,...
- \return string Unite
- \todo gerer les autres unit�s de mesure comme la livre, le gallon, le litre, ...
- */
-function measuring_units_string($unit,$measuring_style='')
-{
- /* Note Rodo aux dev :)
- * Ne pas ins�rer dans la base de donn�es ces valeurs
- * cela surchagerait inutilement d'une requete suppl�mentaire
- * pour quelque chose qui est somme toute peu variable
- */
-
- global $langs;
-
- if ($measuring_style == 'weight')
- {
- $measuring_units[3] = $langs->trans("WeightUnitton");
- $measuring_units[0] = $langs->trans("WeightUnitkg");
- $measuring_units[-3] = $langs->trans("WeightUnitg");
- $measuring_units[-6] = $langs->trans("WeightUnitmg");
- }
- else if ($measuring_style == 'volume')
- {
- $measuring_units[0] = $langs->trans("VolumeUnitm3");
- $measuring_units[-3] = $langs->trans("VolumeUnitdm3");
- $measuring_units[-6] = $langs->trans("VolumeUnitcm3");
- $measuring_units[-9] = $langs->trans("VolumeUnitmm3");
- }
- else if ($measuring_style == 'size')
- {
- $measuring_units[0] = $langs->trans("SizeUnitm");
- $measuring_units[-1] = $langs->trans("SizeUnitdm");
- $measuring_units[-2] = $langs->trans("SizeUnitcm");
- $measuring_units[-3] = $langs->trans("SizeUnitmm");
- }
-
- return $measuring_units[$unit];
-}
-
-/**
- \brief Clean an url
- \param url Url
- \param http 1: keep http, 0: remove also http
- \return string CleanUrl
+ * \brief Clean an url
+ * \param url Url
+ * \param http 1: keep http, 0: remove also http
+ * \return string CleanUrl
*/
function clean_url($url,$http=1)
{
@@ -2686,36 +2410,6 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1)
return $CleanString;
}
-/**
- \brief Convert a binaray data to string that represent hexadecimal value
- \param bin Value to convert
- \param pad Add 0
- \param upper Convert to tupper
- \return string x
- */
-function binhex($bin, $pad=false, $upper=false){
- $last = strlen($bin)-1;
- for($i=0; $i<=$last; $i++){ $x += $bin[$last-$i] * pow(2,$i); }
- $x = dechex($x);
- if($pad){ while(strlen($x) < intval(strlen($bin))/4){ $x = "0$x"; } }
- if($upper){ $x = strtoupper($x); }
- return $x;
-}
-
-/**
- \brief Convertir de l'h�xad�cimal en binaire
- \param string hexa
- \return string bin
- */
-function hexbin($hexa){
- $bin='';
- for($i=0;$i valeur a mettre
@@ -2956,28 +2650,11 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
}
-/*
- *
- */
-function make_alpha_from_numbers($number)
-{
- $numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- if($numberload("main");
$string = '';
-
if ($reduction == 100)
{
$string = $langs->trans("Offered");
@@ -3042,9 +2718,9 @@ function dolibarr_print_reduction($reduction=0)
/**
- \brief Returns formated reduction
- \param reduction Reduction percentage
- \return int Return number of error messages shown
+ * \brief Returns formated reduction
+ * \param reduction Reduction percentage
+ * \return int Return number of error messages shown
*/
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
{
@@ -3112,62 +2788,6 @@ function dol_sort_array($array, $index, $order='asc', $natsort, $case_sensitive)
return $array;
}
-/**
- * \brief Test if a folder is empty
- * \return true is empty or non-existing, false if it contains files
- */
-function is_emtpy_folder($folder){
- if(is_dir($folder) ){
- $handle = opendir($folder);
- while( (gettype( $name = readdir($handle)) != "boolean")){
- $name_array[] = $name;
- }
- foreach($name_array as $temp)
- $folder_content .= $temp;
-
- if($folder_content == "...")
- return true;
- else
- return false;
-
- closedir($handle);
- }
- else
- return true; // Le r�pertoire n'existe pas
-}
-
-/**
- * \brief Return an html table from an array
- */
-function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdoptions=''){
- $text='' ;
- if($tableMarkup) $text = '
' ;
- return $text ;
-}
-
/**
* \brief Check if a string is in UTF8
@@ -3194,25 +2814,4 @@ function utf8_check($Str)
}
-
-/**
- * \brief Search for prospect state selection in $_GET, $_POST, and $_REQUEST
- * \return prospect state selection (array of prospect_state_id => 'true'/'false')
- * \author Matelli (www.matelli.fr)
- * \remarks See http://matelli.fr/showcases/patchs-dolibarr/add-icons-for-prospect-status.html for details
- */
-function get_prospect_state_selection()
-{
- $sts = array(-1,0,1,2,3);
-
- if (isSet($_POST["nouvel_etat"]))
- return $_POST["nouvel_etat"];
- else if (isSet($_GET["nouvel_etat"]))
- return $_GET["nouvel_etat"];
- else if (isSet($_REQUEST["nouvel_etat"]))
- return $_REQUEST["nouvel_etat"];
- else
- return false;
-}
-
?>
\ No newline at end of file
diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php
index fca3579b11b..c4f1399c67a 100644
--- a/htdocs/lib/functions2.lib.php
+++ b/htdocs/lib/functions2.lib.php
@@ -20,12 +20,45 @@
/**
* \file htdocs/lib/functions2.lib.php
- * \brief Ensemble de fonctions de base de dolibarr sous forme d'include.
- * This file contains rare functions.
+ * \brief A set of functions for Dolibarr
+ * This file contains all rare functions.
* \version $Id$
*/
+/**
+ * \brief Return lines of an html table from an array
+ * \remarks Used by array2table function only
+ */
+function array2tr($data,$troptions='',$tdoptions=''){
+ $text = '