Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2013-01-30 16:50:32 +01:00
commit a3027d4590
120 changed files with 587 additions and 3212 deletions

View File

@ -4,9 +4,12 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.4 compared to 3.3 *****
For users:
- New: Some performance enhancements
- New: Some performance enhancements.
- New: Can attach files onto trip and expenses modules.
For developers:
- System of menu managers has been rewritten to reduce code to do same things.
- An external module can force its theme.
For translators:

View File

@ -106,7 +106,7 @@ class modMyModule extends DolibarrModules
// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0)
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
// );
$this->const = array();

View File

@ -189,7 +189,7 @@ if (! empty($conf->banque->enabled))
else
{
print '<td align="right" colspan="2">';
print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")).' '.img_warning("","");
print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name"));
print '</td>';
}
print "</tr>\n";

View File

@ -394,7 +394,7 @@ class Adherent extends CommonObject
*/
function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdparty=0,$action='update')
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
$nbrowsaffected=0;
$error=0;
@ -462,8 +462,6 @@ class Adherent extends CommonObject
$nbrowsaffected+=$this->db->affected_rows($resql);
// Actions on extra fields (by external module)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('memberdao'));
$parameters=array('id'=>$this->id);
$action='';

View File

@ -98,6 +98,8 @@ class AdherentType extends CommonObject
*/
function update($user)
{
global $hookmanager;
$this->libelle=trim($this->libelle);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -114,8 +116,6 @@ class AdherentType extends CommonObject
if ($result)
{
// Actions on extra fields (by external module or standard code)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -107,8 +107,6 @@ if ($rowid)
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('membercard'));

View File

@ -67,8 +67,6 @@ if (GETPOST('button_removefilter'))
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('membertypecard'));
/*

View File

@ -646,13 +646,13 @@ else
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>';
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADRESSE)?'':$conf->global->MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyZip").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_CP . '</td></tr>';
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_CP)?'':$conf->global->MAIN_INFO_SOCIETE_CP) . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyTown").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_VILLE . '</td></tr>';
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_VILLE)?'':$conf->global->MAIN_INFO_SOCIETE_VILLE) . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCountry").'</td><td>';

View File

@ -64,8 +64,6 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('admin'));
// This page is a generic page to edit dictionnaries
@ -734,7 +732,7 @@ if ($id)
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
@ -848,7 +846,7 @@ if ($id)
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; $align="center"; }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }

View File

@ -77,10 +77,6 @@ if ($action == 'update' && empty($_POST["cancel"]))
// Define list of menu handlers to initialize
$listofmenuhandler=array();
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1;
$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1;
if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1;
if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1;
// Initialize menu handlers
foreach ($listofmenuhandler as $key => $val)

View File

@ -86,8 +86,6 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('categorycard'));

View File

@ -543,39 +543,39 @@ class Categorie
return ($n[0] > 0);
}
/**
* Load this->motherof that is array(id_son=>id_parent, ...)
*
* @return int <0 if KO, >0 if OK
*/
private function load_motherof()
{
global $conf;
$this->motherof=array();
/**
* Load this->motherof that is array(id_son=>id_parent, ...)
*
* @return int <0 if KO, >0 if OK
*/
private function load_motherof()
{
global $conf;
$this->motherof=array();
// Load array[child]=parent
$sql = "SELECT fk_parent as id_parent, rowid as id_son";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
$sql.= " WHERE fk_parent != 0";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::load_motherof sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
while ($obj= $this->db->fetch_object($resql))
{
$this->motherof[$obj->id_son]=$obj->id_parent;
}
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
$sql = "SELECT fk_parent as id_parent, rowid as id_son";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
$sql.= " WHERE fk_parent != 0";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::load_motherof sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
while ($obj= $this->db->fetch_object($resql))
{
$this->motherof[$obj->id_son]=$obj->id_parent;
}
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
@ -596,8 +596,8 @@ class Categorie
{
$this->cats = array();
// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
@ -695,7 +695,7 @@ class Categorie
$i++; $cursor_categ=$this->motherof[$cursor_categ];
}
//print 'Result for id_categ='.$id_categ.' : '.$this->cats[$id_categ]['fullpath'].'<br>'."\n";
// We count number of _ to have level
$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));

View File

