2
0
forked from Wavyzz/dolibarr

Fix: Bad management error

This commit is contained in:
Laurent Destailleur
2014-03-25 20:09:30 +01:00
parent 68b54f5cac
commit a5e8063cfd

View File

@@ -324,7 +324,8 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
}
// Classify to validated
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) {
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
{
$idwarehouse = GETPOST('idwarehouse');
$object->fetch($id);
@@ -333,8 +334,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
// Check parameters
// Check for mandatory prof id
for($i = 1; $i < 5; $i ++) {
for($i = 1; $i < 6; $i ++)
{
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
$idprof = 'idprof' . $i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
@@ -362,9 +363,11 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
}
}
if (! $error) {
if (! $error)
{
$result = $object->validate($user, '', $idwarehouse);
if ($result >= 0) {
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang = '';
@@ -381,7 +384,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
} else {
setEventMessage($object->error, 'errors');
if (count($object->errors)) setEventMessage($object->errors, 'errors');
else setEventMessage($object->error, 'errors');
}
}
}