Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-02-12 05:48:11 +01:00
9 changed files with 116 additions and 27 deletions

View File

@@ -437,7 +437,7 @@ if ($mode == 'other') {
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') . '"></td>';
print '</tr>';
// Max size of lists
// Display checkboxes and fields menu left / right
print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>';

View File

@@ -9,37 +9,13 @@ if (!empty($totalarray['totalizable']) && is_array($totalarray['totalizable']))
}
// Show total line
if (isset($totalarray['pos'])) {
print '<tfoot>';
print '<tr class="liste_total">';
$i = 0;
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
// if $totalarray['type'] not present we consider it as number
if (empty($totalarray['type'][$i])) {
$totalarray['type'][$i] = 'real';
}
switch ($totalarray['type'][$i]) {
case 'duration':
print '<td class="right">';
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0);
print '</td>';
break;
case 'string': // This type is no more used. type is now varchar(x)
print '<td class="left">';
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : '');
print '</td>';
break;
case 'stock':
print '<td class="right">';
print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS');
print '</td>';
break;
default:
print '<td class="right">';
print price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0);
print '</td>';
break;
}
printTotalValCell($totalarray['type'][$i], $totalarray['val'][$totalarray['pos'][$i]]);
} else {
if ($i == 1) {
if (is_null($limit) || $num < $limit) {
@@ -59,4 +35,88 @@ if (isset($totalarray['pos'])) {
}
}
print '</tr>';
// Add grand total if necessary ie only if different of page total already printed above
if (getDolGlobalString('MAIN_GRANDTOTAL_LIST_SHOW') && (!(is_null($limit) || $num < $limit))) {
if (isset($totalarray['pos']) && is_array($totalarray['pos']) && count($totalarray['pos']) > 0) {
$sumsarray = false;
$tbsumfields = [];
foreach ($totalarray['pos'] as $field) {
$fieldforsum = preg_replace('/[^a-z0-9]/', '', $field);
$tbsumfields[] = "sum($field) as $fieldforsum";
}
if (isset($sqlfields)) { // In project, commande list, this var is defined
$sqlforgrandtotal = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT '. implode(",", $tbsumfields), $sql);
} else {
$sqlforgrandtotal = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT '. implode(",", $tbsumfields). ' FROM ', $sql);
}
$sqlforgrandtotal = preg_replace('/GROUP BY .*$/', '', $sqlforgrandtotal). '';
$resql = $db->query($sqlforgrandtotal);
if ($resql) {
$sumsarray = $db->fetch_array($resql);
} else {
//dol_print_error($db); // as we're not sure it's ok for ALL lists, we don't print sq errors, they'll be in logs
}
if (is_array($sumsarray) && count($sumsarray) >0) {
print '<tr class="liste_grandtotal">';
$i = 0;
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
printTotalValCell($totalarray['type'][$i], $sumsarray[$totalarray['pos'][$i]]);
} else {
if ($i == 1) {
print '<td>';
if (is_object($form)) {
print $form->textwithpicto($langs->trans("GrandTotal"), $langs->transnoentitiesnoconv("TotalforAllPages"));
} else {
print $langs->trans("GrandTotal");
}
print '</td>';
} else {
print '<td></td>';
}
}
}
print '</tr>';
}
}
}
print '</tfoot>';
}
/** print a total cell value according to its type
*
* @param string $type of field (duration, string..)
* @param string $val the value to display
*
* @return void (direct print)
*/
function printTotalValCell($type, $val)
{
// if $totalarray['type'] not present we consider it as number
if (empty($type)) {
$type = 'real';
}
switch ($type) {
case 'duration':
print '<td class="right">';
print (!empty($val) ? convertSecondToTime($val, 'allhourmin') : 0);
print '</td>';
break;
case 'string': // This type is no more used. type is now varchar(x)
print '<td class="left">';
print (!empty($val) ? $val : '');
print '</td>';
break;
case 'stock':
print '<td class="right">';
print price2num(!empty($val) ? $val : 0, 'MS');
print '</td>';
break;
default:
print '<td class="right">';
print price(!empty($val) ? $val : 0);
print '</td>';
break;
}
}

View File

@@ -833,6 +833,17 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
jQuery("#price_ht").val(data.price_ht);
}
// Set values for any fields in the form options_SOMETHING
for (var key in data.array_options) {
if (data.array_options.hasOwnProperty(key)) {
var field = jQuery("#" + key);
if(field.length > 0){
console.log("objectline_create.tpl set content of options_" + key);
field.val(data.array_options[key]);
}
}
}
var tva_tx = data.tva_tx;
var default_vat_code = data.default_vat_code;

View File

@@ -1197,6 +1197,7 @@ Skin=Skin theme
DefaultSkin=Default skin theme
MaxSizeList=Max length for list
DefaultMaxSizeList=Default max length for lists
DisplayGrandTotalInList=Display grand total (for all pages) in lists footer
DefaultMaxSizeShortList=Default max length for short lists (i.e. in customer card)
MessageOfDay=Message of the day
MessageLogin=Login page message

View File

@@ -420,6 +420,8 @@ TotalTTCShort=Total (inc. tax)
TotalHT=Total (excl. tax)
TotalHTforthispage=Total (excl. tax) for this page
Totalforthispage=Total for this page
GrandTotal=Grand total
TotalforAllPages=Total for all pages
TotalTTC=Total (inc. tax)
TotalTTCToYourCredit=Total (inc. tax) to your credit
TotalVAT=Total tax

View File

@@ -433,4 +433,8 @@ ModifyValueExtrafields = Modify value of an extrafield
OrProductsWithCategories=Or products with tags/categories
WarningTransferBatchStockMouvToGlobal = If you want to deserialize this product, all its serialized stock will be transformed into global stock
WarningConvertFromBatchToSerial=If you currently have a quantity higher or equal to 2 for the product, switching to this choice means you will still have a product with different objects of the same batch (while you want a unique serial number). The duplicate will remain until an inventory or a manual stock movement to fix this is done.
AllowStockMovementVariantParent=Allow stock movements on the variant parent
ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?<br>The quantities currently set in the inventory will be reset.

View File

@@ -1202,6 +1202,7 @@ Skin=Thème visuel
DefaultSkin=Thème visuel par défaut
MaxSizeList=Longueur maximale des listes
DefaultMaxSizeList=Longueur maximale par défaut des listes
DisplayGrandTotalInList=Affiche le total général (de toutes les pages) en bas des listes
DefaultMaxSizeShortList=Longueur maximale par défaut des listes courtes (e.g. dans la fiche client)
MessageOfDay=Message du jour
MessageLogin=Message page de connexion

View File

@@ -420,6 +420,8 @@ TotalTTCShort=Total TTC
TotalHT=Total HT
TotalHTforthispage=Montant (HT) pour la page
Totalforthispage=Total pour cette page
GrandTotal=Total général
TotalforAllPages=Total général de toutes les pages
TotalTTC=Total TTC
TotalTTCToYourCredit=Total TTC à votre crédit
TotalVAT=Total TVA

View File

@@ -50,6 +50,11 @@ if ($action) {
$error++;
}
if (!dolibarr_set_const($db, 'VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT', GETPOST('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
$error++;
}
if (!$error) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
@@ -83,6 +88,9 @@ if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
}
print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans('AllowStockMovementVariantParent').'</td><td>';
print $form->selectyesno("VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT", getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 1).'</td></tr>';
print '</table>';
print '<br><div class="center"><input type="submit" value="'.$langs->trans("Save").'" class="button button-save"></div>';