Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/admin/productaccount.php
	htdocs/contact/card.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/class/extrafields.class.php
This commit is contained in:
Laurent Destailleur 2019-06-02 11:49:33 +02:00
commit 5f0fbcea9a
4 changed files with 64 additions and 33 deletions

View File

@ -376,21 +376,24 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
$result = $object->update($contactid, $user); if (! $error)
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{ {
setEventMessages($object->error, $object->errors, 'errors'); $result = $object->update($contactid, $user);
$action = 'edit';
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
} }
} }
@ -505,7 +508,7 @@ else
$linkback=''; $linkback='';
print load_fiche_titre($title, $linkback, 'title_companies.png'); print load_fiche_titre($title, $linkback, 'title_companies.png');
// Affiche les erreurs // Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors); dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
@ -800,8 +803,8 @@ else
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($object->socid); $objsoc->fetch($object->socid);
// Affiche les erreurs // Show errors
dol_htmloutput_errors($error, $errors); dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -1122,11 +1125,10 @@ else
{ {
$objsoc = new Societe($db); $objsoc = new Societe($db);
/* // View mode
* Fiche en mode visualisation
*/
dol_htmloutput_errors($error, $errors); // Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
dol_fiche_head($head, 'card', $title, -1, 'contact'); dol_fiche_head($head, 'card', $title, -1, 'contact');

View File

@ -3876,9 +3876,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_create.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -4131,9 +4138,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -4154,9 +4168,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
@ -4356,9 +4377,16 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $module => $reldir)
{ {
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); if (!empty($module))
{
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
}
else
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php';
}
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {

View File

@ -1970,7 +1970,7 @@ class ExtraFields
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '') public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
{ {
global $_POST, $langs; global $_POST, $langs;
$nofillrequired='';// For error when required field left blank $nofillrequired=0;// For error when required field left blank
$error_field_required = array(); $error_field_required = array();
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
@ -2001,7 +2001,8 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{ {
// Check if empty without using GETPOST, value can be alpha, int, array, etc... // Check if empty without using GETPOST, value can be alpha, int, array, etc...
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|| (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
{ {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];

View File

@ -270,8 +270,8 @@ CREATE TABLE llx_pos_cash_fence(
-- Withdrawals / Prelevements -- Withdrawals / Prelevements
UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_END_TO_END')__ where name = __ENCRYPT('END_TO_END')__;
UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; UPDATE llx_const set name = __ENCRYPT('PRELEVEMENT_USTRD')__ where name = __ENCRYPT('USTRD')__;
-- Delete duplicate accounting account, but only if not used -- Delete duplicate accounting account, but only if not used