Some enhancements in ecm module

This commit is contained in:
Laurent Destailleur 2008-04-29 23:49:00 +00:00
parent 24bb2ca1d4
commit 79306a55d3
10 changed files with 427 additions and 291 deletions

View File

@ -18,7 +18,7 @@
*/ */
/** /**
\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$
@ -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,16 +82,27 @@ 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"];
$ok=true;
if (! $ecmdir->label)
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
$_GET["action"] = "create";
$ok=false;
}
if ($ok)
{
$id = $ecmdir->create($user); $id = $ecmdir->create($user);
if ($id > 0) if ($id > 0)
{ {
Header("Location: ".DOL_URL_ROOT.'/ecm/docmine.php?section='.$id); Header("Location: ".DOL_URL_ROOT.'/ecm/index.php');
exit; exit;
} }
else else
@ -99,6 +111,7 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup)
$_GET["action"] = "create"; $_GET["action"] = "create";
} }
} }
}
// Suppression fichier // Suppression fichier
if ($_POST['action'] == 'confirm_deletesection' && $_POST['confirm'] == 'yes') if ($_POST['action'] == 'confirm_deletesection' && $_POST['confirm'] == 'yes')
@ -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)

View File

@ -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 ' &nbsp; &nbsp; ';
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)
* Confirmation de la suppression d'une ligne produit {
*/ print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.$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&section='.$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>'; }
// Confirm remove file
if ($_GET['action'] == 'delete_file') if ($_GET['action'] == 'delete_file')
{ {
$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); $form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&amp;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"].'&amp;action=delete_file&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>'; //print '&nbsp;';
print '<a href="'.$url.'?section='.$_REQUEST["section"].'&amp;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

View File

@ -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); $obj = $this->db->fetch_object($resql);
if ($obj)
{
$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;
}
} }
?> ?>

View File

@ -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,8 +117,6 @@ $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 // List
//*********************** //***********************
@ -159,15 +171,6 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
print_fiche_titre($langs->trans("ECMSectionOfDocuments")); print_fiche_titre($langs->trans("ECMSectionOfDocuments"));
//print '<br>'; //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 // Confirmation de la suppression d'une ligne categorie
if ($_GET['action'] == 'delete_section') if ($_GET['action'] == 'delete_section')
{ {
@ -195,10 +198,10 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
print '<tr class="liste_titre">'; 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("ECMSectionAuto").'</td>';
print '<td class="liste_titre" align="left">'.$langs->trans("Description").'</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="right">'.$langs->trans("ECMNbOfDocsSmall").'</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">';
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocs").'</td>'; print '&nbsp;';
print '<td class="liste_titre">&nbsp;</td>'; print '</td>';
print '</tr>'; print '</tr>';
$sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false);
@ -222,10 +225,13 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
// Description // Description
print '<td align="left">'.$val['desc'].'</td>'; print '<td align="left">'.$val['desc'].'</td>';
print '<td align="left">'.$langs->trans("ECMTypeAuto").'</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="right">?</td>'; print '<td align="right">?</td>';
print '<td align="right">&nbsp;</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"; print "</tr>\n";
} }
} }
@ -239,10 +245,12 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
print '<td class="liste_titre" align="left">'.$langs->trans("ECMSectionManual").'</td>'; 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("Description").'</td>';
print '<td class="liste_titre" align="left">'.$langs->trans("ECMCreationUser").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocsSmall");
print '<td class="liste_titre" align="center">'.$langs->trans("ECMCreationDate").'</td>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshauto">'.img_picto($langs->trans("Refresh"),'refresh').'</a>';
print '<td class="liste_titre" align="right">'.$langs->trans("ECMNbOfDocs").'</td>'; print '</td>';
print '<td class="liste_titre" align="center">&nbsp;</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>'; print '</tr>';
$ecmdirstatic = new ECMDirectory($db); $ecmdirstatic = new ECMDirectory($db);
@ -259,6 +267,16 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
$ecmdirstatic->id=$val['id']; $ecmdirstatic->id=$val['id'];
$ecmdirstatic->ref=$val['label']; $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].'>'; print '<tr '.$bc[$var].'>';
// Section // Section
@ -269,24 +287,19 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
// Description // Description
print '<td align="left">'.dolibarr_trunc($val['description'],32).'</td>'; 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 // Nb of docs
//print '<td align="right">'.$obj->cachenbofdoc.'</td>'; //print '<td align="right">'.$obj->cachenbofdoc.'</td>';
print '<td align="right">'.$val['cachenbofdoc'].'</td>'; print '<td align="right">'.$val['cachenbofdoc'].'</td>';
print '<td align="right">'; print '<td align="right">';
if ($val['cachenbofdoc'] == 0 && $val['level'] >= $rub[$key+1]['level']) $userstatic->id=$val['fk_user_c'];
{ $userstatic->nom=$val['login_c'];
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete_section&section='.urlencode($val['id']).'">'.img_delete().'</a>'; $htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
} $htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMManualOrg").'<br>';
else $htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>';
{ $htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.dolibarr_print_date($val['date_c'],"dayhour");
print '&nbsp;'; print $form->textwithhelp('',$htmltooltip,1,0);
}
print "</td></tr>\n"; print "</td></tr>\n";
$nbofentries++; $nbofentries++;
@ -315,7 +328,6 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section')
} }
print '</div>'; print '</div>';
*/ */
}
// End of page // End of page

View File

@ -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);

View File

@ -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
@ -42,3 +43,5 @@ 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

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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;