|
@@ -504,7 +504,7 @@ if ($id > 0)
|
|
|
$sql2.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
|
|
|
|
|
|
$resql2=$db->query($sql2);
|
|
|
- $num2 = $db->num_rows($resql2);
|
|
|
+ $orders2invoice = $db->num_rows($resql2);
|
|
|
$db->free($resql2);
|
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
@@ -512,8 +512,8 @@ if ($id > 0)
|
|
|
print '<tr class="liste_titre">';
|
|
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' ('.$num.')</a></td>';
|
|
|
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
|
|
- if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
|
|
- else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
|
|
+ //if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
|
|
+ //else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
|
|
print '</tr></table></td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
@@ -777,12 +777,17 @@ if ($id > 0)
|
|
|
if ($user->rights->facture->creer)
|
|
|
{
|
|
|
$langs->load("bills");
|
|
|
+
|
|
|
+ if($orders2invoice > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a>';
|
|
|
+ else print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a>';
|
|
|
+
|
|
|
if ($object->client != 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
|
|
|
else print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a>';
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a>';
|
|
|
+ print '<a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a>';
|
|
|
}
|
|
|
}
|
|
|
}
|