Qual: Removed duplicate column "datea" into table llx_societe

(duplicated with column tms).
This commit is contained in:
Laurent Destailleur 2014-05-04 16:59:13 +02:00
parent e1d30837e9
commit d25778f12b
5 changed files with 39 additions and 37 deletions

View File

@ -18,6 +18,8 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
ALTER TABLE llx_societe DROP COLUMN datea;
create table llx_c_email_templates create table llx_c_email_templates
( (

View File

@ -32,7 +32,6 @@ create table llx_societe
parent integer, parent integer,
tms timestamp, tms timestamp,
datec datetime, -- creation date datec datetime, -- creation date
datea datetime, -- activation date
status tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité) status tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité)

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -264,8 +264,7 @@ class Address
// Adresses liees a la societe // Adresses liees a la societe
if ($this->socid) if ($this->socid)
{ {
$sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as dc'; $sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as date_creation, a.tms as date_modification, a.fk_soc';
$sql .= ', a.tms as date_update, a.fk_soc';
$sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax';
$sql .= ', p.code as country_code, p.libelle as country'; $sql .= ', p.code as country_code, p.libelle as country';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
@ -284,8 +283,8 @@ class Address
$line = new AddressLine($this->db); $line = new AddressLine($this->db);
$line->id = $objp->id; $line->id = $objp->id;
$line->date_creation = $this->db->jdate($objp->dc); $line->date_creation = $this->db->jdate($objp->date_creation);
$line->date_update = $this->db->jdate($objp->date_update); $line->date_modification = $this->db->jdate($objp->date_modification);
$line->label = $objp->label; $line->label = $objp->label;
$line->name = $objp->name; $line->name = $objp->name;
$line->address = $objp->address; $line->address = $objp->address;
@ -335,8 +334,7 @@ class Address
global $langs; global $langs;
global $conf; global $conf;
$sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation'; $sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation, a.tms as date_modification';
$sql .= ', a.tms as date_update';
$sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax';
$sql .= ', p.code as country_code, p.libelle as country'; $sql .= ', p.code as country_code, p.libelle as country';
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
@ -352,7 +350,7 @@ class Address
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->date_update = $this->db->jdate($obj->date_update); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->label = $obj->label; $this->label = $obj->label;
@ -446,7 +444,7 @@ class Address
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT s.rowid, s.nom, datec, datea,"; $sql = "SELECT s.rowid, s.nom, datec as date_creation, datea as date_modification,";
$sql.= " fk_user_creat, fk_user_modif"; $sql.= " fk_user_creat, fk_user_modif";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.rowid = ".$id; $sql.= " WHERE s.rowid = ".$id;
@ -472,8 +470,8 @@ class Address
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->ref = $obj->nom; $this->ref = $obj->nom;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->datea); $this->date_modification = $this->db->jdate($obj->date_modification);
} }
$this->db->free($result); $this->db->free($result);
@ -489,15 +487,14 @@ class Address
/** /**
* \class AddressLine * Class to manage one address line
* \brief Class to manage one address line
*/ */
class AddressLine class AddressLine
{ {
var $id; var $id;
var $date_creation; var $date_creation;
var $date_update; var $date_modification;
var $label; var $label;
var $name; var $name;
var $address; var $address;

View File

@ -130,8 +130,8 @@ class Societe extends CommonObject
var $price_level; var $price_level;
var $outstanding_limit; var $outstanding_limit;
var $datec; var $date_creation;
var $date_update; var $date_modification;
var $commercial_id; // Id of sales representative to link (used for thirdparty creation). Not filled by a fetch, because we can have several sales representatives. var $commercial_id; // Id of sales representative to link (used for thirdparty creation). Not filled by a fetch, because we can have several sales representatives.
var $parent; var $parent;
@ -218,8 +218,8 @@ class Societe extends CommonObject
if ($result >= 0) if ($result >= 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, datea, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, import_key)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, import_key)";
$sql.= " VALUES ('".$this->db->escape($this->name)."', ".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($now)."'"; $sql.= " VALUES ('".$this->db->escape($this->name)."', ".$conf->entity.", '".$this->db->idate($now)."'";
$sql.= ", ".(! empty($user->id) ? "'".$user->id."'":"null"); $sql.= ", ".(! empty($user->id) ? "'".$user->id."'":"null");
$sql.= ", ".(! empty($this->canvas) ? "'".$this->canvas."'":"null"); $sql.= ", ".(! empty($this->canvas) ? "'".$this->canvas."'":"null");
$sql.= ", ".$this->status; $sql.= ", ".$this->status;
@ -535,7 +535,6 @@ class Societe extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
$sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required
$sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null"); $sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null");
$sql .= ",datea = '".$this->db->idate($now)."'";
$sql .= ",address = '" . $this->db->escape($this->address) ."'"; $sql .= ",address = '" . $this->db->escape($this->address) ."'";
$sql .= ",zip = ".(! empty($this->zip)?"'".$this->zip."'":"null"); $sql .= ",zip = ".(! empty($this->zip)?"'".$this->zip."'":"null");
@ -732,10 +731,10 @@ class Societe extends CommonObject
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT s.rowid, s.nom as name, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as datec, s.prefix_comm'; $sql = 'SELECT s.rowid, s.nom as name, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
$sql .= ', s.status'; $sql .= ', s.status';
$sql .= ', s.price_level'; $sql .= ', s.price_level';
$sql .= ', s.tms as date_update'; $sql .= ', s.tms as date_modification';
$sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur'; $sql .= ', s.phone, s.fax, s.email, s.skype, s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur';
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6'; $sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
$sql .= ', s.capital, s.tva_intra'; $sql .= ', s.capital, s.tva_intra';
@ -793,8 +792,8 @@ class Societe extends CommonObject
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int; $this->ref_int = $obj->ref_int;
$this->datec = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_update = $this->db->jdate($obj->date_update); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->address = $obj->address; $this->address = $obj->address;
$this->zip = $obj->zip; $this->zip = $obj->zip;
@ -1382,17 +1381,21 @@ class Societe extends CommonObject
{ {
$now=dol_now(); $now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql = "UPDATE ".MAIN_DB_PREFIX."societe";
$sql .= " SET price_level = '".$price_level."'"; $sql .= " SET price_level = '".$price_level."'";
$sql .= " WHERE rowid = " . $this->id; $sql .= " WHERE rowid = " . $this->id;
$this->db->query($sql); if (! $this->db->query($sql))
{
dol_print_error($this->db);
return -1;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_prices "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_prices";
$sql .= " ( datec, fk_soc, price_level, fk_user_author )"; $sql .= " (datec, fk_soc, price_level, fk_user_author)";
$sql .= " VALUES ('".$this->db->idate($now)."',".$this->id.",'".$price_level."',".$user->id.")"; $sql .= " VALUES ('".$this->db->idate($now)."',".$this->id.",'".$price_level."',".$user->id.")";
if (! $this->db->query($sql) ) if (! $this->db->query($sql))
{ {
dol_print_error($this->db); dol_print_error($this->db);
return -1; return -1;
@ -2334,14 +2337,14 @@ class Societe extends CommonObject
/** /**
* Charge les informations d'ordre info dans l'objet societe * Load information for tab info
* *
* @param int $id Id de la societe a charger * @param int $id Id of thirdparty to load
* @return void * @return void
*/ */
function info($id) function info($id)
{ {
$sql = "SELECT s.rowid, s.nom as name, s.datec, s.datea,"; $sql = "SELECT s.rowid, s.nom as name, s.datec as date_creation, tms as date_modification,";
$sql.= " fk_user_creat, fk_user_modif"; $sql.= " fk_user_creat, fk_user_modif";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.rowid = ".$id; $sql.= " WHERE s.rowid = ".$id;
@ -2366,16 +2369,17 @@ class Societe extends CommonObject
$muser->fetch($obj->fk_user_modif); $muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser; $this->user_modification = $muser;
} }
$this->ref = $obj->name; $this->ref = $obj->name;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->datea); $this->date_modification = $this->db->jdate($obj->date_modification);
} }
$this->db->free($result); $this->db->free($result);
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }

View File

@ -303,8 +303,8 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
'customer_code_accountancy' => $thirdparty->code_compta, 'customer_code_accountancy' => $thirdparty->code_compta,
'supplier_code_accountancy' => $thirdparty->code_compta_fournisseur, 'supplier_code_accountancy' => $thirdparty->code_compta_fournisseur,
'fk_user_author' => $thirdparty->fk_user_author, 'fk_user_author' => $thirdparty->fk_user_author,
'date_creation' => dol_print_date($thirdparty->datec,'dayhourrfc'), 'date_creation' => dol_print_date($thirdparty->date_creation,'dayhourrfc'),
'date_modification' => dol_print_date($thirdparty->date_update,'dayhourrfc'), 'date_modification' => dol_print_date($thirdparty->date_modification,'dayhourrfc'),
'address' => $thirdparty->address, 'address' => $thirdparty->address,
'zip' => $thirdparty->zip, 'zip' => $thirdparty->zip,
'town' => $thirdparty->town, 'town' => $thirdparty->town,