Merge branch '13.0_new_collapse_batch_detail' of github.com:atm-gauthier/dolibarr into develop_new_collapse_batch_detail

This commit is contained in:
Gauthier PC portable 024 2021-04-20 09:44:24 +02:00
commit cbfb2d9b47
5 changed files with 73 additions and 4 deletions

View File

@ -743,6 +743,21 @@ if ($conf->use_javascript_ajax) {
}
print "</td>\n";
print "</tr>\n";
if (!empty($conf->productbatch->enabled)) {
print '<tr class="oddeven">';
print '<td>' . $langs->trans("ShowAllBatchByDefault") . '</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_SHOW_ALL_BATCH_BY_DEFAULT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_SHOW_ALL_BATCH_BY_DEFAULT", $arrval, $conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT);
}
print "</td>\n";
print "</tr>\n";
}
print '</table>';
print '</form>';

View File

@ -250,6 +250,12 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if (!$user->rights->societe->client->voir && empty($socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}

View File

@ -254,4 +254,5 @@ ReOpen=Reopen
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock.
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
AutofillWithExpected=Fill real quantity with expected quantity
AutofillWithExpected=Fill real quantity with expected quantity
ShowAllBatchByDefault=By default, show batch details on product "stock" tab

View File

@ -255,3 +255,4 @@ ConfirmFinish=Do you confirm the closing of the inventory ? This will generate a
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
AutofillWithExpected=Fill real quantity with expected quantity
ShowAllBatchByDefault=Dérouler par défaut le détail des lots dans l'onglet "stock"

View File

@ -9,6 +9,7 @@
* Copyright (C) 2014-2015 Cédric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -521,6 +522,44 @@ if ($id > 0 || $ref) {
llxHeader('', $title, $helpurl);
?>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".collapse_batch").click(function() {
var id_entrepot = $(this).attr('id').replace('ent', '');
if($(this).text().indexOf('+') > 0) {
$(".batch_warehouse" + id_entrepot).show();
$(this).html('(-)&nbsp;');
}
else {
$(".batch_warehouse" + id_entrepot).hide();
$(this).html('(+)&nbsp;');
}
return false;
});
$("#show_all").click(function() {
$("[class^=batch_warehouse]").show();
$("[class^=collapse_batch]").html('(-)&nbsp;');
return false;
});
$("#hide_all").click(function() {
$("[class^=batch_warehouse]").hide();
$("[class^=collapse_batch]").html('(+)&nbsp;');
return false;
});
});
</script>
<?php
if ($result > 0) {
$head = product_prepare_head($object);
$titre = $langs->trans("CardProduct".$object->type);
@ -859,7 +898,10 @@ if (!$variants) {
print '</tr>';
if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) {
$colspan = 3;
print '<tr class="liste_titre"><td class="width25"></td>';
print '<tr class="liste_titre"><td width="14%">';
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a><br>';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>';
print '</td>';
print '<td class="right">'.$langs->trans("batch_number").'</td>';
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
$colspan--;
@ -914,7 +956,11 @@ if (!$variants) {
$stock_real = price2num($obj->reel, 'MS');
print '<tr class="oddeven">';
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
print '<td colspan="4">';
if (!empty($conf->productbatch->enabled)) {
print '<a class="collapse_batch" id="ent' . $entrepotstatic->id . '" href="#">' . (empty($conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT) ? '(+)' : '(-)') . '&nbsp;</a>';
}
print $entrepotstatic->getNomUrl(1).'</td>';
print '<td class="right">'.$stock_real.($stock_real < 0 ? ' '.img_warning() : '').'</td>';
// PMP
print '<td class="right">'.(price2num($object->pmp) ? price2num($object->pmp, 'MU') : '').'</td>';
@ -984,7 +1030,7 @@ if (!$variants) {
print '<td></td>';
print '</tr>';
} else {
print "\n".'<tr><td class="left">';
print "\n".'<tr style="display:'.(empty($conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT) ? 'none' : 'visible').';" class="batch_warehouse'.$entrepotstatic->id.'"><td class="left">';
print '</td>';
print '<td class="right nowraponall">';
print $product_lot_static->getNomUrl(1);