Implémentation de la suppression
This commit is contained in:
parent
a8fcc38fb4
commit
0b94a88f1c
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("pre.inc.php");
|
require("pre.inc.php");
|
||||||
|
$user->getrights('societe');
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
|
|
||||||
@ -103,10 +103,35 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->creer)
|
||||||
|
{
|
||||||
|
$soc = new Societe($db);
|
||||||
|
$soc->fetch($_GET["socid"]);
|
||||||
|
$result = $soc->delete($_GET["socid"]);
|
||||||
|
|
||||||
|
if ($result == 0)
|
||||||
|
{
|
||||||
|
llxHeader();
|
||||||
|
print "Société $soc->nom supprimée de la base";
|
||||||
|
llxFooter();
|
||||||
|
exit ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$no_reload = 1;
|
||||||
|
$_GET["action"]='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
@ -296,10 +321,13 @@ elseif ($_GET["action"] == 'edit')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ($no_reload <> 1)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->id = $_GET["socid"];
|
$soc->id = $_GET["socid"];
|
||||||
$soc->fetch($_GET["socid"]);
|
$soc->fetch($_GET["socid"]);
|
||||||
|
}
|
||||||
|
|
||||||
$head[0][0] = 'soc.php?socid='.$soc->id;
|
$head[0][0] = 'soc.php?socid='.$soc->id;
|
||||||
$head[0][1] = $langs->trans("Company");
|
$head[0][1] = $langs->trans("Company");
|
||||||
@ -350,6 +378,24 @@ else
|
|||||||
/*
|
/*
|
||||||
* Fiche société en mode visu
|
* Fiche société en mode visu
|
||||||
*/
|
*/
|
||||||
|
$html = new Form($db);
|
||||||
|
/*
|
||||||
|
* Confirmation de la suppression de la facture
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'delete')
|
||||||
|
{
|
||||||
|
$html->form_confirm("soc.php?socid=".$soc->id,"Supprimer la société","Etes-vous sûr de vouloir supprimer cette société et tous ses contacts associés ?","confirm_delete");
|
||||||
|
print "<br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($soc->error_message)
|
||||||
|
{
|
||||||
|
print '<div class="errormessage">';
|
||||||
|
print $soc->error_message;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td>'.$soc->nom.'</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>';
|
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td>'.$soc->nom.'</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>';
|
||||||
@ -396,13 +442,21 @@ else
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
if ($_GET["action"] == '')
|
||||||
|
{
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&action=edit">'.$langs->trans("Edit").'</a>';
|
||||||
|
|
||||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddContact").'</a>';
|
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddContact").'</a>';
|
||||||
|
|
||||||
|
if ($user->rights->societe->creer)
|
||||||
|
{
|
||||||
|
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user