[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16858] Generic documents
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16858] Generic documents |
Date: |
Fri, 9 Jun 2017 16:22:07 -0400 (EDT) |
Revision: 16858
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16858
Author: sigurdne
Date: 2017-06-09 16:22:07 -0400 (Fri, 09 Jun 2017)
Log Message:
-----------
Generic documents
Modified Paths:
--------------
trunk/property/inc/class.sogeneric_document.inc.php
Modified: trunk/property/inc/class.sogeneric_document.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric_document.inc.php 2017-06-09 19:24:18 UTC
(rev 16857)
+++ trunk/property/inc/class.sogeneric_document.inc.php 2017-06-09 20:22:07 UTC
(rev 16858)
@@ -86,7 +86,7 @@
if ($cat_id)
{
- $filtermethod .= " AND b.metadata @>
'{\"cat_id\":\"{$cat_id}\"}'";
+ $filtermethod .= " AND b.metadata->>'cat_id' =
'{$cat_id}'";
}
if ($location_id)
@@ -362,15 +362,24 @@
public function update( $data = array(), $file_id)
{
$receipt = array();
- $value_set = array
- (
- 'metadata' => json_encode($data)
- );
- $value_set = $this->db->validate_update($value_set);
+ $this->db->transaction_begin();
+
+ if($data)
+ {
+ foreach ($data as $key => $value)
+ {
+ $value =
$this->db->db_addslashes($value);
+ $sql = "UPDATE phpgw_vfs_filedata SET
metadata=jsonb_set(metadata, '{{$key}}', '\"{$value}\"', true)"
+ . " WHERE file_id = {$file_id}";
+
+ $this->db->query($sql, __LINE__,
__FILE__);
+
+ }
+ }
- $result = $this->db->query("UPDATE phpgw_vfs_filedata
SET $value_set WHERE file_id = {$file_id}", __LINE__, __FILE__);
-
+ $result = $this->db->transaction_commit();
+
if ($result)
{
$receipt['message'] = lang('filedata has been
edited');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16858] Generic documents,
sigurdne <=