bug 278 fixed: calendar on date_available could not work because
date_available has a datetime MySQL column format while date_creation has a date MySQL column format. We use DATE_FORMAT MySQL function to resolv this issue. git-svn-id: http://piwigo.org/svn/branches/branch-1_5@1054 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
01b388d518
commit
5865079907
2 changed files with 7 additions and 4 deletions
|
@ -187,7 +187,8 @@ elseif (isset($page['calendar_day']))
|
||||||
SELECT category_id AS category, COUNT(id) AS count
|
SELECT category_id AS category, COUNT(id) AS count
|
||||||
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
|
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
|
||||||
'.$page['where'].'
|
'.$page['where'].'
|
||||||
AND '.$conf['calendar_datefield'].' = \''.$page['calendar_date'].'\'
|
AND DATE_FORMAT('.$conf['calendar_datefield'].', \'%Y-%c-%e\')'
|
||||||
|
.' = \''.$page['calendar_date'].'\'
|
||||||
GROUP BY category_id
|
GROUP BY category_id
|
||||||
;';
|
;';
|
||||||
$result = pwg_query($query);
|
$result = pwg_query($query);
|
||||||
|
@ -337,7 +338,8 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||||
, DAYOFWEEK(\''.$calendar_day.'\') AS dow
|
, DAYOFWEEK(\''.$calendar_day.'\') AS dow
|
||||||
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
|
FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id
|
||||||
'.$page['where'].'
|
'.$page['where'].'
|
||||||
AND '.$conf['calendar_datefield'].' = \''.$calendar_day.'\'
|
AND DATE_FORMAT('.$conf['calendar_datefield'].', \'%Y-%m-%d\')'
|
||||||
|
.' = \''.$calendar_day.'\'
|
||||||
ORDER BY RAND()
|
ORDER BY RAND()
|
||||||
LIMIT 0,1
|
LIMIT 0,1
|
||||||
;';
|
;';
|
||||||
|
@ -405,7 +407,8 @@ elseif (isset($page['calendar_day']))
|
||||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||||
'.$page['where'].'
|
'.$page['where'].'
|
||||||
AND '.$conf['calendar_datefield'].' = \''.$page['calendar_date'].'\'';
|
AND DATE_FORMAT('.$conf['calendar_datefield'].', \'%Y-%c-%e\')'
|
||||||
|
.' = \''.$page['calendar_date'].'\'';
|
||||||
if ($calendar_category != 0)
|
if ($calendar_category != 0)
|
||||||
{
|
{
|
||||||
$query.= '
|
$query.= '
|
||||||
|
|
|
@ -487,7 +487,7 @@ function initialize_category( $calling_page = 'category' )
|
||||||
$key = $datefield;
|
$key = $datefield;
|
||||||
if (isset($search['fields'][$key]))
|
if (isset($search['fields'][$key]))
|
||||||
{
|
{
|
||||||
$local_clause = $datefield." = '";
|
$local_clause = 'DATE_FORMAT('.$datefield.", '%Y-%m-%d') = '";
|
||||||
$local_clause.= str_replace('.', '-',
|
$local_clause.= str_replace('.', '-',
|
||||||
$search['fields'][$key]['words'][0]);
|
$search['fields'][$key]['words'][0]);
|
||||||
$local_clause.= "'";
|
$local_clause.= "'";
|
||||||
|
|
Loading…
Add table
Reference in a new issue