Fix: socid was not caught.
Fix: numbering modules was not correctly scanned.
This commit is contained in:
parent
40742e84a9
commit
bb8516274e
@ -56,7 +56,7 @@ if ($object->id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=GETPOST('socid');
|
||||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'projet', $object->id);
|
$result = restrictedArea($user, 'projet', $object->id);
|
||||||
|
|
||||||
@ -376,6 +376,10 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
/*
|
/*
|
||||||
* Create
|
* Create
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$thirdparty=new Societe($db);
|
||||||
|
if ($socid > 0) $thirdparty->fetch($socid);
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("NewProject"));
|
print_fiche_titre($langs->trans("NewProject"));
|
||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
@ -388,12 +392,28 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$defaultref='';
|
$defaultref='';
|
||||||
$obj = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
|
||||||
if (! empty($conf->global->PROJECT_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php"))
|
|
||||||
|
// Search template files
|
||||||
|
$file=''; $classname=''; $filefound=0;
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
foreach($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php';
|
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php',0);
|
||||||
$modProject = new $obj;
|
if (file_exists($file))
|
||||||
$defaultref = $modProject->getNextValue($soc,$object);
|
{
|
||||||
|
$filefound=1;
|
||||||
|
$classname = $modele;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filefound)
|
||||||
|
{
|
||||||
|
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
|
||||||
|
$modProject = new $classname;
|
||||||
|
|
||||||
|
$defaultref = $modProject->getNextValue($thirdparty,$object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user