Uniformize code

This commit is contained in:
Laurent Destailleur 2016-04-01 16:29:47 +02:00
parent 97b5026ad8
commit e40b678d7b
4 changed files with 44 additions and 31 deletions

View File

@ -2381,7 +2381,7 @@ if ($action == 'create')
{
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}

View File

@ -44,8 +44,10 @@ if (! empty($conf->supplier_proposal->enabled))
require DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
if (!empty($conf->produit->enabled))
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
$langs->load('admin');
@ -1569,7 +1571,7 @@ if ($action=='create')
}
else
{
print $form->select_company((empty($socid)?'':$socid),'socid','s.fournisseur = 1',1);
print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty');
}
print '</td>';
@ -1608,7 +1610,18 @@ if ($action=='create')
print '</td></tr>';
}
// Incoterms
// Project
if (! empty($conf->projet->enabled))
{
$formproject = new FormProjets($db);
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print '</td></tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
{
print '<tr>';

View File

@ -1388,7 +1388,7 @@ if ($action == 'create')
}
else
{
print $form->select_company(GETPOST('socid','int'),'socid','s.fournisseur = 1',1);
print $form->select_company(GETPOST('socid','int'), 'socid', 's.fournisseur = 1', 'SelectThirdParty');
}
print '</td></tr>';
@ -1502,6 +1502,21 @@ if ($action == 'create')
$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT');
print '</td></tr>';
// Bank Account
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
// Multicurrency
if (! empty($conf->multicurrency->enabled))
{
print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>';
}
// Project
if (! empty($conf->projet->enabled))
{
@ -1523,21 +1538,6 @@ if ($action == 'create')
print '</td></tr>';
}
// Bank Account
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
// Multicurrency
if (! empty($conf->multicurrency->enabled))
{
print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>';
}
// Public note
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';

View File

@ -913,53 +913,53 @@ else
if (! empty($conf->propal->enabled) && $user->rights->propal->creer)
{
$langs->load("propal");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddProp").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
}
if (! empty($conf->commande->enabled) && $user->rights->commande->creer)
{
$langs->load("orders");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("CreateOrder").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateOrder").'</a></div>';
}
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
$langs->load("bills");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&projectid='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>';
}
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer)
{
$langs->load("supplier_proposal");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierProposal").'</a></div>';
}
if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->creer)
{
$langs->load("suppliers");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddSupplierOrder").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierOrder").'</a></div>';
}
if (! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer)
{
$langs->load("suppliers");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddSupplierInvoice").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierInvoice").'</a></div>';
}
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer)
{
$langs->load("interventions");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddIntervention").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a></div>';
}
if (! empty($conf->contrat->enabled) && $user->rights->contrat->creer)
{
$langs->load("contracts");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddContract").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddContract").'</a></div>';
}
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer)
{
$langs->load("expensereports");
$langs->load("trips");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddTrip").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddTrip").'</a></div>';
}
if (! empty($conf->don->enabled) && $user->rights->don->creer)
{
$langs->load("donations");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$object->id.'">'.$langs->trans("AddDonation").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddDonation").'</a></div>';
}
}