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

This commit is contained in:
ldestailleur 2025-03-17 10:56:20 +01:00
commit e4cbc6502f
3 changed files with 41 additions and 28 deletions

View file

@ -3091,29 +3091,32 @@ if ($action == 'create' && $usercancreate) {
}*/
$numshipping = 0;
if (isModEnabled('shipping')) {
$numshipping = $object->countNbOfShipments();
}
// Create shipment
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) {
$arrayforbutaction[] = array(
'lang' => 'sendings',
'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
'perm' => $user->hasRight('expedition', 'creer'),
'label' => 'CreateShipment',
'url' => '/expedition/shipment.php?id=' . $object->id
);
/*
if ($user->hasRight('expedition', 'creer')) {
print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
if (isModEnabled('shipping')) {
$numshipping = $object->countNbOfShipments();
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) {
// Add button to create shipment into the combo
$arrayforbutaction[] = array(
'lang' => 'sendings',
'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
'perm' => $user->hasRight('expedition', 'creer'),
'label' => 'CreateShipment',
'url' => '/expedition/shipment.php?id=' . $object->id
);
} else {
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
}*/
} else {
$langs->load("errors");
print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
//c$langs->load("errors");
//print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
$arrayforbutaction[] = array(
'lang' => 'sendings',
'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
'perm' => 0,
'label' => 'CreateShipment',
'url' => '/expedition/shipment.php?id=' . $object->id
);
}
}
}

View file

@ -1180,6 +1180,7 @@ if ($action == 'create') {
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Load shipments already done for same order
@ -1849,6 +1850,7 @@ if ($action == 'create') {
}
print "</table>";
print '</div>';
print '<br>';
@ -2273,7 +2275,7 @@ if ($action == 'create') {
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%" id="tablelines" >';
print '<table class="noborder centpercent" id="tablelines" >';
print '<thead>';
print '<tr class="liste_titre">';
// Adds a line numbering column
@ -2297,15 +2299,15 @@ if ($action == 'create') {
}
print '<td class="center linecoleditlineotherinfo" colspan="'.$editColspan.'">';
if ($object->status <= 1) {
print $langs->trans("QtyToShip").' - ';
print $langs->trans("QtyToShip");
} else {
print $langs->trans("QtyShipped").' - ';
print $langs->trans("QtyShipped");
}
if (isModEnabled('stock')) {
print $langs->trans("WarehouseSource").' - ';
print ' - '.$langs->trans("WarehouseSource");
}
if (isModEnabled('productbatch')) {
print $langs->trans("Batch");
print ' - '.$langs->trans("Batch");
}
print '</td>';
} else {
@ -2554,7 +2556,11 @@ if ($action == 'create') {
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number management
print '<td> - '.$langs->trans("NA").'</td>';
print '<td>';
if (isModEnabled('productbatch')) {
print ' - '.$langs->trans("NA");
}
print '</td>';
print '</tr>';
} elseif (count($lines[$i]->details_entrepot) > 1) {
print '<!-- case edit 3 -->';
@ -2565,7 +2571,11 @@ if ($action == 'create') {
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number management
print '<td> - '.$langs->trans("NA").'</td>';
print '<td>';
if (isModEnabled('productbatch')) {
print ' - '.$langs->trans("NA");
}
print '</td>';
print '</tr>';
}
} elseif ($lines[$i]->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) {

View file

@ -527,7 +527,7 @@ if ($object->id > 0 || !empty($object->ref)) {
print '</td>';
print '</tr></table>';
print '<br><center>';
print '<br><br><center>';
if (isModEnabled('barcode') || isModEnabled('productbatch')) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning&token='.currentToken().'" class="marginrightonly paddingright marginleftonly paddingleft">'.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").'</a>';
}