Look and feel v22

This commit is contained in:
ldestailleur
2025-03-15 15:05:02 +01:00
parent f48536a419
commit f618ee5029
6 changed files with 89 additions and 66 deletions

View File

@@ -3618,18 +3618,15 @@ if ($action == 'create') {
} }
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
print '<div class="tagtable">'."\n"; print '<div class="listofinvoicetypetable">'."\n";
// Standard invoice // Standard invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOSTINT('type') ? '' : ' checked').'> '; $tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOSTINT('type') ? '' : ' checked').'> ';
$tmp = $tmp.'<label for="radio_standard" >'.$langs->trans("InvoiceStandardAsk").'</label>'; $tmp = $tmp.'<label for="radio_standard" >'.$langs->trans("InvoiceStandardAsk").'</label>';
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', 'nowraponall', 0, 3, 'standardonsmartphone'); $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', 'nowraponall', 0, 3, 'standardonsmartphone');
print '<table class="nobordernopadding"><tr>';
print '<td>';
print $desc; print $desc;
print '</td>';
if ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid))) { if ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid))) {
/*print '<td class="nowrap" style="padding-left: 5px">'; /*print '<td class="nowrap" style="padding-left: 5px">';
$arraylist = array( $arraylist = array(
@@ -3639,17 +3636,14 @@ if ($action == 'create') {
); );
print $form->selectarray('typestandard', $arraylist, GETPOST('typestandard', 'aZ09'), 0, 0, 0, '', 1); print $form->selectarray('typestandard', $arraylist, GETPOST('typestandard', 'aZ09'), 0, 0, 0, '', 1);
print '</td>';*/ print '</td>';*/
print '<td class="nowrap" style="padding-left: 15px">'; print '<span class="opacitymedium marginleftonly">'.$langs->trans('PercentOfOriginalObject').'</span>:<input class="right" placeholder="100%" type="text" id="valuestandardinvoice" name="valuestandardinvoice" size="3" value="'.(GETPOSTISSET('valuestandardinvoice') ? GETPOST('valuestandardinvoice', 'alpha') : '100%').'"/>';
print '<span class="opacitymedium">'.$langs->trans('PercentOfOriginalObject').'</span>:<input class="right" placeholder="100%" type="text" id="valuestandardinvoice" name="valuestandardinvoice" size="3" value="'.(GETPOSTISSET('valuestandardinvoice') ? GETPOST('valuestandardinvoice', 'alpha') : '100%').'"/>';
print '</td>';
} }
print '</tr></table>'; print '</div></div>'."\n";
print '</div></div>';
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) { if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) {
// Deposit - Down payment // Deposit - Down payment
if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) { if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOSTINT('type') == 3 ? ' checked' : '').'> '; $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOSTINT('type') == 3 ? ' checked' : '').'> ';
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@@ -3660,13 +3654,23 @@ if ($action == 'create') {
jQuery("#radio_deposit").prop("checked", true); jQuery("#radio_deposit").prop("checked", true);
}); });
jQuery("#typedeposit").change(function() { jQuery("#typedeposit").change(function() {
console.log("We change type of down payment"); console.log("We change type of down payment: "+jQuery("#typedeposit").val());
if (jQuery("#typedeposit").val() == "amount") {
jQuery("#valuedeposit").attr("placeholder", "'.$langs->getCurrencySymbol($conf->currency).'");
jQuery("#valuedeposit").val("");
} else {
jQuery("#valuedeposit").attr("placeholder", "50%");
jQuery("#valuedeposit").val("");
}
jQuery("#radio_deposit").prop("checked", true); jQuery("#radio_deposit").prop("checked", true);
setRadioForTypeOfInvoice(); setRadioForTypeOfInvoice();
}); });
jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() { jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() {
setRadioForTypeOfInvoice(); setRadioForTypeOfInvoice();
}); });
function setRadioForTypeOfInvoice() { function setRadioForTypeOfInvoice() {
console.log("Change radio for type of invoice"); console.log("Change radio for type of invoice");
if (jQuery("#radio_deposit").prop("checked") && (jQuery("#typedeposit").val() == \'amount\' || jQuery("#typedeposit").val() == \'variable\')) { if (jQuery("#radio_deposit").prop("checked") && (jQuery("#typedeposit").val() == \'amount\' || jQuery("#typedeposit").val() == \'variable\')) {
@@ -3684,15 +3688,11 @@ if ($action == 'create') {
}); });
</script>'; </script>';
print '<table class="nobordernopadding"><tr>';
print '<td>';
$tmp = $tmp.'<label for="radio_deposit">'.$langs->trans("InvoiceDeposit").'</label>'; $tmp = $tmp.'<label for="radio_deposit">'.$langs->trans("InvoiceDeposit").'</label>';
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone'); $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone');
print $desc; print $desc;
print '</td>';
if (($origin == 'propal') || ($origin == 'commande')) { if (($origin == 'propal') || ($origin == 'commande')) {
print '<td class="nowrap" style="padding-left: 15px">';
$arraylist = array( $arraylist = array(
'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')),
'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')),
@@ -3709,42 +3709,39 @@ if ($action == 'create') {
if (empty($valuedeposit) && $typedeposit == 'variable' && !empty($objectsrc->deposit_percent)) { if (empty($valuedeposit) && $typedeposit == 'variable' && !empty($objectsrc->deposit_percent)) {
$valuedeposit = $objectsrc->deposit_percent; $valuedeposit = $objectsrc->deposit_percent;
} }
print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1); print '<span class="marginleftonly">'.$form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1).'</span>';
print '</td>'; //print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span>';
print '<td class="nowrap" style="padding-left: 5px">'; print '<input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.($valuedeposit ? $valuedeposit : '').'"'.($valudeposit ? '' : 'placeholder="'.$langs->getCurrencySymbol($conf->currency).'"').'>';
print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span>';
print '<input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.($valuedeposit ? $valuedeposit : '').'"/>';
print '</td>';
} }
print '</tr></table>';
print '</div></div>'; print '</div></div>'."\n";
} }
} }
if ($socid > 0) { if ($socid > 0) {
if (getDolGlobalString('INVOICE_USE_SITUATION')) { if (getDolGlobalString('INVOICE_USE_SITUATION')) {
// First situation invoice // First situation invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input id="radio_situation" type="radio" name="type" value="5"'.(GETPOST('type') == 5 ? ' checked' : '').'> '; $tmp = '<input id="radio_situation" type="radio" name="type" value="5"'.(GETPOST('type') == 5 ? ' checked' : '').'> ';
$tmp = $tmp.'<label for="radio_situation" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>'; $tmp = $tmp.'<label for="radio_situation" >'.$langs->trans("InvoiceFirstSituationAsk").'</label>';
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
$desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone');
print $desc; print $desc;
print '</div></div>';
// Next situation invoice // Next situation invoice
$opt = $form->selectSituationInvoices((string) GETPOSTINT('originid'), $socid); $opt = $form->selectSituationInvoices((string) GETPOSTINT('originid'), $socid);
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; //print ' &nbsp; ';
print '</div></div><div class="listofinvoicetype"><div>';
$tmp = '<input id="radio_situation_bis" type="radio" name="type" value="5"'.(GETPOST('type') == 5 && GETPOSTINT('originid') ? ' checked' : ''); $tmp = '<input id="radio_situation_bis" type="radio" name="type" value="5"'.(GETPOST('type') == 5 && GETPOSTINT('originid') ? ' checked' : '');
if ($opt == ('<option value ="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) { if ($opt == ('<option value="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
$tmp .= ' disabled'; $tmp .= ' disabled';
} }
$tmp .= '> '; $tmp .= '> ';
$text = $tmp.'<label for="radio_situation_bis">'.$langs->trans("InvoiceSituationAsk").'</label> '; $text = $tmp.'<label for="radio_situation_bis">'.$langs->trans("InvoiceSituationAsk").'</label> ';
$text .= '<select class="flat" id="situations" name="situations"'; $text .= '<select class="flat minwidth50" id="situations" name="situations"';
if ($opt == ('<option value ="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) { if ($opt == ('<option value="0" selected>'.$langs->trans('NoSituations').'</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) {
$text .= ' disabled'; $text .= ' disabled';
} }
$text .= '>'; $text .= '>';
@@ -3752,7 +3749,7 @@ if ($action == 'create') {
$text .= '</select>'; $text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'; print '</div></div>'."\n";
} }
// Replacement // Replacement
@@ -3777,7 +3774,7 @@ if ($action == 'create') {
} }
print '<!-- replacement line -->'; print '<!-- replacement line -->';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" name="type" id="radio_replacement" value="1"'.(GETPOST('type') == 1 ? ' checked' : ''); $tmp = '<input type="radio" name="type" id="radio_replacement" value="1"'.(GETPOST('type') == 1 ? ' checked' : '');
if (!$options || $invoice_predefined->id > 0) { if (!$options || $invoice_predefined->id > 0) {
$tmp .= ' disabled'; $tmp .= ' disabled';
@@ -3786,6 +3783,7 @@ if ($action == 'create') {
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() { jQuery("#fac_replacement").change(function() {
console.log("We change fac_replacement");
jQuery("#radio_replacement").prop("checked", true); jQuery("#radio_replacement").prop("checked", true);
}); });
}); });
@@ -3805,26 +3803,25 @@ if ($action == 'create') {
$text .= '</select>'; $text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</div></div>'; print '</div></div>'."\n";
} }
} else { } else {
if (getDolGlobalString('INVOICE_USE_SITUATION')) { if (getDolGlobalString('INVOICE_USE_SITUATION')) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
$text = $tmp.'<label>'.$langs->trans("InvoiceSituationAsk").'</label> '; $text = $tmp.'<label>'.$langs->trans("InvoiceSituationAsk").'</label> ';
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> '; $text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', 'nowraponall', 0, 3, 'firstsituationonsmartphone'); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', 'nowraponall', 0, 3, 'firstsituationonsmartphone');
print $desc; print $desc;
print '</div></div>'; print '</div></div>'."\n";
} }
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
$text = $tmp.'<label for="radio_replacement" class="opacitymedium">'.$langs->trans("InvoiceReplacement").'</label> '; $text = $tmp.'<label for="radio_replacement" class="opacitymedium">'.$langs->trans("InvoiceReplacement").'</label> ';
//$text .= '<span class="opacitymedium hideonsmartphone">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'<br><br>'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', 'nowraponall', 0, 3, 'replacementonsmartphone'); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'<br><br>'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', 'nowraponall', 0, 3, 'replacementonsmartphone');
print $desc; print $desc;
print '</div></div>'; print '</div></div>'."\n";
} }
if (empty($origin)) { if (empty($origin)) {
@@ -3861,7 +3858,7 @@ if ($action == 'create') {
$optionsav .= '</option>'; $optionsav .= '</option>';
} }
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" id="radio_creditnote" name="type" value="2"'.(GETPOST('type') == 2 ? ' checked' : ''); $tmp = '<input type="radio" id="radio_creditnote" name="type" value="2"'.(GETPOST('type') == 2 ? ' checked' : '');
if ((!$optionsav && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) || $invoice_predefined->id > 0) { if ((!$optionsav && !getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) || $invoice_predefined->id > 0) {
$tmp .= ' disabled'; $tmp .= ' disabled';
@@ -3881,9 +3878,11 @@ if ($action == 'create') {
jQuery("#credit_note_options").hide(); jQuery("#credit_note_options").hide();
} }
jQuery("#radio_creditnote").click(function() { jQuery("#radio_creditnote").click(function() {
jQuery("#credit_note_options").show(); jQuery("#credit_note_options").show();
}); });
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() { jQuery("#radio_standard, #radio_replacement, #radio_deposit, #radio_situation, #radio_situation_bis").click(function() {
console.log("We click on a radio to close credit not options");
jQuery("#credit_note_options").hide(); jQuery("#credit_note_options").hide();
}); });
}); });
@@ -3895,7 +3894,7 @@ if ($action == 'create') {
} }
$text .= '>'; $text .= '>';
if ($optionsav) { if ($optionsav) {
$text .= '<option value="-1"></option>'; $text .= '<option value="-1">'.$langs->trans("InvoiceAvoirAskCombo").'</option>';
$text .= $optionsav; $text .= $optionsav;
} else { } else {
$text .= '<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>'; $text .= '<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
@@ -3905,14 +3904,15 @@ if ($action == 'create') {
print $desc; print $desc;
print '<div id="credit_note_options" class="clearboth paddingtop marginbottomonly">'; print '<div id="credit_note_options" class="clearboth paddingtop marginbottomonly">';
print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithLines') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>"; print '<div class="marginleftlarge"><input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithLines') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithLines" class="small">'.$langs->trans('invoiceAvoirWithLines')."</label></div>";
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithPaymentRestAmount') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>"; //print '<br>';
print '<div class="marginleftlarge"><input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOSTINT('invoiceAvoirWithPaymentRestAmount') > 0 ? 'checked' : '').' /> <label for="invoiceAvoirWithPaymentRestAmount" class="small">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label></div>";
print '</div>'; print '</div>';
print '</div></div>'; print '</div></div>'."\n";
} }
} else { } else {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
if (!getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) { if (!getDolGlobalString('INVOICE_CREDIT_NOTE_STANDALONE')) {
$tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
} else { } else {
@@ -3927,12 +3927,12 @@ if ($action == 'create') {
} }
// Template invoice // Template invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="listofinvoicetype"><div class="">';
$tmp = '<input type="radio" name="type" id="radio_template" value="0" disabled> '; $tmp = '<input type="radio" name="type" id="radio_template" value="0" disabled> ';
$text = $tmp.'<label class="opacitymedium" for="radio_template">'.$langs->trans("RepeatableInvoice").'</label> '; $text = $tmp.'<label class="opacitymedium" for="radio_template">'.$langs->trans("RepeatableInvoice").'</label> ';
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone'); $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone');
print $desc; print $desc;
print '</div></div>'; print '</div></div>'."\n";
print '</div>'; print '</div>';

View File

@@ -5192,7 +5192,8 @@ class Form
$langs->load('bills'); $langs->load('bills');
$opt = '<option value="" selected></option>'; $opt = '';
$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc"; $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
$sql .= ' FROM ' . $this->db->prefix() . 'facture'; $sql .= ' FROM ' . $this->db->prefix() . 'facture';
$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; $sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
@@ -5202,6 +5203,8 @@ class Form
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
$nbSituationInvoiceForThirdparty = 0;
if ($resql && $this->db->num_rows($resql) > 0) { if ($resql && $this->db->num_rows($resql) > 0) {
// Last seen cycle // Last seen cycle
$ref = 0; $ref = 0;
@@ -5214,6 +5217,8 @@ class Form
if ($obj->situation_final != 1) { if ($obj->situation_final != 1) {
//Not prov? //Not prov?
if (substr($obj->ref, 1, 4) != 'PROV') { if (substr($obj->ref, 1, 4) != 'PROV') {
$nbSituationInvoiceForThirdparty++;
if ($selected == $obj->rowid) { if ($selected == $obj->rowid) {
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
} else { } else {
@@ -5226,9 +5231,13 @@ class Form
} else { } else {
dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
} }
if ($opt == '<option value ="" selected></option>') {
$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; if ($nbSituationInvoiceForThirdparty > 0) {
$opt = '<option class="minwidth100" value="" selected>&nbsp;</option>'.$opt;
} else {
$opt = '<option class="minwidth100" value="-1" selected>'.$langs->trans('NoSituations').'</option>';
} }
return $opt; return $opt;
} }

View File

@@ -20,26 +20,30 @@
* Needs the following variables defined: * Needs the following variables defined:
* $object Proposal, order, invoice (including supplier versions) * $object Proposal, order, invoice (including supplier versions)
* $thirdparty Third party of object * $thirdparty Third party of object
* $absolute_discount Amount of fixed discounts available
* $absolute_creditnote Amount of credit notes available
* $discount_type 0 => Customer discounts, 1 => Supplier discounts * $discount_type 0 => Customer discounts, 1 => Supplier discounts
* $cannotApplyDiscount Set it to prevent form to apply discount
* $backtopage URL to come back to from discount modification pages * $backtopage URL to come back to from discount modification pages
*/ */
/**
* @var Form $form /**
* @var Translate $langs * @var Object $object
* @var Form $form
* @var Translate $langs
* @var Societe $thirdparty
* @var float $absolute_discount Amount of fixed discounts available
* @var float $absolute_creditnote Amount of credit notes available
* @var int $cannotApplyDiscount
*/ */
print '<!-- BEGIN object_discounts.tpl.php -->'."\n"; print '<!-- BEGIN object_discounts.tpl.php -->'."\n";
' '
@phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object @phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object
@phan-var-force Societe $thirdparty @phan-var-force Societe $thirdparty
@phan-var-force string $backtopage @phan-var-force string $backtopage
@phan-var-force string $filtercreditnote @phan-var-force string $filtercreditnote
@phan-var-force string $filterabsolutediscount @phan-var-force string $filterabsolutediscount
@phan-var-force int<0,1> $discount_type @phan-var-force int<0,1> $discount_type
@phan-var-force int $resteapayer @phan-var-force int $resteapayer
'; ';
$objclassname = get_class($object); $objclassname = get_class($object);
@@ -85,12 +89,11 @@ if ($absolute_discount > 0) {
print '<!-- absolute_discount -->'; print '<!-- absolute_discount -->';
if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) { if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
$translationKey = empty($discount_type) ? 'CompanyHasDownPaymentOrCommercialDiscount' : 'HasDownPaymentOrCommercialDiscountFromSupplier'; $translationKey = empty($discount_type) ? 'CompanyHasDownPaymentOrCommercialDiscount' : 'HasDownPaymentOrCommercialDiscountFromSupplier';
$text = $langs->trans($translationKey, price($absolute_discount, 0, $langs, 1, -1, -1, $conf->currency)).'.'; $text = $langs->trans($translationKey, price($absolute_discount, 0, $langs, 1, -1, -1, $conf->currency));
if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) { if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
} }
if ($isNewObject) { if ($isNewObject) {
$text .= ' '.$addabsolutediscount; $text .= ' '.$addabsolutediscount;
} }

View File

@@ -30,7 +30,8 @@ InvoiceReplacementShort=Replacement
InvoiceReplacementAsk=Replacement invoice for invoice InvoiceReplacementAsk=Replacement invoice for invoice
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to completely replace an invoice with no payment already received.<br><br>Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'. InvoiceReplacementDesc=<b>Replacement invoice</b> is used to completely replace an invoice with no payment already received.<br><br>Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'.
InvoiceAvoir=Credit note InvoiceAvoir=Credit note
InvoiceAvoirAsk=Credit note to correct invoice InvoiceAvoirAsk=Credit note for correction
InvoiceAvoirAskCombo=Invoice to correct
InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to correct the fact that an invoice shows an amount that differs from the amount actually paid (eg the customer paid too much by mistake, or will not pay the complete amount since some products were returned). InvoiceAvoirDesc=The <b>credit note</b> is a negative invoice used to correct the fact that an invoice shows an amount that differs from the amount actually paid (eg the customer paid too much by mistake, or will not pay the complete amount since some products were returned).
invoiceAvoirWithLines=Create Credit Note with lines from the origin invoice invoiceAvoirWithLines=Create Credit Note with lines from the origin invoice
invoiceAvoirWithPaymentRestAmount=Create Credit Note with remaining unpaid of origin invoice invoiceAvoirWithPaymentRestAmount=Create Credit Note with remaining unpaid of origin invoice

View File

@@ -1181,6 +1181,9 @@ td.wordbreak img, td.wordbreakimp img {
.marginright2 { .marginright2 {
margin-<?php print $right; ?>: 2px; margin-<?php print $right; ?>: 2px;
} }
.marginleftlarge {
margin-<?php print $left; ?>: 20px !important;
}
.paddinglarge { .paddinglarge {
padding: 6px !important; padding: 6px !important;
} }
@@ -1378,8 +1381,12 @@ span.fa.fa-plus-circle.paddingleft {
font-size: 1em; font-size: 1em;
} }
.listofinvoicetype { .listofinvoicetype {
height: 2.2em; min-height: 1.8em;
vertical-align: middle; vertical-align: middle;
padding-top: 7px;
padding-bottom: 1px;
display: flex;
align-items: center;
} }
.divsocialnetwork:not(:last-child) { .divsocialnetwork:not(:last-child) {
padding-<?php print $right; ?>: 20px; padding-<?php print $right; ?>: 20px;

View File

@@ -1346,6 +1346,9 @@ td.wordbreak img, td.wordbreakimp img {
.marginright2 { .marginright2 {
margin-<?php print $right; ?>: 2px; margin-<?php print $right; ?>: 2px;
} }
.marginleftlarge {
margin-<?php print $left; ?>: 20px !important;
}
.paddinglarge { .paddinglarge {
padding: 6px !important; padding: 6px !important;
} }