Ajout gestion du parent

This commit is contained in:
Rodolphe Quiedeville 2005-01-17 12:34:00 +00:00
parent 4a6f7320a5
commit 8a488d1be2

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
*
@ -334,7 +334,7 @@ class Societe {
$sql .= ", s.siret, s.capital, s.ape, s.tva_intra, s.rubrique, s.fk_effectif";
$sql .= ", e.libelle as effectif, e.id as effectif_id";
$sql .= ", s.fk_forme_juridique as forme_juridique_code, fj.libelle as forme_juridique";
$sql .= ", s.code_client, s.code_compta";
$sql .= ", s.code_client, s.code_compta, s.parent";
$sql .= ", s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client";
$sql .= ", p.libelle as pays";
$sql .= ", st.libelle as stcomm";
@ -376,6 +376,8 @@ class Societe {
$this->tel = $obj->tel;
$this->fax = $obj->fax;
$this->parent = $obj->parent;
$this->siren = $obj->siren;
$this->siret = $obj->siret;
$this->ape = $obj->ape;
@ -1067,6 +1069,25 @@ class Societe {
}
}
/**
* \brief Définit la société mère pour les filiales
*
*/
function set_parent($id)
{
if ($this->id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
$sql .= " SET parent = ".$id;
$sql .= " WHERE idp = " . $this->id .";";
if ( $this->db->query($sql) )
{
return 0;
}
}
}
}
?>