Skip to content

Commit

Permalink
Fix: no error message if extrafield is require
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Jun 16, 2015
1 parent ceb0d71 commit 3807faf
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions htdocs/fichinter/card.php
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
Expand Down Expand Up @@ -324,24 +324,34 @@
}
else
{
// Extrafields
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels);

$object->array_options = $array_option;

$result = $object->create($user);
if ($result > 0)
{
$id=$result; // Force raffraichissement sur fiche venant d'etre cree
}
else
{
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) {
$error ++;
$action = 'create';
}

if (! $error)
{
// Extrafields
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels);

$object->array_options = $array_option;

$result = $object->create($user);
if ($result > 0)
{
$id=$result; // Force raffraichissement sur fiche venant d'etre cree
}
else
{
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
}
}
}
else
Expand Down

0 comments on commit 3807faf

Please sign in to comment.