Qual: Uniformisation nom des champs. Suppression champ label obsolete sur commande.
This commit is contained in:
parent
66a4a60e61
commit
ddcb333393
@ -393,7 +393,7 @@ if ($socid > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.fk_statut, p.price, p.ref, p.remise, ";
|
||||
$sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite,";
|
||||
$sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||||
$sql .= " AND s.idp = ".$objsoc->id;
|
||||
|
||||
@ -413,7 +413,6 @@ class Commande extends CommonObject
|
||||
{
|
||||
$resql = $this->addline(
|
||||
$this->id,
|
||||
$this->lines[$i]->libelle, // \TODO A virer
|
||||
$this->lines[$i]->desc,
|
||||
$this->lines[$i]->subprice,
|
||||
$this->lines[$i]->qty,
|
||||
@ -502,7 +501,7 @@ class Commande extends CommonObject
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($commandeid, $libelle, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||
function addline($commandeid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||
{
|
||||
dolibarr_syslog("Commande.class.php::addline this->id=$this->id, $commandeid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
@ -539,7 +538,6 @@ class Commande extends CommonObject
|
||||
$ligne=new CommandeLigne($this->db);
|
||||
|
||||
$ligne->fk_commande=$commandeid;
|
||||
$ligne->libelle=$libelle;
|
||||
$ligne->desc=$desc;
|
||||
$ligne->qty=$qty;
|
||||
$ligne->tva_tx=$txtva;
|
||||
@ -974,7 +972,7 @@ class Commande extends CommonObject
|
||||
{
|
||||
$this->lignes = array();
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
|
||||
$sql.= ' l.remise_percent, l.subprice, l.coef, l.rang, l.info_bits, l.label,';
|
||||
$sql.= ' l.remise_percent, l.subprice, l.coef, l.rang, l.info_bits, ';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||
@ -1008,7 +1006,6 @@ class Commande extends CommonObject
|
||||
$ligne->info_bits = $objp->info_bits;
|
||||
|
||||
$ligne->ref = $objp->product_ref;
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
$ligne->fk_product_type= $objp->fk_product_type; // Produit ou service
|
||||
|
||||
@ -2078,7 +2075,7 @@ class CommandeLigne
|
||||
|
||||
// From llx_product
|
||||
var $ref; // Reference produit
|
||||
var $libelle; // Label produit
|
||||
var $product_libelle; // Label produit
|
||||
var $product_desc; // Description produit
|
||||
|
||||
|
||||
@ -2098,7 +2095,6 @@ class CommandeLigne
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.description, cd.price, cd.qty, cd.tva_tx,';
|
||||
$sql.= ' cd.label,';
|
||||
$sql.= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
|
||||
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc, cd.coef, cd.rang,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
||||
@ -2111,7 +2107,6 @@ class CommandeLigne
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->fk_propal = $objp->fk_propal;
|
||||
$this->label = $objp->label;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->price = $objp->price;
|
||||
@ -2129,7 +2124,7 @@ class CommandeLigne
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_libelle;
|
||||
$this->product_libelle= $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->db->free($result);
|
||||
@ -2171,12 +2166,11 @@ class CommandeLigne
|
||||
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
|
||||
$sql.= ' (fk_commande, label, description, price, qty, tva_tx,';
|
||||
$sql.= ' (fk_commande, description, price, qty, tva_tx,';
|
||||
$sql.= ' fk_product, remise_percent, subprice, remise, fk_remise_except, ';
|
||||
$sql.= ' rang, coef,';
|
||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc)';
|
||||
$sql.= " VALUES (".$this->fk_commande.",";
|
||||
$sql.= " '".addslashes($this->libelle)."',";
|
||||
$sql.= " '".addslashes($this->desc)."',";
|
||||
$sql.= " '".price2num($this->price)."',";
|
||||
$sql.= " '".price2num($this->qty)."',";
|
||||
|
||||
@ -297,7 +297,6 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
|
||||
$commande->addline(
|
||||
$_POST['id'],
|
||||
$libelle,
|
||||
$desc,
|
||||
$pu,
|
||||
$_POST['qty'],
|
||||
|
||||
@ -129,43 +129,43 @@ class Fournisseur extends Societe
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ProductCommande($user, $fk_product)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
$commf = new CommandeFournisseur($this->db);
|
||||
|
||||
$nbc = $this->nb_open_commande();
|
||||
|
||||
dolibarr_syslog("Fournisseur::ProductCommande : nbc = ".$nbc);
|
||||
|
||||
if ($nbc == 0)
|
||||
{
|
||||
if ( $this->create_commande($user) == 0 )
|
||||
{
|
||||
$idc = $this->single_open_commande;
|
||||
}
|
||||
}
|
||||
elseif ($nbc == 1)
|
||||
{
|
||||
|
||||
$idc = $this->single_open_commande;
|
||||
}
|
||||
|
||||
if ($idc > 0)
|
||||
{
|
||||
$prod = new Product($this->db);
|
||||
$prod->fetch($fk_product);
|
||||
$prod->fetch_fourn_data($this->id);
|
||||
|
||||
function ProductCommande($user, $fk_product)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
$commf = new CommandeFournisseur($this->db);
|
||||
|
||||
$nbc = $this->nb_open_commande();
|
||||
|
||||
dolibarr_syslog("Fournisseur::ProductCommande : nbc = ".$nbc);
|
||||
|
||||
if ($nbc == 0)
|
||||
{
|
||||
if ( $this->create_commande($user) == 0 )
|
||||
{
|
||||
$idc = $this->single_open_commande;
|
||||
}
|
||||
}
|
||||
elseif ($nbc == 1)
|
||||
{
|
||||
|
||||
$idc = $this->single_open_commande;
|
||||
}
|
||||
|
||||
if ($idc > 0)
|
||||
{
|
||||
$prod = new Product($this->db);
|
||||
$prod->fetch($fk_product);
|
||||
$prod->fetch_fourn_data($this->id);
|
||||
|
||||
$commf->fetch($idc);
|
||||
$commf->addline("Toto",120,1,$prod->tva, $prod->id, 0, $prod->ref_fourn);
|
||||
}
|
||||
}
|
||||
|
||||
$commf->fetch($idc);
|
||||
$commf->addline("Toto",120,1,$prod->tva, $prod->id, 0, $prod->ref_fourn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge indicateurs this->nb de tableau de bord
|
||||
* \return int <0 si ko, >0 si ok
|
||||
|
||||
@ -303,7 +303,6 @@ if ($_POST["action"] == 'addincommande')
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$product->tva_tx);
|
||||
|
||||
$result = $commande->addline($commande->id,
|
||||
$product->libelle,
|
||||
$product->description,
|
||||
$pu,
|
||||
$_POST["qty"],
|
||||
|
||||
@ -355,6 +355,13 @@ ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_source_fk_facture FOREIGN KEY
|
||||
alter table llx_facture add column type smallint DEFAULT 0 NOT NULL after facnumber;
|
||||
|
||||
|
||||
-- Supprimme orphelins pour permettre montée de la clé
|
||||
-- V4 DELETE llx_commandedet FROM llx_commandedet LEFT JOIN llx_commande ON llx_commandedet.fk_commande = llx_commande.rowid WHERE llx_commande.rowid IS NULL;
|
||||
|
||||
ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_commande (fk_commande);
|
||||
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid);
|
||||
|
||||
|
||||
-- drop table llx_societe_remise_except;
|
||||
create table llx_societe_remise_except
|
||||
(
|
||||
@ -407,6 +414,8 @@ alter table llx_commande drop column fk_soc_contact;
|
||||
alter table llx_livraison drop column fk_soc_contact;
|
||||
alter table llx_propal drop column fk_soc_contact;
|
||||
|
||||
alter table llx_commandedet drop column label;
|
||||
|
||||
alter table llx_c_pays modify libelle varchar(50) NOT NULL;
|
||||
|
||||
insert into llx_action_def (rowid,code,titre,description,objet_type) values (3,'NOTIFY_VAL_ORDER_SUUPLIER','Validation commande fournisseur','Déclenché lors de la validation d\'une commande fournisseur','order_supplier');
|
||||
|
||||
27
mysql/tables/llx_commandedet.key.sql
Normal file
27
mysql/tables/llx_commandedet.key.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
-- ===================================================================
|
||||
|
||||
|
||||
-- Supprimme orhpelins pour permettre montée de la clé
|
||||
-- V4 DELETE llx_commandedet FROM llx_commandedet LEFT JOIN llx_commande ON llx_commandedet.fk_commande = llx_commande.rowid WHERE llx_commande.rowid IS NULL;
|
||||
|
||||
ALTER TABLE llx_commandedet ADD INDEX idx_commandedet_fk_commande (fk_commande);
|
||||
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commande FOREIGN KEY (fk_commande) REFERENCES llx_commande (rowid);
|
||||
@ -1,5 +1,6 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- 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
|
||||
@ -24,7 +25,6 @@ create table llx_commandedet
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_commande integer,
|
||||
fk_product integer,
|
||||
label varchar(255),
|
||||
description text,
|
||||
tva_tx real, -- taux tva
|
||||
qty real, -- quantité
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
-- Supprimme orhpelins pour permettre montée de la clé
|
||||
--DELETE llx_facturedet FROM llx_facturedet LEFT JOIN llx_facture ON llx_facturedet.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL;
|
||||
-- V4 DELETE llx_facturedet FROM llx_facturedet LEFT JOIN llx_facture ON llx_facturedet.fk_facture = llx_facture.rowid WHERE llx_facture.rowid IS NULL;
|
||||
|
||||
ALTER TABLE llx_facturedet ADD INDEX idx_facturedet_fk_facture (fk_facture);
|
||||
ALTER TABLE llx_facturedet ADD CONSTRAINT fk_facturedet_fk_facture FOREIGN KEY (fk_facture) REFERENCES llx_facture (rowid);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user