CSS
This commit is contained in:
parent
9d4bc513be
commit
46925dc9c4
@ -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' => '
|
||||
<script>
|
||||
let signedValue = ' . $object::STATUS_SIGNED . ';
|
||||
|
||||
$(document).ready(function() {
|
||||
$("[name=generate_deposit]").change(function () {
|
||||
let $self = $(this);
|
||||
let $target = $(".showonlyifgeneratedeposit").parent(".tagtr");
|
||||
|
||||
if (! $self.parents(".tagtr").is(":hidden") && $self.is(":checked")) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$("#statut").change(function() {
|
||||
let $target = $(".showonlyifsigned").parent(".tagtr");
|
||||
|
||||
if ($(this).val() == signedValue) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
$("[name=generate_deposit]").trigger("change");
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$("#statut").trigger("change");
|
||||
});
|
||||
</script>
|
||||
'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
|
||||
@ -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 .= '<div class="tagtr">';
|
||||
$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].' </div><div class="tagtd">';
|
||||
$more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
|
||||
$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
|
||||
if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
|
||||
$more .= ' checked';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user