@ -106,8 +106,8 @@ class ActionComm extends CommonObject
*/
function add($user,$notrigger=0)
{
global $langs,$conf;
global $langs,$conf,$hookmanager;
$error=0;
$now=dol_now();
@ -210,8 +210,6 @@ class ActionComm extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm","id");
// Actions on extra fields (by external module or standard code)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@ -430,7 +428,7 @@ class ActionComm extends CommonObject
*/
function update($user,$notrigger=0)
{
global $langs,$conf;
global $langs,$conf,$hookmanager;
$error=0;
@ -482,8 +480,6 @@ class ActionComm extends CommonObject
{
// Actions on extra fields (by external module or standard code)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -66,8 +66,6 @@ $extrafields = new ExtraFields($db);
//var_dump($_POST);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('actioncard'));

View File

@ -46,8 +46,6 @@ $origin=GETPOST('origin','alpha');
$originid=GETPOST('originid','int');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('propalcard'));
/*

View File

@ -58,8 +58,6 @@ $search_categ = GETPOST("search_categ",'int');
$catid = GETPOST("catid",'int');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('customerlist'));

View File

@ -47,8 +47,6 @@ $result=$object->fetch($id);
$extrafields = new ExtraFields($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('mailingcard'));
// Tableau des substitutions possibles

View File

@ -99,8 +99,6 @@ else
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('propalcard'));
@ -123,7 +121,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
{
if ($object->id > 0)
{
$result=$object->createFromClone($socid, $hookmanager);
$result=$object->createFromClone($socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
@ -172,7 +170,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
@ -196,7 +194,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
@ -373,7 +371,7 @@ else if ($action == 'add' && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
@ -609,7 +607,7 @@ if ($action == 'modif' && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
@ -816,7 +814,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -937,7 +935,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -983,7 +981,7 @@ else if ($action == 'builddoc' && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
$result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
@ -1072,7 +1070,7 @@ else if ($action == 'up' && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid'));
@ -1094,7 +1092,7 @@ else if ($action == 'down' && $user->rights->propal->creer)
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.GETPOST('rowid'));
@ -1628,7 +1626,7 @@ print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines
$result = $object->getLinesArray();
if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid);
// Form to add new line
if ($object->statut == 0 && $user->rights->propal->creer)
@ -1640,18 +1638,18 @@ if ($object->statut == 0 && $user->rights->propal->creer)
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(0,$mysoc,$soc,$hookmanager);
$object->formAddObjectLine(0,$mysoc,$soc);
}
else
{
// Add free products/services
$object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager);
$object->formAddFreeProduct(0,$mysoc,$soc);
// Add predefined products/services
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$var=!$var;
$object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager);
$object->formAddPredefinedProduct(0,$mysoc,$soc);
}
}
@ -1801,7 +1799,7 @@ if ($action != 'presend')
$var=true;
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$hookmanager);
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang);
/*
@ -1845,7 +1843,7 @@ if ($action == 'presend')
$outputlangs->setDefaultLang($newlang);
}
$result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -867,12 +867,11 @@ class Propal extends CommonObject
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($socid=0,$hookmanager=false)
function createFromClone($socid=0)
{
global $user,$langs,$conf;
global $user,$langs,$conf,$hookmanager;
$error=0;
$now=dol_now();

View File

@ -77,8 +77,6 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('propalcard'));

View File

@ -148,8 +148,6 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('prospectlist'));

View File

@ -794,12 +794,11 @@ class Commande extends CommonOrder
* Load an object from its id and create a new one in database
*
* @param int $socid Id of thirdparty
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($socid=0,$hookmanager=false)
function createFromClone($socid=0)
{
global $conf,$user,$langs;
global $conf,$user,$langs,$hookmanager;
$error=0;
@ -880,8 +879,7 @@ class Commande extends CommonOrder
*/
function createFromProposal($object)
{
global $conf,$user,$langs;
global $hookmanager;
global $conf,$user,$langs,$hookmanager;
$error=0;
@ -945,11 +943,6 @@ class Commande extends CommonOrder
if ($ret > 0)
{
// Actions hooked (by external module)
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);

View File

@ -84,8 +84,6 @@ if ($id > 0 || ! empty($ref))
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('ordercard'));
@ -107,7 +105,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
{
if ($object->id > 0)
{
$result=$object->createFromClone($socid, $hookmanager);
$result=$object->createFromClone($socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
@ -174,7 +172,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
@ -204,7 +202,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
$action='create';
$error++;
}
if ($socid<1)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
@ -506,7 +504,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
}
$ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
}
@ -745,7 +743,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
}
$ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -872,7 +870,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
}
$ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -931,7 +929,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
}
@ -970,7 +968,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer)
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
}
@ -1023,7 +1021,7 @@ else if ($action == 'up' && $user->rights->commande->creer)
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
exit;
@ -1043,7 +1041,7 @@ else if ($action == 'down' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
exit;
@ -1072,7 +1070,7 @@ else if ($action == 'builddoc') // In get or post
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
@ -1493,7 +1491,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
print "<tr><td>".$langs->trans("DefaultContact").'</td><td colspan="2">';
$form->select_contacts($soc->id,$setcontact,'contactidp',1,$srccontactslist);
print '</td></tr>';
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@ -1686,7 +1684,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($hookmanager);
$objectsrc->printOriginLinesList();
print '</table>';
}
@ -2168,7 +2166,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
// Show object lines
if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1,$hookmanager);
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1);
/*
* Form to add new line
@ -2182,18 +2180,18 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
$object->formAddObjectLine(1,$mysoc,$soc);
}
else
{
// Add free products/services
$object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager);
$object->formAddFreeProduct(1,$mysoc,$soc);
// Add predefined products/services
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$var=!$var;
$object->formAddPredefinedProduct(1,$mysoc,$soc,$hookmanager);
$object->formAddPredefinedProduct(1,$mysoc,$soc);
}
}
@ -2356,7 +2354,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$hookmanager);
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
/*
* Linked object block
@ -2399,7 +2397,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$outputlangs->setDefaultLang($newlang);
}
$result=commande_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=commande_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -49,8 +49,6 @@ $mesg = '';
$object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('tripsandexpensescard'));

View File

@ -50,8 +50,6 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
$result = restrictedArea($user, 'don', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('doncard'));

View File

@ -95,8 +95,6 @@ if ($id > 0 || ! empty($ref))
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('invoicecard'));
@ -119,7 +117,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
{
if ($object->fetch($id) > 0)
{
$result=$object->createFromClone($socid, $hookmanager);
$result=$object->createFromClone($socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
@ -193,7 +191,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
if ($result >= 0)
{
@ -396,7 +394,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
@ -473,7 +471,7 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
}
@ -1186,7 +1184,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
}
$ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -1316,7 +1314,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
}
$ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
@ -1362,7 +1360,7 @@ else if ($action == 'up' && $user->rights->facture->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']);
exit;
@ -1384,7 +1382,7 @@ else if ($action == 'down' && $user->rights->facture->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']);
exit;
@ -1616,7 +1614,7 @@ else if ($action == 'builddoc') // En get ou en post
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
@ -2188,7 +2186,7 @@ if ($action == 'create')
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($hookmanager);
$objectsrc->printOriginLinesList();
print '</table>';
}
@ -3056,7 +3054,7 @@ else if ($id > 0 || ! empty($ref))
// Show object lines
if (! empty($object->lines))
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1,$hookmanager);
$ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1);
/*
* Form to add new line
@ -3068,18 +3066,18 @@ else if ($id > 0 || ! empty($ref))
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
$object->formAddObjectLine(1,$mysoc,$soc);
}
else
{
// Add free products/services
$object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager);
$object->formAddFreeProduct(1,$mysoc,$soc);
// Add predefined products/services
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$var=!$var;
$object->formAddPredefinedProduct(1,$mysoc,$soc,$hookmanager);
$object->formAddPredefinedProduct(1,$mysoc,$soc);
}
}
@ -3319,7 +3317,7 @@ else if ($id > 0 || ! empty($ref))
$delallowed=$user->rights->facture->supprimer;
print '<br>';
print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$hookmanager);
print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
$somethingshown=$formfile->numoffiles;
/*
@ -3384,7 +3382,7 @@ else if ($id > 0 || ! empty($ref))
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -541,7 +541,7 @@ class Facture extends CommonInvoice
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($socid=0,$hookmanager=false)
function createFromClone($socid=0)
{
global $conf,$user,$langs;
@ -637,7 +637,7 @@ class Facture extends CommonInvoice
*/
function createFromOrder($object)
{
global $conf,$user,$langs;
global $conf,$user,$langs,$hookmanager;
$error=0;
@ -701,8 +701,6 @@ class Facture extends CommonInvoice
if ($ret > 0)
{
// Actions hooked (by external module)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('invoicedao'));
$parameters=array('objFrom'=>$object);

View File

@ -97,8 +97,6 @@ $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MA
$object=new Facture($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('invoicecard'));
$now=dol_now();

View File

@ -112,7 +112,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs);
}
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);

View File

@ -94,7 +94,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs);
}
header('Location: fiche.php?id='.$paiement->id);

View File

@ -41,8 +41,6 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('taxvatcard'));

View File

@ -210,7 +210,7 @@ class Contact extends CommonObject
*/
function update($id, $user=0, $notrigger=0, $action='update')
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
$error=0;
@ -266,8 +266,6 @@ class Contact extends CommonObject
unset($this->state);
// Actions on extra fields (by external module or standard code)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
$hookmanager->initHooks(array('contactdao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -65,8 +65,6 @@ if (! empty($canvas))
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('contactcard'));

View File

@ -59,8 +59,6 @@ $result=restrictedArea($user,'contrat',$id);
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('contractcard'));
$object = new Contrat($db);
@ -211,7 +209,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")),'errors');
$error++;
}
if (! $error)
{
$ret=$object->fetch($id);
@ -1284,7 +1282,7 @@ else
if ($user->rights->contrat->creer && ($object->statut >= 0))
{
$dateSelector=1;
print '<br>';
print '<table id="tablelines" class="noborder" width="100%">'; // Array with (n*2)+1 lines
@ -1300,28 +1298,28 @@ else
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Add free or predefined products/services
$object->formAddObjectLine($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
$object->formAddObjectLine($dateSelector,$mysoc,$object->thirdparty);
}
else
{
// Add free products/services
$object->formAddFreeProduct($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
$object->formAddFreeProduct($dateSelector,$mysoc,$object->thirdparty);
// Add predefined products/services
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$var=!$var;
$object->formAddPredefinedProduct($dateSelector,$mysoc,$object->thirdparty,$hookmanager);
$object->formAddPredefinedProduct($dateSelector,$mysoc,$object->thirdparty);
}
}
$parameters=array();
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
}
// Restore correct setup
$conf->product->enabled = $savproductenabled;
print '</form>';
print '</table>';

View File

@ -2463,21 +2463,16 @@ abstract class CommonObject
* TODO Move this into html.class.php
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function showLinkedObjectBlock($hookmanager=false)
function showLinkedObjectBlock()
{
global $conf,$langs,$bc;
global $conf,$langs,$hookmanager;
global $bc;
$this->fetchObjectLinked();
// Bypass the default method
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('commonobject'));
$parameters=array();
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook
@ -2547,13 +2542,12 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @param HookManager $hookmanager Hook manager instance
* @return void
* @deprecated
*/
function formAddPredefinedProduct($dateSelector,$seller,$buyer,$hookmanager=false)
function formAddPredefinedProduct($dateSelector,$seller,$buyer)
{
global $conf,$langs,$object;
global $conf,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
// Use global variables + $dateSelector + $seller and $buyer
@ -2568,13 +2562,12 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @param HookManager $hookmanager Hook manager instance
* @return void
* @deprecated
*/
function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
function formAddFreeProduct($dateSelector,$seller,$buyer)
{
global $conf,$langs,$object;
global $conf,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
// Use global variables + $dateSelector + $seller and $buyer
@ -2590,12 +2583,11 @@ abstract class CommonObject
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object thirdparty who sell
* @param Societe $buyer Object thirdparty who buy
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function formAddObjectLine($dateSelector,$seller,$buyer,$hookmanager=false)
function formAddObjectLine($dateSelector,$seller,$buyer)
{
global $conf,$user,$langs,$object;
global $conf,$user,$langs,$object,$hookmanager;
global $form,$bcnd,$var;
// Output template part (modules that overwrite templates must declare this into descriptor)
@ -2629,12 +2621,11 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party
* @param string $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @param HookManager $hookmanager Hookmanager
* @return void
*/
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $hookmanager=false)
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
{
global $conf,$langs;
global $conf,$langs,$hookmanager;
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
@ -2702,12 +2693,11 @@ abstract class CommonObject
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param string $selected Object line selected
* @param HookManager $hookmanager Hook manager
* @return void
*/
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$hookmanager=false)
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0)
{
global $conf,$langs,$user;
global $conf,$langs,$user,$hookmanager;
global $form,$bc,$bcdd;
$element=$this->element;
@ -2812,12 +2802,11 @@ abstract class CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param HookManager $hookmanager Hook manager
* @return void
*/
function printOriginLinesList($hookmanager=false)
function printOriginLinesList()
{
global $langs;
global $langs, $hookmanager;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';

View File

@ -454,7 +454,7 @@ class Conf
throw new Exception('Log handler does not extend LogHandlerInterface');
}
$this->loghandlers[]=$loghandlerinstance;
if (empty($conf->loghandlers[$handler])) $this->loghandlers[$handler]=$loghandlerinstance;
}
}
}

