mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-17 23:11:29 +01:00
Debug API for ticket module
This commit is contained in:
@@ -1072,8 +1072,9 @@ class Invoices extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Add a payment to pay partially or completely one or several invoices.
|
* Add a payment to pay partially or completely one or several invoices.
|
||||||
* Warning: Take care that all invoices are owned by the same customer.
|
* Warning: Take care that all invoices are owned by the same customer.
|
||||||
|
* Example of value for parameter arrayofamounts: {"1": "99.99", "2": "10"}
|
||||||
*
|
*
|
||||||
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice. Example {"1": "99.99", "2": "10"}
|
* @param string $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
|
||||||
* @param string $datepaye {@from body} Payment date {@type timestamp}
|
* @param string $datepaye {@from body} Payment date {@type timestamp}
|
||||||
* @param int $paiementid {@from body} Payment mode Id {@min 1}
|
* @param int $paiementid {@from body} Payment mode Id {@min 1}
|
||||||
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
|
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
|
||||||
|
|||||||
@@ -2268,6 +2268,9 @@ function getModuleDirForApiClass($module)
|
|||||||
elseif ($module == 'ficheinter' || $module == 'interventions') {
|
elseif ($module == 'ficheinter' || $module == 'interventions') {
|
||||||
$moduledirforclass = 'fichinter';
|
$moduledirforclass = 'fichinter';
|
||||||
}
|
}
|
||||||
|
elseif ($module == 'tickets') {
|
||||||
|
$moduledirforclass = 'ticketsup';
|
||||||
|
}
|
||||||
|
|
||||||
return $moduledirforclass;
|
return $moduledirforclass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,16 +59,16 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @param int $id ID of product
|
* @param int $id ID of product
|
||||||
* @param int $includestockdata Load also information about stock (slower)
|
* @param int $includestockdata Load also information about stock (slower)
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @throws RestException
|
|
||||||
* @throws 401
|
* @throws 401
|
||||||
|
* @throws 403
|
||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function get($id, $includestockdata=0)
|
function get($id, $includestockdata=0)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
if(! DolibarrApiAccess::$user->rights->produit->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->product->fetch($id);
|
$result = $this->product->fetch($id);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php';
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Ticketsups extends DolibarrApi
|
class Tickets extends DolibarrApi
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
@@ -53,9 +53,6 @@ class Ticketsups extends DolibarrApi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
|
||||||
* @url GET ticketsup/
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -65,24 +62,84 @@ class Ticketsups extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties of a ticketsup object
|
* Get properties of a Ticket object.
|
||||||
*
|
*
|
||||||
* Return an array with ticketsup informations
|
* Return an array with ticket informations
|
||||||
|
*
|
||||||
|
* @param int $id ID of ticketsup
|
||||||
|
* @return array|mixed Data without useless information
|
||||||
|
*
|
||||||
|
* @throws 401
|
||||||
|
* @throws 403
|
||||||
|
* @throws 404
|
||||||
|
*/
|
||||||
|
function get($id)
|
||||||
|
{
|
||||||
|
return $this->getCommon($id, '', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a Ticket object from track id
|
||||||
|
*
|
||||||
|
* Return an array with ticket informations
|
||||||
|
*
|
||||||
|
* @param string $track_id Tracking ID of ticket
|
||||||
|
* @return array|mixed Data without useless information
|
||||||
|
*
|
||||||
|
* @url GET track_id/{track_id}
|
||||||
|
*
|
||||||
|
* @throws 401
|
||||||
|
* @throws 403
|
||||||
|
* @throws 404
|
||||||
|
*/
|
||||||
|
public function getByTrackId($track_id)
|
||||||
|
{
|
||||||
|
return $this->getCommon(0, $track_id, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a Ticket object from ref
|
||||||
|
*
|
||||||
|
* Return an array with ticket informations
|
||||||
|
*
|
||||||
|
* @param string $ref Reference for ticket
|
||||||
|
* @return array|mixed Data without useless information
|
||||||
|
*
|
||||||
|
* @url GET ref/{ref}
|
||||||
|
*
|
||||||
|
* @throws 401
|
||||||
|
* @throws 403
|
||||||
|
* @throws 404
|
||||||
|
*/
|
||||||
|
public function getByRef($ref)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $this->getCommon(0, '', $ref);
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a Ticket object
|
||||||
|
*
|
||||||
|
* Return an array with ticket informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of ticketsup
|
* @param int $id ID of ticketsup
|
||||||
* @param string $track_id Tracking ID of ticket
|
* @param string $track_id Tracking ID of ticket
|
||||||
* @param string $ref Reference for ticket
|
* @param string $ref Reference for ticket
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed Data without useless information
|
||||||
*
|
*
|
||||||
* @url GET track_id/{track_id}
|
* @throws 401
|
||||||
* @url GET ref/{ref}
|
* @throws 403
|
||||||
* @url GET {id}
|
* @throws 404
|
||||||
* @throws RestException
|
|
||||||
*/
|
*/
|
||||||
public function get($id = 0, $track_id = '', $ref = '')
|
public function getCommon($id = 0, $track_id = '', $ref = '')
|
||||||
{
|
{
|
||||||
if (! DolibarrApiAccess::$user->rights->ticketsup->read) {
|
if (! DolibarrApiAccess::$user->rights->ticketsup->read) {
|
||||||
throw new RestException(401);
|
throw new RestException(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
@@ -474,9 +531,9 @@ class Ticketsups extends DolibarrApi
|
|||||||
function _cleanObjectDatas($object)
|
function _cleanObjectDatas($object)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Remove $db object property for object
|
$object = parent::_cleanObjectDatas($object);
|
||||||
unset($object->db);
|
|
||||||
|
|
||||||
|
// Other attributes to clean
|
||||||
$attr2clean = array(
|
$attr2clean = array(
|
||||||
"contact",
|
"contact",
|
||||||
"contact_id",
|
"contact_id",
|
||||||
@@ -515,7 +572,9 @@ class Ticketsups extends DolibarrApi
|
|||||||
"firstname",
|
"firstname",
|
||||||
"civility_id",
|
"civility_id",
|
||||||
"cache_msgs_ticket",
|
"cache_msgs_ticket",
|
||||||
"cache_logs_ticket"
|
"cache_logs_ticket",
|
||||||
|
"statuts_short",
|
||||||
|
"statuts"
|
||||||
);
|
);
|
||||||
foreach ($attr2clean as $toclean) {
|
foreach ($attr2clean as $toclean) {
|
||||||
unset($object->$toclean);
|
unset($object->$toclean);
|
||||||
@@ -489,7 +489,8 @@ class Ticketsup extends CommonObject
|
|||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
if ($this->db->num_rows($resql)) {
|
if ($this->db->num_rows($resql))
|
||||||
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
@@ -529,10 +530,14 @@ class Ticketsup extends CommonObject
|
|||||||
$this->tms = $this->db->jdate($obj->tms);
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
}
|
|
||||||
$this->db->free($resql);
|
|
||||||
|
|
||||||
|
$this->db->free($resql);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::fetch " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::fetch " . $this->error, LOG_ERR);
|
||||||
|
|||||||
Reference in New Issue
Block a user