This commit is contained in:
Laurent Destailleur 2017-06-03 00:58:51 +02:00
parent 976c8e0752
commit af584bc9c0

View File

@ -134,7 +134,7 @@ if (empty($reshook))
$error++;
setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors');
}
if (! $error)
{
$error=0;
@ -308,8 +308,8 @@ if (empty($reshook))
setEventMessages($langs->trans("FailedToCloseProject").':'.$object->error, $object->errors, 'errors');
}
}
if ($error)
{
$db->rollback();
@ -322,7 +322,7 @@ if (empty($reshook))
if (GETPOST('socid','int') > 0) $object->fetch_thirdparty(GETPOST('socid','int'));
else unset($object->thirdparty);
}
}
// Build doc
@ -619,7 +619,7 @@ if ($action == 'create' && $user->rights->projet->creer)
{
print '     ';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
}
}
print '</div>';
print '</form>';
@ -641,12 +641,12 @@ if ($action == 'create' && $user->rights->projet->creer)
});
</script>';
}
elseif ($object->id > 0)
elseif ($object->id > 0)
{
/*
* Show or edit
*/
$res=$object->fetch_optionals($object->id,$extralabels);
// To verify role of users
@ -828,26 +828,26 @@ elseif ($object->id > 0)
else
{
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Title
$morehtmlref.=$object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -881,18 +881,18 @@ elseif ($object->id > 0)
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,0,$langs,1,0,0,$conf->currency);
print '</td></tr>';
}
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_start,'day');
$end=dol_print_date($object->date_end,'day');
if ($end)
if ($end)
{
print ' - '.$end;
if ($object->hasDelay()) print img_warning($langs->trans('Late'));
}
print '</td></tr>';
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,0,$langs,1,0,0,$conf->currency);
@ -901,16 +901,16 @@ elseif ($object->id > 0)
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->description);
@ -922,13 +922,13 @@ elseif ($object->id > 0)
print $form->showCategories($object->id,'project',1);
print "</td></tr>";
}
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
}
@ -947,9 +947,10 @@ elseif ($object->id > 0)
// Change probability from status
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Default value to close or not when we set opp to 'WON'.
$defaultcheckedwhenoppclose=1;
if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose=0;
print '<!-- Javascript to manage opportunity status change -->';
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
@ -962,13 +963,17 @@ elseif ($object->id > 0)
var oldpercent = \''.dol_escape_js($object->opp_percent).'\';
console.log("We select "+elemcode);
if (elemcode == \'LOST\') defaultcloseproject = 1;
jQuery("#divtocloseproject").show();
if (defaultcloseproject) jQuery("#inputcloseproject").prop("checked", true);
/* Define if checkbox to close is checked or not */
closeproject = 0;
if (elemcode == \'LOST\') closeproject = 1;
if (elemcode == \'WON\') closeproject = defaultcloseproject;
if (closeproject) jQuery("#inputcloseproject").prop("checked", true);
else jQuery("#inputcloseproject").prop("checked", false);
/* Make close project visible or not */
if (elemcode == \'WON\' || elemcode == \'LOST\')
console.log("closeproject="+closeproject);
/* Make the close project checkbox visible or not */
if (elemcode == \'WON\' || elemcode == \'LOST\')
{
jQuery("#divtocloseproject").show();
}
@ -976,7 +981,7 @@ elseif ($object->id > 0)
{
jQuery("#divtocloseproject").hide();
}
/* Change percent of default percent of new status is higher */
if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent))
{
@ -1003,7 +1008,7 @@ elseif ($object->id > 0)
{
if ($action != "edit" )
{
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on