Fix: Error message was not thrown
This commit is contained in:
parent
10b3f64e70
commit
aae72bb7ac
@ -23,7 +23,7 @@
|
|||||||
/**
|
/**
|
||||||
\file htdocs/soc.php
|
\file htdocs/soc.php
|
||||||
\ingroup societe
|
\ingroup societe
|
||||||
\brief Onglet societe d'une societe
|
\brief Third party card page
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -237,20 +237,21 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
|||||||
|
|
||||||
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)
|
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
$result = $soc->delete($socid);
|
$result = $soc->delete($socid);
|
||||||
|
|
||||||
if ($result == 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".DOL_URL_ROOT."/societe.php?delsoc=".$soc->nom."");
|
Header("Location: ".DOL_URL_ROOT."/societe.php?delsoc=".$soc->nom."");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$reload = 0;
|
$reload = 0;
|
||||||
$_GET["action"]='';
|
$mesg=$soc->error;
|
||||||
}
|
$_GET["action"]='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -961,11 +962,10 @@ else
|
|||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mesg)
|
||||||
if ($soc->error)
|
|
||||||
{
|
{
|
||||||
print '<div class="error">';
|
print '<div class="error">';
|
||||||
print $soc->error;
|
print $mesg;
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -682,45 +682,48 @@ class Societe extends CommonObject
|
|||||||
dolibarr_syslog("Societe::Delete");
|
dolibarr_syslog("Societe::Delete");
|
||||||
$sqr = 0;
|
$sqr = 0;
|
||||||
|
|
||||||
|
// \Todo
|
||||||
|
// Check if third party can be deleted
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( $this->db->begin())
|
if ( $this->db->begin())
|
||||||
{
|
{
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople ";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
|
||||||
$sql .= " WHERE fk_soc = " . $id .";";
|
$sql.= " WHERE fk_soc = " . $id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$sqr++;
|
$sqr++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error .= "Impossible de supprimer les contacts.\n";
|
$this->error .= $this->db->lasterror();
|
||||||
dolibarr_syslog("Societe::Delete erreur -1");
|
dolibarr_syslog("Societe::Delete erreur -1 ".$this->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib ";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
|
||||||
$sql .= " WHERE fk_soc = " . $id .";";
|
$sql.= " WHERE fk_soc = " . $id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$sqr++;
|
$sqr++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error .= "Impossible de supprimer le RIB.\n";
|
$this->error = $this->db->lasterror();
|
||||||
dolibarr_syslog("Societe::Delete erreur -2");
|
dolibarr_syslog("Societe::Delete erreur -2 ".$this->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."societe ";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."societe";
|
||||||
$sql .= " WHERE rowid = " . $id .";";
|
$sql.= " WHERE rowid = " . $id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$sqr++;
|
$sqr++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error .= "Impossible de supprimer la soci<63>t<EFBFBD>.\n";
|
$this->error = $this->db->lasterror();
|
||||||
dolibarr_syslog("Societe::Delete erreur -3");
|
dolibarr_syslog("Societe::Delete erreur -3 ".$this->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sqr == 3)
|
if ($sqr == 3)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user