This commit is contained in:
Laurent Destailleur 2011-05-25 13:27:07 +00:00
parent c7dfa3d8fc
commit a96c13b8ad
7 changed files with 74 additions and 64 deletions

View File

@ -141,7 +141,7 @@ class Translate {
* If data for file already loaded, do nothing.
* All data in translation array are stored in UTF-8 format.
* tab_loaded is completed with $domain key.
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* @param domain File name to load (.lang file). Use file@module if file is in a module directory.
* @param alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US or fr_FR or es_ES)
* @param stopafterdirection Stop when the DIRECTION tag is found (optimize)

View File

@ -28,7 +28,7 @@
/**
* Show filter form in agenda view
*
* @param $form
* @param $canedit
* @param $status
* @param $year

View File

@ -27,6 +27,7 @@
/**
* Get value of an HTML field, do Ajax process and show result
* @param selected Preselecte value
* @param htmlname HTML name of input field
* @param url Url for request: /chemin/fichier.php
* @param option More parameters on URL request
@ -207,9 +208,9 @@ function ajax_combobox($htmlname)
$( "#'.$htmlname.'" ).combobox();
});
</script>';
$msg.= "\n";
return $msg;
}
@ -220,7 +221,7 @@ function ajax_combobox($htmlname)
function ajax_constantonoff($code)
{
global $conf, $langs;
$out= '<script type="text/javascript">
$(function() {
$( "#set_'.$code.'" ).click(function() {
@ -245,17 +246,17 @@ function ajax_constantonoff($code)
});
});
</script>';
$out.= '<span id="set_'.$code.'" class="linkobject '.($conf->global->$code?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.($conf->global->$code?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
return $out;
}
/**
*
* Enter description here ...
* @param unknown_type $var
* Convert a PHP array into a js array
* @param $var
* @return String with js array or false if error
*/
function php2js($var)
{
@ -277,7 +278,7 @@ function php2js($var)
return "\"" . addslashes(stripslashes($var)) . "\"";
}
// autres cas: objets, on ne les gère pas
return FALSE;
return false;
}

View File

@ -330,11 +330,11 @@ function getFormeJuridiqueLabel($code)
/**
* \brief Show html area for list of projects
* \param conf Object conf
* \param lang Object lang
* \param db Database handler
* \param objsoc Third party object
* Show html area for list of projects
* @param conf Object conf
* @param lang Object lang
* @param db Database handler
* @param object Third party object
*/
function show_projects($conf,$langs,$db,$object)
{
@ -419,11 +419,11 @@ function show_projects($conf,$langs,$db,$object)
/**
* \brief Show html area for list of contacts
* \param conf Object conf
* \param lang Object lang
* \param db Database handler
* \param objsoc Third party object
* Show html area for list of contacts
* @param conf Object conf
* @param lang Object lang
* @param db Database handler
* @param object Third party object
*/
function show_contacts($conf,$langs,$db,$object)
{
@ -881,7 +881,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
* @param conf Object conf
* @param lang Object lang
* @param db Database handler
* @param objsoc Third party object
* @param object Third party object
*/
function show_subsidiaries($conf,$langs,$db,$object)
{

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
@ -200,35 +200,37 @@ function dol_get_next_month($month, $year)
}
/** Return previous week
* @param day Day
* @param week Week
* @param year Year
* @return array Previous year,month,week
* @return array Previous year,month,day
*/
function dol_get_prev_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
$time-=24*60*60*7;
$tmparray=dol_getdate($time,true);
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return next week
* @param week Week
* @param day Day
* @param week Week
* @param year Year
* @return array Next year,month,week
* @return array Next year,month,day
*/
function dol_get_next_week($day,$week, $month, $year)
function dol_get_next_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
$time+=24*60*60*7;
$tmparray=dol_getdate($time,true);
return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']);
}
/** Return GMT time for first day of a month or year
@ -277,74 +279,75 @@ function dol_get_last_day($year,$month=12,$gm=false)
* @param gm False = Return date to compare with server TZ, True to compare with GM date.
* @return array year,month, week,first_day,prev_year,prev_month,prev_day
*/
function dol_get_first_day_week($day,$month,$year,$gm=false)
function dol_get_first_day_week($day,$month,$year,$gm=false)
{
global $conf;
$date = dol_mktime(0,0,0,$month,$day,$year,$gm);
//Checking conf of start week
$start_week = (isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1);
$tmparray = dol_getdate($date,true);
//Calculate days to count
//Calculate days to count
$days = $start_week - $tmparray['wday'];
if ($days>=1) $days=7-$days;
$days = abs($days);
$seconds = $days*24*60*60;
//Get first day of week
$tmpday = date($tmparray[0])-$seconds;
$tmpday = date("d",$tmpday);
//Check first day of week is form this month or not
if ($tmpday>$day)
{
$prev_month = $month-1;
$prev_year = $year;
if ($prev_month==0)
{
$prev_month = 12;
$prev_year = $year-1;
}
}
else
else
{
$prev_month = $month;
$prev_year = $year;
}
//Get first day of next week
//Get first day of next week
$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0);
$tmptime-=24*60*60*7;
$tmparray=dol_getdate($tmptime,true);
$prev_day = $tmparray['mday'];
//Check first day of week is form this month or not
if ($prev_day>$tmpday)
{
$prev_month = $month-1;
$prev_year = $year;
if ($prev_month==0)
{
$prev_month = 12;
$prev_year = $year-1;
}
}
$week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm));
return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
}
/**
* Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
* @remarks Called by function num_open_day
* Called by function num_open_day
* @param timestampStart Timestamp de debut
* @param timestampEnd Timestamp de fin
* @param countrycode Country code
* @return nbFerie Nombre de jours feries
*/
function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')

