Fix: postgresql compatibility
This commit is contained in:
parent
1048f73d22
commit
10e0b270df
@ -109,12 +109,13 @@ if ($year > 0)
|
||||
$sql .= " AND (";
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql .= " (s.periode is not null and date_format(s.periode, '%Y') = $year) ";
|
||||
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = $year)";
|
||||
$sql .= " (s.periode is not null and s.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= "or (s.periode is null and s.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= ")";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
//$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("compta/charges/index.php: select payment sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -479,7 +479,7 @@ class PaiementCharge extends CommonObject
|
||||
$sql.= " t.fk_user_modif,";
|
||||
$sql.= " pt.code as type_code, pt.libelle as type_libelle,";
|
||||
$sql.= ' b.fk_account';
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."paiementcharge as t, ".MAIN_DB_PREFIX."c_paiement as pt)";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."paiementcharge as t)";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
|
||||
$sql.= " WHERE t.rowid = ".$id." AND t.fk_typepaiement = pt.id";
|
||||
|
||||
|
||||
@ -131,8 +131,8 @@ function dol_get_next_month($month, $year)
|
||||
* \param year Year
|
||||
* \param month Month
|
||||
* \param gm False = Return date to compare with server TZ, True to compare with GM date.
|
||||
* Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after dol_print_date will return 1970-01-01 00:00:00
|
||||
* Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after dol_print_date will return 1970-01-01 00:00:00
|
||||
* Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00
|
||||
* Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00
|
||||
* \return Timestamp Date for first day
|
||||
*/
|
||||
function dol_get_first_day($year,$month=1,$gm=false)
|
||||
|
||||
@ -162,7 +162,7 @@ function dol_compare_file($a, $b)
|
||||
* Return mime type of a file
|
||||
* @param file Filename
|
||||
* @param default Default mime type if extension not found in known list
|
||||
* @param mode 0=Return short mime, 1=otherwise full mime string, 2=image for mime
|
||||
* @param mode 0=Return short mime, 1=otherwise full mime string, 2=image for mime, 3=source language
|
||||
* @return string Return a mime type family
|
||||
* (text/xxx, application/xxx, image/xxx, audio, video, archive)
|
||||
*/
|
||||
@ -170,26 +170,31 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
{
|
||||
$mime=$default;
|
||||
$imgmime='other.png';
|
||||
$srclang='';
|
||||
|
||||
// Text files
|
||||
if (preg_match('/\.txt$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.rtx$/i',$file)) { $mime='text/richtext'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.csv$/i',$file)) { $mime='text/csv'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.tsv$/i',$file)) { $mime='text/tab-separated-values'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(cf|conf|ini|log)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.css$/i',$file)) { $mime='text/css'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(cf|conf|log)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.ini$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='ini'; }
|
||||
if (preg_match('/\.css$/i',$file)) { $mime='text/css'; $imgmime='text.png'; $srclang='css'; }
|
||||
// Certificate files
|
||||
if (preg_match('/\.(crt|cer|key|pub)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
// HTML
|
||||
if (preg_match('/\.(html|htm|shtml)$/i',$file)) { $mime='text/html'; $imgmime='html.png'; }
|
||||
// HTML/XML
|
||||
if (preg_match('/\.(html|htm|shtml)$/i',$file)) { $mime='text/html'; $imgmime='html.png'; $srclang='html'; }
|
||||
if (preg_match('/\.(xml|xhtml)$/i',$file)) { $mime='text/xml'; $imgmime='other.png'; $srclang='xml'; }
|
||||
// Languages
|
||||
if (preg_match('/\.bas$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(c|cpp|h)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.(java|jsp)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.php$/i',$file)) { $mime='text/plain'; $imgmime='php.png'; }
|
||||
if (preg_match('/\.(pl|pm)$/i',$file)) { $mime='text/plain'; $imgmime='pl.png'; }
|
||||
if (preg_match('/\.sql$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; }
|
||||
if (preg_match('/\.js$/i',$file)) { $mime='text/x-javascript'; $imgmime='jscript.png'; }
|
||||
if (preg_match('/\.bas$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='bas'; }
|
||||
if (preg_match('/\.(c)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='c'; }
|
||||
if (preg_match('/\.(cpp)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='cpp'; }
|
||||
if (preg_match('/\.(h)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='h'; }
|
||||
if (preg_match('/\.(java|jsp)$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='java'; }
|
||||
if (preg_match('/\.php$/i',$file)) { $mime='text/plain'; $imgmime='php.png'; $srclang='php'; }
|
||||
if (preg_match('/\.(pl|pm)$/i',$file)) { $mime='text/plain'; $imgmime='pl.png'; $srclang='perl'; }
|
||||
if (preg_match('/\.sql$/i',$file)) { $mime='text/plain'; $imgmime='text.png'; $srclang='sql'; }
|
||||
if (preg_match('/\.js$/i',$file)) { $mime='text/x-javascript'; $imgmime='jscript.png'; $srclang='js'; }
|
||||
// Open office
|
||||
if (preg_match('/\.odp$/i',$file)) { $mime='application/vnd.oasis.opendocument.presentation'; $imgmime='other.png'; }
|
||||
if (preg_match('/\.ods$/i',$file)) { $mime='application/vnd.oasis.opendocument.spreadsheet'; $imgmime='other.png'; }
|
||||
@ -206,10 +211,10 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
// Other
|
||||
if (preg_match('/\.pdf$/i',$file)) { $mime='application/pdf'; $imgmime='pdf.png'; }
|
||||
// Scripts
|
||||
if (preg_match('/\.bat$/i',$file)) { $mime='text/x-bat'; $imgmime='script.png'; }
|
||||
if (preg_match('/\.sh$/i',$file)) { $mime='text/x-sh'; $imgmime='script.png'; }
|
||||
if (preg_match('/\.ksh$/i',$file)) { $mime='text/x-ksh'; $imgmime='script.png'; }
|
||||
if (preg_match('/\.bash$/i',$file)) { $mime='text/x-bash'; $imgmime='script.png'; }
|
||||
if (preg_match('/\.bat$/i',$file)) { $mime='text/x-bat'; $imgmime='script.png'; $srclang='dos'; }
|
||||
if (preg_match('/\.sh$/i',$file)) { $mime='text/x-sh'; $imgmime='script.png'; $srclang='bash'; }
|
||||
if (preg_match('/\.ksh$/i',$file)) { $mime='text/x-ksh'; $imgmime='script.png'; $srclang='bash'; }
|
||||
if (preg_match('/\.bash$/i',$file)) { $mime='text/x-bash'; $imgmime='script.png'; $srclang='bash'; }
|
||||
// Images
|
||||
if (preg_match('/\.ico$/i',$file)) { $mime='image/x-icon'; $imgmime='image.png'; }
|
||||
if (preg_match('/\.(jpg|jpeg)$/i',$file)) { $mime='image/jpeg'; $imgmime='image.png'; }
|
||||
@ -239,11 +244,14 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
||||
$tmp=explode('/',$mime);
|
||||
return $tmp[1];
|
||||
}
|
||||
|
||||
if ($mode == 2)
|
||||
{
|
||||
return $imgmime;
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
return $srclang;
|
||||
}
|
||||
|
||||
return $mime;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
@ini_set('memory_limit', '48M'); // This may be useless if memory is hard limited by your PHP
|
||||
@ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP
|
||||
|
||||
// For optionnal tuning. Enabled if environment variable DOL_TUNING is defined.
|
||||
// A call first. Is the equivalent function dol_microtime_float not yet loaded.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user