View File

@ -179,7 +179,7 @@ class HookManager
if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
}
//print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction;
//print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction;
}
}
}

View File

@ -688,8 +688,21 @@ class Form
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
$out.= ajax_combobox($htmlname, $event);
$out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
/*
if ($selected && empty($selected_input_value))
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($this->db);
$product->fetch($selected);
$selected_input_value=$product->ref;
}
// mode=1 means customers products
$ajaxoptions=array();
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.urlencode($filter).'&showtype='.$showtype;
$out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.='<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
*/
}
$out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
@ -3005,14 +3018,14 @@ class Form
{
global $conf,$langs,$user;
$langs->load_cache_currencies();
$langs->load_cache_currencies('');
$out='';
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
$out.= '<select class="flat" name="'.$htmlname.'">';
foreach ($this->cache_currencies as $code_iso => $currency)
foreach ($langs->cache_currencies as $code_iso => $currency)
{
if ($selected && $selected == $code_iso)
{

View File

@ -121,7 +121,7 @@ class FormAdmin
global $langs,$conf;
// Clean parameters
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // For compatibility
// Check parameters
if (! is_array($dirmenuarray)) return -1;
@ -143,7 +143,11 @@ class FormAdmin
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && substr($file, 0, 5) != 'index')
{
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
$filelib=preg_replace('/\.php$/i','',$file);
if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files
$filelib=preg_replace('/\.php$/i','',$file);
$prefix='';
// 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other
if (preg_match('/^eldy/i',$file)) $prefix='0';

View File

@ -161,13 +161,12 @@ class FormFile
* @param string $title Title to show on top of form
* @param string $buttonlabel Label on submit button
* @param string $codelang Default language code to use on lang combo box if multilang is enabled
* @param HookManager $hookmanager Object hookmanager with instance of external modules hook classes
* @return int <0 if KO, number of shown files if OK
*/
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hookmanager=false)
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
$this->numoffiles=0;
print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang,$hookmanager);
print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang);
return $this->numoffiles;
}
@ -191,15 +190,15 @@ class FormFile
* @param string $title Title to show on top of form
* @param string $buttonlabel Label on submit button
* @param string $codelang Default language code to use on lang combo box if multilang is enabled
* @param HookManager $hookmanager Object hookmanager with instance of external modules hook classes
* @return string Output string with HTML array of documents (might be empty string)
*/
function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hookmanager=false)
function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $langs,$bc,$conf;
global $langs,$conf,$hookmanager;
global $bc;
// For backward compatibility
if (! empty($iconPDF)) {
@ -590,18 +589,10 @@ class FormFile
*/
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='')
{
global $user, $conf, $langs;
global $bc, $hookmanager;
global $user, $conf, $langs, $hookmanager;
global $bc;
global $sortfield, $sortorder, $maxheightmini;
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
}
$hookmanager->initHooks(array('formfile'));
$parameters=array(

View File

@ -216,20 +216,11 @@ class FormMail
*/
function get_form($addfileaction='addfile',$removefileaction='removefile')
{
global $conf, $langs, $user;
global $hookmanager;
global $conf, $langs, $user, $hookmanager;
$langs->load("other");
$langs->load("mails");
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
}
$hookmanager->initHooks(array('formmail'));
$parameters=array(

View File

@ -41,7 +41,9 @@ class DoliDBPgsql
//! Database label
static $label='PostgreSQL'; // Label of manager
//! Charset
var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
//! Version min database
static $versionmin=array(8,4,0); // Version min database

View File

@ -771,7 +771,11 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
*/
(function( $ ) {
$.widget( "ui.combobox", {
options: {
minLengthToAutocomplete: 0,
},
_create: function() {
var savMinLengthToAutocomplete = this.options.minLengthToAutocomplete;
var self = this,
select = this.element.hide(),
selected = select.children( ":selected" ),
@ -781,7 +785,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
.val( value )
.autocomplete({
delay: 0,
minLength: 0,
minLength: this.options.minLengthToAutocomplete,
source: function( request, response ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
response( select.children( "option" ).map(function() {
@ -854,7 +858,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
}
// pass empty string as value to search for, displaying all results
input.autocomplete({ minLength: 0 });
input.autocomplete( "search", "" );
input.autocomplete({ minLength: savMinLengthToAutocomplete });
input.focus();
});
},

View File

@ -303,11 +303,12 @@ function ajax_dialog($title,$message,$w=350,$h=150)
* @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string Return html string to convert a select field into a combo
*/
function ajax_combobox($htmlname, $event=array())
function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0)
{
$msg = '<script type="text/javascript">
$(function() {
$("#'.$htmlname.'").combobox({
minLengthToAutocomplete : '.$minLengthToAutocomplete.',
selected : function(event,ui) {
var obj = '.json_encode($event).';
$.each(obj, function(key,values) {

View File

@ -65,15 +65,8 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
$path=preg_replace('/([\\/]+)$/i','',$path);
$newpath=dol_osencode($path);
if (! $nohook) {
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
}
}
if (! $nohook)
{
$hookmanager->initHooks(array('fileslib'));
$parameters=array(
@ -653,14 +646,6 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
return -2;
}
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
}
$hookmanager=new HookManager($db);
}
$hookmanager->initHooks(array('fileslib'));
$parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite);
@ -722,14 +707,6 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
if (empty($nohook))
{
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
}
}
$hookmanager->initHooks(array('fileslib'));
$parameters=array(

View File

@ -51,15 +51,18 @@ function getStaticMember($class, $member)
$classObj = new ReflectionClass($class);
$result = null;
$found=0;
foreach($classObj->getStaticProperties() as $prop => $value)
{
if($prop == $member)
if ($prop == $member)
{
$result = $value;
$found++;
break;
}
}
if (! $found) dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
return $result;
}
@ -2122,7 +2125,7 @@ function dol_print_error($db='',$error='')
$out.="<br>\n";
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."<br>\n";;
$out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->standard_menu."<br>\n";
$out.="<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu)?$conf->standard_menu:'')."<br>\n";
$out.="<br>\n";
$syslog.="url=".$_SERVER["REQUEST_URI"];
$syslog.=", query_string=".$_SERVER["QUERY_STRING"];

View File

@ -792,12 +792,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
* @param float $h Cell minimum height. The cell extends automatically if needed.
* @param int $align Align
* @param string $default_font_size Font size
* @param HookManager $hookmanager Hook manager object
* @return void
*/
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size,$hookmanager=false)
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size)
{
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs);
if (! empty($linkedobjects))
{
foreach($linkedobjects as $linkedobject)
@ -833,12 +832,11 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @param HookManager $hookmanager Instance of HookManager
* @return void
*/
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0,$hookmanager=false)
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
{
global $db, $conf, $langs;
global $db, $conf, $langs, $hookmanager;
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
@ -1002,9 +1000,11 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0)
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1024,12 +1024,13 @@ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0,$hookmanager=fals
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0)
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1048,12 +1049,13 @@ function pdf_getlineref($object,$i,$outputlangs,$hidedetails=0,$hookmanager=fals
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
global $hookmanager;
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1072,12 +1074,13 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0,$hookman
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1098,12 +1101,11 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0,$hookmanager=
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
global $conf;
global $conf, $hookmanager;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
@ -1133,7 +1135,9 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
*/
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
{
if (! empty($object->hooks) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
global $hookmanager;
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1155,11 +1159,12 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1184,11 +1189,12 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0,$hookmanager=fals
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1213,11 +1219,12 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0,$hookmanage
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1242,11 +1249,12 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0,$hookmana
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code != 3)
{
if (is_object($hookmanager) && (( $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1271,11 +1279,12 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0,$hookm
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if ($object->lines[$i]->special_code != 3)
@ -1302,12 +1311,11 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0,$hookma
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanager=false)
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
{
global $conf;
global $conf, $hookmanager;
$sign=1;
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
@ -1344,13 +1352,15 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
*/
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
{
global $hookmanager;
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
}
else
{
if (! empty($object->hooks) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1373,11 +1383,12 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
* @param Object $object Object
* @param string $type Type
* @param Translate $outputlangs Object langs for output
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getTotalQty($object,$type,$outputlangs,$hookmanager=false)
function pdf_getTotalQty($object,$type,$outputlangs)
{
global $hookmanager;
$total=0;
$nblignes=count($object->lines);
@ -1390,7 +1401,7 @@ function pdf_getTotalQty($object,$type,$outputlangs,$hookmanager=false)
{
$total += $object->lines[$i]->qty;
}
else if ($type==9 && ! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
else if ($type==9 && is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1415,11 +1426,12 @@ function pdf_getTotalQty($object,$type,$outputlangs,$hookmanager=false)
*
* @param object $object Object
* @param Translate $outputlangs Object lang for output
* @param HookManager $hookmanager Hook manager instance
* @return void
*/
function pdf_getLinkedObjects($object,$outputlangs,$hookmanager=false)
function pdf_getLinkedObjects($object,$outputlangs)
{
global $hookmanager;
$linkedobjects=array();
$object->fetchObjectLinked();

View File

@ -131,11 +131,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
global $smartphone,$hookmanager;
// Instantiate hooks of thirdparty module only if not already define
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
}
$hookmanager->initHooks(array('mainloginpage'));
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));

View File

@ -50,11 +50,11 @@ function trip_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove');
return $head;

View File

@ -1,62 +0,0 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.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
* the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/menus/smartphone/smartphone_backoffice.php
* \brief Gestionnaire nomme smartphone du menu smartphone
*/
/**
* Class to manage smartphone menu smartphone (for internal users)
*/
class MenuSmart
{
var $db;
var $require_left=array("smartphone_backoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu
var $atarget=""; // Valeur du target a utiliser dans les liens
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @param string $limitmenuto To limit menu to a top or left menu value
* @return void
*/
function showmenu($limitmenuto)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/smartphone/smartphone.lib.php';
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$limitmenuto);
}
}
?>

View File

@ -17,46 +17,57 @@
*/
/**
* \file htdocs/core/menus/smartphone/smartphone_frontoffice.php
* \brief Gestionnaire nomme smartphone du menu smartphone
* \file htdocs/core/menus/smartphone/smartphone_menu.php
* \brief Menu smartphone manager
*/
/**
* Class to manage smartphone menu smartphone (for external users)
* Class to manage smartphone menu smartphone
*/
class MenuSmart
{
var $require_left=array("smartphone_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier
var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu
var $atarget=""; // Valeur du target a utiliser dans les liens
var $name="smartphone";
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
function __construct($db)
function __construct($db, $type_user)
{
$this->db=$db;
}
/**
* Show menu
* Show menu
*
* @param string $limitmenuto To limit menu to a top or left menu value
* @return void
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu($limitmenuto)
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/smartphone/smartphone.lib.php';
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/menus/smartphone/smartphone.lib.php';
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$limitmenuto);
if ($this->type_user == 1)
{
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$mode);
return 1;
}
}
?>
?>

View File

@ -1,75 +0,0 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008-2013 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/menus/standard/auguria_backoffice.php
* \brief Gestionnaire nomme Auguria du menu du haut
*
* \remarks La construction d'un gestionnaire pour le menu du haut est simple:
* \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut
* \remarks doivent etre affichees par <a class="tmenu" href="...?mainmenu=...">...</a>
* \remarks ou si menu selectionne <a class="tmenusel" href="...?mainmenu=...">...</a>
*/
/**
* Classe permettant la gestion du menu du haut Auguria
*/
class MenuManager
{
var $db;
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $menu_array;
var $menu_array_after;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}
}
?>

View File

@ -18,26 +18,21 @@
*/
/**
* \file htdocs/core/menus/standard/auguria_frontoffice.php
* \brief Gestionnaire nomme Auguria du menu du haut
*
* \remarks La construction d'un gestionnaire pour le menu du haut est simple:
* \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut
* \remarks doivent etre affichees par <a class="tmenu" href="...?mainmenu=...">...</a>
* \remarks ou si menu selectionne <a class="tmenusel" href="...?mainmenu=...">...</a>
* \file htdocs/core/menus/standard/auguria_menu.php
* \brief Menu auguria manager
*/
/**
* Classe permettant la gestion du menu du haut Auguria
* Class to manage menu Auguria
*/
class MenuManager
{
var $db;
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=1; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $type_user; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $name="auguria";
var $menu_array;
var $menu_array_after;
@ -45,11 +40,13 @@ class MenuManager
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
function __construct($db)
function __construct($db, $type_user)
{
$this->db=$db;
$this->type_user=$type_user;
$this->db=$db;
}
@ -65,9 +62,12 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
if ($this->type_user == 1)
{
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);

View File

@ -68,7 +68,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Third parties
$tmpentry=array('enabled'=>($conf->societe->enabled || $conf->fournisseur->enabled), 'perms'=>($user->rights->societe->lire || $user->rights->fournisseur->lire), 'module'=>'societe|fournisseur');
$tmpentry=array('enabled'=>(! empty($conf->societe->enabled) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
@ -110,7 +110,7 @@ function print_eldy_menu($db,$atarget,$type_user)
}
// Products-Services
$tmpentry=array('enabled'=>($conf->product->enabled || $conf->service->enabled), 'perms'=>($user->rights->produit->lire || $user->rights->service->lire), 'module'=>'product|service');
$tmpentry=array('enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), 'module'=>'product|service');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
@ -160,7 +160,7 @@ function print_eldy_menu($db,$atarget,$type_user)
if (! empty($conf->fournisseur->enabled)) $menuqualified++;
if (! empty($conf->contrat->enabled)) $menuqualified++;
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
$tmpentry=array('enabled'=>$menuqualified, 'perms'=>($user->rights->societe->lire || $user->rights->societe->contact->lire), 'module'=>'propal|commande|fournisseur|contrat|ficheinter');
$tmpentry=array('enabled'=>$menuqualified, 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), 'module'=>'propal|commande|fournisseur|contrat|ficheinter');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
@ -201,7 +201,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Financial
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)),
'perms'=>($user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire || $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire),
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)),
'module'=>'comptabilite|accounting|facture|deplacement|don|tax');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@ -243,7 +243,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Bank
$tmpentry=array('enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
'perms'=>($user->rights->banque->lire || $user->rights->prelevement->lire),
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
'module'=>'banque|prelevement');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@ -286,7 +286,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Projects
$tmpentry=array('enabled'=>(! empty($conf->projet->enabled)),
'perms'=>($user->rights->projet->lire),
'perms'=>(! empty($user->rights->projet->lire)),
'module'=>'projet');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@ -328,7 +328,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Tools
$tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled)),
'perms'=>($user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run),
'perms'=>(! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run)),
'module'=>'mailing|export|import');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@ -400,7 +400,7 @@ function print_eldy_menu($db,$atarget,$type_user)
// Members
$tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>($user->rights->adherent->lire),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)

View File

@ -1,74 +0,0 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.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
* the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/menus/standard/eldy_backoffice.php
* \brief Gestionnaire nomme eldy du menu du haut
*
* \remarks La construction d'un gestionnaire pour le menu du haut est simple:
* \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut
* \remarks doivent etre affichees par <a class="tmenu" href="...?mainmenu=...">...</a>
* \remarks ou si menu selectionne <a class="tmenusel" href="...?mainmenu=...">...</a>
*/
/**
* Classe to manage menu Eldy
*/
class MenuManager
{
var $db;
var $require_left=array("eldy_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $menu_array;
var $menu_array_after;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}
}
?>

View File

@ -17,26 +17,21 @@
*/
/**
* \file htdocs/core/menus/standard/eldy_frontoffice.php
* \brief Gestionnaire nomme eldy du menu du haut
*
* \remarks La construction d'un gestionnaire pour le menu du haut est simple:
* \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut
* \remarks doivent etre affichees par <a class="tmenu" href="...?mainmenu=...">...</a>
* \remarks ou si menu selectionne <a class="tmenusel" href="...?mainmenu=...">...</a>
* \file htdocs/core/menus/standard/eldy_menu.php
* \brief Menu eldy manager
*/
/**
* Class to manage menu Eldy (for external users)
* Class to manage menu Eldy
*/
class MenuManager
{
var $db;
var $require_left=array("eldy_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=1; // Put 0 for internal users, 1 for external users
var $type_user; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $name="eldy";
var $menu_array;
var $menu_array_after;
@ -44,10 +39,12 @@ class MenuManager
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
* @param int $type_user Type of user
*/
function __construct($db)
function __construct($db, $type_user)
{
$this->type_user=$type_user;
$this->db=$db;
}
@ -55,8 +52,8 @@ class MenuManager
/**
* Show menu
*
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu($mode)
{
@ -64,8 +61,11 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
if ($this->type_user == 1)
{
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user);

View File

@ -26,7 +26,6 @@
class MenuManager
{
var $db;
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // To store arget to use in menu links

View File

@ -238,12 +238,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{

View File

@ -133,12 +133,11 @@ class pdf_einstein extends ModelePDFCommandes
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc,$db;
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -230,7 +229,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -284,7 +283,7 @@ class pdf_einstein extends ModelePDFCommandes
$showpricebeforepagebreak=1;
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
@ -292,7 +291,7 @@ class pdf_einstein extends ModelePDFCommandes
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
@ -300,7 +299,7 @@ class pdf_einstein extends ModelePDFCommandes
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pagenb+1);
}
}
@ -331,18 +330,18 @@ class pdf_einstein extends ModelePDFCommandes
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails, $hookmanager);
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars
@ -350,12 +349,12 @@ class pdf_einstein extends ModelePDFCommandes
if ($object->lines[$i]->remise_percent)
{
$pdf->SetXY($this->posxdiscount-2, $curY);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails, $hookmanager);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
}
// Total HT line
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
@ -426,7 +425,7 @@ class pdf_einstein extends ModelePDFCommandes
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
@ -443,7 +442,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
@ -1041,12 +1040,11 @@ class pdf_einstein extends ModelePDFCommandes
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
global $conf,$langs,$hookmanager;
$outputlangs->load("main");
$outputlangs->load("bills");
@ -1125,7 +1123,7 @@ class pdf_einstein extends ModelePDFCommandes
$posy+=2;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{

View File

@ -157,12 +157,11 @@ abstract class ModeleNumRefCommandes
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$user,$langs;
global $conf,$user,$langs,$hookmanager;
$langs->load("orders");
$error=0;
@ -223,7 +222,7 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -222,7 +222,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object,$outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object,$outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -78,12 +78,11 @@ class pdf_expedition_merou extends ModelePdfExpedition
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$conf,$langs,$mysoc;
global $user,$conf,$langs,$mysoc,$hookmanager;
$object->fetch_thirdparty();
@ -183,7 +182,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);

View File

@ -81,12 +81,11 @@ class pdf_expedition_rouget extends ModelePdfExpedition
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$conf,$langs;
global $user,$conf,$langs,$hookmanager;
$object->fetch_thirdparty();
@ -170,7 +169,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);

View File

@ -250,12 +250,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{

View File

@ -134,12 +134,11 @@ class pdf_crabe extends ModelePDFFactures
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc,$db;
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -232,7 +231,7 @@ class pdf_crabe extends ModelePDFFactures
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -285,7 +284,7 @@ class pdf_crabe extends ModelePDFFactures
$showpricebeforepagebreak=1;
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
@ -293,7 +292,7 @@ class pdf_crabe extends ModelePDFFactures
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
@ -303,7 +302,7 @@ class pdf_crabe extends ModelePDFFactures
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pagenb+1);
}
}
@ -334,18 +333,18 @@ class pdf_crabe extends ModelePDFFactures
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails, $hookmanager);
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars
@ -353,12 +352,12 @@ class pdf_crabe extends ModelePDFFactures
if ($object->lines[$i]->remise_percent)
{
$pdf->SetXY($this->posxdiscount-2, $curY);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails, $hookmanager);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
}
// Total HT line
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
@ -428,7 +427,7 @@ class pdf_crabe extends ModelePDFFactures
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
@ -445,7 +444,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
@ -1194,10 +1193,9 @@ class pdf_crabe extends ModelePDFFactures
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@ -1331,7 +1329,7 @@ class pdf_crabe extends ModelePDFFactures
$posy+=1;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{

View File

@ -152,10 +152,9 @@ abstract class ModeleNumRefFactures
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int <0 if KO, >0 if OK
*/
function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$user,$langs;
@ -224,7 +223,7 @@ function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -101,10 +101,9 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
@ -174,7 +173,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);

View File

@ -151,10 +151,9 @@ abstract class ModeleNumRefFicheinter
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs,$user;
$langs->load("ficheinter");
@ -216,7 +215,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -110,7 +110,7 @@ abstract class ModeleNumRefProjects
/**
* Renvoi prochaine valeur attribuee
*
*
* @param Societe $objsoc Object third party
* @param Project $project Object project
* @return string Valeur
@ -149,10 +149,9 @@ abstract class ModeleNumRefProjects
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
$langs->load("projects");
@ -214,7 +213,7 @@ function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -237,12 +237,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
@ -485,11 +484,6 @@ class doc_generic_proposal_odt extends ModelePDFPropales
}
// Add odtgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;

View File

@ -132,12 +132,11 @@ class pdf_azur extends ModelePDFPropales
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc,$db;
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -229,7 +228,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -282,7 +281,7 @@ class pdf_azur extends ModelePDFPropales
$showpricebeforepagebreak=1;
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
@ -290,7 +289,7 @@ class pdf_azur extends ModelePDFPropales
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
@ -299,7 +298,7 @@ class pdf_azur extends ModelePDFPropales
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pagenb+1);
}
}
@ -330,18 +329,18 @@ class pdf_azur extends ModelePDFPropales
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails, $hookmanager);
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars
@ -349,12 +348,12 @@ class pdf_azur extends ModelePDFPropales
if ($object->lines[$i]->remise_percent)
{
$pdf->SetXY($this->posxdiscount-2, $curY);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails, $hookmanager);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
}
// Total HT line
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
@ -423,7 +422,7 @@ class pdf_azur extends ModelePDFPropales
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
@ -440,7 +439,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
@ -480,11 +479,6 @@ class pdf_azur extends ModelePDFPropales
$pdf->Output($file,'F');
//Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
@ -1088,10 +1082,9 @@ class pdf_azur extends ModelePDFPropales
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@ -1186,7 +1179,7 @@ class pdf_azur extends ModelePDFPropales
$posy+=2;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{

View File

@ -153,10 +153,9 @@ abstract class ModeleNumRefPropales
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$user,$langs;
$langs->load("propale");
@ -219,7 +218,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -161,12 +161,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
@ -298,11 +297,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc
}
// Add odtgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
$parameters=array('odfHandler'=>$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;

View File

@ -65,10 +65,9 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf, $user, $langs;
@ -137,7 +136,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -129,12 +129,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $user,$langs,$conf,$mysoc,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -227,7 +226,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -276,7 +275,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
@ -294,7 +293,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
@ -414,11 +413,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->Output($file,'F');
// Add pdfgeneration hook
if (!is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
@ -824,10 +818,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -907,7 +900,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{

View File

@ -147,10 +147,9 @@ abstract class ModeleNumRefSuppliersOrders
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf, $user, $langs;
$langs->load("suppliers");
@ -218,7 +217,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -138,12 +138,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf;
global $user,$langs,$conf,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -239,7 +238,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
@ -288,7 +287,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1,$hookmanager);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
@ -306,7 +305,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
@ -433,11 +432,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
@ -917,10 +911,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -1005,7 +998,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
if ($showaddress)
{

View File

@ -138,7 +138,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
LOG_DEBUG => 'DEBUG'
);
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-5s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
fwrite($filefd, $message."\n");
fclose($filefd);

View File

@ -59,8 +59,6 @@ if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user, $origin, $origin_id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('expeditioncard'));
$action = GETPOST('action','alpha');
@ -1424,7 +1422,7 @@ else
$outputlangs->setDefaultLang($newlang);
}
$result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -60,8 +60,6 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('interventioncard'));
$object = new Fichinter($db);
@ -1468,7 +1466,7 @@ else if ($id > 0 || ! empty($ref))
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -1029,12 +1029,11 @@ class CommandeFournisseur extends CommonOrder
/**
* Load an object from its id and create a new one in database
*
* @param HookManager $hookmanager Hook manager instance
* @return int New id of clone
*/
function createFromClone($hookmanager=false)
function createFromClone()
{
global $conf,$user,$langs;
global $conf,$user,$langs,$hookmanager;
$error=0;

View File

@ -70,8 +70,6 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('ordersuppliercard'));
$object = new CommandeFournisseur($db);
@ -310,7 +308,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
}
$ret=$object->fetch($object->id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST['qty']);
unset($_POST['type']);
@ -369,7 +367,7 @@ else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($object->id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
@ -394,7 +392,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($object->id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
@ -425,7 +423,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($object->id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
@ -524,7 +522,7 @@ else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fourn
{
if ($object->id > 0)
{
$result=$object->createFromClone($hookmanager);
$result=$object->createFromClone();
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
@ -594,7 +592,7 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
exit;
}
@ -608,7 +606,7 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
exit;
}
@ -630,7 +628,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) /
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang(GETPOST('lang_id'));
}
$result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
@ -1799,7 +1797,7 @@ if (! empty($object->id))
$outputlangs->setDefaultLang($newlang);
}
$result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -61,8 +61,6 @@ if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('invoicesuppliercard'));
$object=new FactureFournisseur($db);
@ -564,7 +562,7 @@ elseif ($action == 'addline')
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
unset($_POST['qty']);
unset($_POST['type']);
@ -615,7 +613,7 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
$action='';
}
@ -841,7 +839,7 @@ elseif ($action == 'builddoc')
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
@ -1223,7 +1221,7 @@ if ($action == 'create')
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($hookmanager);
$objectsrc->printOriginLinesList();
print '</table>';
}
@ -2056,7 +2054,7 @@ else
$outputlangs->setDefaultLang($newlang);
}
$result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
$result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);

View File

@ -57,8 +57,6 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('supplierlist'));
/*

File diff suppressed because it is too large Load Diff

View File

@ -1,125 +0,0 @@
<?php
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Error.php,v 1.5 2005/05/27 14:03:50 pmjones Exp $
*
*/
/**
*
* Provides a simple error class for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Error {
/**
*
* The error code, typically a Savant 'ERR_*' string.
*
* @access public
*
* @var string
*
*/
public $code = null;
/**
*
* An array of error-specific information.
*
* @access public
*
* @var array
*
*/
public $info = array();
/**
*
* The error severity level.
*
* @access public
*
* @var int
*
*/
public $level = E_USER_ERROR;
/**
*
* A debug backtrace for the error, if any.
*
* @access public
*
* @var array
*
*/
public $trace = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An associative array where the key is a
* Savant3_Error property and the value is the value for that
* property.
*
*/
public function __construct($conf = array())
{
// set public properties
foreach ($conf as $key => $val) {
$this->$key = $val;
}
// add a backtrace
if ($conf['trace'] === true) {
$this->trace = debug_backtrace();
}
}
/**
*
* Magic method for output dump.
*
* @access public
*
* @return void
*/
public function __toString()
{
ob_start();
echo get_class($this) . ': ';
print_r(get_object_vars($this));
return ob_get_clean();
}
}
?>

View File

@ -1,29 +0,0 @@
<?php
/**
*
* Throws PHP5 exceptions for Savant.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Exception.php,v 1.1 2005/05/27 14:04:36 pmjones Exp $
*
*/
/**
*
* A simple Savant3_Exception class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Exception extends Exception {
}
?>

View File

@ -1,85 +0,0 @@
<?php
/**
*
* Abstract Savant3_Filter class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Filter.php,v 1.5 2005/04/29 16:23:50 pmjones Exp $
*
*/
/**
*
* Abstract Savant3_Filter class.
*
* You have to extend this class for it to be useful; e.g., "class
* Savant3_Filter_example extends Savant3_Filter".
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
abstract class Savant3_Filter {
/**
*
* Optional reference to the calling Savant object.
*
* @access protected
*
* @var object
*
*/
protected $Savant = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An array of configuration keys and values for
* this filter.
*
* @return void
*
*/
public function __construct($conf = null)
{
settype($conf, 'array');
foreach ($conf as $key => $val) {
$this->$key = $val;
}
}
/**
*
* Stub method for extended behaviors.
*
* @access public
*
* @param string $text The text buffer to filter.
*
* @return string The text buffer after it has been filtered.
*
*/
public static function filter($text)
{
return $text;
}
}
?>

View File

@ -1,67 +0,0 @@
<?php
/**
*
* Abstract Savant3_Plugin class.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Plugin.php,v 1.5 2005/04/29 16:23:50 pmjones Exp $
*
*/
/**
*
* Abstract Savant3_Plugin class.
*
* You have to extend this class for it to be useful; e.g., "class
* Savant3_Plugin_example extends Savant2_Plugin". Be sure to add a
* method named for the plugin itself; e.g., "function example()".
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
abstract class Savant3_Plugin {
/**
*
* Reference to the calling Savant object.
*
* @access protected
*
* @var object
*
*/
protected $Savant = null;
/**
*
* Constructor.
*
* @access public
*
* @param array $conf An array of configuration keys and values for
* this plugin.
*
* @return void
*
*/
public function __construct($conf = null)
{
settype($conf, 'array');
foreach ($conf as $key => $val) {
$this->$key = $val;
}
}
}
?>

View File

@ -1,147 +0,0 @@
<?php
/**
*
* Filter to remove extra white space within the text.
*
* @package Savant3
*
* @author Monte Ohrt <monte@ispi.net>
*
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
*
* @author Converted to a Savant3 filter by Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Filter_trimwhitespace.php,v 1.4 2005/05/29 15:27:07 pmjones Exp $
*
*/
/**
*
* Filter to remove extra white space within the text.
*
* @package Savant3
*
* @author Monte Ohrt <monte@ispi.net>
*
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
*
* @author Converted to a Savant3 filter by Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Filter_trimwhitespace extends Savant3_Filter {
/**
*
* Removes extra white space within the text.
*
* Trim leading white space and blank lines from template source
* after it gets interpreted, cleaning up code and saving bandwidth.
* Does not affect <pre></pre>, <script></script>, or
* <textarea></textarea> blocks.
*
* @access public
*
* @param string $buffer The source text to be filtered.
*
* @return string The filtered text.
*
*/
public static function filter($buffer)
{
// Pull out the script blocks
preg_match_all("!<script[^>]+>.*?</script>!is", $buffer, $match);
$script_blocks = $match[0];
$buffer = preg_replace(
"!<script[^>]+>.*?</script>!is",
'@@@SAVANT:TRIM:SCRIPT@@@',
$buffer
);
// Pull out the pre blocks
preg_match_all("!<pre[^>]*>.*?</pre>!is", $buffer, $match);
$pre_blocks = $match[0];
$buffer = preg_replace(
"!<pre[^>]*>.*?</pre>!is",
'@@@SAVANT:TRIM:PRE@@@',
$buffer
);
// Pull out the textarea blocks
preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $buffer, $match);
$textarea_blocks = $match[0];
$buffer = preg_replace(
"!<textarea[^>]+>.*?</textarea>!is",
'@@@SAVANT:TRIM:TEXTAREA@@@',
$buffer
);
// remove all leading spaces, tabs and carriage returns NOT
// preceeded by a php close tag.
$buffer = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $buffer));
// replace script blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:SCRIPT@@@",
$script_blocks,
$buffer
);
// replace pre blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:PRE@@@",
$pre_blocks,
$buffer
);
// replace textarea blocks
Savant3_Filter_trimwhitespace::replace(
"@@@SAVANT:TRIM:TEXTAREA@@@",
$textarea_blocks,
$buffer
);
return $buffer;
}
/**
*
* Does a simple search-and-replace on the source text.
*
* @access protected
*
* @param string $search The string to search for.
*
* @param string $replace Replace with this text.
*
* @param string &$buffer The source text.
*
* @return string The text after search-and-replace.
*
*/
protected static function replace($search, $replace, &$buffer)
{
$len = strlen($search);
$pos = 0;
$count = count($replace);
for ($i = 0; $i < $count; $i++) {
// does the search-string exist in the buffer?
$pos = strpos($buffer, $search, $pos);
if ($pos !== false) {
// replace the search-string
$buffer = substr_replace($buffer, $replace[$i], $pos, $len);
} else {
break;
}
}
}
}
?>

View File

@ -1,109 +0,0 @@
<?php
/**
*
* Generates an <a href="">...</a> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_ahref.php,v 1.4 2005/08/09 12:56:14 pmjones Exp $
*
*/
/**
*
* Generates an <a href="">...</a> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_ahref extends Savant3_Plugin {
/**
*
* Generate an HTML <a href="">...</a> tag.
*
* @access public
*
* @param string|array $href A string URL for the resulting tag. May
* also be an array with any combination of the keys 'scheme',
* 'host', 'path', 'query', and 'fragment' (c.f. PHP's native
* parse_url() function).
*
* @param string $text The displayed text of the link.
*
* @param string|array $attr Any extra attributes for the <a> tag.
*
* @return string The <a href="">...</a> tag.
*
*/
public function ahref($href, $text, $attr = null)
{
$html = '<a href="';
if (is_array($href)) {
// add the HREF from an array
$tmp = '';
if (isset($href['scheme'])) {
$tmp .= $href['scheme'] . ':';
if (strtolower($href['scheme']) != 'mailto') {
$tmp .= '//';
}
}
if (isset($href['host'])) {
$tmp .= $href['host'];
}
if (isset($href['path'])) {
$tmp .= $href['path'];
}
if (isset($href['query'])) {
$tmp .= '?' . $href['query'];
}
if (isset($href['fragment'])) {
$tmp .= '#' . $href['fragment'];
}
$html .= htmlspecialchars($tmp);
} else {
// add the HREF from a scalar
$html .= htmlspecialchars($href);
}
$html .= '"';
// add attributes
if (is_array($attr)) {
// from array
foreach ($attr as $key => $val) {
$key = htmlspecialchars($key);
$val = htmlspecialchars($val);
$html .= " $key=\"$val\"";
}
} elseif (! is_null($attr)) {
// from scalar
$html .= htmlspecialchars(" $attr");
}
// set the link text, close the tag, and return
$html .= '>' . $text . '</a>';
return $html;
}
}
?>

