View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Term Query - ProjeQtOr
 
 

Term Query

More
22 Dec 2016 08:59 #1 by antonio.grr
Term Query was created by antonio.grr
Hi.
In term.php the query prepared to find Terms uses table name without prefix to specify fields. As elsewhere the method getDatabaseTableName() should be used.
Best wishes.

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 09:29 #2 by babynus
Replied by babynus on topic Term Query
I don't find a query build in /model/Term.php.
Could you point out line number ?

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 09:50 - 22 Dec 2016 09:51 #3 by antonio.grr
Replied by antonio.grr on topic Term Query
Actually it's just the where clause
$where = '1=1';
if ($idProject) $where .= ' AND term.idProject = '.$idProject;
if ($periodType) {
$start=date('Y-m-d');
$end=date('Y-m-d');
if ($periodType=='year') {
$start=$paramYear . '-01-01';
$end=$paramYear . '-12-31';
} else if ($periodType=='month') {
$start=$paramYear . '-' . (($paramMonth<10)?'0':'') . $paramMonth . '-01';
$end=$paramYear . '-' . (($paramMonth<10)?'0':'') . $paramMonth . '-' . date('t',mktime(0,0,0,$paramMonth,1,$paramYear));
} if ($periodType=='week') {
$start=date('Y-m-d', firstDayofWeek($paramWeek, $paramYear));
$end=addDaysToDate($start,6);
}
$where.=" AND ( term.date >= '" . $start . "'";
$where.=" and term.date <='" . $end . "' )";
}

As you can see date and idProject are prefixed "term.".
My fix

//On construit la clause where
$term = new Term();
$termAlias = $term->getDatabaseTableName();
$where = '1=1';
if ($idProject)
$where .= " AND ".$termAlias . ".idProject = " . $idProject;
if ($periodType) {
$start = date('Y-m-d');
$end = date('Y-m-d');
if ($periodType == 'year') {
$start = $paramYear . '-01-01';
$end = $paramYear . '-12-31';
} else if ($periodType == 'month') {
$start = $paramYear . '-' . (($paramMonth < 10) ? '0' : '') . $paramMonth . '-01';
$end = $paramYear . '-' . (($paramMonth < 10) ? '0' : '') . $paramMonth . '-' . date('t', mktime(0, 0, 0, $paramMonth, 1, $paramYear));
} if ($periodType == 'week') {
$start = date('Y-m-d', GlbCalendar::istanza()->firstDayofWeek($paramWeek, $paramYear));
$end = GlbCalendar::istanza()->addDaysToDate($start, 6);
}
$where.=" AND ( ".$termAlias . ".date >= '" . $start . "'";
$where.=" and ". $termAlias . ".date <='" . $end . "' )";
}

$termList = $term->getSqlElementsFromCriteria(null, false, $where);
Last edit: 22 Dec 2016 09:51 by antonio.grr.
The following user(s) said Thank You: babynus

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 10:29 #4 by babynus
Replied by babynus on topic Term Query
OK !

So it's not in /modle/Term.php but in /report/term.php, I was not looking at the right file.

Thanks for your fix.
It will be included in next patch / version.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.032 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.