[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6678] property: Fix sql bug
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6678] property: Fix sql bug |
Date: |
Thu, 16 Dec 2010 13:08:52 +0000 |
Revision: 6678
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6678
Author: sigurdne
Date: 2010-12-16 13:08:52 +0000 (Thu, 16 Dec 2010)
Log Message:
-----------
property: Fix sql bug
Modified Paths:
--------------
trunk/property/inc/class.sodocument.inc.php
trunk/property/inc/class.soworkorder.inc.php
Modified: trunk/property/inc/class.sodocument.inc.php
===================================================================
--- trunk/property/inc/class.sodocument.inc.php 2010-12-15 17:57:14 UTC (rev
6677)
+++ trunk/property/inc/class.sodocument.inc.php 2010-12-16 13:08:52 UTC (rev
6678)
@@ -431,12 +431,11 @@
}
$document['descr'] =
$this->db->db_addslashes($document['descr']);
- $document['name'] =
$this->db->db_addslashes($document['name']);
$document['title'] =
$this->db->db_addslashes($document['title']);
//_debug_array($document);
$values= array(
- $document['document_name'],
+
$this->db->db_addslashes($document['document_name']),
$document['link'],
$document['title'],
'public',
@@ -483,21 +482,23 @@
function edit($document)
{
$receipt = array();
- while (is_array($document['location']) &&
list($input_name,$value) = each($document['location']))
+ $value_set=array();
+ if (isset($document['location']) &&
is_array($document['location']))
{
- $vals[] = "$input_name = '$value'";
+ foreach($document['location'] as $input_name =>
$value)
+ {
+ $value_set[$input_name] = $value;
+ }
}
- while (is_array($document['extra']) &&
list($input_name,$value) = each($document['extra']))
+ if (isset($document['extra']) &&
is_array($document['extra']))
{
- $vals[] = "$input_name = '$value'";
+ foreach($document['extra'] as $input_name =>
$value)
+ {
+ $value_set[$input_name] = $value;
+ }
}
- if($vals)
- {
- $vals = "," . implode(",",$vals);
- }
-
if($document['street_name'])
{
$address[]= $document['street_name'];
@@ -588,29 +589,23 @@
if($document['link'])
{
- unset($document['document_name']);
+ $document['document_name'] = '';
}
- $document['descr'] =
$this->db->db_addslashes($document['descr']);
- $document['name'] =
$this->db->db_addslashes($document['name']);
- $document['title'] =
$this->db->db_addslashes($document['title']);
+ $value_set['document_name'] =
$this->db->db_addslashes($document['document_name']);
+ $value_set['link'] =
$document['link'];
+ $value_set['title'] =
$this->db->db_addslashes($document['title']);
+ $value_set['branch_id'] =
$document['branch_id'];
+ $value_set['status'] = $document['status'];
+ $value_set['category'] = $document['doc_type'];
+ $value_set['document_date'] =
$document['document_date'];
+ $value_set['coordinator'] =
$document['coordinator'];
+ $value_set['descr'] =
$this->db->db_addslashes($document['descr']);
+ $value_set['version'] = $document['version'];
+ $value_set['location_code'] =
$document['location_code'];
+ $value_set['vendor_id'] =
$document['vendor_id'];
+ $value_set['address'] = $address;
- $value_set=array(
- 'document_name' =>$document['document_name'],
- 'link' =>$document['link'],
- 'title' =>$document['title'],
- 'branch_id'
=>$document['branch_id'],
- 'status' =>$document['status'],
- 'category' =>$document['doc_type'],
- 'document_date' =>$document['document_date'],
- 'coordinator' =>$document['coordinator'],
- 'descr' =>$document['descr'],
- 'version' =>$document['version'],
- 'location_code' =>$document['location_code'],
- 'vendor_id'
=>$document['vendor_id'],
- 'address' =>$address
- );
-
$value_set =
$this->db->validate_update($value_set);
$this->db->query("UPDATE fm_document set $value_set
$vals WHERE id= '" . $document['document_id'] ."'",__LINE__,__FILE__);
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2010-12-15 17:57:14 UTC
(rev 6677)
+++ trunk/property/inc/class.soworkorder.inc.php 2010-12-16 13:08:52 UTC
(rev 6678)
@@ -585,7 +585,7 @@
$sql = "SELECT fm_workorder.*, fm_chapter.descr as
chapter ,fm_workorder.user_id as user_id FROM fm_workorder"
// . " $this->join fm_project on
fm_workorder.project_id=fm_project.id"
. " $this->left_join fm_chapter on "
- . " fm_workorder.chapter_id = fm_chapter.id
where fm_workorder.id={$workorder_id}";
+ . " fm_workorder.chapter_id = fm_chapter.id
WHERE fm_workorder.id='{$workorder_id}'";
$this->db->query($sql,__LINE__,__FILE__);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6678] property: Fix sql bug,
Sigurd Nes <=