View File

@ -1,123 +0,0 @@
<?php
/**
*
* Plugin to generate a formatted date using strftime() conventions.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_date.php,v 1.3 2005/03/07 14:40:16 pmjones Exp $
*
*/
/**
*
* Plugin to generate a formatted date using strftime() conventions.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_date extends Savant3_Plugin {
/**
*
* The default strftime() format string.
*
* @access public
*
* @var array
*
*/
public $default = '%c';
/**
*
* Custom strftime() format strings to use for dates.
*
* You can preset the format strings via Savant3::setPluginConf().
*
* <code>
* $conf = array(
* 'custom' => array(
* 'mydate' => '%Y-%m-%d',
* 'mytime' => '%R'
* )
* );
*
* $Savant->setPluginConf('date', $conf);
* </code>
*
* ... and in your template, to use a preset custom string by name:
*
* <code>
* echo $this->date($value, 'mydate');
* </code>
*
* @access public
*
* @var array
*
*/
public $custom = array(
'date' => '%Y-%m-%d',
'time' => '%H:%M:%S'
);
/**
*
* Outputs a formatted date using strftime() conventions.
*
* @access public
*
* @param string $datestring Any date-time string suitable for
* strtotime().
*
* @param string $format The strftime() formatting string, or a named
* custom string key from $this->custom.
*
* @return string The formatted date string.
*
*/
function date($datestring, $format = null)
{
settype($format, 'string');
if (is_null($format)) {
$format = $this->default;
}
// does the format string have a % sign in it?
if (strpos($format, '%') === false) {
// no, look for a custom format string
if (! empty($this->custom[$format])) {
// found a custom format string
$format = $this->custom[$format];
} else {
// did not find the custom format, revert to default
$format = $this->default;
}
}
// convert the date string to the specified format
if (trim($datestring != '')) {
return strftime($format, strtotime($datestring));
} else {
// no datestring, return VOID
return;
}
}
}
?>

