diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php
index 1426c323c01..a5a68a0bb49 100644
--- a/htdocs/admin/const.php
+++ b/htdocs/admin/const.php
@@ -220,7 +220,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity) {
print '
';
print '';
}
-print '';
+print '';
print " | \n";
print '';
@@ -273,7 +273,7 @@ if ($result) {
print '';
// Date last change
- print '';
+ print ' | ';
print dol_print_date($db->jdate($obj->tms), 'dayhour');
print ' | ';
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 506a1465fdc..4452c9a7eb8 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -134,6 +134,8 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
if (!$error) {
+ $db->begin();
+
$result = $object->create($user);
if ($result > 0) {
// Creation OK
@@ -141,14 +143,19 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$categories = GETPOST('categories', 'array:int');
$object->setCategories($categories);
}
+
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
+ $db->commit();
+
if (empty($noback)) {
header("Location: " . $urltogo);
exit;
}
} else {
+ $db->rollback();
+
$error++;
// Creation KO
if (!empty($object->errors)) {
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index bee63613bca..d0b64fdca77 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -895,7 +895,12 @@ abstract class CommonDocGenerator
//Add value to store price with currency
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select') {
- $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
+ $valueofselectkey = $object->array_options['options_'.$key];
+ if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element]['param'][$key]['options'])) {
+ $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$valueofselectkey];
+ } else {
+ $object->array_options['options_'.$key] = '';
+ }
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
$valArray = explode(',', $object->array_options['options_'.$key]);
$output = array();
@@ -945,7 +950,11 @@ abstract class CommonDocGenerator
}
}
- $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
+ if (array_key_exists('option_'.$key, $object->array_options)) {
+ $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
+ } else {
+ $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => ''));
+ }
}
}
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index 94bd36799fc..c11f94fa047 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -904,11 +904,11 @@ class Translate
* This function need module "numberwords" to be installed. If not it will return
* same number (this module is not provided by default as it use non GPL source code).
*
- * @param int $number Number to encode in full text
- * @param string $isamount ''=it's just a number, '1'=It's an amount (default currency), 'currencycode'=It's an amount (foreign currency)
- * @return string Label translated in UTF8 (but without entities)
- * 10 if setDefaultLang was en_US => ten
- * 123 if setDefaultLang was fr_FR => cent vingt trois
+ * @param int|string $number Number to encode in full text
+ * @param string $isamount ''=it's just a number, '1'=It's an amount (default currency), 'currencycode'=It's an amount (foreign currency)
+ * @return string Label translated in UTF8 (but without entities)
+ * 10 if setDefaultLang was en_US => ten
+ * 123 if setDefaultLang was fr_FR => cent vingt trois
*/
public function getLabelFromNumber($number, $isamount = '')
{
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index bfb1e170078..38b60b9f17b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -8611,7 +8611,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
}
} elseif ($onlysimplestring == '2') {
// We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
- if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/;[]', '/').']/i', $s)) {
+ if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@;[]', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
@@ -9020,7 +9020,6 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
if ($values[0] != $type) {
continue;
}
- //var_dump(verifCond($values[4]));
if (verifCond($values[4])) {
if ($values[3]) {
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 97269fa996a..c352faef1fc 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2683,7 +2683,7 @@ if ($action == 'create') {
$delallowed = $usercancreate;
$modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF) ? '' : $conf->global->COMMANDE_SUPPLIER_ADDON_PDF));
- print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang);
+ print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang, '', $object);
$somethingshown = $formfile->numoffiles;
// Show links to link elements
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index 982a183d388..03de4f7ecca 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -307,7 +307,7 @@ $sql .= " p.rowid as project_id, p.ref as project_ref,";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " sc.fk_soc, sc.fk_user,";
}
-$sql .= " u.firstname, u.lastname, u.photo, u.login, u.statut as status, u.admin, u.employee, u.email as uemail";
+$sql .= " u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {