Skip to content

Commit

Permalink
Fix #7387 : filter clsed company when create new documents
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxgasy committed Sep 14, 2017
1 parent 6d40f79 commit f098335
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion htdocs/commande/card.php
Expand Up @@ -1513,7 +1513,7 @@
print '</td>';
} else {
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) AND status=1', 'SelectThirdParty');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{
Expand Down
29 changes: 25 additions & 4 deletions htdocs/fourn/card.php
Expand Up @@ -629,19 +629,40 @@
if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer)
{
$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");
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)
{
$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)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/commande/card.php
Expand Up @@ -1427,7 +1427,7 @@
}
else
{
print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty');
}
print '</td>';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/facture/card.php
Expand Up @@ -1480,7 +1480,7 @@
}
else
{
print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company($societe->id, 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty');
}
print '</td></tr>';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/supplier_proposal/card.php
Expand Up @@ -1079,7 +1079,7 @@
print '</td>';
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty');
print $form->select_company('', 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty');
print '</td>';
}
print '</tr>' . "\n";
Expand Down

0 comments on commit f098335

Please sign in to comment.