View File

@ -1,63 +0,0 @@
<?php
/**
*
* Plugin to convert an associative array to a string of tag attributes.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_htmlAttribs.php,v 1.3 2005/09/12 17:49:27 pmjones Exp $
*
*/
/**
*
* Plugin to convert an associative array to a string of tag attributes.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_htmlAttribs extends Savant3_Plugin {
/**
*
* Converts an associative array to a string of tag attributes.
*
* @access public
*
* @param array $attribs From this array, each key-value pair is
* converted to an attribute name and value.
*
* @return string The XHTML for the attributes.
*
*/
public function htmlAttribs($attribs)
{
$xhtml = '';
foreach ((array) $attribs as $key => $val) {
if ($val === null) {
continue;
}
if (is_array($val)) {
$val = implode(' ', $val);
}
$key = htmlspecialchars($key);
$val = htmlspecialchars($val);
$xhtml .= " $key=\"$val\"";
}
return $xhtml;
}
}
?>

View File

@ -1,199 +0,0 @@
<?php
/**
*
* Plugin to generate an <img ... /> tag.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
* @version $Id: Savant3_Plugin_image.php,v 1.7 2005/08/12 14:34:09 pmjones Exp $
*
*/
/**
*
* Plugin to generate an <img ... /> tag.
*
* Support for alpha transparency of PNG files in Microsoft IE added by
* Edward Ritter; thanks, Edward.
*
* @package Savant3
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
*/
class Savant3_Plugin_image extends Savant3_Plugin {
/**
*
* The document root.
*
* @access public
*
* @var string
*
*/
protected $documentRoot = null;
/**
*
* The base directory for images within the document root.
*
* @access public
*
* @var string
*
*/
protected $imageDir = null;
/**
*
* Outputs an <img ... /> tag.
*
* Microsoft IE alpha PNG support added by Edward Ritter.
*
* @access public
*
* @param string $file The path to the image on the local file system
* relative to $this->imageDir.
*
* @param string $alt Alternative descriptive text for the image;
* defaults to the filename of the image.
*
* @param int $border The border width for the image; defaults to zero.
*
* @param int $width The displayed image width in pixels; defaults to
* the width of the image.
*
* @param int $height The displayed image height in pixels; defaults to
* the height of the image.
*
* @return string An <img ... /> tag.
*
*/
public function image($file, $alt = null, $height = null, $width = null,
$attr = null)
{
// is the document root set?
if (is_null($this->documentRoot) && isset($_SERVER['DOCUMENT_ROOT'])) {
// no, so set it
$this->documentRoot = $_SERVER['DOCUMENT_ROOT'];
}
// make sure there's a DIRECTORY_SEPARATOR between the docroot
// and the image dir
if (substr($this->documentRoot, -1) != DIRECTORY_SEPARATOR &&
substr($this->imageDir, 0, 1) != DIRECTORY_SEPARATOR) {
$this->documentRoot .= DIRECTORY_SEPARATOR;
}
// make sure there's a separator between the imageDir and the
// file name
if (substr($this->imageDir, -1) != DIRECTORY_SEPARATOR &&
substr($file, 0, 1) != DIRECTORY_SEPARATOR) {
$this->imageDir .= DIRECTORY_SEPARATOR;
}
// the image file type code (PNG = 3)
$type = null;
// get the file information
$info = false;
if (strpos($file, '://') === false) {
// no "://" in the file, so it's local
$file = $this->imageDir . $file;
$tmp = $this->documentRoot . $file;
$info = @getimagesize($tmp);
} else {
// don't attempt to get file info from streams, it takes
// way too long.
$info = false;
}
// did we find the file info?
if (is_array($info)) {
// capture type info regardless
$type = $info[2];
// capture size info where both not specified
if (is_null($width) && is_null($height)) {
$width = $info[0];
$height = $info[1];
}
}
// clean up
unset($info);
// is the file a PNG? if so, check user agent, we will need to
// make special allowances for Microsoft IE.
if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && $type === 3) {
// support alpha transparency for PNG files in MSIE
$html = '<span style="position: relative;';
if ($height) {
$html .= ' height: ' . $height . 'px;';
}
if ($width) {
$html .= ' width: ' . $width . 'px;';
}
$html .= ' filter:progid:DXImageTransform.Microsoft.AlphaImageLoader';
$html .= "(src='" . htmlspecialchars($file) . "',sizingMethod='scale');\"";
$html .= ' title="' . htmlspecialchars($alt) . '"';
$html .= $this->Savant->htmlAttribs($attr);
// done
$html .= '></span>';
} else {
// not IE, so build a normal image tag.
$html = '<img';
$html .= ' src="' . htmlspecialchars($file) . '"';
// add the alt attribute
if (is_null($alt)) {
$alt = basename($file);
}
$html .= ' alt="' . htmlspecialchars($alt) . '"';
// add the height attribute
if ($height) {
$html .= ' height="' . htmlspecialchars($height) . '"';
}
// add the width attribute
if ($width) {
$html .= ' width="' . htmlspecialchars($width) . '"';
}
$html .= $this->Savant->htmlAttribs($attr);
// done
$html .= ' />';
}
// done!
return $html;
}
}
?>

