Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
e8221b8a81
@ -1224,18 +1224,17 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Delete bookkepping by piece number
|
* Delete bookkepping by piece number
|
||||||
*
|
*
|
||||||
* @param int $piecenum peicenum to delete
|
* @param int $piecenum Piecenum to delete
|
||||||
* @param string $mode Mode
|
* @return int Result
|
||||||
* @return int Result
|
|
||||||
*/
|
*/
|
||||||
function deleteMvtNum($piecenum, $mode) {
|
function deleteMvtNum($piecenum) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use Stripe\BankAccount;
|
|
||||||
|
|
||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class PrestaShopWebservice
|
|||||||
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
||||||
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
|
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
||||||
* <code>
|
* <code>
|
||||||
@ -79,6 +80,7 @@ class PrestaShopWebservice
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
||||||
|
*
|
||||||
* @param int $status_code Status code of an HTTP return
|
* @param int $status_code Status code of an HTTP return
|
||||||
*/
|
*/
|
||||||
protected function checkStatusCode($status_code)
|
protected function checkStatusCode($status_code)
|
||||||
@ -86,21 +88,32 @@ class PrestaShopWebservice
|
|||||||
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
||||||
switch($status_code)
|
switch($status_code)
|
||||||
{
|
{
|
||||||
case 200: case 201: break;
|
case 200:
|
||||||
case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break;
|
case 201:
|
||||||
case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break;
|
break;
|
||||||
case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break;
|
case 204:
|
||||||
case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break;
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
|
||||||
case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break;
|
case 400:
|
||||||
case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break;
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
|
||||||
default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
|
case 401:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
|
||||||
|
case 404:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
|
||||||
|
case 405:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
|
||||||
|
case 500:
|
||||||
|
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
|
||||||
|
default:
|
||||||
|
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
|
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
|
||||||
* @param string $url Resource name
|
*
|
||||||
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
|
* @param string $url Resource name
|
||||||
* @return array status_code, response
|
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
|
||||||
|
* @return array status_code, response
|
||||||
*/
|
*/
|
||||||
public function executeRequest($url, $curl_params = array())
|
public function executeRequest($url, $curl_params = array())
|
||||||
{
|
{
|
||||||
@ -178,11 +191,23 @@ class PrestaShopWebservice
|
|||||||
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
|
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output debug info
|
||||||
|
*
|
||||||
|
* @param string $title Title
|
||||||
|
* @param string $content Content
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function printDebug($title, $content)
|
public function printDebug($title, $content)
|
||||||
{
|
{
|
||||||
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
|
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return version
|
||||||
|
*
|
||||||
|
* @return string Version
|
||||||
|
*/
|
||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
@ -190,8 +215,9 @@ class PrestaShopWebservice
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load XML from string. Can throw exception
|
* Load XML from string. Can throw exception
|
||||||
* @param string $response String from a CURL response
|
*
|
||||||
* @return SimpleXMLElement status_code, response
|
* @param string $response String from a CURL response
|
||||||
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
protected function parseXML($response)
|
protected function parseXML($response)
|
||||||
{
|
{
|
||||||
@ -268,8 +294,8 @@ class PrestaShopWebservice
|
|||||||
* }
|
* }
|
||||||
* ?>
|
* ?>
|
||||||
* </code>
|
* </code>
|
||||||
* @param array $options Array representing resource to get.
|
* @param array $options Array representing resource to get.
|
||||||
* @return SimpleXMLElement status_code, response
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
public function get($options)
|
public function get($options)
|
||||||
{
|
{
|
||||||
@ -301,8 +327,8 @@ class PrestaShopWebservice
|
|||||||
/**
|
/**
|
||||||
* Head method (HEAD) a resource
|
* Head method (HEAD) a resource
|
||||||
*
|
*
|
||||||
* @param array $options Array representing resource for head request.
|
* @param array $options Array representing resource for head request.
|
||||||
* @return SimpleXMLElement status_code, response
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
public function head($options)
|
public function head($options)
|
||||||
{
|
{
|
||||||
@ -336,7 +362,9 @@ class PrestaShopWebservice
|
|||||||
* 'id' => ID of a resource you want to edit,<br>
|
* 'id' => ID of a resource you want to edit,<br>
|
||||||
* 'putXml' => Modified XML string of a resource<br><br>
|
* 'putXml' => Modified XML string of a resource<br><br>
|
||||||
* Examples are given in the tutorial</p>
|
* Examples are given in the tutorial</p>
|
||||||
* @param array $options Array representing resource to edit.
|
*
|
||||||
|
* @param array $options Array representing resource to edit.
|
||||||
|
* @return SimpleXMLElement status_code, response
|
||||||
*/
|
*/
|
||||||
public function edit($options)
|
public function edit($options)
|
||||||
{
|
{
|
||||||
@ -381,7 +409,8 @@ class PrestaShopWebservice
|
|||||||
* }
|
* }
|
||||||
* ?>
|
* ?>
|
||||||
* </code>
|
* </code>
|
||||||
* @param array $options Array representing resource to delete.
|
* @param array $options Array representing resource to delete.
|
||||||
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
public function delete($options)
|
public function delete($options)
|
||||||
{
|
{
|
||||||
@ -400,8 +429,6 @@ class PrestaShopWebservice
|
|||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
self::checkStatusCode($request['status_code']);// check the response validity
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -79,18 +79,18 @@ abstract class ActionsContactCardCommon
|
|||||||
*/
|
*/
|
||||||
function getObject($id)
|
function getObject($id)
|
||||||
{
|
{
|
||||||
$ret = $this->getInstanceDao();
|
/*$ret = $this->getInstanceDao();
|
||||||
|
|
||||||
if (is_object($this->object) && method_exists($this->object,'fetch'))
|
if (is_object($this->object) && method_exists($this->object,'fetch'))
|
||||||
{
|
{
|
||||||
if (! empty($id)) $this->object->fetch($id);
|
if (! empty($id)) $this->object->fetch($id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{*/
|
||||||
$object = new Contact($this->db);
|
$object = new Contact($this->db);
|
||||||
if (! empty($id)) $object->fetch($id);
|
if (! empty($id)) $object->fetch($id);
|
||||||
$this->object = $object;
|
$this->object = $object;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/lib/json.lib.php
|
* \file htdocs/core/lib/json.lib.php
|
||||||
* \brief Functions to emulate json function for PHP < 5.3 compatibility
|
* \brief Functions to emulate json function when there were not activated
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! function_exists('json_encode'))
|
if (! function_exists('json_encode'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Implement json_encode for PHP that does not support it
|
* Implement json_encode for PHP that does not have module enabled.
|
||||||
*
|
*
|
||||||
* @param mixed $elements PHP Object to json encode
|
* @param mixed $elements PHP Object to json encode
|
||||||
* @return string Json encoded string
|
* @return string Json encoded string
|
||||||
@ -42,12 +42,11 @@ if (! function_exists('json_encode'))
|
|||||||
*
|
*
|
||||||
* @param mixed $elements PHP Object to json encode
|
* @param mixed $elements PHP Object to json encode
|
||||||
* @return string Json encoded string
|
* @return string Json encoded string
|
||||||
* @deprecated PHP >= 5.3 supports native json_encode
|
|
||||||
* @see json_encode()
|
* @see json_encode()
|
||||||
*/
|
*/
|
||||||
function dol_json_encode($elements)
|
function dol_json_encode($elements)
|
||||||
{
|
{
|
||||||
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
|
dol_syslog("For better permorfance, enable the native json in your PHP", LOG_WARNING);
|
||||||
|
|
||||||
$num=0;
|
$num=0;
|
||||||
if (is_object($elements)) // Count number of properties for an object
|
if (is_object($elements)) // Count number of properties for an object
|
||||||
|
|||||||
@ -1171,8 +1171,6 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user