mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-14 08:54:21 +01:00
Fix: Error in migrate of deliveries
This commit is contained in:
@@ -240,6 +240,8 @@ ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, p
|
||||
|
||||
UPDATE llx_const SET name = 'MAIN_MODULE_PRODUCT' WHERE name = 'MAIN_MODULE_PRODUIT';
|
||||
|
||||
UPDATE llx_expedition set ref_customer = NULL where ref_customer = '';
|
||||
|
||||
-- Add more predefined action codes --
|
||||
insert into llx_c_actioncomm (id, code, type, libelle, module) values (30, 'AC_SUP_ORD', 'system', 'Send supplier invoice by email' ,'supplier_order');
|
||||
insert into llx_c_actioncomm (id, code, type, libelle, module) values (31, 'AC_SUP_INV', 'system', 'Send supplier invoice by email' ,'supplier_invoice');
|
||||
|
||||
@@ -3104,7 +3104,8 @@ function migrate_shipping_delivery($db,$langs,$conf)
|
||||
}
|
||||
|
||||
/*
|
||||
* Migrate shipping ref_customer and date_delivery fields to llx_livraison
|
||||
* We try to complete field ref_customer and date_delivery that are empty into llx_livraison.
|
||||
* We set them with value from llx_expedition.
|
||||
*/
|
||||
function migrate_shipping_delivery2($db,$langs,$conf)
|
||||
{
|
||||
@@ -3126,6 +3127,7 @@ function migrate_shipping_delivery2($db,$langs,$conf)
|
||||
$sqlSelect.= " WHERE l.rowid = el.fk_target";
|
||||
$sqlSelect.= " AND el.targettype = 'delivery'";
|
||||
$sqlSelect.= " AND e.rowid = el.fk_source AND el.sourcetype = 'shipping'";
|
||||
$sqlSelect.= " AND (e.ref_customer IS NOT NULL OR e.date_delivery IS NOT NULL)"; // Useless to process this record if both are null
|
||||
// Add condition to know if we never migrate this record
|
||||
$sqlSelect.= " AND (l.ref_customer IS NULL".($db->type!='pgsql'?" or l.ref_customer = ''":"").")";
|
||||
$sqlSelect.= " AND (l.date_delivery IS NULL".($db->type!='pgsql'?" or l.date_delivery = ''":"").")";
|
||||
@@ -3144,7 +3146,7 @@ function migrate_shipping_delivery2($db,$langs,$conf)
|
||||
|
||||
$sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."livraison SET";
|
||||
$sqlUpdate.= " ref_customer = '".$obj->ref_customer."',";
|
||||
$sqlUpdate.= " date_delivery = '".($obj->date_delivery?$obj->date_delivery:'null')."'";
|
||||
$sqlUpdate.= " date_delivery = ".($obj->date_delivery?"'".$obj->date_delivery."'":'null');
|
||||
$sqlUpdate.= " WHERE rowid = ".$obj->delivery_id;
|
||||
|
||||
$result=$db->query($sqlUpdate);
|
||||
|
||||
Reference in New Issue
Block a user