View File

@ -34,8 +34,6 @@ $_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'hom
$action=GETPOST('action');
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('index'));

View File

@ -255,8 +255,10 @@ if (! $error && $db->connected)
{
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
{
$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate');
//$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
//$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate');
$defaultCharacterSet=$db->forcecharset;
$defaultDBSortingCollation=$db->forcecollate;
}
else // If already created, we take current value
{
@ -268,6 +270,7 @@ if (! $error && $db->connected)
print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
$db_character_set=$defaultCharacterSet;
$db_collation=$defaultDBSortingCollation;
dolibarr_install_syslog("db_character_set=".$db_character_set." db_collation=".$db_collation);
}
@ -559,8 +562,8 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name, LOG_DEBUG);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user, LOG_DEBUG);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
if ($newdb->connected)

View File

@ -142,6 +142,10 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
$ok = 0;
// If first install

View File

@ -200,6 +200,7 @@ if (constant('DOL_DATA_ROOT') && file_exists($lockfile))
// Force usage of log file for install and upgrades
$conf->syslog->enabled=1;
$conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG');
if (! defined('SYSLOG_HANDLERS')) define('SYSLOG_HANDLERS','["mod_syslog_file"]');
if (! defined('SYSLOG_FILE')) // To avoid warning on systems with constant already defined
{
if (@is_writable('/tmp')) define('SYSLOG_FILE','/tmp/dolibarr_install.log');
@ -227,10 +228,9 @@ foreach ($handlers as $handler)
throw new Exception('Log handler does not extend LogHandlerInterface');
}
$conf->loghandlers[]=$loghandlerinstance;
if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance;
}
// Removed magic_quotes
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.4
{
@ -314,7 +314,26 @@ function conf($dolibarr_main_document_root)
//print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
}
if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1);
// We init log handler for install
$handlers = array('mod_syslog_file');
foreach ($handlers as $handler)
{
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
if (!file_exists($file))
{
throw new Exception('Missing log handler file '.$handler.'.php');
}
require_once $file;
$loghandlerinstance = new $handler();
if (!$loghandlerinstance instanceof LogHandlerInterface)
{
throw new Exception('Log handler does not extend LogHandlerInterface');
}
if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance;
}
return 1;
}

