[-] WS : Fix bug from 1.4 Groups for entity customers API
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13516 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
1e0a422626
commit
2f34d9fc8f
1 file changed
+21
@@ -143,6 +143,9 @@ class CustomerCore extends ObjectModel
|
|||||||
'deleted' => array(),
|
'deleted' => array(),
|
||||||
'passwd' => array('setter' => 'setWsPasswd'),
|
'passwd' => array('setter' => 'setWsPasswd'),
|
||||||
),
|
),
|
||||||
|
'associations' => array(
|
||||||
|
'groups' => array('resource' => 'group'),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -747,4 +750,22 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
return $total_paid - $total_rest;
|
return $total_paid - $total_rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWsGroups()
|
||||||
|
{
|
||||||
|
return Db::getInstance()->ExecuteS('
|
||||||
|
SELECT cg.`id_group` as id
|
||||||
|
FROM '._DB_PREFIX_.'customer_group cg
|
||||||
|
WHERE cg.`id_customer` = '.(int)$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setWsGroups($result)
|
||||||
|
{
|
||||||
|
$groups = array();
|
||||||
|
foreach ($result as $row)
|
||||||
|
$groups[] = $row['id'];
|
||||||
|
$this->cleanGroups();
|
||||||
|
$this->addGroups($groups);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user