From 3ba97627ff1be26f39ccb58b4382bfd4c89836d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 2 Nov 2015 15:50:03 +0100 Subject: [PATCH] FIX Default thirdparty when cloning invoice was not set. --- htdocs/compta/facture.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6368dd00831..9608bd87a0c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2548,7 +2548,8 @@ else if ($id > 0 || ! empty($ref)) $qualified_for_stock_change = $object->hasProductsOrServices(1); } - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) { + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) + { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2738,17 +2739,19 @@ else if ($id > 0 || ! empty($ref)) } // Clone confirmation - if ($action == 'clone') { + if ($action == 'clone') + { // Create an array for form $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) - array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company('', 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1))); + array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1))); // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('CloneInvoice'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - if (! $formconfirm) { + if (! $formconfirm) + { $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; -- GitLab