View File

@ -554,7 +554,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* Remove a file or several files with a mask
* @param file File to delete or mask of file to delete
* @param disableglob Disable usage of glob like *
* @param boolean True if file is deleted, False if error
* @return boolean True if file is deleted, False if error
*/
function dol_delete_file($file,$disableglob=0)
{
@ -582,7 +582,7 @@ function dol_delete_file($file,$disableglob=0)
/**
* Remove a directory (not recursive, so content must be empty).
* If directory is not empty, return false
* @param file Directory to delete
* @param dir Directory to delete
* @return boolean True if success, false if error
*/
function dol_delete_dir($dir)
@ -593,7 +593,7 @@ function dol_delete_dir($dir)
/**
* Remove a directory $dir and its subdirectories
* @param file Dir to delete
* @param dir Dir to delete
* @param count Counter to count nb of deleted elements
* @return int Number of files and directory removed
*/

View File

@ -550,6 +550,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
* false or 'tzserver'=output string is for local PHP server TZ usage
* 'tzuser'=output string is for local browser TZ usage
* @param outputlangs Object lang that contains language for text translation.
* @param encodetooutput false=no convert into output pagecode
* @return string Formated date or '' if time is null
* @see dol_mktime, dol_stringtotime, dol_getdate
*/
@ -2285,10 +2286,12 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
/**
* Affiche message erreur de type acces interdit et arrete le programme
* L'appel a cette fonction termine le code.
* @param message Force error message
* @param printheader Affiche avant le header
* Show a message to say access is forbidden and stop program
* Calling this function terminate execution of PHP.
* @param message Force error message
* @param printheader Show header before
* @param printfooter Show footer after
* @param showonlymessage Show only message parameter. Otherwise add more information.
*/
function accessforbidden($message='',$printheader=1,$printfooter=1,$showonlymessage=0)
{
@ -3369,8 +3372,9 @@ function dol_htmlcleanlastbr($stringtodecode)
/**
* This function is called to decode a string with HTML entities (it decodes entities tags)
* @param string stringhtml
* @return string decodestring
* @param stringhtml stringhtml
* @param pagecodeto Encoding of input string
* @return string decodestring
*/
function dol_entity_decode($stringhtml,$pagecodeto='UTF-8')
{
@ -3380,9 +3384,10 @@ function dol_entity_decode($stringhtml,$pagecodeto='UTF-8')
/**
* Replace html_entity_decode functions to manage errors
* @param unknown_type $a
* @param unknown_type $b
* @param unknown_type $c
* @param a
* @param b
* @param c
* @return string String decoded
*/
function dol_html_entity_decode($a,$b,$c)
{
@ -3393,9 +3398,10 @@ function dol_html_entity_decode($a,$b,$c)
/**
* Replace htmlentities functions to manage errors
* @param unknown_type $a
* @param unknown_type $b
* @param unknown_type $c
* @param a
* @param b
* @param c
* @return string String encoded
*/
function dol_htmlentities($a,$b,$c)
{
@ -3489,7 +3495,7 @@ function dol_microtime_float()
return ((float)$usec + (float)$sec);
}
/*
/**
* Return if a text is a html content
* @param msg Content to check
* @param option 0=Full detection, 1=Fast check