Fix Quick hack to solve legal problem in some countries.

This commit is contained in:
Laurent Destailleur 2016-08-31 18:35:15 +02:00
parent 45fceaeea5
commit 56d6510472

View File

@ -2190,31 +2190,34 @@ if ($action == 'create')
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
{ {
// Deposit // Deposit
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; {
print '<script type="text/javascript" language="javascript"> print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
jQuery(document).ready(function() { $tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
jQuery("#typedeposit, #valuedeposit").click(function() { print '<script type="text/javascript" language="javascript">
jQuery("#radio_deposit").prop("checked", true); jQuery(document).ready(function() {
}); jQuery("#typedeposit, #valuedeposit").click(function() {
}); jQuery("#radio_deposit").prop("checked", true);
</script>'; });
});
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); </script>';
print '<table class="nobordernopadding"><tr><td>';
print $desc; $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
print '</td>'; print '<table class="nobordernopadding"><tr><td>';
if (($origin == 'propal') || ($origin == 'commande')) print $desc;
{ print '</td>';
print '<td class="nowrap" style="padding-left: 5px">'; if (($origin == 'propal') || ($origin == 'commande'))
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); {
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); print '<td class="nowrap" style="padding-left: 5px">';
print '</td>'; $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>'; print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
} print '</td>';
print '</td></tr></table>'; print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
}
print '</div></div>'; print '</td></tr></table>';
print '</div></div>';
}
} }
if ($socid > 0) if ($socid > 0)
@ -2244,32 +2247,36 @@ if ($action == 'create')
} }
// Replacement // Replacement
print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); {
if (! $options) $tmp.=' disabled'; print '<!-- replacement line -->';
$tmp.='> '; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<script type="text/javascript" language="javascript"> $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
jQuery(document).ready(function() { if (! $options) $tmp.=' disabled';
jQuery("#fac_replacement").change(function() { $tmp.='> ';
jQuery("#radio_replacement").prop("checked", true); print '<script type="text/javascript" language="javascript">
}); jQuery(document).ready(function() {
}); jQuery("#fac_replacement").change(function() {
</script>'; jQuery("#radio_replacement").prop("checked", true);
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; });
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"'; });
if (! $options) </script>';
$text .= ' disabled'; $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
$text .= '>'; $text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
if ($options) { if (! $options)
$text .= '<option value="-1">&nbsp;</option>'; $text .= ' disabled';
$text .= $options; $text .= '>';
} else { if ($options) {
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>'; $text .= '<option value="-1">&nbsp;</option>';
$text .= $options;
} else {
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
}
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
} }
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
} }
else else
{ {
@ -2286,48 +2293,51 @@ if ($action == 'create')
{ {
if ($socid > 0) if ($socid > 0)
{ {
// Credit note // Credit note
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : ''); {
if (! $optionsav) $tmp.=' disabled'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp.= '> '; $tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
// Show credit note options only if we checked credit note if (! $optionsav) $tmp.=' disabled';
print '<script type="text/javascript" language="javascript"> $tmp.= '> ';
jQuery(document).ready(function() { // Show credit note options only if we checked credit note
if (! jQuery("#radio_creditnote").is(":checked")) print '<script type="text/javascript" language="javascript">
{ jQuery(document).ready(function() {
jQuery("#credit_note_options").hide(); if (! jQuery("#radio_creditnote").is(":checked"))
} {
jQuery("#radio_creditnote").click(function() { jQuery("#credit_note_options").hide();
jQuery("#credit_note_options").show(); }
}); jQuery("#radio_creditnote").click(function() {
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() { jQuery("#credit_note_options").show();
jQuery("#credit_note_options").hide(); });
}); jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
}); jQuery("#credit_note_options").hide();
</script>'; });
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' '; });
// $text.='<input type="text" value="">'; </script>';
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"'; $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
if (! $optionsav) // $text.='<input type="text" value="">';
$text .= ' disabled'; $text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
$text .= '>'; if (! $optionsav)
if ($optionsav) { $text .= ' disabled';
$text .= '<option value="-1"></option>'; $text .= '>';
$text .= $optionsav; if ($optionsav) {
} else { $text .= '<option value="-1"></option>';
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>'; $text .= $optionsav;
} } else {
$text .= '</select>'; $text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); }
print $desc; $text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print '<div id="credit_note_options" class="clearboth">'; print $desc;
print '&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>"; print '<div id="credit_note_options" class="clearboth">';
print '</div>'; print '&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div></div>'; print '</div>';
print '</div></div>';
}
} }
else else
{ {