diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 21a9612c829..52e2f9beb83 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2061,129 +2061,6 @@ if ($action == 'create') { $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); - if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; - - $object->fetchObjectLinked(); - - $eligibleForDepositGeneration = true; - - if (array_key_exists('facture', $object->linkedObjects)) { - foreach ($object->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break; - } - } - } - - if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) { - foreach ($object->linkedObjects['commande'] as $order) { - $order->fetchObjectLinked(); - - if (array_key_exists('facture', $order->linkedObjects)) { - foreach ($order->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break 2; - } - } - } - } - } - - - if ($eligibleForDepositGeneration) { - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifsigned', - 'name' => 'generate_deposit', - 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) - ); - - $formquestion[] = array( - 'type' => 'date', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'datef', - 'label' => $langs->trans('DateInvoice'), - 'value' => dol_now(), - 'datenow' => true - ); - - if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) { - $formquestion[] = array( - 'type' => 'date', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'date_pointoftax', - 'label' => $langs->trans('DatePointOfTax'), - 'value' => dol_now(), - 'datenow' => true - ); - } - - ob_start(); - $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); - $paymentTermsSelect = ob_get_clean(); - - $formquestion[] = array( - 'type' => 'other', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'cond_reglement_id', - 'label' => $langs->trans('PaymentTerm'), - 'value' => $paymentTermsSelect - ); - - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifgeneratedeposit', - 'name' => 'validate_generated_deposit', - 'label' => $langs->trans('ValidateGeneratedDeposit') - ); - - $formquestion[] = array( - 'type' => 'onecolumn', - 'value' => ' - - ' - ); - } - } - - $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); - if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)) { require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; @@ -2221,6 +2098,7 @@ if ($action == 'create') { 'type' => 'checkbox', 'tdclass' => 'showonlyifsigned', 'name' => 'generate_deposit', + 'morecss' => 'margintoponly marginbottomonly', 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) ); @@ -2244,9 +2122,7 @@ if ($action == 'create') { ); } - ob_start(); - $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); - $paymentTermsSelect = ob_get_clean(); + $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 1, 'minwidth200'); $formquestion[] = array( 'type' => 'other', @@ -2260,6 +2136,7 @@ if ($action == 'create') { 'type' => 'checkbox', 'tdclass' => 'showonlyifgeneratedeposit', 'name' => 'validate_generated_deposit', + 'morecss' => 'margintoponly marginbottomonly', 'label' => $langs->trans('ValidateGeneratedDeposit') ); @@ -2314,9 +2191,9 @@ if ($action == 'create') { } if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 300); } else { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 300); } } elseif ($action == 'delete') { // Confirm delete diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a738bce9004..41279c8ae36 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4040,6 +4040,7 @@ class Form * 0 : use default deposit percentage from entry * > 0 : force deposit percentage (for example, from company object) * @return void + * @deprecated */ public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1) { @@ -5013,7 +5014,7 @@ class Form } elseif ($input['type'] == 'checkbox') { $more .= '
'; $more .= '
'.$input['label'].'
'; - $more .= '