Some enhancements in ecm module
This commit is contained in:
parent
24bb2ca1d4
commit
79306a55d3
@ -18,11 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdoc/ecm/index.php
|
\file htdoc/ecm/docdir.php
|
||||||
\ingroup ecm
|
\ingroup ecm
|
||||||
\brief Main page for ECM section area
|
\brief Main page for ECM section area
|
||||||
\version $Id$
|
\version $Id$
|
||||||
\author Laurent Destailleur
|
\author Laurent Destailleur
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -44,6 +44,7 @@ $langs->load("categories");
|
|||||||
// Load permissions
|
// Load permissions
|
||||||
$user->getrights('ecm');
|
$user->getrights('ecm');
|
||||||
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
|
|
||||||
@ -81,22 +82,34 @@ if (! empty($_GET["section"]))
|
|||||||
// Action ajout d'un produit ou service
|
// Action ajout d'un produit ou service
|
||||||
if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
|
if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
|
||||||
{
|
{
|
||||||
$ecmdir->ref = $_POST["ref"];
|
$ecmdir->ref = trim($_POST["ref"]);
|
||||||
$ecmdir->label = $_POST["label"];
|
$ecmdir->label = trim($_POST["label"]);
|
||||||
$ecmdir->description = $_POST["desc"];
|
$ecmdir->description = trim($_POST["desc"]);
|
||||||
$ecmdir->fk_parent = $_POST["catParent"];
|
$ecmdir->fk_parent = $_POST["catParent"];
|
||||||
|
|
||||||
$id = $ecmdir->create($user);
|
$ok=true;
|
||||||
|
|
||||||
if ($id > 0)
|
if (! $ecmdir->label)
|
||||||
{
|
{
|
||||||
Header("Location: ".DOL_URL_ROOT.'/ecm/docmine.php?section='.$id);
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>';
|
|
||||||
$_GET["action"] = "create";
|
$_GET["action"] = "create";
|
||||||
|
$ok=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ok)
|
||||||
|
{
|
||||||
|
$id = $ecmdir->create($user);
|
||||||
|
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
Header("Location: ".DOL_URL_ROOT.'/ecm/index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>';
|
||||||
|
$_GET["action"] = "create";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +199,7 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
|
|||||||
// Construit fiche rubrique
|
// Construit fiche rubrique
|
||||||
|
|
||||||
|
|
||||||
|
print $user->rights->ecm->setup;
|
||||||
// Actions buttons
|
// Actions buttons
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
if ($user->rights->ecm->setup)
|
if ($user->rights->ecm->setup)
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $langs->load("other");
|
|||||||
// Load permissions
|
// Load permissions
|
||||||
$user->getrights('ecm');
|
$user->getrights('ecm');
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@ -99,9 +100,8 @@ if ( $_POST["sendit"] && $conf->upload != 0)
|
|||||||
$result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']);
|
$result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']);
|
||||||
if ($result == 1)
|
if ($result == 1)
|
||||||
{
|
{
|
||||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
//$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||||
//print_r($_FILES);
|
//print_r($_FILES);
|
||||||
|
|
||||||
$result=$ecmdir->changeNbOfFiles('+');
|
$result=$ecmdir->changeNbOfFiles('+');
|
||||||
}
|
}
|
||||||
else if (!$result)
|
else if (!$result)
|
||||||
@ -118,7 +118,7 @@ if ( $_POST["sendit"] && $conf->upload != 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suppression fichier
|
// Remove file
|
||||||
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
|
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
|
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
|
||||||
@ -129,7 +129,21 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
|
|||||||
$result=$ecmdir->changeNbOfFiles('-');
|
$result=$ecmdir->changeNbOfFiles('-');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove dir
|
||||||
|
if ($_POST['action'] == 'confirm_deletedir' && $_POST['confirm'] == 'yes')
|
||||||
|
{
|
||||||
|
$result=$ecmdir->delete($user);
|
||||||
|
header("Location: ".DOL_URL_ROOT."/ecm/index.php");
|
||||||
|
exit;
|
||||||
|
// $mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove dir
|
||||||
|
if ($_POST['action'] == 'update' && ! $_POST['cancel'])
|
||||||
|
{
|
||||||
|
$ecmdir->description = $_POST["description"];
|
||||||
|
$result=$ecmdir->update($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -151,6 +165,12 @@ $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolowe
|
|||||||
$head = ecm_prepare_head($ecmdir);
|
$head = ecm_prepare_head($ecmdir);
|
||||||
dolibarr_fiche_head($head, 'card', $langs->trans("ECMManualOrg"));
|
dolibarr_fiche_head($head, 'card', $langs->trans("ECMManualOrg"));
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'edit')
|
||||||
|
{
|
||||||
|
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="section" value="'.$section.'">';
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
}
|
||||||
|
|
||||||
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>';
|
||||||
@ -174,13 +194,19 @@ while ($tmpecmdir && $result > 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>';
|
||||||
print '<tr><td>'.$langs->trans("Description").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||||
print dol_nl2br($ecmdir->description);
|
if ($_GET["action"] == 'edit')
|
||||||
|
{
|
||||||
|
print '<textarea class="flat" name="description" cols="80">';
|
||||||
|
print $ecmdir->description;
|
||||||
|
print '</textarea>';
|
||||||
|
}
|
||||||
|
else print dol_nl2br($ecmdir->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
||||||
$user=new User($db,$ecmdir->fk_user_c);
|
$userecm=new User($db,$ecmdir->fk_user_c);
|
||||||
$user->fetch();
|
$userecm->fetch();
|
||||||
print $user->getNomUrl(1);
|
print $userecm->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||||
print dolibarr_print_date($ecmdir->date_c,'dayhour');
|
print dolibarr_print_date($ecmdir->date_c,'dayhour');
|
||||||
@ -200,22 +226,67 @@ foreach($filearray as $key => $file)
|
|||||||
}
|
}
|
||||||
print dol_print_size($totalsize);
|
print dol_print_size($totalsize);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
if ($_GET["action"] == 'edit')
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="2" align="center">';
|
||||||
|
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
if ($_GET["action"] == 'edit')
|
||||||
|
{
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
// Actions buttons
|
||||||
|
if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete_dir' && $_GET['action'] != 'delete_file')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
if ($user->rights->ecm->setup)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'">'.$langs->trans('Edit').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($filearray) == 0)
|
||||||
|
{
|
||||||
|
if ($user->rights->ecm->setup)
|
||||||
|
{
|
||||||
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete_dir§ion='.$section.'">'.$langs->trans('Delete').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionDeleteRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFiles").'">'.$langs->trans('Delete').'</a>';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
if ($mesg) { print $mesg.'<br>'; }
|
||||||
* Confirmation de la suppression d'une ligne produit
|
|
||||||
*/
|
|
||||||
|
// Confirm remove file
|
||||||
if ($_GET['action'] == 'delete_file')
|
if ($_GET['action'] == 'delete_file')
|
||||||
{
|
{
|
||||||
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
|
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mesg) { print $mesg."<br>"; }
|
// Confirm remove file
|
||||||
|
if ($_GET['action'] == 'delete_dir')
|
||||||
|
{
|
||||||
|
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection'), 'confirm_deletedir');
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Affiche formulaire upload
|
// Affiche formulaire upload
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
@ -250,11 +321,13 @@ foreach($filearray as $key => $file)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '<td align="right">'.dol_print_size($file['size']).'</td>';
|
print '<td align="right">'.dol_print_size($file['size']).'</td>';
|
||||||
print '<td align="center">'.dolibarr_print_date($file['date'],"dayhour").'</td>';
|
print '<td align="center">'.dolibarr_print_date($file['date'],"dayhour").'</td>';
|
||||||
print '<td align="center">';
|
print '<td align="right">';
|
||||||
echo '<a href="'.$url.'?section='.$_REQUEST["section"].'&action=delete_file&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
|
//print ' ';
|
||||||
|
print '<a href="'.$url.'?section='.$_REQUEST["section"].'&action=delete_file&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sizeof($filearray) == 0) print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("ECMNoFileFound").'</td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
// Fin de zone Ajax
|
// Fin de zone Ajax
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql.= " '".$this->fk_user_c."'";
|
$sql.= " '".$this->fk_user_c."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dolibarr_syslog("Ecm_directories::create sql=".$sql, LOG_DEBUG);
|
dolibarr_syslog("EcmDirectories::create sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -120,7 +120,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("Ecm_directories::create ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::create ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,13 +136,10 @@ class EcmDirectory // extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
// 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);
|
||||||
$this->description=trim($this->description);
|
$this->description=trim($this->description);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
@ -151,18 +148,15 @@ class EcmDirectory // extends CommonObject
|
|||||||
|
|
||||||
$sql.= " label='".addslashes($this->label)."',";
|
$sql.= " label='".addslashes($this->label)."',";
|
||||||
$sql.= " fk_parent='".$this->fk_parent."',";
|
$sql.= " fk_parent='".$this->fk_parent."',";
|
||||||
$sql.= " description='".addslashes($this->description)."',";
|
$sql.= " description='".addslashes($this->description)."'";
|
||||||
$sql.= " tms=".$this->db->idate($this->tms)."";
|
|
||||||
|
|
||||||
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Ecm_directories::update sql=".$sql, LOG_DEBUG);
|
dolibarr_syslog("EcmDirectories::update sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("Ecm_directories::update ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::update ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,12 +189,12 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1";
|
$sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Ecm_directories::changeNbOfFiles sql=".$sql, LOG_DEBUG);
|
dolibarr_syslog("EcmDirectories::changeNbOfFiles sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("Ecm_directories::changeNbOfFiles ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::changeNbOfFiles ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,11 +205,10 @@ class EcmDirectory // extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Load object in memory from database
|
* \brief Load object in memory from database
|
||||||
* \param id id object
|
* \param id id object
|
||||||
* \return int <0 if KO, >0 if OK
|
* \return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
{
|
{
|
||||||
global $langs;
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
$sql.= " t.label,";
|
$sql.= " t.label,";
|
||||||
@ -229,14 +222,13 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
|
||||||
$sql.= " WHERE t.rowid = ".$id;
|
$sql.= " WHERE t.rowid = ".$id;
|
||||||
|
|
||||||
dolibarr_syslog("Ecm_directories::fetch sql=".$sql, LOG_DEBUG);
|
dolibarr_syslog("EcmDirectories::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
$obj = $this->db->fetch_object($resql);
|
||||||
{
|
if ($obj)
|
||||||
$obj = $this->db->fetch_object($resql);
|
{
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
@ -249,14 +241,15 @@ class EcmDirectory // extends CommonObject
|
|||||||
$this->date_c = $obj->date_c;
|
$this->date_c = $obj->date_c;
|
||||||
$this->date_m = $obj->date_m;
|
$this->date_m = $obj->date_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return $obj?1:0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("Ecm_directories::fetch ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::fetch ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,12 +267,12 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Ecm_directories::delete sql=".$sql);
|
dolibarr_syslog("EcmDirectories::delete sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dolibarr_syslog("Ecm_directories::delete ".$this->error, LOG_ERR);
|
dolibarr_syslog("EcmDirectories::delete ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +322,12 @@ class EcmDirectory // extends CommonObject
|
|||||||
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
||||||
$picto='dir';
|
$picto='dir';
|
||||||
|
|
||||||
$label=$langs->trans("ShowECMSection").': '.$this->ref;
|
$newref=eregi_replace('_',' ',$this->ref);
|
||||||
|
$newlabel=$langs->trans("ShowECMSection").': '.$newref;
|
||||||
if ($withpicto) $result.=($lien.img_object($label,$picto,'',1).$lienfin);
|
|
||||||
|
if ($withpicto) $result.=($lien.img_object($newlabel,$picto,'',1).$lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
if ($withpicto != 2) $result.=$lien.$newref.$lienfin;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +381,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
|
$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
|
||||||
$sql.= " WHERE fk_parent != 0";
|
$sql.= " WHERE fk_parent != 0";
|
||||||
|
|
||||||
dolibarr_syslog("ECMDirectory::get_full_arbo sql=".$sql);
|
dolibarr_syslog("EcmDirectory::get_full_arbo sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -415,10 +409,16 @@ class EcmDirectory // extends CommonObject
|
|||||||
* label = nom de la categorie
|
* label = nom de la categorie
|
||||||
* fulllabel = nom avec chemin complet de la categorie
|
* fulllabel = nom avec chemin complet de la categorie
|
||||||
* fullpath = chemin complet compose des id
|
* fullpath = chemin complet compose des id
|
||||||
|
* \param force Force reload of full arbo even if already loaded
|
||||||
* \return array Tableau de array
|
* \return array Tableau de array
|
||||||
*/
|
*/
|
||||||
function get_full_arbo()
|
function get_full_arbo($force=0)
|
||||||
{
|
{
|
||||||
|
if (empty($force) && $this->full_arbo_loaded)
|
||||||
|
{
|
||||||
|
return $this->cats;
|
||||||
|
}
|
||||||
|
|
||||||
// Init this->motherof array
|
// Init this->motherof array
|
||||||
$this->load_motherof();
|
$this->load_motherof();
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
$sql.= " WHERE c.fk_user_c = u.rowid";
|
$sql.= " WHERE c.fk_user_c = u.rowid";
|
||||||
$sql.= " ORDER BY c.label, c.rowid";
|
$sql.= " ORDER BY c.label, c.rowid";
|
||||||
|
|
||||||
dolibarr_syslog("ECMDirectory::get_full_arbo sql=".$sql);
|
dolibarr_syslog("EcmDirectory::get_full_arbo sql=".$sql);
|
||||||
$resql = $this->db->query ($sql);
|
$resql = $this->db->query ($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -484,8 +484,7 @@ class EcmDirectory // extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
|
$this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
|
||||||
|
$this->full_arbo_loaded=1;
|
||||||
//$this->debug_cats();
|
|
||||||
|
|
||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
@ -525,7 +524,40 @@ class EcmDirectory // extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief refresh cachenboffile
|
||||||
|
* \param directory Directory to scan
|
||||||
|
* \return int <0 if ko, >0 if OK
|
||||||
|
*/
|
||||||
|
function refreshcachenboffile()
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||||
|
|
||||||
|
$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
|
||||||
|
$filelist=dol_dir_list($dir,'files',0,'','\.meta$');
|
||||||
|
|
||||||
|
// Test if filelist is in database
|
||||||
|
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
||||||
|
$sql.= " cachenbofdoc='".sizeof($filelist)."'";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
dolibarr_syslog("EcmDirectories::refreshcachenboffile sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
|
dolibarr_syslog("EcmDirectories::refreshcachenboffile ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,5 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,220 +117,218 @@ $form=new Form($db);
|
|||||||
$ecmdirstatic = new ECMDirectory($db);
|
$ecmdirstatic = new ECMDirectory($db);
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
if (! $_GET["action"] || $_GET["action"] == 'delete_section')
|
//***********************
|
||||||
|
// List
|
||||||
|
//***********************
|
||||||
|
print_fiche_titre($langs->trans("ECMArea"));
|
||||||
|
|
||||||
|
print $langs->trans("ECMAreaDesc")."<br>";
|
||||||
|
print $langs->trans("ECMAreaDesc2")."<br>";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
print '<table class="notopnoleftnoright" width="100%"><tr><td width="50%" valign="top">';
|
||||||
|
|
||||||
|
//print_fiche_titre($langs->trans("ECMManualOrg"));
|
||||||
|
|
||||||
|
print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">';
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td colspan="3">'.$langs->trans("ECMSearchByKeywords").'</td></tr>';
|
||||||
|
print "<tr $bc[0]><td>".$langs->trans("Title").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
||||||
|
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||||
|
print "<tr $bc[0]><td>".$langs->trans("Keyword").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print "</table></form><br>";
|
||||||
|
//print $langs->trans("ECMManualOrgDesc");
|
||||||
|
|
||||||
|
print '</td><td width="50%" valign="top">';
|
||||||
|
|
||||||
|
//print_fiche_titre($langs->trans("ECMAutoOrg"));
|
||||||
|
|
||||||
|
print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">';
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td colspan="3">'.$langs->trans("ECMSearchByEntity").'</td></tr>';
|
||||||
|
|
||||||
|
$buthtml='<td rowspan="5"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||||
|
$butshown=0;
|
||||||
|
|
||||||
|
if ($conf->societe->enabled) { print "<tr $bc[0]><td>".$langs->trans("ThirdParty").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
||||||
|
if ($conf->contrat->enabled) { print "<tr $bc[0]><td>".$langs->trans("Contrat").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
||||||
|
if ($conf->propal->enabled) { print "<tr $bc[0]><td>".$langs->trans("Proposal").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
||||||
|
if ($conf->commande->enabled) { print "<tr $bc[0]><td>".$langs->trans("Order").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
||||||
|
if ($conf->facture->enabled) { print "<tr $bc[0]><td>".$langs->trans("Invoice").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
||||||
|
print "</table></form><br>";
|
||||||
|
//print $langs->trans("ECMAutoOrgDesc");
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
//***********************
|
||||||
|
// Files
|
||||||
|
//***********************
|
||||||
|
print_fiche_titre($langs->trans("ECMSectionOfDocuments"));
|
||||||
|
//print '<br>';
|
||||||
|
|
||||||
|
// Confirmation de la suppression d'une ligne categorie
|
||||||
|
if ($_GET['action'] == 'delete_section')
|
||||||
{
|
{
|
||||||
//***********************
|
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
|
||||||
// List
|
print '<br>';
|
||||||
//***********************
|
|
||||||
print_fiche_titre($langs->trans("ECMArea"));
|
|
||||||
|
|
||||||
print $langs->trans("ECMAreaDesc")."<br>";
|
|
||||||
print $langs->trans("ECMAreaDesc2")."<br>";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print '<table class="notopnoleftnoright" width="100%"><tr><td width="50%" valign="top">';
|
|
||||||
|
|
||||||
//print_fiche_titre($langs->trans("ECMManualOrg"));
|
|
||||||
|
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">';
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td colspan="3">'.$langs->trans("ECMSearchByKeywords").'</td></tr>';
|
|
||||||
print "<tr $bc[0]><td>".$langs->trans("Title").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
|
||||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
|
||||||
print "<tr $bc[0]><td>".$langs->trans("Keyword").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
print "</table></form><br>";
|
|
||||||
//print $langs->trans("ECMManualOrgDesc");
|
|
||||||
|
|
||||||
print '</td><td width="50%" valign="top">';
|
|
||||||
|
|
||||||
//print_fiche_titre($langs->trans("ECMAutoOrg"));
|
|
||||||
|
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/ecm/search.php">';
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td colspan="3">'.$langs->trans("ECMSearchByEntity").'</td></tr>';
|
|
||||||
|
|
||||||
$buthtml='<td rowspan="5"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
|
||||||
$butshown=0;
|
|
||||||
|
|
||||||
if ($conf->societe->enabled) { print "<tr $bc[0]><td>".$langs->trans("ThirdParty").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
|
||||||
if ($conf->contrat->enabled) { print "<tr $bc[0]><td>".$langs->trans("Contrat").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
|
||||||
if ($conf->propal->enabled) { print "<tr $bc[0]><td>".$langs->trans("Proposal").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
|
||||||
if ($conf->commande->enabled) { print "<tr $bc[0]><td>".$langs->trans("Order").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
|
||||||
if ($conf->facture->enabled) { print "<tr $bc[0]><td>".$langs->trans("Invoice").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>'.($butshown?'':$buthtml).'</tr>'; $butshown=1; }
|
|
||||||
print "</table></form><br>";
|
|
||||||
//print $langs->trans("ECMAutoOrgDesc");
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
|
||||||
//***********************
|
|
||||||
// Files
|
|
||||||
//***********************
|
|
||||||
print_fiche_titre($langs->trans("ECMSectionOfDocuments"));
|
|
||||||
//print '<br>';
|
|
||||||
|
|
||||||
/*
|
|
||||||
$ecmdir->ref=$ecmdir->label;
|
|
||||||
print $langs->trans("ECMSection").': ';
|
|
||||||
print img_picto('','object_dir').' ';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php">'.$langs->trans("ECMRoot").'</a>';
|
|
||||||
//print ' -> <b>'.$ecmdir->getNomUrl(1).'</b><br>';
|
|
||||||
print "<br><br>";
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Confirmation de la suppression d'une ligne categorie
|
|
||||||
if ($_GET['action'] == 'delete_section')
|
|
||||||
{
|
|
||||||
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection');
|
|
||||||
print '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mesg) { print $mesg."<br>"; }
|
|
||||||
|
|
||||||
|
|
||||||
// Construit liste des répertoires
|
|
||||||
print '<table width="100%" class="noborder">';
|
|
||||||
|
|
||||||
// Ajout rubriques automatiques
|
|
||||||
$sectionauto=array();
|
|
||||||
if ($conf->societe->enabled) $sectionauto[]=array('test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties"));
|
|
||||||
if ($conf->propal->enabled) $sectionauto[]=array('test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals"));
|
|
||||||
if ($conf->commande->enabled) $sectionauto[]=array('test'=>$conf->commande->enabled,'label'=>$langs->trans("Orders"), 'desc'=>$langs->trans("ECMDocsByOrders"));
|
|
||||||
if ($conf->contrat->enabled) $sectionauto[]=array('test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts"));
|
|
||||||
if ($conf->facture->enabled) $sectionauto[]=array('test'=>$conf->facture->enabled, 'label'=>$langs->trans("Invoices"), 'desc'=>$langs->trans("ECMDocsByInvoices"));
|
|
||||||
|
|
||||||
if (sizeof($sectionauto))
|
|
||||||
{
|
|
||||||
// Automatic sections
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionAuto").'</td>';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("ECMCreationUser").'</td>';
|
|
||||||
print '<td class="liste_titre"> </td>';
|
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocs").'</td>';
|
|
||||||
print '<td class="liste_titre"> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false);
|
|
||||||
|
|
||||||
$var=true;
|
|
||||||
foreach ($sectionauto as $key => $val)
|
|
||||||
{
|
|
||||||
if ($val['test'])
|
|
||||||
{
|
|
||||||
$var=! $var;
|
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
|
||||||
|
|
||||||
// Section
|
|
||||||
print '<td align="left">';
|
|
||||||
print img_picto('','object_dir').' ';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/ecm/docother.php">';
|
|
||||||
print $val['label'];
|
|
||||||
print '</a>';
|
|
||||||
print "</td>\n";
|
|
||||||
|
|
||||||
// Description
|
|
||||||
print '<td align="left">'.$val['desc'].'</td>';
|
|
||||||
print '<td align="left">'.$langs->trans("ECMTypeAuto").'</td>';
|
|
||||||
print '<td align="center"> </td>';
|
|
||||||
print '<td align="right">?</td>';
|
|
||||||
print '<td align="right"> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Manual sections
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
$param='&socid='.$socid;
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionManual").'</td>';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("ECMCreationUser").'</td>';
|
|
||||||
print '<td class="liste_titre" align="center">'.$langs->trans("ECMCreationDate").'</td>';
|
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocs").'</td>';
|
|
||||||
print '<td class="liste_titre" align="center"> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$ecmdirstatic = new ECMDirectory($db);
|
|
||||||
$rub=$ecmdirstatic->get_full_arbo();
|
|
||||||
|
|
||||||
$userstatic = new User($db);
|
|
||||||
|
|
||||||
$nbofentries=0;
|
|
||||||
$var=true;
|
|
||||||
foreach($rub as $key => $val)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
$ecmdirstatic->id=$val['id'];
|
|
||||||
$ecmdirstatic->ref=$val['label'];
|
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
|
||||||
|
|
||||||
// Section
|
|
||||||
print '<td align="left">';
|
|
||||||
print str_repeat(' ',$val['level']-1);
|
|
||||||
print $ecmdirstatic->getNomUrl(1);
|
|
||||||
print "</td>\n";
|
|
||||||
|
|
||||||
// Description
|
|
||||||
print '<td align="left">'.dolibarr_trunc($val['description'],32).'</td>';
|
|
||||||
$userstatic->id=$val['fk_user_c'];
|
|
||||||
$userstatic->nom=$val['login_c'];
|
|
||||||
print '<td align="left">'.$userstatic->getNomUrl(1).'</td>';
|
|
||||||
print '<td align="center">'.dolibarr_print_date($val['date_c'],"dayhour").'</td>';
|
|
||||||
|
|
||||||
// Nb of docs
|
|
||||||
//print '<td align="right">'.$obj->cachenbofdoc.'</td>';
|
|
||||||
print '<td align="right">'.$val['cachenbofdoc'].'</td>';
|
|
||||||
|
|
||||||
print '<td align="right">';
|
|
||||||
if ($val['cachenbofdoc'] == 0 && $val['level'] >= $rub[$key+1]['level'])
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete_section§ion='.urlencode($val['id']).'">'.img_delete().'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
$nbofentries++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If nothing to show
|
|
||||||
if ($nbofentries == 0)
|
|
||||||
{
|
|
||||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("ECMNoDirecotyYet").'</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
// Fin de zone Ajax
|
|
||||||
|
|
||||||
|
|
||||||
// Actions buttons
|
|
||||||
/*
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
if ($user->rights->ecm->setup)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create">'.$langs->trans('ECMAddSection').'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mesg) { print $mesg."<br>"; }
|
||||||
|
|
||||||
|
|
||||||
|
// Construit liste des répertoires
|
||||||
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
|
// Ajout rubriques automatiques
|
||||||
|
$sectionauto=array();
|
||||||
|
if ($conf->societe->enabled) $sectionauto[]=array('test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties"));
|
||||||
|
if ($conf->propal->enabled) $sectionauto[]=array('test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals"));
|
||||||
|
if ($conf->commande->enabled) $sectionauto[]=array('test'=>$conf->commande->enabled,'label'=>$langs->trans("Orders"), 'desc'=>$langs->trans("ECMDocsByOrders"));
|
||||||
|
if ($conf->contrat->enabled) $sectionauto[]=array('test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts"));
|
||||||
|
if ($conf->facture->enabled) $sectionauto[]=array('test'=>$conf->facture->enabled, 'label'=>$langs->trans("Invoices"), 'desc'=>$langs->trans("ECMDocsByInvoices"));
|
||||||
|
|
||||||
|
if (sizeof($sectionauto))
|
||||||
|
{
|
||||||
|
// Automatic sections
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionAuto").'</td>';
|
||||||
|
print '<td class="liste_titre" align="left">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocsSmall").'</td>';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false);
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
foreach ($sectionauto as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val['test'])
|
||||||
|
{
|
||||||
|
$var=! $var;
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
|
// Section
|
||||||
|
print '<td align="left">';
|
||||||
|
print img_picto('','object_dir').' ';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/ecm/docother.php">';
|
||||||
|
print $val['label'];
|
||||||
|
print '</a>';
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<td align="left">'.$val['desc'].'</td>';
|
||||||
|
print '<td align="right">?</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||||
|
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMAutoOrg").'<br>';
|
||||||
|
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$langs->trans("ECMTypeAuto");
|
||||||
|
print $form->textwithhelp('',$htmltooltip,1,0);
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Manual sections
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
$param='&socid='.$socid;
|
||||||
|
|
||||||
|
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionManual").'</td>';
|
||||||
|
print '<td class="liste_titre" align="left">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocsSmall");
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshauto">'.img_picto($langs->trans("Refresh"),'refresh').'</a>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir?action=create">'.img_picto($langs->trans("ECMNewSection"),'edit_add').'</a>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$ecmdirstatic = new ECMDirectory($db);
|
||||||
|
$rub=$ecmdirstatic->get_full_arbo();
|
||||||
|
|
||||||
|
$userstatic = new User($db);
|
||||||
|
|
||||||
|
$nbofentries=0;
|
||||||
|
$var=true;
|
||||||
|
foreach($rub as $key => $val)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
$ecmdirstatic->id=$val['id'];
|
||||||
|
$ecmdirstatic->ref=$val['label'];
|
||||||
|
|
||||||
|
// Refresh cache
|
||||||
|
if ($_GET['action'] == 'refreshauto')
|
||||||
|
{
|
||||||
|
$result=$ecmdirstatic->fetch($val['id']);
|
||||||
|
$result=$ecmdirstatic->refreshcachenboffile();
|
||||||
|
|
||||||
|
$ecmdirstatic->ref=$ecmdirstatic->label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
|
// Section
|
||||||
|
print '<td align="left">';
|
||||||
|
print str_repeat(' ',$val['level']-1);
|
||||||
|
print $ecmdirstatic->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<td align="left">'.dolibarr_trunc($val['description'],32).'</td>';
|
||||||
|
|
||||||
|
// Nb of docs
|
||||||
|
//print '<td align="right">'.$obj->cachenbofdoc.'</td>';
|
||||||
|
print '<td align="right">'.$val['cachenbofdoc'].'</td>';
|
||||||
|
|
||||||
|
print '<td align="right">';
|
||||||
|
$userstatic->id=$val['fk_user_c'];
|
||||||
|
$userstatic->nom=$val['login_c'];
|
||||||
|
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||||
|
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMManualOrg").'<br>';
|
||||||
|
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>';
|
||||||
|
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.dolibarr_print_date($val['date_c'],"dayhour");
|
||||||
|
print $form->textwithhelp('',$htmltooltip,1,0);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
$nbofentries++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If nothing to show
|
||||||
|
if ($nbofentries == 0)
|
||||||
|
{
|
||||||
|
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("ECMNoDirecotyYet").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
// Fin de zone Ajax
|
||||||
|
|
||||||
|
|
||||||
|
// Actions buttons
|
||||||
|
/*
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
if ($user->rights->ecm->setup)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=create">'.$langs->trans('ECMAddSection').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -39,7 +39,6 @@ function llxHeader($head = "", $title="", $help_url='')
|
|||||||
$menu = new Menu();
|
$menu = new Menu();
|
||||||
|
|
||||||
$menu->add(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("MenuECM"),0,$user->rights->ecm->read);
|
$menu->add(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("MenuECM"),0,$user->rights->ecm->read);
|
||||||
//$menu->add_submenu(DOL_URL_ROOT."/ecm/docdir.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read);
|
|
||||||
$menu->add_submenu(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read);
|
$menu->add_submenu(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("List"),1,$user->rights->ecm->read);
|
||||||
//$menu->add_submenu(DOL_URL_ROOT."/ecm/index?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewDocument"),1,$user->rights->ecm->create);
|
//$menu->add_submenu(DOL_URL_ROOT."/ecm/index?mainmenu=ecm&action=create&idmenu=".$_SESSION["idmenu"], $langs->trans("ECMNewDocument"),1,$user->rights->ecm->create);
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,8 @@ DocsContracts=Documents contracts
|
|||||||
DocsProposals=Documents proposals
|
DocsProposals=Documents proposals
|
||||||
DocsOrders=Documents orders
|
DocsOrders=Documents orders
|
||||||
DocsInvoices=Documents invoices
|
DocsInvoices=Documents invoices
|
||||||
ECMNbOfDocs=Nb doc
|
ECMNbOfDocs=Nb of documents in directory
|
||||||
|
ECMNbOfDocsSmall=Nb of doc.
|
||||||
ECMSection=Directory
|
ECMSection=Directory
|
||||||
ECMSectionManual=Manual directory
|
ECMSectionManual=Manual directory
|
||||||
ECMSectionAuto=Automatic directory
|
ECMSectionAuto=Automatic directory
|
||||||
@ -41,4 +42,6 @@ ECMNoDirecotyYet=No directory created
|
|||||||
ShowECMSection=Show directory
|
ShowECMSection=Show directory
|
||||||
DeleteSection=Remove directory
|
DeleteSection=Remove directory
|
||||||
ConfirmDeleteSection=Can you confirm you want to delete the directory <b>%s</b> ?
|
ConfirmDeleteSection=Can you confirm you want to delete the directory <b>%s</b> ?
|
||||||
ECMDirectoryForFiles=Relative directory for files
|
ECMDirectoryForFiles=Relative directory for files
|
||||||
|
CannotRemoveDirectoryContainsFiles=Removed not possible because it contains some files
|
||||||
|
ECMNoFileFound=No documents saved in this directory
|
||||||
@ -8,7 +8,8 @@ DocsContracts=Documents contrats
|
|||||||
DocsProposals=Documents propositions
|
DocsProposals=Documents propositions
|
||||||
DocsOrders=Documents commandes
|
DocsOrders=Documents commandes
|
||||||
DocsInvoices=Documents factures
|
DocsInvoices=Documents factures
|
||||||
ECMNbOfDocs=Nb doc
|
ECMNbOfDocs=Nb de documents de la rubrique
|
||||||
|
ECMNbOfDocsSmall=Nb de doc.
|
||||||
ECMSection=Rubrique
|
ECMSection=Rubrique
|
||||||
ECMSectionManual=Rubriques manuelles
|
ECMSectionManual=Rubriques manuelles
|
||||||
ECMSectionAuto=Rubriques automatique
|
ECMSectionAuto=Rubriques automatique
|
||||||
@ -22,7 +23,7 @@ ECMCreationDate=Date cr
|
|||||||
ECMCreationUser=Créateur
|
ECMCreationUser=Créateur
|
||||||
ECMArea=Espace GED
|
ECMArea=Espace GED
|
||||||
ECMAreaDesc=L'espace GED (Gestion Electronique de Documents) vous permet de stocker dans Dolibarr et retrouver rapidement tout type de documents.
|
ECMAreaDesc=L'espace GED (Gestion Electronique de Documents) vous permet de stocker dans Dolibarr et retrouver rapidement tout type de documents.
|
||||||
ECMAreaDesc2=* Les rubriques automatiques sont alimentées automatiquement lors de l'ajout d'un document depuis une fiche objet (propal, facture, commande...).<br>* Les rubriques manuelles peuvent etre utilisées pour stocker des documents divers, non liés à un objet particulier.
|
ECMAreaDesc2=* Les rubriques automatiques sont alimentées automatiquement lors de l'ajout d'un document depuis une fiche objet (propal, facture...).<br>* Les rubriques manuelles peuvent etre utilisées pour stocker des documents divers, non liés à un objet particulier.
|
||||||
ECMSectionWasRemoved=La rubrique <b>%s</b> a été effacée.
|
ECMSectionWasRemoved=La rubrique <b>%s</b> a été effacée.
|
||||||
ECMDocumentsSection=Document de la section
|
ECMDocumentsSection=Document de la section
|
||||||
ECMSearchByKeywords=Recherche par mots clés
|
ECMSearchByKeywords=Recherche par mots clés
|
||||||
@ -40,5 +41,7 @@ ECMAutoOrg=Rubrique automatique
|
|||||||
ECMNoDirecotyYet=Aucune rubrique créée
|
ECMNoDirecotyYet=Aucune rubrique créée
|
||||||
ShowECMSection=Afficher rubrique
|
ShowECMSection=Afficher rubrique
|
||||||
DeleteSection=Suppression rubrique
|
DeleteSection=Suppression rubrique
|
||||||
ConfirmDeleteSection=Confirmez-vous la suppression de la rubique <b>%s</b> ?
|
ConfirmDeleteSection=Confirmez-vous la suppression de la rubrique <b>%s</b> ?
|
||||||
ECMDirectoryForFiles=Répertoire relatif pour les fichiers
|
ECMDirectoryForFiles=Répertoire relatif pour les fichiers
|
||||||
|
CannotRemoveDirectoryContainsFiles=Suppression impossible car des fichiers sont présents
|
||||||
|
ECMNoFileFound=Pas de documents stockés dans cette rubrique
|
||||||
@ -32,7 +32,7 @@
|
|||||||
\param $exludefilter Regex for exclude filter (example: '\.meta$')
|
\param $exludefilter Regex for exclude filter (example: '\.meta$')
|
||||||
\param $sortcriteria Sort criteria ("name","date","size")
|
\param $sortcriteria Sort criteria ("name","date","size")
|
||||||
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||||
\param $mode 0=Return array of key need, 1=Force all key to be loaded
|
\param $mode 0=Return array with only keys needed, 1=Force all keys to be loaded
|
||||||
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
||||||
*/
|
*/
|
||||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
|
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
|
||||||
|
|||||||
@ -252,6 +252,7 @@ alter table llx_tva modify fk_bank integer;
|
|||||||
|
|
||||||
delete from llx_const where name='MAIN_USE_PREVIEW_TABS';
|
delete from llx_const where name='MAIN_USE_PREVIEW_TABS';
|
||||||
|
|
||||||
|
drop table if exists llx_ecm_directories;
|
||||||
create table llx_ecm_directories
|
create table llx_ecm_directories
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
@ -259,8 +260,8 @@ create table llx_ecm_directories
|
|||||||
fk_parent integer,
|
fk_parent integer,
|
||||||
description varchar(255) NOT NULL,
|
description varchar(255) NOT NULL,
|
||||||
cachenbofdoc integer NOT NULL DEFAULT 0,
|
cachenbofdoc integer NOT NULL DEFAULT 0,
|
||||||
date_c timestamp,
|
date_c datetime,
|
||||||
date_m datetime,
|
date_m timestamp,
|
||||||
fk_user_c integer,
|
fk_user_c integer,
|
||||||
fk_user_m integer
|
fk_user_m integer
|
||||||
) type=innodb;
|
) type=innodb;
|
||||||
|
|||||||
@ -27,8 +27,8 @@ create table llx_ecm_directories
|
|||||||
fk_parent integer,
|
fk_parent integer,
|
||||||
description varchar(255) NOT NULL,
|
description varchar(255) NOT NULL,
|
||||||
cachenbofdoc integer NOT NULL DEFAULT 0,
|
cachenbofdoc integer NOT NULL DEFAULT 0,
|
||||||
date_c timestamp,
|
date_c datetime,
|
||||||
date_m datetime,
|
date_m timestamp,
|
||||||
fk_user_c integer,
|
fk_user_c integer,
|
||||||
fk_user_m integer
|
fk_user_m integer
|
||||||
) type=innodb;
|
) type=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user