Skip to content

Conversation

@thersane-john
Copy link
Contributor

@thersane-john thersane-john commented Oct 1, 2024

Need #441 before.

c'est possible grâce à la PR coeur suivante : Dolibarr/dolibarr#31266

Cette PR permet de réduire le nombre de bouton "sous total" sur les documents et simplifier cette zone...

@thersane-john thersane-john marked this pull request as ready for review October 17, 2024 15:38
Comment on lines +4219 to +4224
let tr = '<tr><td>'+jsConf.langs.SubtotalOptions+'</td><td>';
tr+= '<label><input type="checkbox" value="1" name="subtotal_add_title_bloc_from_orderstoinvoice" checked="checked" /> '+jsConf.langs.AddTitleBlocFromOrdersToInvoice+'</label>';
if(jsConf.isModShippingEnable){
tr+= '<br/><label><input type="checkbox" value="1" name="subtotal_add_shipping_list_to_title_desc" /> '+jsConf.langs.AddShippingListToTile+' <i class="fa fa-question-circle" title="'+jsConf.langs.UseHiddenConfToAutoCheck+' SUBTOTAL_DEFAULT_CHECK_SHIPPING_LIST_FOR_TITLE_DESC"></label>';
}
tr+= '<td></tr>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour la lisibilité (je sais pas si ça vaut vraiment le coup, mais je trouve ça plus simple à comprendre).
J'ai pas testé encore, mais en principe, ça ne doit rien changer.

Suggested change
let tr = '<tr><td>'+jsConf.langs.SubtotalOptions+'</td><td>';
tr+= '<label><input type="checkbox" value="1" name="subtotal_add_title_bloc_from_orderstoinvoice" checked="checked" /> '+jsConf.langs.AddTitleBlocFromOrdersToInvoice+'</label>';
if(jsConf.isModShippingEnable){
tr+= '<br/><label><input type="checkbox" value="1" name="subtotal_add_shipping_list_to_title_desc" /> '+jsConf.langs.AddShippingListToTile+' <i class="fa fa-question-circle" title="'+jsConf.langs.UseHiddenConfToAutoCheck+' SUBTOTAL_DEFAULT_CHECK_SHIPPING_LIST_FOR_TITLE_DESC"></label>';
}
tr+= '<td></tr>';
const checkboxWithLabel = (name, label, checked = false) => `<label><input type="checkbox" value="1" name="${name}" ${checked ? 'checked="checked"' : ''} />${label}</label>`;
const buildInfoHelp = (helpText, faClass='fa-question-circle') => `<i class="fa ${faClass}" title="${helpText}"></i>`;
let optCheckboxes = checkboxWithLabel('subtotal_add_title_bloc_from_orderstoinvoice', jsConf.langs.AddTitleBlocFromOrdersToInvoice, true);
if (jsConf.isModShippingEnable) {
optCheckboxes += checkboxWithLabel(
'subtotal_add_shipping_list_to_title_desc',
buildInfoHelp(jsConf.langs.UseHiddenConfToAutoCheck + ' SUBTOTAL_DEFAULT_CHECK_SHIPPING_LIST_FOR_TITLE_DESC')
);
}
const tr = `<tr><td>${jsConf.langs.SubtotalOptions}</td><td>${optCheckboxes}</td></tr>`;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Franchement je ne sais pas non plus, au début j'avais fait un peu comme toi mais après j'ai changé pour remettre un truc plus "à l'ancienne" car je me suis dit que ce serait plus compréhensible, mais je me suis peut-être fait des idées...
Du coup je ne sais pas. Mais vu que c'est toi maintenant le mainteneur du module, je dirais que c'est toi qui choisis ;-)

Copy link
Contributor

@atm-florianm atm-florianm Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu sais quoi ? Je vais merger tel quel et quand j'aurai du temps pour faire des tests et de la refacto, je reprendrai ça… au moins je prends aucun risque.

thersane-john and others added 2 commits November 27, 2024 07:31
Co-authored-by: Florian Mortgat <[email protected]>
Co-authored-by: Florian Mortgat <[email protected]>
thersane-john and others added 4 commits November 27, 2024 07:31
@atm-florianm atm-florianm merged commit 96b8e47 into ATM-Consulting:main Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants