From 336927ad704a78d80e698b007975264dd3fa0fcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Sep 2023 17:59:46 +0200 Subject: [PATCH] Fix link to create puchase order from sale order --- htdocs/commande/card.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/commande/card.php | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 94ba56db84d..0b681b65160 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2735,7 +2735,7 @@ if ($action == 'create' && $usercancreate) { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) { if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($usercancreatepurchaseorder) { - print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); + print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id, ''); } } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7efcb5bf9a8..c7ab4b57303 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1874,7 +1874,7 @@ class CommandeFournisseur extends CommonOrder // Predefine quantity according to packaging if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $prod = new Product($this->db); - $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); + $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', (empty($this->fk_soc) ? $this->socid : $this->fk_soc)); if ($qty < $prod->packaging) { $qty = $prod->packaging; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8f5a4a7ac33..86c2087b783 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1599,7 +1599,8 @@ if ($action == 'create') { $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $ref_client = (!empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); - $soc = $objectsrc->client; + $soc = $objectsrc->thirdparty; + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); @@ -1846,6 +1847,8 @@ if ($action == 'create') { print '
'; print ''; + $selectedLines = array(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
';