New: Possibilit de supprimer la maison mre
This commit is contained in:
parent
0d67e6fcba
commit
1990d66be2
@ -92,4 +92,6 @@ BillingContact=Billing contact
|
||||
TotalSizeOfAttachedFiles=Total size of attached files
|
||||
NbOfAttachedFiles=Number of attached files
|
||||
AttachANewFile=Attached a new file
|
||||
FileWasRemoved=Files was removed
|
||||
FileWasRemoved=Files was removed
|
||||
NoRIB=No RIB defined
|
||||
NoParentCompany=None
|
||||
@ -92,4 +92,6 @@ BillingContact=Contact facturation
|
||||
TotalSizeOfAttachedFiles=Taille totale des fichiers joints
|
||||
NbOfAttachedFiles=Nombre de fichiers joints
|
||||
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);
|
||||
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>';
|
||||
|
||||
// Commerciaux
|
||||
|
||||
@ -1092,13 +1092,21 @@ class Societe {
|
||||
|
||||
function display_rib()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . "/companybankaccount.class.php";
|
||||
|
||||
$bac = new CompanyBankAccount($this->db, $this->id);
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -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 .";";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supprime la société mère
|
||||
* \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
|
||||
|
||||
@ -21,10 +21,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/societe/lien.php
|
||||
\ingroup societe
|
||||
\brief Page des societes
|
||||
\version $Revision$
|
||||
\file htdocs/societe/lien.php
|
||||
\ingroup societe
|
||||
\brief Page des societes
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -36,16 +36,19 @@ $langs->load("customers");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("banks");
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Positionne companie parente
|
||||
if($_GET["socid"] && $_GET["select"])
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
@ -56,13 +59,37 @@ if($_GET["socid"] && $_GET["select"])
|
||||
$soc->set_parent($_GET["select"]);
|
||||
|
||||
Header("Location: lien.php?socid=".$soc->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
|
||||
@ -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->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">';
|
||||
if ($soc->parent)
|
||||
{
|
||||
$socm = new Societe($db);
|
||||
$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>';
|
||||
|
||||
@ -204,9 +240,9 @@ if($_GET["socid"])
|
||||
print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td valign="right">';
|
||||
print '<input type="text" name="search_nom" value="'.stripslashes($search_nom).'">';
|
||||
print '</td><td colspan="5" align="center">';
|
||||
print '<input type="submit" class="button" name="button_search" value="'.$langs->trans("Search").'">';
|
||||
print '<input type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
|
||||
print '</td><td colspan="5" align="right">';
|
||||
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
@ -244,13 +280,17 @@ if($_GET["socid"])
|
||||
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";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user