diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php
index dc63b7a5f2f..c05bd985705 100644
--- a/htdocs/admin/delivery.php
+++ b/htdocs/admin/delivery.php
@@ -208,8 +208,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle)) !== false)
{
- if (substr($file, 0, 14) == 'mod_delivery_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
- {
+ if (preg_match('/^mod_delivery_([a-z0-9_]*)\.php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
@@ -222,8 +221,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
-
- print '
| '.$module->nom." | \n";
+ print ' |
| '.$module->name." | \n";
print $module->info();
print ' | ';
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index 8305ef63004..b446851b539 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -212,8 +212,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle)) !== false)
{
- if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
- {
+ if (preg_match('/^mod_expedition_([a-z0-9_]*)\.php$/', $file)) {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
@@ -226,7 +225,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
- print '
| '.$module->nom." | \n";
+ print '
| '.$module->name." | \n";
print '';
print $module->info();
print ' | ';
diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php
index 59f0e46d428..756b9cfe930 100644
--- a/htdocs/core/lib/sendings.lib.php
+++ b/htdocs/core/lib/sendings.lib.php
@@ -51,6 +51,7 @@ function shipping_prepare_head($object)
{
// delivery link
$object->fetchObjectLinked($object->id, $object->element);
+ var_dump($object->id);
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
{
// Take first one element of array
diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
index 114283c6773..2239745d407 100644
--- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
@@ -124,7 +124,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$langs->loadLangs(array("main", "bills", "sendings", "companies"));
$this->db = $db;
- $this->name = "typhon";
+ $this->name = "Typhon";
$this->description = $langs->trans("DocumentModelTyphon");
// Page size for A4 format
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index a26b6bf8113..a2e1c3a26db 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -890,13 +890,15 @@ if ($action == 'create')
print '
| ';
if ($origin == 'commande' && !empty($conf->commande->enabled))
{
- print $langs->trans("RefOrder").' | '.img_object($langs->trans("ShowOrder"), 'order').' '.$object->ref;
+ print $langs->trans("RefOrder");
}
if ($origin == 'propal' && !empty($conf->propal->enabled))
{
- print $langs->trans("RefProposal").' | '.img_object($langs->trans("ShowProposal"), 'propal').' '.$object->ref;
+ print $langs->trans("RefProposal");
}
- print ' | ';
+ print '';
+ print $object->getNomUrl(1);
+ print ' | ';
print "
\n";
// Ref client
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index 784bb8f60b8..a73ca40d86f 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -425,6 +425,11 @@ ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished
-- MIGRATION TO DO AFTER RENAMING AN OBJECT
+-- drop constraint
+ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_soc;
+ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_author;
+ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_valid;
+
-- rename Table
ALTER TABLE llx_livraison RENAME TO llx_delivery;
ALTER TABLE llx_livraison_extrafields RENAME TO llx_delivery_extrafields;
@@ -442,15 +447,17 @@ ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_valid;
ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_valid (fk_user_valid);
-- drop constraint
-ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_soc;
-ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_author;
-ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_valid;
+ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_soc;
+ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_user_author;
+ALTER TABLE llx_delivery DROP CONSTRAINT fk_livraison_fk_user_valid;
-- add constraint
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
+ALTER TABLE llx_deliverydet CHANGE COLUMN fk_livraison fk_delivery integer;
+
-- update llx_extrafields
UPDATE llx_extrafields SET elementtype = 'delivery' WHERE elementtype = 'livraison';
UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE elementtype = 'livraisondet';
@@ -480,3 +487,12 @@ UPDATE llx_element_element SET targettype = 'delivery' WHERE targettype = 'livra
-- update llx_actioncomm
UPDATE llx_actioncomm SET element_type = 'delivery' WHERE element_type = 'livraison';
+-- update llx_const
+UPDATE llx_const set name = 'DELIVERY_ADDON_NUMBER' WHERE name = 'LIVRAISON_ADDON_NUMBER';
+UPDATE llx_const set value = 'mod_delivery_jade' WHERE value = 'mod_livraison_jade' AND name = 'DELIVERY_ADDON_NUMBER';
+UPDATE llx_const set value = 'mod_delivery_saphir' WHERE value = 'mod_livraison_saphir' AND name = 'DELIVERY_ADDON_NUMBER';
+
+-- update llx_rights_def
+UPDATE llx_rights_def set perms = 'delivery' WHERE perms = 'livraison' and module = 'expedition';
+UPDATE llx_rights_def set perms = 'delivery_advance' WHERE perms = 'livraison_advance' and module = 'expedition';
+
diff --git a/htdocs/install/mysql/tables/llx_deliverydet.sql b/htdocs/install/mysql/tables/llx_deliverydet.sql
index 69612018bf3..97ea193b045 100644
--- a/htdocs/install/mysql/tables/llx_deliverydet.sql
+++ b/htdocs/install/mysql/tables/llx_deliverydet.sql
@@ -20,7 +20,7 @@
create table llx_deliverydet
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
- fk_delivery integer,
+ fk_delivery integer,
fk_origin_line integer, -- Correspondance de la ligne avec le document d'origine (propal, commande)
fk_product integer,
description text,