diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index ae47515aef85b809182fe2059d2dc98eab9283f6..0dfdffea9d2b8d8eecbf1bf1bc8a53ae8b65ff0c 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -271,7 +271,7 @@ if ($resql) print ' '; if ($user->rights->adherent->supprimer) { - print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign&return=liste.php\">".img_disable($langs->trans("Resiliate"))."</a>"; + print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign&return=liste.php\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>"; } print "</td>"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index becf1802fbce3841e7457de282bd8f3cdfa59aca..22d6f6a30876fec1c75e9f3adaba8fdcda2ff09e 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -28,6 +28,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/images.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); $langs->load("admin"); $langs->load("companies"); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d94859382584a67d1b5cd9fefc52eae2213ea260..06df81646ae1d0fc42f13a09b8c24d7f93fa0199 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1309,7 +1309,7 @@ if ($_GET['propalid'] > 0) else { $picto = '<a href="#" onClick="dialogWindow($(\'calc_markup'.$i.'\').innerHTML,\''.$langs->trans('ToCalculateMarkup').'\')">'; - $picto.= img_calc(); + $picto.= img_picto($langs->trans("Calculate"),'calc.png'); $picto.= '</a>'; print $html->textwithtooltip($picto,$langs->trans("ToCalculateMarkup"),3,'','',$i); } diff --git a/htdocs/comm/stats.php b/htdocs/comm/stats.php index 3762f1815346020e11ac8bef129db95c8f5ccc9b..eb6e2372ab17fdfac22d2b2ea5c18d63ef82ad70 100644 --- a/htdocs/comm/stats.php +++ b/htdocs/comm/stats.php @@ -27,6 +27,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); /* @@ -212,9 +213,7 @@ foreach($graphfiles as $graph){ </table>' ; } -/************** - * Fin de page - **************/ $db->close(); + llxFooter(); ?> diff --git a/htdocs/compta/stats/comm.php b/htdocs/compta/stats/comm.php index ac9f20a538295e1d847227c1af52ea463c74a418..a8cc611c0059da7a60aea59892b7fe7bed7808d7 100644 --- a/htdocs/compta/stats/comm.php +++ b/htdocs/compta/stats/comm.php @@ -26,6 +26,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); if (!$user->rights->compta->resultat->lire) accessforbidden(); @@ -216,9 +217,8 @@ if($_GET['id']!="") } } -/************** - * Fin de page - **************/ + $db->close(); + llxFooter(); ?> diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php index af5430aa22b4a1913161f77dcdb017f69a919209..38f5a5cba0a469c7923f082317024bdd5cb80aff 100644 --- a/htdocs/contact/exportimport.php +++ b/htdocs/contact/exportimport.php @@ -98,7 +98,7 @@ print '<br>'; print $langs->trans("ExportCardToFormat").': '; print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"].'">'; -print img_vcard($langs->trans("VCard")).' '; +print img_picto($langs->trans("VCard"),'vcard.png').' '; print $langs->trans("VCard"); print '</a>'; diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php index 7c2930b0e681be68d59eb1a4b5ab6595a08b0ba4..28efe2727d918cfe5621a5a299d7bea8d326a393 100644 --- a/htdocs/contact/index.php +++ b/htdocs/contact/index.php @@ -348,7 +348,7 @@ if ($result) // Link export vcard print '<td align="right">'; print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$obj->cidp.'">'; - print img_vcard($langs->trans("VCard")).' '; + print img_picto($langs->trans("VCard"),'vcard.png').' '; print '</a></td>'; print "</tr>\n"; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 3cd4c16ac3a4629b6e916f7a5e5a8b0686c5c6d1..44c87c56cc81f4fe0cbba2bea440e8d62159c570 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 10652319fc478620f929dc35bdfc9887959c4e68..630a458f1ab55199d169a1aa94f7fd12787ec9ca 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2613,10 +2613,18 @@ class Form print '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; print '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; print '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; - if($form_name =="") - print '<A HREF="javascript:showCalendar(document.forms[3].'.$prefix.')">'.img_cal().'</a>'; + if ($form_name =="") + { + print '<A HREF="javascript:showCalendar(document.forms[3].'.$prefix.')">'; + print '<img style="vertical-align:middle" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/calendar.png" border="0" alt="" title="">'; + print '</a>'; + } else - print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'.img_cal().'</a>'; + { + print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'; + print '<img style="vertical-align:middle" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/calendar.png" border="0" alt="" title="">'; + print '</a>'; + } } } diff --git a/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN b/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN index 2e2ddf085d0c7fa380e125b75b68055840322a01..bd02d70b0a6956b8412b58c5bc3a4746d8352ed6 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 599630175b716b99bce8cf80472a59b5e8230f82..5e7bd2bfa77227164c07d356d810d03da41a21ff 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 865c9a3c147e8e49ca4d3df8769ca097e5eee859..9d6b6ce65a57f4488b5a1c03736bcfb81f19f033 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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/vcard.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -} - -/** - \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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/edit_add.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; } /** - \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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; } -/** - \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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/disable.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -} - /** - \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 '<img style="vertical-align:middle" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/calendar.png" border="0" alt="" title="">'; -} - -/** - \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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/calc.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -} - -/** - \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 '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/alerte.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -} - -/** - \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."<BR>"; - - 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 '<b>*</b>'; } -/** - \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<strlen($hexa);$i++) - { - $bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT); - } - return $bin; -} - /** * \brief Replace CRLF in string with a HTML BR tag. @@ -2837,9 +2531,9 @@ function dol_nboflines($s,$maxchar=0) /** * \brief Fonction retournant le nombre de lignes dans un texte formate - * \param texte Texte - * \param maxlinesize Largeur de ligne en caracteres(ou 0 si pas de limite - defaut) - * \return nblines Nombre de lignes + * \param texte Texte + * \param maxlinesize Largeur de ligne en caracteres(ou 0 si pas de limite - defaut) + * \return nblines Nombre de lignes */ function num_lines($texte,$maxlinesize=0) { @@ -2911,7 +2605,7 @@ function dol_textishtml($msg,$option=0) } } -/* +/** * \brief Effectue les substitutions des mots cl�s par les donn�es en fonction du tableau * \param chaine Chaine dans laquelle faire les substitutions * \param substitutionarray Tableau cl� substitution => 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($number<strlen($numeric)) - { - return $numeric[$number]; - } - else - { - $dev_by = floor($number/strlen($numeric)); - return "" . make_alpha_from_numbers($dev_by-1) . make_alpha_from_numbers($number-($dev_by*strlen($numeric))); - } -} - /** - \brief Retourne un tableau des mois ou le mois s�lectionn� - \param selected Mois � s�lectionner ou -1 - \return string or array Month string or array if selected < 0 + * \brief Retourne un tableau des mois ou le mois selectionne + * \param selected Mois a selectionner ou -1 + * \return string or array Month string or array if selected < 0 */ function monthArrayOrSelected($selected=0) { @@ -3017,9 +2694,9 @@ function monthArrayOrSelected($selected=0) } /** - \brief Returns formated reduction - \param reduction Reduction percentage - \return string Formated reduction + * \brief Returns formated reduction + * \param reduction Reduction percentage + * \return string Formated reduction */ function dolibarr_print_reduction($reduction=0) { @@ -3027,7 +2704,6 @@ function dolibarr_print_reduction($reduction=0) $langs->load("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 = '<table '.$tableoptions.'>' ; - foreach($data as $key => $item){ - if(is_array($item)){ - $text.=array2tr($item,$troptions,$tdoptions) ; - } else { - $text.= '<tr '.$troptions.'>' ; - $text.= '<td '.$tdoptions.'>'.$key.'</td>' ; - $text.= '<td '.$tdoptions.'>'.$item.'</td>' ; - $text.= '</tr>' ; - } - } - if($tableMarkup) $text.= '</table>' ; - return $text ; -} - -/** - * \brief Return lines of an html table from an array - */ -function array2tr($data,$troptions='',$tdoptions=''){ - $text = '<tr '.$troptions.'>' ; - foreach($data as $key => $item){ - $text.= '<td '.$tdoptions.'>'.$item.'</td>' ; - } - $text.= '</tr>' ; - 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 fca3579b11b91a519f24ed23b822d32554fd83a0..c4f1399c67a92588eb84b875b3e6173f44b7539b 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 = '<tr '.$troptions.'>' ; + foreach($data as $key => $item){ + $text.= '<td '.$tdoptions.'>'.$item.'</td>' ; + } + $text.= '</tr>' ; + return $text ; +} + +/** + * \brief Return an html table from an array + */ +function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdoptions=''){ + $text='' ; + if($tableMarkup) $text = '<table '.$tableoptions.'>' ; + foreach($data as $key => $item){ + if(is_array($item)){ + $text.=array2tr($item,$troptions,$tdoptions) ; + } else { + $text.= '<tr '.$troptions.'>' ; + $text.= '<td '.$tdoptions.'>'.$key.'</td>' ; + $text.= '<td '.$tdoptions.'>'.$item.'</td>' ; + $text.= '</tr>' ; + } + } + if($tableMarkup) $text.= '</table>' ; + return $text ; +} + /** * Return next value for a mask @@ -224,4 +257,185 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date= dolibarr_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG); return $numFinal; -} \ No newline at end of file +} + + +/** + * \brief Convert a binary 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'hexadecimal en binaire + * \param string hexa + * \return string bin + */ +function hexbin($hexa) +{ + $bin=''; + for($i=0;$i<strlen($hexa);$i++) + { + $bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT); + } + return $bin; +} + + +/** + * \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 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."<BR>"; + + return sprintf("%02d",$numeroSemaine); +} + + +/** + * \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; +} + diff --git a/htdocs/lib/images.lib.php b/htdocs/lib/images.lib.php index c7b521b770a440174fb699c29ee921bd33b4277f..a78563f9389757ff8737abcf3eb8b4620b48cae2 100644 --- a/htdocs/lib/images.lib.php +++ b/htdocs/lib/images.lib.php @@ -39,6 +39,8 @@ */ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50) { + require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); + global $conf,$langs; dolibarr_syslog("functions.inc::vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality); diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 2df3a6ceace4164e7b4700969ce4ba49b6c8f8b2..5683dafe194dc27de76f8b1891902601e429a1ed 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -257,4 +257,46 @@ function show_stats_for_company($product,$socid) } +/** + * \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 unites 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]; +} + ?> diff --git a/htdocs/lib/viewfiles.lib.php b/htdocs/lib/viewfiles.lib.php index 1dbbf2a2ef309be8d7b846cecdeb2fd81459d3f0..f53533445fed3a7dd8bf034920dfd925043174a8 100644 --- a/htdocs/lib/viewfiles.lib.php +++ b/htdocs/lib/viewfiles.lib.php @@ -19,11 +19,28 @@ */ /** - \file htdocs/lib/excel.lib.php - \brief Ensemble de fonctions de base de dolibarr sous forme d'include - \version $Id$ -*/ + * \file htdocs/lib/viewfiles.lib.php + * \brief Set of function to view file content + * \version $Id$ + */ + +/** + * + */ +function make_alpha_from_numbers($number) +{ + $numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + if($number<strlen($numeric)) + { + return $numeric[$number]; + } + else + { + $dev_by = floor($number/strlen($numeric)); + return "" . make_alpha_from_numbers($dev_by-1) . make_alpha_from_numbers($number-($dev_by*strlen($numeric))); + } +} /** * \brief Affiche le contenu d'un fichier CSV sous forme de tableau diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 4212e4979ae87a387c472317a38d748d80d759d0..f9e06ad860fe2b6af40b5ada937e4ab371118da3 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -315,7 +315,7 @@ if ($_GET["action"] == 'create') // Stock if ($stock < $quantite_a_livrer) { - print '<td align="center">'.$stock.' '.img_alerte().'</td>'; + print '<td align="center">'.$stock.' '.img_warning().'</td>'; } else { @@ -324,7 +324,7 @@ if ($_GET["action"] == 'create') } else { - // Quantit� � livrer + // Quantite a livrer print '<td align="center">'; print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">'; print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 56783f22cb7d349c1061b7e604830e65717de8e2..1f720aa60120a5be6d70771d8e2206f91db1699b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -386,7 +386,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($user->rights->produit->creer) { print '<a href="fournisseurs.php?id='.$product->id.'&socid='.$objp->socid.'&action=add_price&rowid='.$objp->rowid.'">'.img_edit()."</a>"; - print '<a href="fournisseurs.php?id='.$product->id.'&socid='.$objp->socid.'&action=remove_pf&rowid='.$objp->rowid.'">'.img_disable($langs->trans("Remove")).'</a>'; + print '<a href="fournisseurs.php?id='.$product->id.'&socid='.$objp->socid.'&action=remove_pf&rowid='.$objp->rowid.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>'; } print '</td>';