Commit 88600c94ef744f284f871da8482900f3d0bb00f8
1 parent
70c8f988
Don't set boolean SQL values to '1' directly, use abstraction layer
instead. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3320 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
12 additions
and
5 deletions
lib/documentmanagement/Document.inc
| ... | ... | @@ -535,11 +535,18 @@ class Document extends KTEntity { |
| 535 | 535 | $aDocumentFieldArray; |
| 536 | 536 | settype($aDocumentFieldArray,"array"); |
| 537 | 537 | $sql = $default->db; |
| 538 | - $result = $sql->query(array("SELECT DF.id AS id, DF.name AS name, DF.data_type AS data_type " ./*ok*/ | |
| 539 | - "FROM $default->document_fields_table AS DF " . | |
| 540 | - "INNER JOIN $default->document_type_fields_table AS DTFL ON DF.id = DTFL.field_id " . | |
| 541 | - "WHERE DTFL.document_type_id = ? " . ($bMandatoryOnly ? "AND DFTL.is_mandatory = 1 " : " ") . | |
| 542 | - "ORDER BY DF.name ASC", $iDocumentTypeID)); | |
| 538 | + $sQuery = "SELECT DF.id AS id, DF.name AS name, DF.data_type AS data_type " ./*ok*/ | |
| 539 | + "FROM $default->document_fields_table AS DF " . | |
| 540 | + "INNER JOIN $default->document_type_fields_table AS DTFL ON DF.id = DTFL.field_id " . | |
| 541 | + "WHERE DTFL.document_type_id = ? "; | |
| 542 | + $aParams = array($iDocumentTypeID); | |
| 543 | + if ($bMandatoryOnly) { | |
| 544 | + $sQuery .= "AND DFTL.is_mandatory = ? "; | |
| 545 | + $aParams[] = true; | |
| 546 | + } | |
| 547 | + $sQuery .= "ORDER BY DF.name ASC"; | |
| 548 | + $result = $sql->query(array($sQuery, $aParams)); | |
| 549 | + | |
| 543 | 550 | if ($result) { |
| 544 | 551 | $iCount = 0; |
| 545 | 552 | while ($sql->next_record()) { | ... | ... |