NEW Add option PROJECT_THIRDPARTY_REQUIRED
This commit is contained in:
parent
eb70d6eea1
commit
3803330701
@ -507,7 +507,11 @@ if ($action == 'create' && $user->rights->projet->creer)
|
|||||||
// Thirdparty
|
// Thirdparty
|
||||||
if ($conf->societe->enabled)
|
if ($conf->societe->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td class="maxwidthonsmartphone">';
|
print '<tr><td>';
|
||||||
|
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'<span class="fieldrequired">');
|
||||||
|
print $langs->trans("ThirdParty");
|
||||||
|
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'</span>');
|
||||||
|
print '</td><td class="maxwidthonsmartphone">';
|
||||||
$filteronlist='';
|
$filteronlist='';
|
||||||
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
||||||
$text=$form->select_thirdparty_list(GETPOST('socid','int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
|
$text=$form->select_thirdparty_list(GETPOST('socid','int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
|
||||||
@ -719,7 +723,11 @@ elseif ($object->id > 0)
|
|||||||
// Thirdparty
|
// Thirdparty
|
||||||
if ($conf->societe->enabled)
|
if ($conf->societe->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<tr><td>';
|
||||||
|
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'<span class="fieldrequired">');
|
||||||
|
print $langs->trans("ThirdParty");
|
||||||
|
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED)?'':'</span>');
|
||||||
|
print '</td><td>';
|
||||||
$filteronlist='';
|
$filteronlist='';
|
||||||
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
||||||
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), '', 0, 0, 'minwidth300');
|
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), '', 0, 0, 'minwidth300');
|
||||||
|
|||||||
@ -139,7 +139,13 @@ class Project extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
|
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) && ! $this->socid > 0)
|
||||||
|
{
|
||||||
|
$this->error = 'ErrorFieldsRequired';
|
||||||
|
dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet (";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet (";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user