From 4e65d12a0fb56669dc99576fc319cfe29ecf7b64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Apr 2012 17:43:32 +0200 Subject: [PATCH] Fix: The draft view must be at same place for all pages. We will have to discuss to move all or not later. --- htdocs/fourn/commande/index.php | 248 ++++++++++++++++---------------- 1 file changed, 125 insertions(+), 123 deletions(-) diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 565c5adff1c..22ef3d72e8b 100755 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012-2012 Vinicius Nogueira + * Copyright (C) 2012-2012 Vinicius Nogueira * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ $langs->load("orders"); /* * View - */ +*/ llxHeader('',$langs->trans("SuppliersOrdersArea")); @@ -56,7 +56,7 @@ print ''; /* * Search form - */ +*/ $var=false; print ''; print ''; @@ -71,7 +71,7 @@ print "

\n"; /* * Statistics - */ +*/ $sql = "SELECT count(cf.rowid), fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -149,9 +149,9 @@ else /* * Legends / Status - * - * Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles - * Reason: Show all Status and give the possibility to filter only one + * + * Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles + * Reason: Show all Status and give the possibility to filter only one */ $sql = "SELECT count(cf.rowid), fk_statut"; @@ -167,36 +167,81 @@ $sql.= " GROUP BY cf.fk_statut"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - print ''; + print '
'; - print ''; - print ''; - print "\n"; - $var=True; + print ''; + print ''; + print "\n"; + $var=True; - while ($i < $num) + while ($i < $num) { - $row = $db->fetch_row($resql); - $var=!$var; + $row = $db->fetch_row($resql); + $var=!$var; - print ""; - print ''; - print ''; + print ""; + print ''; + print ''; - print "\n"; - $i++; + print "\n"; + $i++; } - print "
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$langs->trans($commandestatic->statuts[$row[1]]).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).'
'.$langs->trans($commandestatic->statuts[$row[1]]).''.$row[0].' '.$commandestatic->LibStatut($row[1],3).'

"; - $db->free($resql); + print "
"; + $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } + +/* + * Draft orders + */ + +if ($conf->fournisseur->enabled) +{ + $sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE c.fk_soc = s.rowid"; + $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.fk_statut = 0"; + if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + + $resql=$db->query($sql); + if ($resql) + { + print ''; + print ''; + print ''; + $langs->load("orders"); + $num = $db->num_rows($resql); + if ($num) + { + $i = 0; + $var = True; + while ($i < $num) + { + $var=!$var; + $obj = $db->fetch_object($resql); + print ""; + print '"; + print ''; + $i++; + } + } + print "
'.$langs->trans("DraftOrders").'
'; + print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'

"; + } +} + + /* * List of users allowed */ @@ -252,7 +297,7 @@ print ''; /* * Last modified orders - */ +*/ $max=5; $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid,"; @@ -320,118 +365,75 @@ if ($resql) } else dol_print_error($db); -/* - * Commandes brouillons - */ - // Drafts position of the box changed to a better visualization - -if ($conf->fournisseur->enabled) -{ - $sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND c.fk_statut = 0"; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - - $resql=$db->query($sql); - if ($resql) - { - print ''; - print ''; - print ''; - $langs->load("orders"); - $num = $db->num_rows($resql); - if ($num) - { - $i = 0; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - print '"; - print ''; - $i++; - } - } - print "
'.$langs->trans("DraftOrders").'
'; - print "rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'

"; - } -} /* * Orders to process - */ - /* +*/ +/* $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid"; - $sql.=" FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND c.fk_statut = 1"; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; - if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - $sql.= " ORDER BY c.rowid DESC"; +$sql.=" FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; +$sql.= ", ".MAIN_DB_PREFIX."societe as s"; +if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE c.fk_soc = s.rowid"; +$sql.= " AND c.entity = ".$conf->entity; +$sql.= " AND c.fk_statut = 1"; +if ($socid) $sql.= " AND c.fk_soc = ".$socid; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +$sql.= " ORDER BY c.rowid DESC"; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); +$resql=$db->query($sql); +if ($resql) +{ +$num = $db->num_rows($resql); - print ''; - print ''; - print ''; +print '
'.$langs->trans("OrdersToProcess").' ('.$num.')
'; +print ''; +print ''; - if ($num) - { - $i = 0; - $var = True; - while ($i < $num) - { - $var=!$var; - $obj = $db->fetch_object($resql); - print ""; - print '"; +print '
'.$langs->trans("OrdersToProcess").' ('.$num.')
'; +if ($num) +{ +$i = 0; +$var = True; +while ($i < $num) +{ +$var=!$var; +$obj = $db->fetch_object($resql); +print "
'; - $commandestatic->id=$obj->rowid; - $commandestatic->ref=$obj->ref; +$commandestatic->id=$obj->rowid; +$commandestatic->ref=$obj->ref; - print ''; - print ''; +print '
'; - print $commandestatic->getNomUrl(1); - print '
'; +print ''; - print ''; +print ''; - print '
'; +print $commandestatic->getNomUrl(1); +print ''; - print ' '; - print ''; +print ' '; +print ''; - $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; - $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); - print '
'; +print '
'; +$filename=dol_sanitizeFileName($obj->ref); +$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); +$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; +$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); +print '
'; - print ''; +print ''; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).''; +print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).''; - print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; +print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; - print ''; - $i++; - } - } +print ''; +$i++; +} +} - print "
"; - } - */ +print "
"; +} +*/ print '';