New: Possibilité de supprimer la maison mère
This commit is contained in:
parent
0d67e6fcba
commit
1990d66be2
@ -93,3 +93,5 @@ TotalSizeOfAttachedFiles=Total size of attached files
|
|||||||
NbOfAttachedFiles=Number of attached files
|
NbOfAttachedFiles=Number of attached files
|
||||||
AttachANewFile=Attached a new file
|
AttachANewFile=Attached a new file
|
||||||
FileWasRemoved=Files was removed
|
FileWasRemoved=Files was removed
|
||||||
|
NoRIB=No RIB defined
|
||||||
|
NoParentCompany=None
|
||||||
@ -93,3 +93,5 @@ TotalSizeOfAttachedFiles=Taille totale des fichiers joints
|
|||||||
NbOfAttachedFiles=Nombre de fichiers joints
|
NbOfAttachedFiles=Nombre de fichiers joints
|
||||||
AttachANewFile=Joindre un nouveau fichier
|
AttachANewFile=Joindre un nouveau fichier
|
||||||
FileWasRemoved=Le fichier a été supprimé
|
FileWasRemoved=Le fichier a été supprimé
|
||||||
|
NoRIB=Aucun RIB défini
|
||||||
|
NoParentCompany=Aucune
|
||||||
@ -566,6 +566,9 @@ else
|
|||||||
$socm->fetch($soc->parent);
|
$socm->fetch($soc->parent);
|
||||||
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socm->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville;
|
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socm->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
print $langs->trans("NoParentCompany");
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Commerciaux
|
// Commerciaux
|
||||||
|
|||||||
@ -1092,13 +1092,21 @@ class Societe {
|
|||||||
|
|
||||||
function display_rib()
|
function display_rib()
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . "/companybankaccount.class.php";
|
require_once DOL_DOCUMENT_ROOT . "/companybankaccount.class.php";
|
||||||
|
|
||||||
$bac = new CompanyBankAccount($this->db, $this->id);
|
$bac = new CompanyBankAccount($this->db, $this->id);
|
||||||
$bac->fetch();
|
$bac->fetch();
|
||||||
|
|
||||||
$rib = $bac->code_banque." ".$bac->code_guichet." ".$bac->number." ".$bac->cle_rib;
|
if ($bac->code_banque || $bac->code_guichet || $bac->number || $bac->cle_rib)
|
||||||
|
{
|
||||||
|
$rib = $bac->code_banque." ".$bac->code_guichet." ".$bac->number." (".$bac->cle_rib.")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rib=$langs->trans("NoRIB");
|
||||||
|
}
|
||||||
return $rib;
|
return $rib;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,24 +1203,52 @@ class Societe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Définit la société mère pour les filiales
|
* \brief Défini la société mère pour les filiales
|
||||||
*
|
* \param id id compagnie mère à positionner
|
||||||
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
|
function set_parent($id)
|
||||||
|
{
|
||||||
|
if ($this->id)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||||
|
$sql .= " SET parent = ".$id;
|
||||||
|
$sql .= " WHERE idp = " . $this->id .";";
|
||||||
|
|
||||||
function set_parent($id)
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
if ($this->id)
|
return 1;
|
||||||
{
|
}
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
else
|
||||||
$sql .= " SET parent = ".$id;
|
{
|
||||||
$sql .= " WHERE idp = " . $this->id .";";
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $this->db->query($sql) )
|
/**
|
||||||
{
|
* \brief Supprime la société mère
|
||||||
return 0;
|
* \param id id compagnie mère à effacer
|
||||||
}
|
* \return int <0 si ko, >0 si ok
|
||||||
}
|
*/
|
||||||
}
|
function remove_parent($id)
|
||||||
|
{
|
||||||
|
if ($this->id)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
|
||||||
|
$sql .= " SET parent = null";
|
||||||
|
$sql .= " WHERE idp = " . $this->id .";";
|
||||||
|
|
||||||
|
if ( $this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Verifie la validite du siren
|
* \brief Verifie la validite du siren
|
||||||
|
|||||||
@ -21,10 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/societe/lien.php
|
\file htdocs/societe/lien.php
|
||||||
\ingroup societe
|
\ingroup societe
|
||||||
\brief Page des societes
|
\brief Page des societes
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -36,16 +36,19 @@ $langs->load("customers");
|
|||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
|
|
||||||
/*
|
// Sécurité accés client
|
||||||
* Sécurité accés client
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Positionne companie parente
|
||||||
if($_GET["socid"] && $_GET["select"])
|
if($_GET["socid"] && $_GET["select"])
|
||||||
{
|
{
|
||||||
if ($user->rights->societe->creer)
|
if ($user->rights->societe->creer)
|
||||||
@ -56,13 +59,37 @@ if($_GET["socid"] && $_GET["select"])
|
|||||||
$soc->set_parent($_GET["select"]);
|
$soc->set_parent($_GET["select"]);
|
||||||
|
|
||||||
Header("Location: lien.php?socid=".$soc->id);
|
Header("Location: lien.php?socid=".$soc->id);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header("Location: lien.php?socid=".$_GET["socid"]);
|
Header("Location: lien.php?socid=".$_GET["socid"]);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Supprime companie parente
|
||||||
|
if($_GET["socid"] && $_GET["delsocid"])
|
||||||
|
{
|
||||||
|
if ($user->rights->societe->creer)
|
||||||
|
{
|
||||||
|
$soc = new Societe($db);
|
||||||
|
$soc->id = $_GET["socid"];
|
||||||
|
$soc->fetch($_GET["socid"]);
|
||||||
|
$soc->remove_parent($_GET["delsocid"]);
|
||||||
|
|
||||||
|
Header("Location: lien.php?socid=".$soc->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header("Location: lien.php?socid=".$_GET["socid"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -129,12 +156,21 @@ if($_GET["socid"])
|
|||||||
print '<tr><td>'.$langs->transcountry('ProfId3',$soc->pays_code).'</td><td>'.$soc->ape.'</td><td colspan="2"> </td></tr>';
|
print '<tr><td>'.$langs->transcountry('ProfId3',$soc->pays_code).'</td><td>'.$soc->ape.'</td><td colspan="2"> </td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Capital").'</td><td colspan="3">'.$soc->capital.' '.$conf->monnaie.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Capital").'</td><td colspan="3">'.$soc->capital.' '.$conf->monnaie.'</td></tr>';
|
||||||
|
|
||||||
|
// Société mère
|
||||||
print '<tr><td>'.$langs->trans("ParentCompany").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("ParentCompany").'</td><td colspan="3">';
|
||||||
if ($soc->parent)
|
if ($soc->parent)
|
||||||
{
|
{
|
||||||
$socm = new Societe($db);
|
$socm = new Societe($db);
|
||||||
$socm->fetch($soc->parent);
|
$socm->fetch($soc->parent);
|
||||||
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socm->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville;
|
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socm->id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?"(".$socm->code_client.")":"");
|
||||||
|
print ($socm->ville?' - '.$socm->ville:'');
|
||||||
|
print ' <a href="'.$_SERVER["PHP_SELF"].'?socid='.$_GET["socid"].'&delsocid='.$socm->id.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a><br>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("NoParentCompany");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -204,9 +240,9 @@ if($_GET["socid"])
|
|||||||
print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
|
print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td valign="right">';
|
print '<td valign="right">';
|
||||||
print '<input type="text" name="search_nom" value="'.stripslashes($search_nom).'">';
|
print '<input type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
|
||||||
print '</td><td colspan="5" align="center">';
|
print '</td><td colspan="5" align="right">';
|
||||||
print '<input type="submit" class="button" name="button_search" value="'.$langs->trans("Search").'">';
|
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -244,13 +280,17 @@ if($_GET["socid"])
|
|||||||
print " ";
|
print " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td><td><a href="lien.php?socid='.$_GET["socid"].'&select='.$obj->idp.'">'.$langs->trans("Select").'</a></td>';
|
print '</td>';
|
||||||
|
// Lien Sélectionner
|
||||||
|
print '<td align="center"><a href="lien.php?socid='.$_GET["socid"].'&select='.$obj->idp.'">'.$langs->trans("Select").'</a>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '<br>';
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user