mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Debug v21 - Restore common behaviour of other objects.
This commit is contained in:
@@ -160,9 +160,10 @@ class Proposals extends DolibarrApi
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'2016-01-01')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
|
||||
* @param int $loadlinkedobjects Load also linked object
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false)
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) {
|
||||
throw new RestException(403);
|
||||
@@ -226,12 +227,18 @@ class Proposals extends DolibarrApi
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$proposal_static = new Propal($this->db);
|
||||
if ($proposal_static->fetch($obj->rowid)) {
|
||||
if ($proposal_static->fetch($obj->rowid) > 0) {
|
||||
// Add external contacts ids
|
||||
$tmparray = $proposal_static->liste_contact(-1, 'external', 1);
|
||||
if (is_array($tmparray)) {
|
||||
$proposal_static->contacts_ids = $tmparray;
|
||||
}
|
||||
|
||||
if ($loadlinkedobjects) {
|
||||
// retrieve linked objects
|
||||
$proposal_static->fetchObjectLinked();
|
||||
}
|
||||
|
||||
$obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($proposal_static), $properties);
|
||||
}
|
||||
$i++;
|
||||
|
||||
@@ -47,7 +47,8 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
global $db;
|
||||
|
||||
$this->db = $db;
|
||||
$this->commande = new Commande($this->db);
|
||||
}
|
||||
@@ -160,12 +161,13 @@ class Orders extends DolibarrApi
|
||||
* @param string $sqlfilterlines Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
|
||||
* @param int $loadlinkedobjects Load also linked object
|
||||
* @return array Array of order objects
|
||||
*
|
||||
* @throws RestException 404 Not found
|
||||
* @throws RestException 503 Error
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $sqlfilterlines = '', $properties = '', $pagination_data = false)
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $sqlfilterlines = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('commande', 'lire')) {
|
||||
throw new RestException(403);
|
||||
@@ -239,14 +241,18 @@ class Orders extends DolibarrApi
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$commande_static = new Commande($this->db);
|
||||
if ($commande_static->fetch($obj->rowid)) {
|
||||
if ($commande_static->fetch($obj->rowid) > 0) {
|
||||
// Add external contacts ids
|
||||
$tmparray = $commande_static->liste_contact(-1, 'external', 1);
|
||||
if (is_array($tmparray)) {
|
||||
$commande_static->contacts_ids = $tmparray;
|
||||
}
|
||||
// retrieve linked objects
|
||||
$commande_static->fetchObjectLinked();
|
||||
|
||||
if ($loadlinkedobjects) {
|
||||
// retrieve linked objects
|
||||
$commande_static->fetchObjectLinked();
|
||||
}
|
||||
|
||||
// Add online_payment_url, cf #20477
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
|
||||
|
||||
@@ -171,21 +171,22 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* Get a list of invoices
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||
* @param string $status Filter by invoice status : draft | unpaid | paid | cancelled
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0
|
||||
* @return array Array of invoice objects
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||
* @param string $status Filter by invoice status : draft | unpaid | paid | cancelled
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0
|
||||
* @param int $loadlinkedobjects Load also linked object
|
||||
* @return array Array of invoice objects
|
||||
*
|
||||
* @throws RestException 404 Not found
|
||||
* @throws RestException 503 Error
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '', $properties = '', $pagination_data = false)
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('facture', 'lire')) {
|
||||
throw new RestException(403);
|
||||
@@ -260,7 +261,7 @@ class Invoices extends DolibarrApi
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$invoice_static = new Facture($this->db);
|
||||
if ($invoice_static->fetch($obj->rowid)) {
|
||||
if ($invoice_static->fetch($obj->rowid) > 0) {
|
||||
// Get payment details
|
||||
$invoice_static->totalpaid = $invoice_static->getSommePaiement();
|
||||
$invoice_static->totalcreditnotes = $invoice_static->getSumCreditNotesUsed();
|
||||
@@ -272,6 +273,12 @@ class Invoices extends DolibarrApi
|
||||
if (is_array($tmparray)) {
|
||||
$invoice_static->contacts_ids = $tmparray;
|
||||
}
|
||||
|
||||
if ($loadlinkedobjects) {
|
||||
// retrieve linked objects
|
||||
$invoice_static->fetchObjectLinked();
|
||||
}
|
||||
|
||||
// Add online_payment_url, copied from order
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$invoice_static->online_payment_url = getOnlinePaymentUrl(0, 'invoice', $invoice_static->ref);
|
||||
|
||||
Reference in New Issue
Block a user