Fix: Description was lost
This commit is contained in:
parent
e2475e9530
commit
37bae6699e
@ -80,6 +80,7 @@ $relativepath=$ecmdir->getRelativePath();
|
|||||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* ACTIONS
|
* ACTIONS
|
||||||
*
|
*
|
||||||
@ -128,17 +129,23 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
|
|||||||
// Remove dir
|
// Remove dir
|
||||||
if ($_POST['action'] == 'confirm_deletedir' && $_POST['confirm'] == 'yes')
|
if ($_POST['action'] == 'confirm_deletedir' && $_POST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
|
// Fetch was already done
|
||||||
$result=$ecmdir->delete($user);
|
$result=$ecmdir->delete($user);
|
||||||
header("Location: ".DOL_URL_ROOT."/ecm/index.php");
|
header("Location: ".DOL_URL_ROOT."/ecm/index.php");
|
||||||
exit;
|
exit;
|
||||||
// $mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>';
|
// $mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove dir
|
// Update description
|
||||||
if ($_POST['action'] == 'update' && ! $_POST['cancel'])
|
if ($_POST['action'] == 'update' && ! $_POST['cancel'])
|
||||||
{
|
{
|
||||||
|
// Fetch was already done
|
||||||
$ecmdir->description = $_POST["description"];
|
$ecmdir->description = $_POST["description"];
|
||||||
$result=$ecmdir->update($user);
|
$result=$ecmdir->update($user);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$ecmdir->error.'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,7 +183,8 @@ if ($_GET["action"] == 'edit')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||||
$s='';
|
$s='';
|
||||||
$tmpecmdir=$ecmdir;
|
$tmpecmdir=new ECMDirectory($db); // Need to create a new one
|
||||||
|
$tmpecmdir->fetch($ecmdir->id);
|
||||||
$result = 1;
|
$result = 1;
|
||||||
while ($tmpecmdir && $result > 0)
|
while ($tmpecmdir && $result > 0)
|
||||||
{
|
{
|
||||||
@ -192,6 +200,7 @@ while ($tmpecmdir && $result > 0)
|
|||||||
$tmpecmdir=0;
|
$tmpecmdir=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
|
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> ';
|
||||||
print $s;
|
print $s;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
$now=time();
|
$now=time();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label=sanitize_string($this->label);
|
$this->label=sanitize_string($this->label);
|
||||||
$this->fk_parent=trim($this->fk_parent);
|
$this->fk_parent=trim($this->fk_parent);
|
||||||
$this->description=trim($this->description);
|
$this->description=trim($this->description);
|
||||||
if (! $this->cachenbofdoc) $this->cachenbofdoc=0;
|
if (! $this->cachenbofdoc) $this->cachenbofdoc=0;
|
||||||
@ -139,6 +139,8 @@ class EcmDirectory // extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label=trim($this->label);
|
$this->label=trim($this->label);
|
||||||
$this->fk_parent=trim($this->fk_parent);
|
$this->fk_parent=trim($this->fk_parent);
|
||||||
@ -147,6 +149,8 @@ class EcmDirectory // extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
||||||
|
|
||||||
@ -159,12 +163,12 @@ class EcmDirectory // extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$error++;
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("EcmDirectories::update ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::update ".$this->error, LOG_ERR);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
@ -174,7 +178,16 @@ class EcmDirectory // extends CommonObject
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user