2
0
forked from Wavyzz/dolibarr

New: A module can add a new tab in third party view tabs

This commit is contained in:
Laurent Destailleur
2009-03-12 01:44:02 +00:00
parent 2570312475
commit 65f707dea0
11 changed files with 94 additions and 45 deletions

View File

@@ -75,6 +75,7 @@ For developers:
- Renamed all function dolibarr_xxx into dol_xxx to have same prefix everywhere.
- Rewrite clone feature for supplier invoice to work like other clone features.
- First change to manage a future feature "stock PMP value".
- A module can add a new tab in third party view tabs.
***** Changelog for 2.5 compared to 2.4 *****

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 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
@@ -90,8 +90,18 @@ class modMyModule extends DolibarrModules
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// New pages on tabs
// Array to add new pages in new tabs
$this->tabs = array('entity:Title:@mymodule:/mymodule/mynewtab.php?id=__ID__');
// where entity can be
// 'thirdparty' to add a tab in third party view
// 'intervention' to add a tab in intervention view
// 'supplier_order' to add a tab in supplier order view
// 'supplier_invoice' to add a tab in supplier invoice view
// 'invoice' to add a tab in customer invoice view
// 'order' to add a tab in customer order view
// 'product' to add a tab in product view
// 'propal' to add a tab in propal view
// 'member' to add a tab in fundation member view
// Boxes

View File

@@ -60,32 +60,36 @@ class modAgenda extends DolibarrModules
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='calendar';
// Dir
//----
$this->dirs = array();
//$this->dirs[0] = DOL_DATA_ROOT.'/mymodule;
//$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp;
// Config pages
//-------------
$this->config_page_url = array("agenda.php");
// Dependancies
//-------------
$this->depends = array();
$this->requiredby = array();
$this->langfiles = array("companies");
// Constantes
//-----------
$this->const = array();
// Boites
//-------
// New pages on tabs
// -----------------
$this->tabs = array();
// Boxes
//------
$this->boxes = array();
$this->boxes[0][1] = "box_actions.php";
// Permissions
//------------
$this->rights = array();
@@ -99,7 +103,7 @@ class modAgenda extends DolibarrModules
// $this->rights[$r][4] Niveau 1 pour nommer permission dans code
// $this->rights[$r][5] Niveau 2 pour nommer permission dans code
// $r++;
$this->rights[$r][0] = 2401;
$this->rights[$r][1] = 'Read actions/tasks linked to his account';
$this->rights[$r][2] = 'r';
@@ -107,7 +111,7 @@ class modAgenda extends DolibarrModules
$this->rights[$r][4] = 'myactions';
$this->rights[$r][5] = 'read';
$r++;
$this->rights[$r][0] = 2402;
$this->rights[$r][1] = 'Create/modify/delete actions/tasks linked to his account';
$this->rights[$r][2] = 'w';
@@ -115,7 +119,7 @@ class modAgenda extends DolibarrModules
$this->rights[$r][4] = 'myactions';
$this->rights[$r][5] = 'create';
$r++;
$this->rights[$r][0] = 2403;
$this->rights[$r][1] = 'Read actions/tasks of others';
$this->rights[$r][2] = 'r';
@@ -123,7 +127,7 @@ class modAgenda extends DolibarrModules
$this->rights[$r][4] = 'allactions';
$this->rights[$r][5] = 'read';
$r++;
$this->rights[$r][0] = 2405;
$this->rights[$r][1] = 'Create/modify/delete actions/tasks of others';
$this->rights[$r][2] = 'w';
@@ -135,10 +139,10 @@ class modAgenda extends DolibarrModules
// Menus
//------
$r=0;
$this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Agenda','mainmenu'=>'agenda','leftmenu'=>'0','url'=>'/comm/action/index.php','langs'=>'commercial','position'=>100,'perms'=>'$user->rights->agenda->myactions->read','target'=>'','user'=>0);
$r++;
// Exports
//--------
$r=0;
@@ -151,7 +155,7 @@ class modAgenda extends DolibarrModules
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
}
/**
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
* Definit egalement les repertoires de donnees a creer pour ce module.
@@ -159,10 +163,10 @@ class modAgenda extends DolibarrModules
function init()
{
$sql = array();
return $this->_init($sql);
}
/**
* \brief Fonction appelee lors de la desactivation d'un module.
* Supprime de la base les constantes, boites et permissions du module.
@@ -170,7 +174,7 @@ class modAgenda extends DolibarrModules
function remove()
{
$sql = array();
return $this->_remove($sql);
}

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* 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
@@ -27,10 +27,10 @@
*/
/**
* Enter description here...
* Return array of tabs to used on pages for third parties cards.
*
* @param unknown_type $objsoc
* @return unknown
* @param $objsoc Object company shown
* @return array Array of tabs
*/
function societe_prepare_head($objsoc)
{
@@ -120,12 +120,30 @@ function societe_prepare_head($objsoc)
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['thirdparty']))
{
$i=0;
foreach ($conf->tabs_modules['thirdparty'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$objsoc->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}
/**
* Enter description here...
* Return array of tabs to used on page
*
* @param unknown_type $objsoc
* @return unknown

View File

@@ -68,7 +68,9 @@ function fichinter_prepare_head($fichinter)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['intervention']))
{
$i=0;

View File

@@ -55,7 +55,9 @@ function facturefourn_prepare_head($fac)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['supplier_invoice']))
{
$i=0;
@@ -114,7 +116,9 @@ function ordersupplier_prepare_head($commande)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['supplier_order']))
{
$i=0;

View File

@@ -31,7 +31,7 @@ function facture_prepare_head($fac)
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'compta';
@@ -73,7 +73,9 @@ function facture_prepare_head($fac)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['invoice']))
{
$i=0;
@@ -87,7 +89,7 @@ function facture_prepare_head($fac)
$h++;
}
}
return $head;
}

View File

@@ -28,19 +28,19 @@
function member_prepare_head($member)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$member->id;
$head[$h][1] = $langs->trans("MemberCard");
$head[$h][2] = 'general';
$h++;
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
{
$langs->load("ldap");
$head[$h][0] = DOL_URL_ROOT.'/adherents/ldap.php?id='.$member->id;
$head[$h][1] = $langs->trans("LDAPCard");
$head[$h][2] = 'ldap';
@@ -54,7 +54,7 @@ function member_prepare_head($member)
$head[$h][2] = 'subscription';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$member->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
@@ -65,7 +65,9 @@ function member_prepare_head($member)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['member']))
{
$i=0;
@@ -79,7 +81,7 @@ function member_prepare_head($member)
$h++;
}
}
return $head;
}

View File

@@ -90,7 +90,9 @@ function commande_prepare_head($commande)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['order']))
{
$i=0;

View File

@@ -23,7 +23,7 @@
* \brief Ensemble de fonctions de base pour le module produit et service
* \ingroup product
* \version $Id$
*
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
@@ -118,7 +118,9 @@ function product_prepare_head($product, $user)
}
}
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['product']))
{
$i=0;

View File

@@ -22,7 +22,7 @@
* \brief Ensemble de fonctions de base pour le module propal
* \ingroup propal
* \version $Id$
*
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
@@ -86,7 +86,9 @@ function propal_prepare_head($propal)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:MyModule:@mymodule:/dolibarr/mymodule/mypage.php?id=__ID__');
if (is_array($conf->tabs_modules['propal']))
{
$i=0;
@@ -100,7 +102,7 @@ function propal_prepare_head($propal)
$h++;
}
}
return $head;
}