Some fix: List of invoices to show in "to bill" menu must contains

"Validated, Shipment in process, Delivered" (some users may want to
make invoice before shipment, some after).
We keep workflow opened by default. Module workflow may restrict this
however.
Also, remove menu entry, because we now have direct link to page onto
list.
This commit is contained in:
Laurent Destailleur 2012-10-03 11:43:39 +02:00
parent a347b996b5
commit 2617fc21a6
6 changed files with 22 additions and 12 deletions

View File

@ -2529,10 +2529,10 @@ class Commande extends CommonOrder
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param int $option Where point the link * @param int $option Where point the link (0=> main card, 1,2 => shipment)
* @param int $max Max length to show * @param int $max Max length to show
* @param int $short Use short labels * @param int $short Use short labels
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
{ {

View File

@ -126,7 +126,7 @@ if ($sall)
} }
if ($viewstatut <> '') if ($viewstatut <> '')
{ {
if ($viewstatut < 4 && $viewstatut > -2) if ($viewstatut < 4 && $viewstatut > -3)
{ {
$sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee $sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee
if ($viewstatut == 3) if ($viewstatut == 3)
@ -143,6 +143,11 @@ if ($viewstatut <> '')
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
$sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
} }
if ($viewstatut == -3) // To bill
{
$sql.= ' AND c.fk_statut in (1,2,3)';
$sql.= ' AND c.facture = 0'; // invoice not created
}
} }
if ($ordermonth > 0) if ($ordermonth > 0)
{ {
@ -215,6 +220,8 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderCanceledShort'); $title.=' - '.$langs->trans('StatusOrderCanceledShort');
if ($viewstatut == -2) if ($viewstatut == -2)
$title.=' - '.$langs->trans('StatusOrderToProcessShort'); $title.=' - '.$langs->trans('StatusOrderToProcessShort');
if ($viewstatut == -3)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill');
$param='&socid='.$socid.'&viewstatut='.$viewstatut; $param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($ordermonth) $param.='&ordermonth='.$ordermonth;
@ -233,6 +240,7 @@ if ($resql)
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -297,7 +305,7 @@ if ($resql)
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding" nowrap="nowrap">'; print '<td class="nobordernopadding" nowrap="nowrap">';
print $generic_commande->getNomUrl(1,$objp->fk_statut); print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut));
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';

View File

@ -540,12 +540,8 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs))
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
$title = $langs->trans('ListOfOrders');
}
else
{
$title = $langs->trans('ListOfOrders');
} }
$title = $langs->trans('ListOfOrders');
$title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill');
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_fiche_titre($title); print_fiche_titre($title);

View File

@ -951,10 +951,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$langs->load("orders"); $langs->load("orders");
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&amp;viewstatut=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&amp;viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); // if ($leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
// Does this link is required now we have link into "Orders to bill" list ?
if ($leftmenu=="orders") $newmenu->add("/commande/customer.php", $langs->trans("GenerateBill"), 1, $user->rights->commande->lire); //if ($leftmenu=="orders") $newmenu->add("/commande/customer.php", $langs->trans("GenerateBill"), 1, $user->rights->commande->lire);
} }
// Donations // Donations

View File

@ -33,6 +33,7 @@ StatusOrderSent=Shipment in process
StatusOrderOnProcessShort=Reception StatusOrderOnProcessShort=Reception
StatusOrderProcessedShort=Processed StatusOrderProcessedShort=Processed
StatusOrderToBillShort=Delivered StatusOrderToBillShort=Delivered
StatusOrderToBill2Short=To bill
StatusOrderApprovedShort=Approved StatusOrderApprovedShort=Approved
StatusOrderRefusedShort=Refused StatusOrderRefusedShort=Refused
StatusOrderToProcessShort=To process StatusOrderToProcessShort=To process
@ -44,6 +45,7 @@ StatusOrderValidated=Validated
StatusOrderOnProcess=Waiting to receive StatusOrderOnProcess=Waiting to receive
StatusOrderProcessed=Processed StatusOrderProcessed=Processed
StatusOrderToBill=Delivered StatusOrderToBill=Delivered
StatusOrderToBill2=To bill
StatusOrderApproved=Approved StatusOrderApproved=Approved
StatusOrderRefused=Refused StatusOrderRefused=Refused
StatusOrderReceivedPartially=Partially received StatusOrderReceivedPartially=Partially received
@ -52,6 +54,7 @@ ShippingExist=A shipment exists
DraftOrWaitingApproved=Draft or approved not yet ordered DraftOrWaitingApproved=Draft or approved not yet ordered
DraftOrWaitingShipped=Draft or validated not yet shipped DraftOrWaitingShipped=Draft or validated not yet shipped
MenuOrdersToBill=Orders delivered MenuOrdersToBill=Orders delivered
MenuOrdersToBill2=Orders to bill
SearchOrder=Search order SearchOrder=Search order
Sending=Sending Sending=Sending
Sendings=Sendings Sendings=Sendings

View File

@ -33,6 +33,7 @@ StatusOrderSentShort=Envoi en cours
StatusOrderSent=Envoi en cours StatusOrderSent=Envoi en cours
StatusOrderProcessedShort=Traitée StatusOrderProcessedShort=Traitée
StatusOrderToBillShort=Délivrée StatusOrderToBillShort=Délivrée
StatusOrderToBill2Short=A facturer
StatusOrderApprovedShort=Approuvée StatusOrderApprovedShort=Approuvée
StatusOrderRefusedShort=Refusée StatusOrderRefusedShort=Refusée
StatusOrderToProcessShort=A traiter StatusOrderToProcessShort=A traiter
@ -44,6 +45,7 @@ StatusOrderValidated=Validée
StatusOrderOnProcess=Attente réception StatusOrderOnProcess=Attente réception
StatusOrderProcessed=Traitée StatusOrderProcessed=Traitée
StatusOrderToBill=Délivrée StatusOrderToBill=Délivrée
StatusOrderToBill2=A facturer
StatusOrderApproved=Approuvée StatusOrderApproved=Approuvée
StatusOrderRefused=Refusée StatusOrderRefused=Refusée
StatusOrderReceivedPartially=Reçu partiellement StatusOrderReceivedPartially=Reçu partiellement
@ -53,6 +55,7 @@ DraftOrWaitingApproved=Brouillon ou approuvée pas encore commandée
DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée
SearchOrder=Rechercher une commande SearchOrder=Rechercher une commande
MenuOrdersToBill=Commandes délivrées MenuOrdersToBill=Commandes délivrées
MenuOrdersToBill2=Commandes à facturer
Sending=Expédition Sending=Expédition
Sendings=Expéditions Sendings=Expéditions
ShipProduct=Expédier produit ShipProduct=Expédier produit