From dd3fbbd7e47b7479c95f71cf1c3a182d5aff2ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Wed, 29 Jun 2011 14:30:17 +0200 Subject: [PATCH 1/5] Fixes to support older PHP versions. --- src/IDF/Project.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/IDF/Project.php b/src/IDF/Project.php index 14f66c7..ca1df1a 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -152,15 +152,14 @@ class IDF_Project extends Pluf_Model break; } $sqlIssueTable = Pluf::factory('IDF_Issue')->getSqlTable(); - $query = <<<"QUERY" -SELECT uid AS id,COUNT(uid) AS nb + $query = "SELECT uid AS id,COUNT(uid) AS nb FROM ( SELECT COALESCE(owner, -1) AS uid FROM $sqlIssueTable WHERE status IN ($tags) ) AS ff -GROUP BY uid -QUERY; +GROUP BY uid" + $db = Pluf::db(); $dbData = $db->select($query); $ownerStatistics = array(); From 2c2da6082ac9a820ce9cb194a27b2bdff33c0add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20d=27Anterroches?= Date: Wed, 29 Jun 2011 14:41:57 +0200 Subject: [PATCH 2/5] Fixed stupid missing semicolon. --- src/IDF/Project.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IDF/Project.php b/src/IDF/Project.php index ca1df1a..66a070e 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -158,7 +158,7 @@ FROM ( FROM $sqlIssueTable WHERE status IN ($tags) ) AS ff -GROUP BY uid" +GROUP BY uid"; $db = Pluf::db(); $dbData = $db->select($query); From 324b20221577880b89586bac0e94248d3bc5af6d Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 29 Jun 2011 17:41:18 +0200 Subject: [PATCH 3/5] Fix the rendering of issue changes in a mail template and the issue feed fragment. --- src/IDF/templates/idf/issues/feedfragment.xml | 14 ++++++++++++-- .../templates/idf/issues/issue-updated-email.txt | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/IDF/templates/idf/issues/feedfragment.xml b/src/IDF/templates/idf/issues/feedfragment.xml index 15fda48..b44b946 100644 --- a/src/IDF/templates/idf/issues/feedfragment.xml +++ b/src/IDF/templates/idf/issues/feedfragment.xml @@ -10,12 +10,22 @@ {if $attachments.count() > 0}
    -{foreach $attachments as $a}
  • {$a.filename} - {$a.filesize|ssize}
  • {/foreach} +{foreach $attachments as $a}
  • {$a.filename} - {$a.filesize|ssize}
  • {/foreach}
{/if} {if $c.changes} {foreach $c.changes as $w => $v} -{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}
+{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}{if $w == 'rel'}{trans 'Relations:'}{/if} +{if $w == 'lb' or $w == 'rel'} + {foreach $v as $t => $ls} + {foreach $ls as $l} + {if $t == 'rem'}{/if}{$l}{if $t == 'rem'}{/if} + {/foreach} + {/foreach} +{else} + {$v} +{/if}
{/foreach} {/if} + diff --git a/src/IDF/templates/idf/issues/issue-updated-email.txt b/src/IDF/templates/idf/issues/issue-updated-email.txt index 62aaa7a..3597dec 100644 --- a/src/IDF/templates/idf/issues/issue-updated-email.txt +++ b/src/IDF/templates/idf/issues/issue-updated-email.txt @@ -16,7 +16,7 @@ {if strlen($c.content) > 0}{$c.content|safe}{/if}{if $c.changedIssue()} {foreach $c.changes as $w => $v} - {if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}{/foreach}{/if}{assign $attachments = $c.get_attachment_list()}{if $attachments.count() > 0} + {if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}{if $w == 'rel'}{trans 'Relations:'}{/if} {if $w == 'lb' or $w == 'rel'}{foreach $v as $t => $ls}{foreach $ls as $l}{if $t == 'rem'}-{/if}{$l} {/foreach}{/foreach}{else}{$v}{/if}{/foreach}{/if}{assign $attachments = $c.get_attachment_list()}{if $attachments.count() > 0} {trans 'Attachments:'}{foreach $attachments as $a} - {$a.filename|safe} - {$a.filesize|ssize} From 7b2552f9409c326afb9b7d4e4c5bfb65ae340d85 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Thu, 30 Jun 2011 00:25:29 +0200 Subject: [PATCH 4/5] Postgres (and probably others as well) needs an explicit char cast. --- src/IDF/Views/Issue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index fc9d7b4..297e02f 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -747,7 +747,7 @@ class IDF_Views_Issue else { // ID-based search if (is_numeric($query)) { - $sql = new Pluf_SQL('project=%s AND id LIKE %s', array($prj->id, $query.'%')); + $sql = new Pluf_SQL('project=%s AND CAST(id AS CHAR) LIKE %s', array($prj->id, $query.'%')); $tmp = Pluf::factory('IDF_Issue')->getList(array( 'filter' => $sql->gen(), 'order' => 'id ASC' From 3a8c56acc4430547efe9cdadc32c706d1bed6a99 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Fri, 1 Jul 2011 13:35:43 +0200 Subject: [PATCH 5/5] Postgres needs a VARCHAR cast, which MySQL doesn't understand, of course. *sigh* --- src/IDF/Views/Issue.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index 297e02f..9c749af 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -747,7 +747,13 @@ class IDF_Views_Issue else { // ID-based search if (is_numeric($query)) { - $sql = new Pluf_SQL('project=%s AND CAST(id AS CHAR) LIKE %s', array($prj->id, $query.'%')); + $sql = 'project=%s AND CAST(id AS VARCHAR) LIKE %s'; + // MySQL can't cast to VARCHAR and a CAST to CHAR converts + // the whole number, not just the first digit + if (strtolower(Pluf::f('db_engine')) == 'mysql') { + $sql = 'project=%s AND CAST(id AS CHAR) LIKE %s'; + } + $sql = new Pluf_SQL($sql, array($prj->id, $query.'%')); $tmp = Pluf::factory('IDF_Issue')->getList(array( 'filter' => $sql->gen(), 'order' => 'id ASC'