From 119716bd82e409595ae45e38ac7f540e23f55ed2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Mar 2025 23:56:14 +0100 Subject: [PATCH 1/3] Fix button "Create shipment" if no permission --- htdocs/commande/card.php | 43 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index db4c5609f22..c817a252603 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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 + ); + } } } From b389cbb59e7ad12c444c0bb5b61419a6969bbdfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Mar 2025 00:27:40 +0100 Subject: [PATCH 2/3] Fix reponsive and NA that must not be visible --- htdocs/expedition/card.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8c365e7bee5..c7fc531c605 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1180,6 +1180,7 @@ if ($action == 'create') { print '
'; + print '
'; print ''; // Load shipments already done for same order @@ -1849,6 +1850,7 @@ if ($action == 'create') { } print "
"; + print '
'; print '
'; @@ -2273,7 +2275,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; print ''; print ''; // Adds a line numbering column @@ -2297,15 +2299,15 @@ if ($action == 'create') { } print ''; } else { @@ -2554,7 +2556,11 @@ if ($action == 'create') { // Warehouse source print ''; // Batch number management - print ''; + print ''; print ''; } elseif (count($lines[$i]->details_entrepot) > 1) { print ''; @@ -2565,7 +2571,11 @@ if ($action == 'create') { // Warehouse source print ''; // Batch number management - print ''; + print ''; print ''; } } elseif ($lines[$i]->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) { From e9928ef7e6f8450e03f63e79ac25baa90bde7cab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Mar 2025 00:32:51 +0100 Subject: [PATCH 3/3] Fix br --- htdocs/expedition/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 7fa4f672175..2d553c8dc51 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -527,7 +527,7 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; print '
'; 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 ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").''; + if (isModEnabled('productbatch')) { + print ' - '.$langs->trans("NA"); + } + print '
'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).' - '.$langs->trans("NA").''; + if (isModEnabled('productbatch')) { + print ' - '.$langs->trans("NA"); + } + print '
'; - print '
'; + print '

'; if (isModEnabled('barcode') || isModEnabled('productbatch')) { print ''.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").''; }