diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e7b3e95e757..60bc466a907 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -78,6 +78,7 @@ class modMyModule extends DolibarrModules // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file // 'menus' => 0, // Set this to 1 if module has its own menus handler directory // 'barcode' => 0, // Set this to 1 if module has its own barcode directory + // 'models' => 0, // Set this to 1 if module has its own models directory // 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // ); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 7f41578058c..0836989d66f 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -38,8 +38,8 @@ $langs->load("errors"); if (! $user->admin) accessforbidden(); -$action = GETPOST("action"); -$value = GETPOST("value"); +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); /* * Actions @@ -242,6 +242,11 @@ print "\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + foreach ($conf->file->dol_document_root as $dirroot) { $dir = $dirroot . "/core/modules/commande/"; @@ -373,6 +378,11 @@ print "\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + $var=true; foreach ($conf->file->dol_document_root as $dirroot) { diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index bd145f32ae4..fa4e2f6e0d4 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * * This program is free software; you can redistribute it and/or modify @@ -34,8 +34,8 @@ $langs->load("errors"); if (! $user->admin) accessforbidden(); -$action = GETPOST("action"); -$value = GETPOST("value"); +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); /* @@ -308,6 +308,11 @@ print ''."\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + $var=true; foreach ($conf->file->dol_document_root as $dirroot) { @@ -473,6 +478,11 @@ print "\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + $var=true; foreach ($conf->file->dol_document_root as $dirroot) { diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index 1689a406f88..2e2e15d398e 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2012 Juanjo Menent * @@ -35,11 +35,10 @@ require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); $langs->load("admin"); $langs->load("errors"); -if (!$user->admin) -accessforbidden(); +if (! $user->admin) accessforbidden(); -$action =GETPOST("action"); -$value = GETPOST("value"); +$action =GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); /* * Actions @@ -186,7 +185,8 @@ if ($action == 'set') $sql.= ")"; $resql=$db->query($sql); } -if ($action == 'del') + +else if ($action == 'del') { $type='propal'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; @@ -199,7 +199,7 @@ if ($action == 'del') } } -if ($action == 'setdoc') +else if ($action == 'setdoc') { $label = GETPOST("label"); $scandir = GETPOST("scandir"); @@ -235,7 +235,7 @@ if ($action == 'setdoc') } } -if ($action == 'setmod') +else if ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -274,6 +274,11 @@ print ''."\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + foreach ($conf->file->dol_document_root as $dirroot) { $dir = $dirroot . "/core/modules/propale/"; @@ -405,6 +410,11 @@ print "\n"; clearstatcache(); +// Check if there is external models to do asked by plugins +if (is_array($conf->models_modules) && ! empty($conf->models_modules)) { + $conf->file->dol_document_root = array_merge($conf->file->dol_document_root,$conf->models_modules); +} + $var=true; foreach ($conf->file->dol_document_root as $dirroot) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 84b49901ce8..f8e698e09fb 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -58,6 +58,7 @@ class Conf public $triggers_modules = array(); public $menus_modules = array(); public $hooks_modules = array(); + public $models_modules = array(); public $login_modules = array(); public $sms_engine_modules = array(); public $barcode_modules = array(); @@ -163,6 +164,7 @@ class Conf if (! is_array($this->$varname)) { $this->$varname = array(); } $arrValue = @unserialize($value); if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; + else if ($partname == 'models' && $value == 1) $value = dol_buildpath('/'.$modulename); else $value = ($value == 1 ? '/'.$modulename.'/core/'.$partname.'/' : $value); $this->$varname = array_merge($this->$varname, array($modulename => $value)); }