FIX : create proposal from project
This commit is contained in:
parent
8c63d68083
commit
d38ff5c246
@ -279,7 +279,7 @@ if (empty($reshook))
|
||||
|
||||
if ($socid < 1) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||
|
||||
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
}
|
||||
@ -345,7 +345,7 @@ if (empty($reshook))
|
||||
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
@ -718,7 +718,7 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
@ -932,7 +932,7 @@ if (empty($reshook))
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
@ -1167,12 +1167,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
@ -1432,11 +1434,11 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
@ -1934,7 +1936,7 @@ if ($action == 'create')
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
@ -2053,7 +2055,7 @@ if ($action == 'create')
|
||||
print '<td class="nowrap" colspan="2">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled))
|
||||
if (! empty($conf->margin->enabled))
|
||||
{
|
||||
$rowspan=4;
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++;
|
||||
@ -2087,25 +2089,25 @@ if ($action == 'create')
|
||||
print '<tr><td height="10">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
@ -2397,7 +2399,7 @@ if ($action == 'create')
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $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,
|
||||
@ -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