';
+
+ print ' ';
+ print ''.$langs->trans('MigrationPaymentMode')." \n";
+
+ $elements = array(
+ 'old_id' => array(5,8,9,10,11),
+ 'new_id' => array(50,51,52,53,54),
+ 'code' => array('VAD','TRA','LCR','FAC','PRO'),
+ 'tables' => array('commande_fournisseur','commande','facture_rec','facture','propal')
+ );
+
+ foreach($elements['old_id'] as $key => $old_id)
+ {
+ $error=0;
+
+ dolibarr_install_syslog("upgrade2::migrate_mode_reglement code=".$elements['code'][$key]);
+
+ $sqlSelect = "SELECT id";
+ $sqlSelect.= " FROM ".MAIN_DB_PREFIX."c_paiement";
+ $sqlSelect.= " WHERE id = ".$old_id;
+ $sqlSelect.= " AND code = '".$elements['code'][$key]."'";
- $elements = array( 'propal' => 'propalrowid',
- 'order' => 'fk_commande',
- 'invoice' => 'fk_facture',
- 'contract' => 'fk_contract',
- 'order_supplier' => 'fk_supplier_order',
- 'invoice_supplier' => 'fk_supplier_invoice'
- );
+ $resql = $db->query($sqlSelect);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ $db->begin();
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET ";
+ $sql.= "id = ".$elements['new_id'][$key];
+ $sql.= " WHERE id = ".$old_id;
+ $sql.= " AND code = '".$elements['code'][$key]."'";
- foreach($elements as $type => $field)
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ foreach($elements['tables'] as $table)
+ {
+ $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
+ $sql.= "fk_mode_reglement = ".$elements['new_id'][$key];
+ $sql.= " WHERE fk_mode_reglement = ".$old_id;
+
+ $resql = $db->query($sql);
+ if (! $resql)
{
- $result = $db->DDLDescTable(MAIN_DB_PREFIX."actioncomm",$field);
- $obj = $db->fetch_object($result);
- if ($obj)
- {
- dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field);
-
- $db->begin();
-
- $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ";
- $sql.= "fk_element = ".$field.", elementtype = '".$type."'";
- $sql.= " WHERE ".$field." IS NOT NULL";
- $sql.= " AND fk_element IS NULL";
- $sql.= " AND elementtype IS NULL";
-
- $resql = $db->query($sql);
- if ($resql)
- {
- $db->commit();
-
- // DDL commands must not be inside a transaction
- // We will drop at next version because a migrate should be runnable several times if it fails.
- //$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field;
- //$db->query($sqlDrop);
- //print ". ";
- }
- else
- {
- dol_print_error($db);
- $db->rollback();
- }
- }
- else
- {
- print $langs->trans('AlreadyDone')." \n";
- }
+ dol_print_error($db);
+ $error++;
}
-
- print '
';
+ print ". ";
+ }
+
+ if (! $error)
+ {
+ $db->commit();
+ }
+ else
+ {
+ dol_print_error($db);
+ $db->rollback();
+ }
+ }
+ else
+ {
+ dol_print_error($db);
+ $db->rollback();
+ }
+ }
+ else
+ {
+ print $langs->trans('AlreadyDone')." \n";
+ }
+ }
+ }
+
+ print '';
}
diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang
index 700f4750687..f40d500f2cf 100644
--- a/htdocs/langs/en_US/install.lang
+++ b/htdocs/langs/en_US/install.lang
@@ -232,4 +232,7 @@ MigrationProjectUserResp=Data migration field fk_user_resp of llx_projet to llx_
MigrationProjectTaskTime=Update time spent in seconds
# Migration Acctioncom
-MigrationActioncommElement=Update data on actions
\ No newline at end of file
+MigrationActioncommElement=Update data on actions
+
+# Migration payment mode
+MigrationPaymentMode=Data migration for payment mode
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/install.lang b/htdocs/langs/fr_FR/install.lang
index 55872123ef4..8c772dc390f 100644
--- a/htdocs/langs/fr_FR/install.lang
+++ b/htdocs/langs/fr_FR/install.lang
@@ -236,3 +236,6 @@ MigrationProjectTaskTime=Mise à jour du temps consommé en secondes
# Migration Acctioncom
MigrationActioncommElement=Mise à jour des données des actions des éléments
+
+# Migration payment mode
+MigrationPaymentMode=Migration des modes de paiement
diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php
index fade073eca4..354acc4a241 100644
--- a/htdocs/societe/class/address.class.php
+++ b/htdocs/societe/class/address.class.php
@@ -1,7 +1,7 @@
* Copyright (C) 2004-2006 Laurent Destailleur
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2011 Regis Houssin
*
* 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
@@ -27,7 +27,6 @@
/**
* \class Address
* \brief Class to manage addresses
- * @deprecated
*/
class Address
{
diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php
index 10857fa5e0f..378b8c5fbf6 100644
--- a/test/phpunit/BuildDocTest.php
+++ b/test/phpunit/BuildDocTest.php
@@ -51,7 +51,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/modules_comm
require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/modules_propale.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_project.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.php';
-require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/ModelePdfExpedition.class.php';
+require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/modules_expedition.php';
if (empty($user->id))
{