From e4db6dc21d18167eef34fe2aa668673854a35770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Mar 2008 14:20:49 +0000 Subject: [PATCH] Add link to supplier unpayd invoices --- htdocs/compta/index.php | 41 +--------------------- htdocs/lib/bookmark.lib.php | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 htdocs/lib/bookmark.lib.php diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9e19c881934..d33036a8de5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -332,45 +332,6 @@ if ($conf->tax->enabled) } -/** - * Bookmark - */ -$sql = "SELECT s.rowid as socid, s.nom, b.rowid as bid"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b"; -$sql .= " WHERE b.fk_soc = s.rowid AND b.fk_user = ".$user->id; -$sql .= " ORDER BY lower(s.nom) ASC"; - -$resql = $db->query($sql); - -if ( $resql ) -{ - $num = $db->num_rows($resql); - $i = 0; - if ($num) - { - print ''; - print "\n"; - $var = True; - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var = !$var; - print ""; - print ''; - print ''; - print ''; - $i++; - } - print '
".$langs->trans("Bookmarks")."
'.$obj->nom.''.img_delete().'
'; - } - $db->free($resql); -} -else -{ - dolibarr_print_error($db); -} - - print ''; @@ -723,7 +684,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $num = $db->num_rows($resql); print ''; - print ''; + print ''; if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print ''; print ''; print ''; diff --git a/htdocs/lib/bookmark.lib.php b/htdocs/lib/bookmark.lib.php new file mode 100644 index 00000000000..689bfcf611d --- /dev/null +++ b/htdocs/lib/bookmark.lib.php @@ -0,0 +1,69 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/lib/invoice.lib.php + \brief Ensemble de fonctions de base pour le module factures + \version $Revision$ + + Ensemble de fonctions de base de dolibarr sous forme d'include +*/ + +function showArrayOfBookmark($fac) +{ + $sql = "SELECT s.rowid as socid, s.nom, b.rowid as bid"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b"; + $sql .= " WHERE b.fk_soc = s.rowid AND b.fk_user = ".$user->id; + $sql .= " ORDER BY lower(s.nom) ASC"; + + $resql = $db->query($sql); + + if ( $resql ) + { + $num = $db->num_rows($resql); + $i = 0; + if ($num) + { + print '
'.$langs->trans("BillsSuppliersUnpayed").' ('.$num.')
'.$langs->trans("BillsSuppliersUnpayed",min($conf->liste_limit,$num)).' ('.$num.')'.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Payed").'
'; + print "\n"; + $var = True; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var = !$var; + print ""; + print ''; + print ''; + print ''; + $i++; + } + print '
".$langs->trans("Bookmarks")."
'.$obj->nom.''.img_delete().'
'; + } + $db->free($resql); + } + else + { + dolibarr_print_error($db); + } +} + +?> \ No newline at end of file