diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index eb5dc2979d9..d3e7070a25d 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1791,7 +1791,7 @@ if ($action == 'create') {
// Terms of payment
print '
| '.$langs->trans('PaymentConditionsShort').' | ';
print img_picto('', 'paiment');
- $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
+ print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
print ' |
';
// Mode of payment
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index cf6237cd012..9998a8b714f 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -1232,7 +1232,7 @@ if ($resql) {
// Payment term
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '';
- $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
+ print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print ' | ';
}
// Payment mode
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index d6a4aead2ec..3b4b05f6ec3 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1813,7 +1813,7 @@ if ($action == 'create' && $usercancreate) {
// Terms of payment
print '| '.$langs->trans('PaymentConditionsShort').' | ';
print img_picto('', 'payment', 'class="pictofixedwidth"');
- $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
+ print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
print ' |
';
// Payment mode
@@ -2105,109 +2105,112 @@ if ($action == 'create' && $usercancreate) {
}
if ($nbMandated > 0 ) $text .= ''.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
';
+ if (getDolGlobalInt('SALE_ORDER_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) {
+ // This is a hidden option:
+ // Suggestion to create invoice during order validation is not enabled by default.
+ // Such choice should be managed by the workflow module and trigger. This option generates conflicts with some setup.
+ // It may also break step of creating an order when invoicing must be done from proposals and not from orders
+ $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
- $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';
- 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();
- $object->fetchObjectLinked();
+ $eligibleForDepositGeneration = true;
- $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 (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('propal', $object->linkedObjects)) {
- foreach ($object->linkedObjects['propal'] as $proposal) {
- $proposal->fetchObjectLinked();
+ if ($eligibleForDepositGeneration && array_key_exists('propal', $object->linkedObjects)) {
+ foreach ($object->linkedObjects['propal'] as $proposal) {
+ $proposal->fetchObjectLinked();
- if (array_key_exists('facture', $proposal->linkedObjects)) {
- foreach ($proposal->linkedObjects['facture'] as $invoice) {
- if ($invoice->type == Facture::TYPE_DEPOSIT) {
- $eligibleForDepositGeneration = false;
- break 2;
+ if (array_key_exists('facture', $proposal->linkedObjects)) {
+ foreach ($proposal->linkedObjects['facture'] as $invoice) {
+ if ($invoice->type == Facture::TYPE_DEPOSIT) {
+ $eligibleForDepositGeneration = false;
+ break 2;
+ }
}
}
}
}
- }
+ if ($eligibleForDepositGeneration) {
+ $formquestion[] = array(
+ 'type' => 'checkbox',
+ 'tdclass' => '',
+ 'name' => 'generate_deposit',
+ 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected'))
+ );
- if ($eligibleForDepositGeneration) {
- $formquestion[] = array(
- 'type' => 'checkbox',
- 'tdclass' => '',
- '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'),
+ 'name' => 'datef',
+ 'label' => $langs->trans('DateInvoice'),
'value' => dol_now(),
'datenow' => true
);
- }
- ob_start();
- $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
- $paymentTermsSelect = ob_get_clean();
+ 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
+ );
+ }
- $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')
- );
+ $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
- $formquestion[] = array(
- 'type' => 'onecolumn',
- 'value' => '
-
- '
- );
+
+ '
+ );
+ }
}
}
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 6984255b91c..ef485f62b5f 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1507,7 +1507,7 @@ if ($resql) {
// Payment term
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
print '';
- $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
+ print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print ' | ';
}
// Payment mode
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index aadaf3895e9..3edefe8f159 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3670,7 +3670,7 @@ if ($action == 'create') {
// Payment term
print '| '.$langs->trans('PaymentConditionsShort').' | ';
- $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
+ print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
print ' |
';
@@ -3702,7 +3702,7 @@ if ($action == 'create') {
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
}
}
- $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
+ print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '';
print '