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

This commit is contained in:
Laurent Destailleur 2011-12-08 20:20:59 +01:00
commit 147ddd6551
10 changed files with 167 additions and 73 deletions

View File

@ -3084,6 +3084,7 @@ else
$pageprev = $page - 1;
$pagenext = $page + 1;
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
@ -3137,8 +3138,10 @@ else
}
if ($month > 0)
{
if ($year > 0)
if ($year > 0 && empty($day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
else if ($year > 0 && ! empty($day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
else
$sql.= " AND date_format(f.datef, '%m') = '".$month."'";
}
@ -3202,11 +3205,9 @@ else
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
//print '&nbsp;'.$langs->trans('Year').': '.$syear;
//print 'xx'.$syear.'zz';
//if ($syear == '') $syear = date("Y");
$htmlother->select_year($syear?$syear:-1,'year',1, 20, 5);
$htmlother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left">&nbsp;</td>';
print '<td class="liste_titre" align="left">';

View File

@ -247,7 +247,7 @@ class FormFile
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once(DOL_DOCUMENT_ROOT.'/core/modules/expedition/doc/ModelePdfExpedition.class.php');
include_once(DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php');
$modellist=ModelePDFExpedition::liste_modeles($this->db);
}
}

View File

@ -24,7 +24,7 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
*/
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/expedition/modules_expedition.php";
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');

View File

@ -31,15 +31,15 @@
--
delete from llx_c_paiement;
insert into llx_c_paiement (id,code,libelle,type,active) values (0, '', '-', 3,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (1, 'TIP', 'TIP', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (2, 'VIR', 'Virement', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (3, 'PRE', 'Prélèvement', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (4, 'LIQ', 'Espèces', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (5, 'VAD', 'Paiement en ligne', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (6, 'CB', 'Carte Bancaire', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (7, 'CHQ', 'Chèque', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (8, 'TRA', 'Traite', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (9, 'LCR', 'LCR', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (10,'FAC', 'Factor', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (11,'PRO', 'Proforma', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 0, '', '-', 3,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, 'TIP', 'TIP', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 2, 'VIR', 'Virement', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Prélèvement', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 4, 'LIQ', 'Espèces', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 6, 'CB', 'Carte Bancaire', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values ( 7, 'CHQ', 'Chèque', 2,1);
insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Paiement en ligne', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (51, 'TRA', 'Traite', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (52, 'LCR', 'LCR', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (53, 'FAC', 'Factor', 2,0);
insert into llx_c_paiement (id,code,libelle,type,active) values (54, 'PRO', 'Proforma', 2,0);

View File

@ -71,7 +71,7 @@ DROP TABLE IF EXISTS llx_pos_tmp;
ALTER TABLE llx_deplacement ADD COLUMN fk_user_modif integer AFTER fk_user_author;
CREATE TABLE IF NOT EXISTS llx_localtax
CREATE TABLE llx_localtax
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer NOT NULL DEFAULT '1',

View File

@ -308,6 +308,8 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$beforeversionarray=explode('.','3.2.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
migrate_mode_reglement($db,$langs,$conf);
// Reload modules
migrate_reload_modules($db,$langs,$conf);
@ -1742,7 +1744,7 @@ function migrate_modeles($db,$langs,$conf)
if (! empty($conf->expedition->enabled))
{
include_once(DOL_DOCUMENT_ROOT.'/core/modules/expedition/doc/ModelePdfExpedition.class.php');
include_once(DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php');
$modellist=ModelePDFExpedition::liste_modeles($db);
if (count($modellist)==0)
{
@ -3085,59 +3087,145 @@ function migrate_shipping_delivery2($db,$langs,$conf)
*/
function migrate_actioncomm_element($db,$langs,$conf)
{
print '<tr><td colspan="4">';
print '<tr><td colspan="4">';
print '<br>';
print '<b>'.$langs->trans('MigrationActioncommElement')."</b><br>\n";
$elements = array(
'propal' => 'propalrowid',
'order' => 'fk_commande',
'invoice' => 'fk_facture',
'contract' => 'fk_contract',
'order_supplier' => 'fk_supplier_order',
'invoice_supplier' => 'fk_supplier_invoice'
);
foreach($elements as $type => $field)
{
$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')."<br>\n";
}
}
print '</td></tr>';
}
print '<br>';
print '<b>'.$langs->trans('MigrationActioncommElement')."</b><br>\n";
/*
* Migrate link stored into fk_mode_reglement
*/
function migrate_mode_reglement($db,$langs,$conf)
{
print '<tr><td colspan="4">';
print '<br>';
print '<b>'.$langs->trans('MigrationPaymentMode')."</b><br>\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')."<br>\n";
}
dol_print_error($db);
$error++;
}
print '</td></tr>';
print ". ";
}
if (! $error)
{
$db->commit();
}
else
{
dol_print_error($db);
$db->rollback();
}
}
else
{
dol_print_error($db);
$db->rollback();
}
}
else
{
print $langs->trans('AlreadyDone')."<br>\n";
}
}
}
print '</td></tr>';
}

View File

@ -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
MigrationActioncommElement=Update data on actions
# Migration payment mode
MigrationPaymentMode=Data migration for payment mode

View File

@ -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

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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
{

View File

@ -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))
{