mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -38,6 +38,7 @@ PHP-Iban 4.1.1 LGPL-3+ Yes
|
||||
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
PrestaShop-WS-Lib 94feb5f OSL-3.0 No Library providing API client for Prestashop.
|
||||
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
|
||||
@@ -740,7 +740,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $langs, $db;
|
||||
global $form;
|
||||
|
||||
@@ -958,7 +958,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListAccountingCategories($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
|
||||
@@ -691,7 +691,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListJournal($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
|
||||
@@ -829,7 +829,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportQuadratus($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
@@ -1309,7 +1309,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportFEC($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
@@ -1520,7 +1520,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportFEC2($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
|
||||
@@ -2124,7 +2124,7 @@ class BookKeeping extends CommonObject
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @param string $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
|
||||
@@ -1360,7 +1360,7 @@ class Adherent extends CommonObject
|
||||
* @param bool $fetch_subscriptions To load member subscriptions
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
|
||||
public function fetch($rowid, $ref = '', $fk_soc = 0, $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@@ -1678,7 +1678,7 @@ class Adherent extends CommonObject
|
||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||
* @param string $emetteur_nom Name of cheque writer
|
||||
* @param string $emetteur_banque Name of bank of cheque
|
||||
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
|
||||
* @param int $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
|
||||
* @param string $ext_payment_id External id of payment (for example Stripe charge id)
|
||||
* @param string $ext_payment_site Name of external paymentmode (for example 'stripe')
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
|
||||
@@ -2540,7 +2540,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return string '' or value of entity into table
|
||||
*/
|
||||
function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db, $mysoc;
|
||||
global $form;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
* 2007-2022 PrestaShop SA and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -18,10 +18,10 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2022 PrestaShop SA
|
||||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* PrestaShop Webservice Library
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
@@ -31,10 +31,11 @@
|
||||
*/
|
||||
class PrestaShopWebservice
|
||||
{
|
||||
|
||||
/** @var string Shop URL */
|
||||
protected $url;
|
||||
|
||||
/** @var string Authentification key */
|
||||
/** @var string Authentication key */
|
||||
protected $key;
|
||||
|
||||
/** @var boolean is debug activated */
|
||||
@@ -43,36 +44,40 @@ class PrestaShopWebservice
|
||||
/** @var string PS version */
|
||||
protected $version;
|
||||
|
||||
/** @var string compatible min version of PrestaShop Webservice */
|
||||
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
||||
/** @var string compatible max version of PrestaShop Webservice */
|
||||
const PSCOMPATIBLEVERSIONMAX = '1.7.99.99';
|
||||
|
||||
/** @var string Minimal version of PrestaShop to use with this library */
|
||||
const PS_COMPATIBLE_VERSIONS_MIN = '1.4.0.0';
|
||||
/** @var string Maximal version of PrestaShop to use with this library */
|
||||
const PS_COMPATIBLE_VERSIONS_MAX = '8.1.1';
|
||||
|
||||
/**
|
||||
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once './PrestaShopWebservice.php';
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* // Now we have a webservice object to play with
|
||||
* $ws = new PrestaShopWebservice('https://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* // Now we have a webservice object to play with
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @param string $url Root URL for the shop
|
||||
* @param string $key Authentification key
|
||||
* @param string $key Authentication key
|
||||
* @param mixed $debug Debug mode Activated (true) or deactivated (false)
|
||||
*
|
||||
* @throws PrestaShopWebserviceException if curl is not loaded
|
||||
*/
|
||||
public function __construct($url, $key, $debug = true)
|
||||
{
|
||||
if (!extension_loaded('curl')) {
|
||||
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
|
||||
throw new PrestaShopWebserviceException(
|
||||
'Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'
|
||||
);
|
||||
}
|
||||
$this->url = $url;
|
||||
$this->key = $key;
|
||||
@@ -82,51 +87,92 @@ class PrestaShopWebservice
|
||||
|
||||
/**
|
||||
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
* 'status_code' => Status code of an HTTP return<br>
|
||||
* 'response' => CURL response
|
||||
* </p>
|
||||
*
|
||||
* @param array $request Response elements of CURL request
|
||||
*
|
||||
* @param int $status_code Status code of an HTTP return
|
||||
* @return void
|
||||
* @throws PrestaShopWebserviceException if HTTP status code is not 200 or 201
|
||||
*/
|
||||
protected function checkStatusCode($status_code)
|
||||
protected function checkStatusCode($request)
|
||||
{
|
||||
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
||||
switch ($status_code) {
|
||||
switch ($request['status_code']) {
|
||||
case 200:
|
||||
case 201:
|
||||
break;
|
||||
case 204:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
|
||||
$error_message = 'No content';
|
||||
break;
|
||||
case 400:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
|
||||
$error_message = 'Bad Request';
|
||||
break;
|
||||
case 401:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
|
||||
$error_message = 'Unauthorized';
|
||||
break;
|
||||
case 404:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
|
||||
$error_message = 'Not Found';
|
||||
break;
|
||||
case 405:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
|
||||
$error_message = 'Method Not Allowed';
|
||||
break;
|
||||
case 500:
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
|
||||
$error_message = 'Internal Server Error';
|
||||
break;
|
||||
default:
|
||||
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:'.$status_code);
|
||||
throw new PrestaShopWebserviceException(
|
||||
'This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $request['status_code']
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($error_message)) {
|
||||
$response = $this->parseXML($request['response']);
|
||||
$errors = $response->children()->children();
|
||||
if ($errors && count($errors) > 0) {
|
||||
foreach ($errors as $error) {
|
||||
$error_message.= ' - (Code ' . $error->code . '): ' . $error->message;
|
||||
}
|
||||
}
|
||||
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
||||
throw new PrestaShopWebserviceException(sprintf($error_label, $request['status_code'], $error_message));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
* @return array status_code, response
|
||||
* Provides default parameters for the curl connection(s)
|
||||
* @return array Default parameters for curl connection(s)
|
||||
*/
|
||||
public function executeRequest($url, $curl_params = array())
|
||||
protected function getCurlDefaultParams()
|
||||
{
|
||||
$defaultParams = array(
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLINFO_HEADER_OUT => true,
|
||||
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
|
||||
CURLOPT_USERPWD => $this->key.':',
|
||||
CURLOPT_HTTPHEADER => array('Expect:')
|
||||
CURLOPT_USERPWD => $this->key . ':',
|
||||
CURLOPT_HTTPHEADER => array('Expect:'),
|
||||
//CURLOPT_SSL_VERIFYPEER => false, // reminder, in dev environment sometimes self-signed certificates are used
|
||||
//CURLOPT_CAINFO => "PATH2CAINFO", // ssl certificate chain checking
|
||||
//CURLOPT_CAPATH => "PATH2CAPATH",
|
||||
);
|
||||
return $defaultParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* @return array status_code, response, header
|
||||
*
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
protected function executeRequest($url, $curl_params = array())
|
||||
{
|
||||
$defaultParams = $this->getCurlDefaultParams();
|
||||
|
||||
dol_syslog("curl_init url=".$url);
|
||||
$session = curl_init($url);
|
||||
@@ -151,7 +197,7 @@ class PrestaShopWebservice
|
||||
|
||||
$index = strpos($response, "\r\n\r\n");
|
||||
if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD') {
|
||||
throw new PrestaShopWebserviceException('Bad HTTP response');
|
||||
throw new PrestaShopWebserviceException('Bad HTTP response ' . $response . curl_error($session));
|
||||
}
|
||||
|
||||
$header = substr($response, 0, $index);
|
||||
@@ -170,10 +216,13 @@ class PrestaShopWebservice
|
||||
|
||||
if (array_key_exists('PSWS-Version', $headerArray)) {
|
||||
$this->version = $headerArray['PSWS-Version'];
|
||||
if (version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMIN, $headerArray['PSWS-Version']) == 1 ||
|
||||
version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMAX, $headerArray['PSWS-Version']) == -1
|
||||
if (
|
||||
version_compare(PrestaShopWebservice::PS_COMPATIBLE_VERSIONS_MIN, $headerArray['PSWS-Version']) == 1 ||
|
||||
version_compare(PrestaShopWebservice::PS_COMPATIBLE_VERSIONS_MAX, $headerArray['PSWS-Version']) == -1
|
||||
) {
|
||||
throw new PrestaShopWebserviceException('This library is not compatible with this version of PrestaShop. Please upgrade/downgrade this library');
|
||||
throw new PrestaShopWebserviceException(
|
||||
'This library is not compatible with this version of PrestaShop. Please upgrade/downgrade this library'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +232,7 @@ class PrestaShopWebservice
|
||||
}
|
||||
$status_code = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
if ($status_code === 0) {
|
||||
throw new PrestaShopWebserviceException('CURL Error: '.curl_error($session));
|
||||
throw new PrestaShopWebserviceException('CURL Error: ' . curl_error($session));
|
||||
}
|
||||
curl_close($session);
|
||||
if ($this->debug) {
|
||||
@@ -200,19 +249,27 @@ class PrestaShopWebservice
|
||||
/**
|
||||
* Output debug info
|
||||
*
|
||||
* @param string $title Title
|
||||
* @param string $content Content
|
||||
* @return void
|
||||
* @param string $title Title
|
||||
* @param string $content Content
|
||||
* @return void
|
||||
*/
|
||||
public function printDebug($title, $content)
|
||||
{
|
||||
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.dol_escape_htmltag($title).'</h6><pre>'.dol_escape_htmltag($content).'</pre></div>';
|
||||
if (php_sapi_name() == 'cli') {
|
||||
echo $title . PHP_EOL . $content;
|
||||
} else {
|
||||
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
|
||||
* @return string Version
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
@@ -222,9 +279,9 @@ class PrestaShopWebservice
|
||||
/**
|
||||
* Load XML from string. Can throw exception
|
||||
*
|
||||
* @param string $response String from a CURL response
|
||||
* @return SimpleXMLElement|boolean status_code, response
|
||||
* @param string $response String from a CURL response
|
||||
*
|
||||
* @return SimpleXMLElement status_code, response
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
protected function parseXML($response)
|
||||
@@ -232,16 +289,17 @@ class PrestaShopWebservice
|
||||
if ($response != '') {
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors(true);
|
||||
libxml_disable_entity_loader(true); // Avoid load of external entities (security problem). Required only if LIBXML_VERSION < 20900
|
||||
|
||||
if (!function_exists('simplexml_load_string')) {
|
||||
throw new PrestaShopWebserviceException('Method simplexml_load_string not available. Your PHP does not support xml.');
|
||||
if (LIBXML_VERSION < 20900) {
|
||||
// Avoid load of external entities (security problem).
|
||||
// Required only if LIBXML_VERSION < 20900
|
||||
libxml_disable_entity_loader(true);
|
||||
}
|
||||
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
|
||||
$xml = simplexml_load_string(trim($response), 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||
if (libxml_get_errors()) {
|
||||
$msg = var_export(libxml_get_errors(), true);
|
||||
libxml_clear_errors();
|
||||
throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg);
|
||||
throw new PrestaShopWebserviceException('HTTP XML response is not parsable: ' . $msg);
|
||||
}
|
||||
return $xml;
|
||||
} else {
|
||||
@@ -256,62 +314,62 @@ class PrestaShopWebservice
|
||||
* 'postXml' => Full XML string to add resource<br><br>
|
||||
* Examples are given in the tutorial</p>
|
||||
*
|
||||
* @param array $options Options
|
||||
* @return SimpleXMLElement|boolean status_code, response
|
||||
* @param array $options Options
|
||||
*
|
||||
* @return SimpleXMLElement status_code, response
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
public function add($options)
|
||||
{
|
||||
$xml = '';
|
||||
$url = '';
|
||||
|
||||
if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml'])) {
|
||||
$url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']);
|
||||
$url = (isset($options['resource']) ? $this->url . '/api/' . $options['resource'] : $options['url']);
|
||||
$xml = $options['postXml'];
|
||||
if (isset($options['id_shop'])) {
|
||||
$url .= '&id_shop='.$options['id_shop'];
|
||||
$url .= '&id_shop=' . $options['id_shop'];
|
||||
}
|
||||
if (isset($options['id_group_shop'])) {
|
||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
||||
$url .= '&id_group_shop=' . $options['id_group_shop'];
|
||||
}
|
||||
} else {
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
}
|
||||
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
|
||||
|
||||
$this->checkStatusCode($request['status_code']);
|
||||
$this->checkStatusCode($request);
|
||||
return $this->parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve (GET) a resource
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
* 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<br>
|
||||
* 'url' => Full URL for a GET request of Webservice (ex: https://mystore.com/api/customers/1/)<br>
|
||||
* OR<br>
|
||||
* 'resource' => Resource name,<br>
|
||||
* 'id' => ID of a resource you want to get<br><br>
|
||||
* </p>
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once './PrestaShopWebservice.php';
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* $ws = new PrestaShopWebservice('https://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||
* foreach ($xml->children()->children() as $attName => $attValue)
|
||||
* echo $attName.' = '.$attValue.'<br>';
|
||||
* echo $attName.' = '.$attValue.'<br>';
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
* @param array $options Array representing resource to get.
|
||||
* @return SimpleXMLElement|boolean status_code, response
|
||||
*
|
||||
* @param array $options Array representing resource to get.
|
||||
*
|
||||
* @return SimpleXMLElement status_code, response
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
public function get($options)
|
||||
@@ -319,15 +377,13 @@ class PrestaShopWebservice
|
||||
if (isset($options['url'])) {
|
||||
$url = $options['url'];
|
||||
} elseif (isset($options['resource'])) {
|
||||
$url = $this->url.'/api/'.$options['resource'];
|
||||
$url = $this->url . '/api/' . $options['resource'];
|
||||
$url_params = array();
|
||||
if (isset($options['id'])) {
|
||||
$url .= '/'.$options['id'];
|
||||
$url .= '/' . $options['id'];
|
||||
}
|
||||
|
||||
// @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');
|
||||
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'schema', 'language', 'date', 'price');
|
||||
foreach ($params as $p) {
|
||||
foreach ($options as $k => $o) {
|
||||
if (strpos($k, $p) !== false) {
|
||||
@@ -336,23 +392,25 @@ class PrestaShopWebservice
|
||||
}
|
||||
}
|
||||
if (count($url_params) > 0) {
|
||||
$url .= '?'.http_build_query($url_params);
|
||||
$url .= '?' . http_build_query($url_params);
|
||||
}
|
||||
} else {
|
||||
throw new PrestaShopWebserviceException('Bad parameters given ');
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
}
|
||||
|
||||
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
|
||||
$this->checkStatusCode($request['status_code']); // check the response validity
|
||||
|
||||
$this->checkStatusCode($request);// check the response validity
|
||||
|
||||
return $this->parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Head method (HEAD) a resource
|
||||
*
|
||||
* @param array $options Array representing resource for head request.
|
||||
* @return SimpleXMLElement status_code, response
|
||||
* @param array $options Array representing resource for head request.
|
||||
*
|
||||
* @return SimpleXMLElement status_code, response
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
public function head($options)
|
||||
@@ -360,10 +418,10 @@ class PrestaShopWebservice
|
||||
if (isset($options['url'])) {
|
||||
$url = $options['url'];
|
||||
} elseif (isset($options['resource'])) {
|
||||
$url = $this->url.'/api/'.$options['resource'];
|
||||
$url = $this->url . '/api/' . $options['resource'];
|
||||
$url_params = array();
|
||||
if (isset($options['id'])) {
|
||||
$url .= '/'.$options['id'];
|
||||
$url .= '/' . $options['id'];
|
||||
}
|
||||
|
||||
$params = array('filter', 'display', 'sort', 'limit');
|
||||
@@ -375,15 +433,16 @@ class PrestaShopWebservice
|
||||
}
|
||||
}
|
||||
if (count($url_params) > 0) {
|
||||
$url .= '?'.http_build_query($url_params);
|
||||
$url .= '?' . http_build_query($url_params);
|
||||
}
|
||||
} else {
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
}
|
||||
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
|
||||
$this->checkStatusCode($request['status_code']); // check the response validity
|
||||
$this->checkStatusCode($request);// check the response validity
|
||||
return $request['header'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit (PUT) a resource
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
@@ -392,9 +451,9 @@ class PrestaShopWebservice
|
||||
* 'putXml' => Modified XML string of a resource<br><br>
|
||||
* Examples are given in the tutorial</p>
|
||||
*
|
||||
* @param array $options Array representing resource to edit.
|
||||
* @return SimpleXMLElement|boolean status_code, response
|
||||
* @param array $options Array representing resource to edit.
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
public function edit($options)
|
||||
@@ -403,22 +462,74 @@ class PrestaShopWebservice
|
||||
if (isset($options['url'])) {
|
||||
$url = $options['url'];
|
||||
} elseif ((isset($options['resource'], $options['id']) || isset($options['url'])) && $options['putXml']) {
|
||||
$url = (isset($options['url']) ? $options['url'] : $this->url.'/api/'.$options['resource'].'/'.$options['id']);
|
||||
$url = (isset($options['url']) ? $options['url'] :
|
||||
$this->url . '/api/' . $options['resource'] . '/' . $options['id']);
|
||||
$xml = $options['putXml'];
|
||||
if (isset($options['id_shop'])) {
|
||||
$url .= '&id_shop='.$options['id_shop'];
|
||||
$url .= '&id_shop=' . $options['id_shop'];
|
||||
}
|
||||
if (isset($options['id_group_shop'])) {
|
||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
||||
$url .= '&id_group_shop=' . $options['id_group_shop'];
|
||||
}
|
||||
} else {
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
}
|
||||
|
||||
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
|
||||
$this->checkStatusCode($request['status_code']); // check the response validity
|
||||
$this->checkStatusCode($request);// check the response validity
|
||||
return $this->parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete (DELETE) a resource.
|
||||
* Unique parameter must take : <br><br>
|
||||
* 'resource' => Resource name<br>
|
||||
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('https://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* $xml = $ws->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();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @param array $options Array representing resource to delete.
|
||||
*
|
||||
* @return bool
|
||||
* @throws PrestaShopWebserviceException
|
||||
*/
|
||||
public function delete($options)
|
||||
{
|
||||
if (isset($options['url'])) {
|
||||
$url = $options['url'];
|
||||
} elseif (isset($options['resource']) && isset($options['id'])) {
|
||||
$url = (is_array($options['id']))
|
||||
? $this->url . '/api/' . $options['resource'] . '/?id=[' . implode(',', $options['id']) . ']'
|
||||
: $this->url . '/api/' . $options['resource'] . '/' . $options['id'];
|
||||
} else {
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
}
|
||||
|
||||
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 = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
|
||||
$this->checkStatusCode($request);// check the response validity
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
53
htdocs/admin/dolistore/class/PS_WS_LIB-LICENSE.md
Normal file
53
htdocs/admin/dolistore/class/PS_WS_LIB-LICENSE.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Open Software License v. 3.0 (OSL-3.0)
|
||||
|
||||
This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
|
||||
|
||||
Licensed under the Open Software License version 3.0
|
||||
|
||||
1) **Grant of Copyright License.** Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
|
||||
|
||||
a) to reproduce the Original Work in copies, either alone or as part of a collective work;
|
||||
|
||||
b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
|
||||
|
||||
c) to distribute or communicate copies of the Original Work and Derivative Works to the public, _with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License_;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) **Grant** of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
|
||||
|
||||
3) **Grant** of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
|
||||
|
||||
4) **Exclusions From License Grant.** Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2\. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
|
||||
|
||||
5) **External Deployment.** The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
|
||||
|
||||
6) **Attribution Rights.** You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
|
||||
|
||||
7) **Warranty of Provenance and Disclaimer of Warranty.** Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
|
||||
|
||||
8) **Limitation of Liability.** Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
|
||||
|
||||
9) **Acceptance and Termination.** If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
|
||||
|
||||
10) **Termination for Patent Action.** This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
|
||||
|
||||
11) **Jurisdiction, Venue and Governing Law.** Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
|
||||
|
||||
12) **Attorneys' Fees.** In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
|
||||
|
||||
13) **Miscellaneous.** If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
|
||||
|
||||
14) **Definition of "You" in This License.** "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
15) **Right to Use.** You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
|
||||
|
||||
16) **Modification of This License.** This License is Copyright (c) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here\>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
|
||||
|
||||
[A brief explanation of this license is available][0].
|
||||
|
||||
|
||||
[0]: http://rosenlaw.com/OSL3.0-explained.htm
|
||||
|
||||
12
htdocs/admin/dolistore/class/README.md
Normal file
12
htdocs/admin/dolistore/class/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# PrestaShop-webservice-lib
|
||||
|
||||
Source updated from:
|
||||
|
||||
https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/master/PSWebServiceLibrary.php
|
||||
|
||||
## Compatibility analysis
|
||||
|
||||
https://www.gnu.org/licenses/license-list.html#OSL
|
||||
|
||||
|
||||
|
||||
@@ -1354,7 +1354,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $langs, $user, $db;
|
||||
global $form;
|
||||
|
||||
@@ -681,7 +681,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListWebsites($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $form;
|
||||
|
||||
@@ -797,7 +797,7 @@ class BlockedLog
|
||||
* Encode data
|
||||
*
|
||||
* @param string $data Data to serialize
|
||||
* @param string $mode 0=serialize, 1=json_encode
|
||||
* @param int $mode 0=serialize, 1=json_encode
|
||||
* @return string Value serialized, an object (stdClass)
|
||||
*/
|
||||
public function dolEncodeBlockedData($data, $mode = 0)
|
||||
@@ -817,7 +817,7 @@ class BlockedLog
|
||||
* Decode data
|
||||
*
|
||||
* @param string $data Data to unserialize
|
||||
* @param string $mode 0=unserialize, 1=json_decode
|
||||
* @param int $mode 0=unserialize, 1=json_decode
|
||||
* @return object Value unserialized, an object (stdClass)
|
||||
*/
|
||||
public function dolDecodeBlockedData($data, $mode = 0)
|
||||
@@ -852,7 +852,7 @@ class BlockedLog
|
||||
* Create blocked log in database.
|
||||
*
|
||||
* @param User $user Object user that create
|
||||
* @param int $forcesignature Force signature (for example '0000000000' when we disabled the module)
|
||||
* @param string $forcesignature Force signature (for example '0000000000' when we disabled the module)
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function create($user, $forcesignature = '')
|
||||
|
||||
@@ -602,7 +602,7 @@ class BOM extends CommonObject
|
||||
* @param int $fk_default_workstation Default workstation
|
||||
* @return int Return integer <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0, $fk_default_workstation = null)
|
||||
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = array(), $fk_default_workstation = null)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
@@ -710,7 +710,7 @@ class BOM extends CommonObject
|
||||
* @param int $fk_default_workstation Default workstation
|
||||
* @return int Return integer <0 if KO, Id of updated BOM-Line if OK
|
||||
*/
|
||||
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = 0, $fk_default_workstation = null)
|
||||
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = array(), $fk_default_workstation = null)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
@@ -1594,7 +1594,7 @@ class BOM extends CommonObject
|
||||
* @param int $level Protection against infinite loop
|
||||
* @return void
|
||||
*/
|
||||
public function getParentBomTreeRecursive(&$TParentBom, $bom_id = '', $level = 1)
|
||||
public function getParentBomTreeRecursive(&$TParentBom, $bom_id = 0, $level = 1)
|
||||
{
|
||||
|
||||
// Protection against infinite loop
|
||||
|
||||
@@ -1385,7 +1385,7 @@ class Categorie extends CommonObject
|
||||
* @param string $sep Separator
|
||||
* @param string $url Url ('', 'none' or 'urltouse')
|
||||
* @param int $nocolor 0
|
||||
* @param string $addpicto Add picto into link
|
||||
* @param int $addpicto Add picto into link
|
||||
* @return array
|
||||
*/
|
||||
public function print_all_ways($sep = '>>', $url = '', $nocolor = 0, $addpicto = 0)
|
||||
|
||||
@@ -784,7 +784,7 @@ class ActionComm extends CommonObject
|
||||
* @param string $ref Ref of action to get
|
||||
* @param string $ref_ext Ref ext to get
|
||||
* @param string $email_msgid Email msgid
|
||||
* @param string $loadresources 1=Load also resources
|
||||
* @param int $loadresources 1=Load also resources
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
|
||||
@@ -1328,7 +1328,7 @@ class ActionComm extends CommonObject
|
||||
* @param string $filter Other filter
|
||||
* @param string $sortfield Sort on this field
|
||||
* @param string $sortorder ASC or DESC
|
||||
* @param string $limit Limit number of answers
|
||||
* @param int $limit Limit number of answers
|
||||
* @return ActionComm[]|string Error string if KO, array with actions if OK
|
||||
*/
|
||||
public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
|
||||
@@ -1542,7 +1542,7 @@ class ActionComm extends CommonObject
|
||||
* @param int $percent Percent
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @param int $datestart Date start of event
|
||||
* @param int|string $datestart Date start of event
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
|
||||
|
||||
@@ -103,7 +103,7 @@ class AgendaEvents extends DolibarrApi
|
||||
* @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names
|
||||
* @return array Array of Agenda Events objects
|
||||
*/
|
||||
public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '')
|
||||
public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = '', $sqlfilters = '', $properties = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class ICal
|
||||
*
|
||||
* @param string $uri Url
|
||||
* @param string $usecachefile Full path of a cache file to use a cache file
|
||||
* @param string $delaycache Delay in seconds for cache (by default 3600 secondes)
|
||||
* @param int $delaycache Delay in seconds for cache (by default 3600 secondes)
|
||||
* @return array|string
|
||||
*/
|
||||
public function parse($uri, $usecachefile = '', $delaycache = 3600)
|
||||
|
||||
@@ -1743,8 +1743,8 @@ $db->close();
|
||||
* @param string $newparam Parameters on current URL
|
||||
* @param int $showinfo Add extended information (used by day and week view)
|
||||
* @param int $minheight Minimum height for each event. 60px by default.
|
||||
* @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
|
||||
* @param string $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
|
||||
* @param int $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
|
||||
* @param array $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
|
||||
* @return void
|
||||
*/
|
||||
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
|
||||
|
||||
@@ -577,8 +577,8 @@ class Propal extends CommonObject
|
||||
* @param int $fk_fournprice Id supplier price
|
||||
* @param int $pa_ht Buying price without tax
|
||||
* @param string $label ???
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int|string $date_start Start date of the line
|
||||
* @param int|string $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||
@@ -589,7 +589,7 @@ class Propal extends CommonObject
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @see add_product()
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
@@ -827,8 +827,8 @@ class Propal extends CommonObject
|
||||
* @param int $pa_ht Price (without tax) of product when it was bought
|
||||
* @param string $label ???
|
||||
* @param int $type 0/1=Product/service
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int|string $date_start Start date of the line
|
||||
* @param int|string $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
@@ -836,7 +836,7 @@ class Propal extends CommonObject
|
||||
* @param integer $rang line rank
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
|
||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
|
||||
{
|
||||
global $mysoc, $langs;
|
||||
|
||||
|
||||
@@ -1483,8 +1483,8 @@ class Commande extends CommonOrder
|
||||
* @param int $fk_remise_except Id remise
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param float $pu_ttc Prix unitaire TTC
|
||||
* @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param int|string $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param int|string $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
|
||||
* @param int $rang Position of line
|
||||
* @param int $special_code Special code (also used by externals modules!)
|
||||
@@ -1508,7 +1508,7 @@ class Commande extends CommonOrder
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
@@ -1755,8 +1755,8 @@ class Commande extends CommonOrder
|
||||
* @param int $idproduct Product Id
|
||||
* @param float $qty Quantity
|
||||
* @param float $remise_percent Product discount relative
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int|string $date_start Start date of the line
|
||||
* @param int|string $date_end End date of the line
|
||||
* @return void
|
||||
*
|
||||
* TODO Remplacer les appels a cette fonction par generation objet Ligne
|
||||
@@ -2728,7 +2728,7 @@ class Commande extends CommonOrder
|
||||
* @param string $sortorder Sort order
|
||||
* @return int|array -1 if KO, array with result if OK
|
||||
*/
|
||||
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
|
||||
public function liste_array($shortlist = 0, $draft = 0, $excluser = null, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user;
|
||||
@@ -3092,8 +3092,8 @@ class Commande extends CommonOrder
|
||||
* @param float $txlocaltax2 Local tax 2 rate
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Miscellaneous informations on line
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int|string $date_start Start date of the line
|
||||
* @param int|string $date_end End date of the line
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||
@@ -3109,7 +3109,7 @@ class Commande extends CommonOrder
|
||||
* @param integer $rang line rank
|
||||
* @return int Return integer < 0 if KO, > 0 if OK
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
|
||||
{
|
||||
global $conf, $mysoc, $langs, $user;
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ class Account extends CommonObject
|
||||
* @param string $type To search using type
|
||||
* @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
|
||||
*/
|
||||
public function get_url($fk_bank = '', $url_id = '', $type = '')
|
||||
public function get_url($fk_bank = 0, $url_id = 0, $type = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
$lines = array();
|
||||
@@ -1258,7 +1258,7 @@ class Account extends CommonObject
|
||||
* Return current sold
|
||||
*
|
||||
* @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
|
||||
* @param int $date_end Date until we want to get bank account sold
|
||||
* @param int|string $date_end Date until we want to get bank account sold
|
||||
* @param string $field dateo or datev
|
||||
* @return int current sold (value date <= today)
|
||||
*/
|
||||
|
||||
@@ -873,7 +873,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0, $fk_parent_line = 0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = 0, $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0, $fk_parent_line = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@@ -1080,7 +1080,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $fk_parent_line Id of parent line
|
||||
* @return int Return integer <0 if KO, Id of line if OK
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0, $fk_parent_line = 0)
|
||||
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = 0, $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0, $fk_parent_line = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@@ -1447,7 +1447,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
|
||||
{
|
||||
global $langs, $hookmanager;
|
||||
|
||||
@@ -2172,7 +2172,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
|
||||
@@ -2113,7 +2113,7 @@ class Facture extends CommonInvoice
|
||||
* @param bool $fetch_situation Load also the previous and next situation invoice into $tab_previous_situation_invoice and $tab_next_situation_invoice
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = 0, $fetch_situation = false)
|
||||
{
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext)) {
|
||||
return -1;
|
||||
@@ -3747,8 +3747,8 @@ class Facture extends CommonInvoice
|
||||
* @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
|
||||
* @param int $fk_product Id of predefined product/service
|
||||
* @param double $remise_percent Percent of discount on line
|
||||
* @param int $date_start Date start of service
|
||||
* @param int $date_end Date end of service
|
||||
* @param int|string $date_start Date start of service
|
||||
* @param int|string $date_end Date end of service
|
||||
* @param int $ventil Code of dispatching into accountancy
|
||||
* @param int $info_bits Bits of type of lines
|
||||
* @param int $fk_remise_except Id discount used
|
||||
@@ -3785,7 +3785,7 @@ class Facture extends CommonInvoice
|
||||
$date_end = '',
|
||||
$ventil = 0,
|
||||
$info_bits = 0,
|
||||
$fk_remise_except = '',
|
||||
$fk_remise_except = 0,
|
||||
$price_base_type = 'HT',
|
||||
$pu_ttc = 0,
|
||||
$type = 0,
|
||||
@@ -3797,7 +3797,7 @@ class Facture extends CommonInvoice
|
||||
$fk_fournprice = null,
|
||||
$pa_ht = 0,
|
||||
$label = '',
|
||||
$array_options = 0,
|
||||
$array_options = array(),
|
||||
$situation_percent = 100,
|
||||
$fk_prev_id = 0,
|
||||
$fk_unit = null,
|
||||
@@ -4068,7 +4068,7 @@ class Facture extends CommonInvoice
|
||||
* @param integer $rang rank of line
|
||||
* @return int Return integer < 0 if KO, > 0 if OK
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = array(), $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
|
||||
{
|
||||
global $conf, $user;
|
||||
// Deprecation warning
|
||||
@@ -4709,7 +4709,7 @@ class Facture extends CommonInvoice
|
||||
* @param string $sortorder Sort order
|
||||
* @return array|int -1 if KO, array with result if OK
|
||||
*/
|
||||
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC')
|
||||
public function liste_array($shortlist = 0, $draft = 0, $excluser = null, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user;
|
||||
@@ -5581,7 +5581,7 @@ class Facture extends CommonInvoice
|
||||
* @param string $dateYmd date limit of retained warranty in Y m d format
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = false)
|
||||
public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = '')
|
||||
{
|
||||
if (!$timestamp && $dateYmd) {
|
||||
$timestamp = $this->db->jdate($dateYmd);
|
||||
@@ -6449,7 +6449,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update($user = '', $notrigger = 0)
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ class RemiseCheque extends CommonObject
|
||||
* @param User $user User that delete
|
||||
* @return int
|
||||
*/
|
||||
public function delete($user = '')
|
||||
public function delete($user = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class Paiement extends CommonObject
|
||||
* @param int $fk_bank Id of bank line associated to payment
|
||||
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '', $fk_bank = '')
|
||||
public function fetch($id, $ref = '', $fk_bank = 0)
|
||||
{
|
||||
$sql = 'SELECT p.rowid, p.ref, p.ref_ext, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank, p.multicurrency_amount,';
|
||||
$sql .= ' c.code as type_code, c.libelle as type_label,';
|
||||
|
||||
@@ -954,7 +954,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param int $did ID of an existing payment request. If $did is defined, we use the existing payment request.
|
||||
* @param int $fk_bank_account Bank account ID the receipt is generated for. Will use the ID into the setup of module Direct Debit or Credit Transfer if 0.
|
||||
* @param int $sourcetype 'invoice' or 'salary'
|
||||
* @param string $sourcetype 'invoice' or 'salary'
|
||||
* @return int Return integer <0 if KO, No of invoice included into file if OK
|
||||
*/
|
||||
public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit', $did = 0, $fk_bank_account = 0, $sourcetype = 'invoice')
|
||||
|
||||
@@ -1474,10 +1474,10 @@ class Contrat extends CommonObject
|
||||
* @param int $pa_ht Buying price HT
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $rang Position
|
||||
* @param int $rang Position
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null, $rang = 0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = array(), $fk_unit = null, $rang = 0)
|
||||
{
|
||||
global $user, $langs, $conf, $mysoc;
|
||||
$error = 0;
|
||||
@@ -1706,10 +1706,10 @@ class Contrat extends CommonObject
|
||||
* @param int $pa_ht Buying price HT
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $rang Position
|
||||
* @param int $rang Position
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx = 0.0, $localtax2tx = 0.0, $date_start_real = '', $date_end_real = '', $price_base_type = 'HT', $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null, $rang = 0)
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx = 0.0, $localtax2tx = 0.0, $date_start_real = '', $date_end_real = '', $price_base_type = 'HT', $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = array(), $fk_unit = null, $rang = 0)
|
||||
{
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
|
||||
@@ -411,7 +411,6 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
||||
$object->email_tocc = $sendtocc;
|
||||
$object->email_tobcc = $sendtobcc;
|
||||
$object->email_subject = $subject;
|
||||
$object->email_msgid = $mailfile->msgid;
|
||||
|
||||
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
|
||||
if (!empty($triggersendname) || !empty($trigger_name)) {
|
||||
|
||||
@@ -177,7 +177,7 @@ class Comment extends CommonObject
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param int $ref ref object
|
||||
* @param string $ref ref object
|
||||
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '')
|
||||
|
||||
@@ -825,7 +825,7 @@ abstract class CommonDocGenerator
|
||||
*
|
||||
* @param Expedition $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @param array $array_key Name of the key for return array
|
||||
* @param string $array_key Name of the key for return array
|
||||
* @return array Array of substitution
|
||||
*/
|
||||
public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object')
|
||||
@@ -1189,7 +1189,7 @@ abstract class CommonDocGenerator
|
||||
* @param bool $insertAfterTarget insert before or after target column ?
|
||||
* @return int new rank on success and -1 on error
|
||||
*/
|
||||
public function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false)
|
||||
public function insertNewColumnDef($newColKey, $defArray, $targetCol = '', $insertAfterTarget = false)
|
||||
{
|
||||
// prepare wanted rank
|
||||
$rank = -1;
|
||||
|
||||
@@ -4342,7 +4342,7 @@ abstract class CommonObject
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
|
||||
*/
|
||||
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '', $f_user = null, $notrigger = 0)
|
||||
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = 0, $f_user = null, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
$deletesource = false;
|
||||
@@ -8491,7 +8491,7 @@ abstract class CommonObject
|
||||
* @param string $display_type "card" for form display, "line" for document line display (extrafields on propal line, order line, etc...)
|
||||
* @return string String with html content to show
|
||||
*/
|
||||
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0, $display_type = 'card')
|
||||
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = '', $display_type = 'card')
|
||||
{
|
||||
global $db, $conf, $langs, $action, $form, $hookmanager;
|
||||
|
||||
|
||||
@@ -532,7 +532,7 @@ class DiscountAbsolute
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int Return integer <0 if KO, amount otherwise
|
||||
*/
|
||||
public function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0, $multicurrency = 0)
|
||||
public function getAvailableDiscounts($company = null, $user = null, $filter = '', $maxvalue = 0, $discount_type = 0, $multicurrency = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class DolEditor
|
||||
*
|
||||
* @param string $htmlname HTML name of WYSIWIG field
|
||||
* @param string $content Content of WYSIWIG field
|
||||
* @param int $width Width in pixel of edit area (auto by default)
|
||||
* @param int|string $width Width in pixel of edit area (auto by default)
|
||||
* @param int $height Height in pixel of edit area (200px by default)
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
|
||||
* @param string $toolbarlocation Deprecated. Not used
|
||||
@@ -67,7 +67,7 @@ class DolEditor
|
||||
* @param int $readonly 0=Read/Edit, 1=Read only
|
||||
* @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y)
|
||||
*/
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = '', $readonly = 0, $poscursor = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -9024,7 +9024,8 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
|
||||
{
|
||||
//dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function
|
||||
if (!is_array($mesgs)) {
|
||||
// If mesgs is a string
|
||||
$mesgs = trim((string) $mesgs);
|
||||
// If mesgs is a not an empty string
|
||||
if ($mesgs) {
|
||||
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) {
|
||||
return;
|
||||
@@ -9034,6 +9035,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0)
|
||||
} else {
|
||||
// If mesgs is an array
|
||||
foreach ($mesgs as $mesg) {
|
||||
$mesg = trim((string) $mesg);
|
||||
if ($mesg) {
|
||||
if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) {
|
||||
return;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -1253,6 +1254,16 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
} elseif ($action == 'PROJECT_DELETE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
if (empty($object->actionmsg2)) {
|
||||
$object->actionmsg2 = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref);
|
||||
}
|
||||
$object->actionmsg = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = 0;
|
||||
} elseif ($action == 'PROJECT_CLOSE') {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -89,6 +89,8 @@ ShippingSentByEMail=Shipment %s sent by email
|
||||
ShippingValidated= Shipment %s validated
|
||||
InterventionSentByEMail=Intervention %s sent by email
|
||||
ProjectSentByEMail=Project %s sent by email
|
||||
ProjectDeletedInDolibarr=Project %s deleted
|
||||
ProjectClosedInDolibarr=Project %s closed
|
||||
ProposalDeleted=Proposal deleted
|
||||
OrderDeleted=Order deleted
|
||||
InvoiceDeleted=Invoice deleted
|
||||
|
||||
@@ -437,3 +437,4 @@ ModifyValueExtrafields = Modify value of an extrafield
|
||||
OrProductsWithCategories=Or products with tags/categories
|
||||
WarningTransferBatchStockMouvToGlobal = If you want to deserialize this product, all its serialized stock will be transformed into global stock
|
||||
WarningConvertFromBatchToSerial=If you currently have a quantity higher or equal to 2 for the product, switching to this choice means you will still have a product with different objects of the same batch (while you want a unique serial number). The duplicate will remain until an inventory or a manual stock movement to fix this is done.
|
||||
ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?<br>The quantities currently set in the inventory will be reset.
|
||||
|
||||
@@ -262,6 +262,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'setdraft') {
|
||||
$text = $langs->trans('ConfirmSetToDraftInventory', $object->ref);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', '', 0, 1, 220);
|
||||
}
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
|
||||
@@ -403,7 +409,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Back to draft
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&confirm=yes&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>';
|
||||
}
|
||||
}
|
||||
// Back to validate
|
||||
|
||||
@@ -100,7 +100,7 @@ class Inventory extends CommonObject
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
|
||||
'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object', 'css'=>'maxwidth150'),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150'),
|
||||
'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150', 'alwayseditable'=>1),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax150'),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax150'),
|
||||
'categories_product' => array('type'=>'chkbxlst:categorie:label:rowid::type=0:0:', 'label'=>'OrProductsWithCategories', 'visible'=>3, 'enabled'=>1, 'position'=>33, 'help'=>'', 'picto'=>'category', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx'),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2023 Charlene Benke <charlene@patas_monkey.com>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -977,7 +978,11 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
|
||||
print '<select class="flat" name="status" id="status">';
|
||||
foreach ($object->labelStatusShort as $key => $val) {
|
||||
$statuses = $object->labelStatusShort;
|
||||
if (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_PROJECT')) {
|
||||
unset($statuses[$object::STATUS_DRAFT]);
|
||||
}
|
||||
foreach ($statuses as $key => $val) {
|
||||
print '<option value="'.$key.'"'.((GETPOSTISSET('status') ? GETPOST('status') : $object->statut) == $key ? ' selected="selected"' : '').'>'.$langs->trans($val).'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
|
||||
@@ -481,7 +481,7 @@ if (empty($reshook)) {
|
||||
$object->thm = GETPOST("thm", 'alphanohtml') != '' ? GETPOST("thm", 'alphanohtml') : '';
|
||||
$object->thm = price2num($object->thm);
|
||||
$object->tjm = GETPOST("tjm", 'alphanohtml') != '' ? GETPOST("tjm", 'alphanohtml') : '';
|
||||
$object->thm = price2num($object->thm);
|
||||
$object->tjm = price2num($object->tjm);
|
||||
$object->salary = GETPOST("salary", 'alphanohtml') != '' ? GETPOST("salary", 'alphanohtml') : '';
|
||||
$object->salary = price2num($object->salary);
|
||||
$object->salaryextra = GETPOST("salaryextra", 'alphanohtml') != '' ? GETPOST("salaryextra", 'alphanohtml') : '';
|
||||
|
||||
Reference in New Issue
Block a user