NEW Include number of linked files into badge counter of "Linked files"
tab.
This commit is contained in:
parent
a435d0e147
commit
da93e35dbb
@ -222,19 +222,18 @@ class Link extends CommonObject
|
||||
/**
|
||||
* Loads all links from database
|
||||
*
|
||||
* @param array $links array of Link objects to fill
|
||||
* @param array $links array of Link objects to fill
|
||||
* @param string $objecttype type of the associated object in dolibarr
|
||||
* @param int $objectid id of the associated object in dolibarr
|
||||
* @param string $sortfield field used to sort
|
||||
* @param string $sortorder sort order
|
||||
* @return 1 if ok, 0 if no records, -1 if error
|
||||
*
|
||||
* */
|
||||
* @return int 1 if ok, 0 if no records, -1 if error
|
||||
**/
|
||||
public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
if ($sortfield) {
|
||||
@ -273,12 +272,36 @@ class Link extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return nb of links
|
||||
*
|
||||
* @param DoliDb $dblinks Database handler
|
||||
* @param string $objecttype type of the associated object in dolibarr
|
||||
* @param int $objectid id of the associated object in dolibarr
|
||||
* @return int Nb of links, -1 if error
|
||||
**/
|
||||
public static function count($db, $objecttype, $objectid)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) return $obj->nb;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a link from database
|
||||
*
|
||||
* @param int $rowid Id of link to load
|
||||
* @return int 1 if ok, 0 if no record found, -1 if error
|
||||
*
|
||||
**/
|
||||
public function fetch($rowid=null)
|
||||
{
|
||||
@ -333,7 +356,7 @@ class Link extends CommonObject
|
||||
$result=$this->call_trigger('LINK_DELETE',$user);
|
||||
if ($result < 0) return -1;
|
||||
// End call triggers
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Remove link
|
||||
@ -347,7 +370,6 @@ class Link extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ function agenda_prepare_head()
|
||||
*/
|
||||
function actions_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -446,11 +446,13 @@ function actions_prepare_head($object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->agenda->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if ($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if ($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function bank_prepare_head(Account $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -74,11 +74,13 @@ function bank_prepare_head(Account $object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -177,11 +177,14 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->societe->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function contact_prepare_head(Contact $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
@ -74,11 +74,13 @@ function contact_prepare_head(Contact $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@
|
||||
*/
|
||||
function contract_prepare_head(Contrat $object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -66,11 +67,13 @@ function contract_prepare_head(Contrat $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ function donation_admin_prepare_head()
|
||||
*/
|
||||
function donation_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -79,11 +79,13 @@ function donation_prepare_head($object)
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function expensereport_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -46,11 +46,13 @@ function expensereport_prepare_head($object)
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function fichinter_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("fichinter");
|
||||
|
||||
$h = 0;
|
||||
@ -78,11 +78,13 @@ function fichinter_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
*/
|
||||
function facturefourn_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -69,11 +70,13 @@ function facturefourn_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$object->ref;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -96,7 +99,7 @@ function facturefourn_prepare_head($object)
|
||||
*/
|
||||
function ordersupplier_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -141,11 +144,13 @@ function ordersupplier_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function holiday_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -41,11 +41,13 @@ function holiday_prepare_head($object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
*/
|
||||
function facture_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -86,11 +87,13 @@ function facture_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function loan_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
@ -58,11 +58,13 @@ function loan_prepare_head($object)
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab,'loan');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function member_prepare_head(Adherent $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -86,11 +86,13 @@ function member_prepare_head(Adherent $object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,1,$object,'member').'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
function commande_prepare_head(Commande $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||
$langs->load("orders");
|
||||
|
||||
@ -95,11 +95,13 @@ function commande_prepare_head(Commande $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
function product_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("products");
|
||||
|
||||
$h = 0;
|
||||
@ -132,12 +132,14 @@ function product_prepare_head($object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
*/
|
||||
function project_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -77,11 +78,13 @@ function project_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function propal_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("propal");
|
||||
$langs->load("compta");
|
||||
|
||||
@ -89,11 +89,13 @@ function propal_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
function salaries_prepare_head($object) {
|
||||
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -43,11 +43,13 @@ function salaries_prepare_head($object) {
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function supplier_proposal_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("supplier_proposal");
|
||||
$langs->load("compta");
|
||||
|
||||
@ -63,11 +63,13 @@ function supplier_proposal_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->supplier_proposal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
function tax_prepare_head(ChargeSociales $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -53,11 +53,13 @@ function tax_prepare_head(ChargeSociales $object)
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'tax');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function user_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$langs->load("users");
|
||||
|
||||
@ -117,11 +117,13 @@ function user_prepare_head($object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->user->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user