Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
106fe22234
@ -240,10 +240,24 @@ class FormSetup
|
|||||||
* saveConfFromPost
|
* saveConfFromPost
|
||||||
*
|
*
|
||||||
* @param bool $noMessageInUpdate display event message on errors and success
|
* @param bool $noMessageInUpdate display event message on errors and success
|
||||||
* @return void|null
|
* @return int -1 if KO, 1 if OK
|
||||||
*/
|
*/
|
||||||
public function saveConfFromPost($noMessageInUpdate = false)
|
public function saveConfFromPost($noMessageInUpdate = false)
|
||||||
{
|
{
|
||||||
|
global $hookmanager;
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) {
|
||||||
|
$this->setErrors($hookmanager->errors);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($reshook > 0) {
|
||||||
|
return $reshook;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($this->items)) {
|
if (empty($this->items)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -265,11 +279,13 @@ class FormSetup
|
|||||||
if (empty($noMessageInUpdate)) {
|
if (empty($noMessageInUpdate)) {
|
||||||
setEventMessages($this->langs->trans("SetupSaved"), null);
|
setEventMessages($this->langs->trans("SetupSaved"), null);
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
if (empty($noMessageInUpdate)) {
|
if (empty($noMessageInUpdate)) {
|
||||||
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
|
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,8 +668,22 @@ class FormSetupItem
|
|||||||
*/
|
*/
|
||||||
public function saveConfValue()
|
public function saveConfValue()
|
||||||
{
|
{
|
||||||
|
global $hookmanager;
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) {
|
||||||
|
$this->setErrors($hookmanager->errors);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($reshook > 0) {
|
||||||
|
return $reshook;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
|
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
|
||||||
return call_user_func($this->saveCallBack);
|
return call_user_func($this->saveCallBack, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify constant only if key was posted (avoid resetting key to the null value)
|
// Modify constant only if key was posted (avoid resetting key to the null value)
|
||||||
@ -1013,6 +1043,7 @@ class FormSetupItem
|
|||||||
}
|
}
|
||||||
$out.= $this->langs->trans($template->label);
|
$out.= $this->langs->trans($template->label);
|
||||||
} elseif (preg_match('/category:/', $this->type)) {
|
} elseif (preg_match('/category:/', $this->type)) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
$c = new Categorie($this->db);
|
$c = new Categorie($this->db);
|
||||||
$result = $c->fetch($this->fieldValue);
|
$result = $c->fetch($this->fieldValue);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user