From 2617fc21a69c821c80315856f8dea7c6817bef9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Oct 2012 11:43:39 +0200 Subject: [PATCH] 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. --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/commande/liste.php | 12 ++++++++++-- htdocs/commande/orderstoinvoice.php | 6 +----- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/langs/en_US/orders.lang | 3 +++ htdocs/langs/fr_FR/orders.lang | 3 +++ 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ee3f627f073..4415fb05229 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2529,10 +2529,10 @@ class Commande extends CommonOrder * Return clicable link of object (with eventually picto) * * @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 $short Use short labels - * @return string String with URL + * @return string String with URL */ function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) { diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index b3ea2328866..1a8afa7fef5 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -126,7 +126,7 @@ if ($sall) } if ($viewstatut <> '') { - if ($viewstatut < 4 && $viewstatut > -2) + if ($viewstatut < 4 && $viewstatut > -3) { $sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee 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)) 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) { @@ -215,6 +220,8 @@ if ($resql) $title.=' - '.$langs->trans('StatusOrderCanceledShort'); if ($viewstatut == -2) $title.=' - '.$langs->trans('StatusOrderToProcessShort'); + if ($viewstatut == -3) + $title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill'); $param='&socid='.$socid.'&viewstatut='.$viewstatut; if ($ordermonth) $param.='&ordermonth='.$ordermonth; @@ -233,6 +240,7 @@ if ($resql) // Lignes des champs de filtre print '
'; + print ''; print ''; @@ -297,7 +305,7 @@ if ($resql) print '
'; print ''; print '
'; - print $generic_commande->getNomUrl(1,$objp->fk_statut); + print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut)); print ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 512da366ea8..c807b4b8327 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -540,12 +540,8 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { $soc = new Societe($db); $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'); $num = $db->num_rows($resql); print_fiche_titre($title); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 0f4b477264d..c23ca4caaed 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -951,10 +951,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) if (! empty($conf->commande->enabled)) { $langs->load("orders"); - if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (! empty($conf->facture->enabled)) $newmenu->add("/commande/liste.php?leftmenu=orders&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/customer.php", $langs->trans("GenerateBill"), 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); } // Donations diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 3aadefcf239..9a626731e8c 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -33,6 +33,7 @@ StatusOrderSent=Shipment in process StatusOrderOnProcessShort=Reception StatusOrderProcessedShort=Processed StatusOrderToBillShort=Delivered +StatusOrderToBill2Short=To bill StatusOrderApprovedShort=Approved StatusOrderRefusedShort=Refused StatusOrderToProcessShort=To process @@ -44,6 +45,7 @@ StatusOrderValidated=Validated StatusOrderOnProcess=Waiting to receive StatusOrderProcessed=Processed StatusOrderToBill=Delivered +StatusOrderToBill2=To bill StatusOrderApproved=Approved StatusOrderRefused=Refused StatusOrderReceivedPartially=Partially received @@ -52,6 +54,7 @@ ShippingExist=A shipment exists DraftOrWaitingApproved=Draft or approved not yet ordered DraftOrWaitingShipped=Draft or validated not yet shipped MenuOrdersToBill=Orders delivered +MenuOrdersToBill2=Orders to bill SearchOrder=Search order Sending=Sending Sendings=Sendings diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index d8c72f32201..04dc0184800 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -33,6 +33,7 @@ StatusOrderSentShort=Envoi en cours StatusOrderSent=Envoi en cours StatusOrderProcessedShort=Traitée StatusOrderToBillShort=Délivrée +StatusOrderToBill2Short=A facturer StatusOrderApprovedShort=Approuvée StatusOrderRefusedShort=Refusée StatusOrderToProcessShort=A traiter @@ -44,6 +45,7 @@ StatusOrderValidated=Validée StatusOrderOnProcess=Attente réception StatusOrderProcessed=Traitée StatusOrderToBill=Délivrée +StatusOrderToBill2=A facturer StatusOrderApproved=Approuvée StatusOrderRefused=Refusée 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 SearchOrder=Rechercher une commande MenuOrdersToBill=Commandes délivrées +MenuOrdersToBill2=Commandes à facturer Sending=Expédition Sendings=Expéditions ShipProduct=Expédier produit