Merge pull request #7395 from tuxgasy/5.0_bug7387

Fix #7387 : filter closed company when create new documents
This commit is contained in:
Laurent Destailleur 2017-09-14 13:26:03 +02:00 committed by GitHub
commit 9e7108ff60
2 changed files with 26 additions and 5 deletions

View File

@ -1513,7 +1513,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td>'; print '</td>';
} else { } else {
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{ {

View File

@ -629,19 +629,40 @@ if ($object->id > 0)
if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer) if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer)
{ {
$langs->load("supplier_proposal"); $langs->load("supplier_proposal");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>'; if ($object->status == 1)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddSupplierProposal").'</a>';
}
} }
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
$langs->load("orders"); $langs->load("orders");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddOrder").'</a>'; if ($object->status == 1)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddOrder").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddOrder").'</a>';
}
} }
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
$langs->load("bills"); $langs->load("bills");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>'; if ($object->status == 1)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
}
} }
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)