mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
nicer save-function
This commit is contained in:
parent
b6cc2d6d7b
commit
3d31b0e7fe
@ -174,7 +174,7 @@ class bo_resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_images($params)
|
function get_images($params)
|
||||||
{
|
{
|
||||||
$id = implode($params);
|
$id = implode($params);
|
||||||
$picture = $this->so->get_value('picture_thumb',$id);
|
$picture = $this->so->get_value('picture_thumb',$id);
|
||||||
if($picture)
|
if($picture)
|
||||||
|
@ -115,26 +115,19 @@ class so_resources
|
|||||||
@function save
|
@function save
|
||||||
@abstract saves a resource including binary datas
|
@abstract saves a resource including binary datas
|
||||||
@param array $resource key => value
|
@param array $resource key => value
|
||||||
@return array with key => value or false if not found
|
@return bool succsess or not!
|
||||||
*/
|
*/
|
||||||
function save($resource)
|
function save($resource)
|
||||||
{
|
{
|
||||||
$where = array('id' => $resource['id']);
|
$where = array('id' => $resource['id']);
|
||||||
$data = array( 'name' => $resource['name'],
|
|
||||||
'cat_id' => $resource['cat_id'],
|
// get rid of the non storeable datas
|
||||||
'short_description' => $resource['short_description'],
|
$tabledef = $this->db->metadata($table=$this->rs_table,$full=false);
|
||||||
'long_description' => $resource['long_description'],
|
foreach($tabledef as $n => $fielddef)
|
||||||
'location' => $resource['location'],
|
{
|
||||||
'quantity' => $resource['quantity'],
|
$data[$fielddef['name']] = $resource[$fielddef['name']];
|
||||||
'useable' => $resource['useable'],
|
}
|
||||||
'bookable' => $resource['bookable'],
|
|
||||||
'buyable' => $resource['buyable'],
|
|
||||||
'prize' => $resource['prize'],
|
|
||||||
'accessories' => $resource['accessories'],
|
|
||||||
'picture_src' => $resource['picture_src'],
|
|
||||||
'picture_thumb' => $resource['picture_thumb'],
|
|
||||||
'picture' => $resource['picture']
|
|
||||||
);
|
|
||||||
return $this->db->insert($this->rs_table,$data,$where,__LINE__,__FILE__) ? true : false;
|
return $this->db->insert($this->rs_table,$data,$where,__LINE__,__FILE__) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user