View File

@ -55,10 +55,10 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_M
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_LISTE_LIMIT','25','chaine','Longueur maximum des listes',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SHOW_WORKBOARD','1','yesno','Affichage tableau de bord de travail Dolibarr',0,0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_STANDARD','eldy_backoffice.php','chaine','Module de gestion de la barre de menu pour utilisateurs internes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_STANDARD','eldy_frontoffice.php','chaine','Module de gestion de la barre de menu pour utilisateurs externes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_SMARTPHONE','eldy_backoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs internes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_SMARTPHONE','eldy_frontoffice.php','chaine','Module de gestion de la barre de menu smartphone pour utilisateurs externes',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_STANDARD','eldy_menu.php','chaine','Menu manager for internal users',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_STANDARD','eldy_menu.php','chaine','Menu manager for external users',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_SMARTPHONE','eldy_menu.php','chaine','Menu manager for internal users using smartphones',0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENUFRONT_SMARTPHONE','eldy_menu.php','chaine','Menu manager for external users using smartphones',0);
--

View File

@ -23,3 +23,13 @@ create table llx_adherent_type_extrafields
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_adherent_type_extrafields ADD INDEX idx_adherent_type_extrafields (fk_object);
UPDATE llx_const set value='eldy_menu.php' where value='eldy_backoffice.php';
UPDATE llx_const set value='eldy_menu.php' where value='eldy_frontoffice.php';
UPDATE llx_const set value='auguria_menu.php' where value='auguria_backoffice.php';
UPDATE llx_const set value='auguria_menu.php' where value='auguria_frontoffice.php';
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_backoffice.php';
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontoffice.php';
ALTER TABLE llx_user add COLUMN fk_user integer;

Some files were not shown because too many files have changed in this diff Show More