diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d8861154f9e..5bad55fd4d2 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -8,6 +8,15 @@ ALL: Check "@CHANGE" +PrestaShopWebservice: +--------------------- +Replace + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); +With + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); + + + CKEDITOR (4.6.2): ----------------- * In ckeditor/ckeditor/contents.css diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index a91ff8e8efa..dfd3f3f36c1 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -46,7 +46,7 @@ class PrestaShopWebservice /** @var array compatible versions of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; - const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; + const PSCOMPATIBLEVERSIONMAX = '1.7.99.99'; /** @@ -311,7 +311,9 @@ class PrestaShopWebservice if (isset($options['id'])) $url .= '/'.$options['id']; - $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + // @CHANGE LDR + //$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); foreach ($params as $p) foreach ($options as $k => $o) if (strpos($k, $p) !== false) @@ -390,6 +392,47 @@ class PrestaShopWebservice self::checkStatusCode($request['status_code']);// check the response validity return self::parseXML($request['response']); } + + /** + * Delete (DELETE) a resource. + * Unique parameter must take :

+ * 'resource' => Resource name
+ * 'id' => ID or array which contains IDs of a resource(s) you want to delete

+ * + * delete(array('resource' => 'orders', 'id' => 1)); + * // Following code will not be executed if an exception is thrown. + * echo 'Successfully deleted.'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + * + * @param array $options Array representing resource to delete. + */ + public function delete($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource']) && isset($options['id'])) + if (is_array($options['id'])) + $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; + else + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); + self::checkStatusCode($request['status_code']);// check the response validity + return true; + } } /**