From 53ff837d0f84589342c6456be43304b6930473f2 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 29 Mar 2022 09:48:18 +0200 Subject: [PATCH 1/3] fix #20477: add online_payment_url on orders API requests --- htdocs/commande/class/api_orders.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 48865f958a2..b2fd8f830c6 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -230,6 +230,10 @@ class Orders extends DolibarrApi if ($commande_static->fetch($obj->rowid)) { // Add external contacts ids $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1); + // 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); + $obj_ret[] = $this->_cleanObjectDatas($commande_static); } $i++; @@ -735,6 +739,10 @@ class Orders extends DolibarrApi $this->commande->fetchObjectLinked(); + //fix #20477 : add online_payment_url + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); + return $this->_cleanObjectDatas($this->commande); } From 9f2480712bd7dd0d7ba4ee5decd3293bc62d1066 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 29 Mar 2022 10:32:14 +0200 Subject: [PATCH 2/3] end of #20477 --- htdocs/commande/class/api_orders.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index b2fd8f830c6..0e14c99bb27 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -135,6 +135,11 @@ class Orders extends DolibarrApi // Add external contacts ids $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list); $this->commande->fetchObjectLinked(); + + // Add online_payment_url, cf #20477 + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); + return $this->_cleanObjectDatas($this->commande); } From 1589afde1990ea518ba0dedb3fcf9d91e289c497 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 30 Mar 2022 14:06:15 +0200 Subject: [PATCH 3/3] fix #20477 : add online_payment_url as public var --- htdocs/commande/class/commande.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 06f2e6c318d..5eec9bcc792 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -266,6 +266,11 @@ class Commande extends CommonOrder */ public $expeditions; + /** + * @var string payment url + */ + public $online_payment_url; + /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')