Fix: Les messages d'erreurs sur creation/modif societe ne s'affichaient plus

This commit is contained in:
Laurent Destailleur 2007-12-11 20:42:49 +00:00
parent cdc282167d
commit b827e5b2ce
4 changed files with 44 additions and 19 deletions

View File

@ -1713,6 +1713,7 @@ else
$soc = new Societe($db, $fac->socid); $soc = new Societe($db, $fac->socid);
$soc->fetch($fac->socid); $soc->fetch($fac->socid);
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');

View File

@ -3873,4 +3873,38 @@ function dolibarr_print_reduction($reduction=0)
return $string; return $string;
} }
/**
\brief Returns formated reduction
\param reduction Reduction percentage
\return int Return number of error messages shown
*/
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
{
global $langs;
$ret = 0;
$langs->load("errors");
if (is_array($mesgarray) && sizeof($mesgarray))
{
print '<div class="error">';
foreach($mesgarray as $message)
{
$ret++;
print $langs->trans($message)."<br>\n";
}
print '</div>';
}
if ($mesgstring)
{
$ret++;
print '<div class="error">';
print $mesgstring;
print '</div>';
}
return $ret;
}
?> ?>

View File

@ -188,6 +188,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
{ {
$soc->id = $socid; $soc->id = $socid;
$reload = 0; $reload = 0;
$mesg = $soc->error; $mesg = $soc->error;
$_GET["action"]= "edit"; $_GET["action"]= "edit";
} }
@ -325,15 +326,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
print "<br>\n"; print "<br>\n";
} }
if (sizeof($soc->errors)) dol_htmloutput_errors($soc->error,$soc->errors);
{
print '<div class="error">';
foreach($soc->errors as $message)
{
print $langs->trans($message)."<br>\n";
}
print '</div>';
}
print '<form action="soc.php" method="post" name="formsoc">'; print '<form action="soc.php" method="post" name="formsoc">';
@ -672,12 +665,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
} }
} }
if ($soc->error) dol_htmloutput_errors($soc->error,$soc->errors);
{
print '<div class="error">';
print $soc->error;
print '</div>';
}
print '<form action="soc.php?socid='.$soc->id.'" method="post" name="formsoc">'; print '<form action="soc.php?socid='.$soc->id.'" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';

View File

@ -340,7 +340,9 @@ class Societe
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0); if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1); if ($this->code_fournisseur == -1) $this->get_codefournisseur($this->prefix_comm,1);
$result = $this->verify(); // Verifie que nom obligatoire et code client ok et unique // Check name is required and codes are ok or unique.
// If error, this->errors[] is filled
$result = $this->verify();
if ($result >= 0) if ($result >= 0)
{ {