Merge pull request #5604 from atm-florian/FIX_createpropalfromproject
FIX : create proposal from project
This commit is contained in:
commit
3b509db141
@ -1266,6 +1266,8 @@ if ($action == 'create')
|
||||
if ($origin != 'project' && $originid) {
|
||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
} elseif ($origin == 'project' && !empty($projectid)) {
|
||||
print '<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
}
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@ -140,7 +140,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result = $object->setValid($user);
|
||||
@ -733,14 +733,14 @@ if (empty($reshook))
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
|
||||
|
||||
// Actions to send emails
|
||||
$actiontypecode='AC_OTH_AUTO';
|
||||
$trigger_name='FICHINTER_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromintervention';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
@ -955,7 +955,7 @@ if ($action == 'create')
|
||||
else
|
||||
$numprojet=select_projects($societe->id,$_POST["projectid"],'projectid');
|
||||
*/
|
||||
$numprojet=$formproject->select_projects($soc->id,GETPOST('projectid','int'),'projectid');
|
||||
$numprojet=$formproject->select_projects($soc->id,$projectid,'projectid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
@ -1027,6 +1027,8 @@ if ($action == 'create')
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
} elseif ($origin == 'project' && !empty($projectid)) {
|
||||
print '<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
@ -1044,6 +1046,13 @@ if ($action == 'create')
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
} elseif ($origin == 'project' && !empty($projectid)) {
|
||||
print '<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
}
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
|
||||
print $form->select_company('','socid','','SelectThirdParty',1);
|
||||
@ -1137,7 +1146,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneIntervention'), $langs->trans('ConfirmCloneIntervention', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
|
||||
if (!$formconfirm)
|
||||
{
|
||||
$parameters=array('lineid'=>$lineid);
|
||||
@ -1168,7 +1177,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES))
|
||||
{
|
||||
// Date Start
|
||||
@ -1177,14 +1186,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Date End
|
||||
print '<tr><td>'.$langs->trans("Datee").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->datee ? dol_print_date($object->datee, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Date Terminate/close
|
||||
print '<tr><td>'.$langs->trans("Datet").'</td>';
|
||||
print '<td colspan="3">';
|
||||
@ -1428,7 +1437,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center" class="nowrap">';
|
||||
$form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention");
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Duration
|
||||
print '<td align="right">';
|
||||
if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
|
||||
@ -1629,7 +1638,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=ficheinter">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
// Delete
|
||||
if (($object->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer)
|
||||
{
|
||||
@ -1742,7 +1751,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'int'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
|
||||
@ -165,7 +165,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
|
||||
if ($code) print $langs->trans("OppStatus".$code);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Opportunity Amount
|
||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
|
||||
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
|
||||
@ -193,7 +193,7 @@ $listofreferent=array(
|
||||
'class'=>'Propal',
|
||||
'table'=>'propal',
|
||||
'datefieldname'=>'datep',
|
||||
'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
||||
'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
||||
'lang'=>'propal',
|
||||
'buttonnew'=>'AddProp',
|
||||
'testnew'=>$user->rights->propal->creer,
|
||||
@ -284,7 +284,7 @@ $listofreferent=array(
|
||||
'table'=>'fichinter',
|
||||
'datefieldname'=>'date_valid',
|
||||
'disableamount'=>1,
|
||||
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
||||
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
||||
'lang'=>'interventions',
|
||||
'buttonnew'=>'AddIntervention',
|
||||
'testnew'=>$user->rights->ficheinter->creer,
|
||||
@ -356,19 +356,19 @@ if ($action=="addelement")
|
||||
$tablename = GETPOST("tablename");
|
||||
$elementselectid = GETPOST("elementselect");
|
||||
$result=$object->update_element($tablename, $elementselectid);
|
||||
if ($result<0)
|
||||
if ($result<0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($action == "unlink")
|
||||
elseif ($action == "unlink")
|
||||
{
|
||||
|
||||
$tablename = GETPOST("tablename");
|
||||
$elementselectid = GETPOST("elementselect");
|
||||
|
||||
$result = $object->remove_element($tablename, $elementselectid);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -399,7 +399,7 @@ if (! $showdatefilter)
|
||||
print '</tr></table>';
|
||||
print '</form>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
$showdatefilter++;
|
||||
}
|
||||
|
||||
@ -569,14 +569,14 @@ foreach ($listofreferent as $key => $value)
|
||||
$urlnew=$value['urlnew'];
|
||||
$buttonnew=$value['buttonnew'];
|
||||
$testnew=$value['testnew'];
|
||||
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
// If we want the project task array to have details of users
|
||||
//if ($key == 'project_task') $key = 'project_task_time';
|
||||
|
||||
|
||||
if ($langtoload) $langs->load($langtoload);
|
||||
|
||||
|
||||
$element = new $classname($db);
|
||||
|
||||
$addform='';
|
||||
@ -584,7 +584,7 @@ foreach ($listofreferent as $key => $value)
|
||||
$idtofilterthirdparty=0;
|
||||
if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id;
|
||||
|
||||
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0)
|
||||
if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0)
|
||||
{
|
||||
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300');
|
||||
if (! $selectList || ($selectList<0))
|
||||
@ -615,7 +615,7 @@ foreach ($listofreferent as $key => $value)
|
||||
else $addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
|
||||
$addform.='<div>';
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans($title), $addform, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user