forked from Wavyzz/dolibarr
Debug v21 - Restore common behaviour of other objects.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user