Enhancement in bookmark module

This commit is contained in:
Laurent Destailleur 2009-01-23 16:03:24 +00:00
parent 31fb99d450
commit 6254a6a217
10 changed files with 161 additions and 139 deletions

View File

@ -40,10 +40,19 @@ function printBookmarksList ($aDb, $aLangs)
$ret = ''; $ret = '';
// Menu bookmark // Menu bookmark
$ret.= '<div class="menu_titre"><a class="vmenu" href="'.DOL_URL_ROOT.'/bookmarks/liste.php">'.$langs->trans('Bookm').'</a></div>'; $ret.= '<div class="menu_titre">';
$ret.= '<table class="nobordernopadding" width="100%"><tr class="no"><td>';
$ret.= '<a class="vmenu" href="'.DOL_URL_ROOT.'/bookmarks/liste.php">'.$langs->trans('Bookm').'</a>';
// $ret.='</div>';
// Menu New bookmark // Menu New bookmark
$ret.= '<div class="menu_contenu"><a class="vsmenu" href="'.DOL_URL_ROOT.'/bookmarks/fiche.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url).'">'; // $ret.= '<div class="menu_contenu">';
$ret.= $langs->trans('NewBookmark').'</a><br></div>'; $ret.= '</td><td align="right">';
$ret.= '<a class="vsmenu" href="'.DOL_URL_ROOT.'/bookmarks/fiche.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url).'">';
// $ret.= $langs->trans('NewBookmark');
$ret.=img_object($langs->trans('AddThisPageToBookmarks'),'bookmark');
$ret.= '</a>';
$ret.= '</td></tr></table>';
$ret.= '</div>';
// Menu with all bookmarks // Menu with all bookmarks
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
{ {

View File

@ -41,7 +41,14 @@ $target=isset($_GET["target"])?$_GET["target"]:$_POST["target"];
*/ */
if ($action == 'add' || $action == 'addproduct') if ($action == 'add' || $action == 'addproduct')
{var_dump($_POST);
if ($_POST["cancel"])
{ {
$urlsource=isset($_GET["urlsource"])?$_GET["urlsource"]:(isset($url)?$url:DOL_URL_ROOT.'/bookmarks/liste.php');
header("Location: ".$urlsource);
exit;
}
$mesg=''; $mesg='';
$bookmark=new Bookmark($db); $bookmark=new Bookmark($db);
@ -50,6 +57,7 @@ if ($action == 'add' || $action == 'addproduct')
$bookmark->url=$url; $bookmark->url=$url;
$bookmark->target=$target; $bookmark->target=$target;
// TODO Remove because this test is now always false
if ($action == 'add' && $_GET["socid"]) // Link to third party card if ($action == 'add' && $_GET["socid"]) // Link to third party card
{ {
require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
@ -63,6 +71,7 @@ if ($action == 'add' || $action == 'addproduct')
$title=$bookmark->title; $title=$bookmark->title;
$url=$bookmark->url; $url=$bookmark->url;
} }
// TODO Remove because this test is now always false
if ($action == 'addproduct' && $_GET["id"]) // Link to product card if ($action == 'addproduct' && $_GET["id"]) // Link to product card
{ {
require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@ -165,7 +174,12 @@ if ($action == 'create')
$liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow")); $liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow"));
$html->select_array('target',$liste,1); $html->select_array('target',$liste,1);
print '</td><td>'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</td></tr>'; print '</td><td>'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'"></td></tr>';
print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateBookmark").'" name="create"> &nbsp; ';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -55,34 +55,6 @@ print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">'; print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Liste des categories
*/
$companystatic->LoadSupplierCateg();
if (sizeof($companystatic->SupplierCategories))
{
print '<table class="liste" width="100%">';
print '<tr class="liste_titre"><td colspan="2">';
print $langs->trans("Category");
print "</td></tr>\n";
$var=True;
foreach ($companystatic->SupplierCategories as $rowid => $label)
{
$var=!$var;
print "<tr $bc[$var]>\n";
print '<td><a href="liste.php?cat='.$rowid.'">'.stripslashes($label).'</a>';
print '</td><td align="right">';
print '<a href="stats.php?cat='.$rowid.'">('.$langs->trans("Stats").')</a>';
print "</tr>\n";
}
print "</table>\n";
print "<br>\n";
}
/* /*
* *
*/ */
@ -248,10 +220,6 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
} }
} }
/*
*
*
*/
print "</td>\n"; print "</td>\n";
print '<td valign="top" width="70%" class="notopnoleft">'; print '<td valign="top" width="70%" class="notopnoleft">';
@ -260,7 +228,7 @@ print '<td valign="top" width="70%" class="notopnoleft">';
* *
*/ */
$max=10; $max=10;
$sql = "SELECT s.rowid as socid, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm"; $sql = "SELECT s.rowid as socid, s.nom, s.ville, s.datec, s.datea, s.tms, st.libelle as stcomm, s.prefix_comm";
$sql.= " , code_fournisseur, code_compta_fournisseur"; $sql.= " , code_fournisseur, code_compta_fournisseur";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
@ -268,7 +236,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI
$sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur=1"; $sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur=1";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql.= " ORDER BY s.datec DESC"; $sql.= " ORDER BY s.tms DESC";
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -281,7 +249,7 @@ if ($resql)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastSuppliers",min($max,$num))."</td>\n"; print '<td colspan="2">'.$langs->trans("BoxTitleLastSuppliers",min($max,$num))."</td>\n";
print '<td align="right">'.$langs->trans("DateCreation")."</td>\n"; print '<td align="right">'.$langs->trans("DateModification")."</td>\n";
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
@ -294,7 +262,7 @@ if ($resql)
print '<td><a href="fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>'; print '<td><a href="fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>';
print "&nbsp;<a href=\"fiche.php?socid=".$obj->socid."\">".$obj->nom."</a></td>\n"; print "&nbsp;<a href=\"fiche.php?socid=".$obj->socid."\">".$obj->nom."</a></td>\n";
print '<td align="left">'.$obj->code_fournisseur.'&nbsp;</td>'; print '<td align="left">'.$obj->code_fournisseur.'&nbsp;</td>';
print '<td align="right">'.dolibarr_print_date($obj->datec,'day').'</td>'; print '<td align="right">'.dolibarr_print_date($obj->tms,'day').'</td>';
print "</tr>\n"; print "</tr>\n";
} }
print "</table>\n"; print "</table>\n";
@ -306,6 +274,35 @@ else
dolibarr_print_error($db); dolibarr_print_error($db);
} }
/*
* List of categories
*/
$companystatic->LoadSupplierCateg();
if (sizeof($companystatic->SupplierCategories))
{
print '<br>';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre"><td colspan="2">';
print $langs->trans("Category");
print "</td></tr>\n";
$var=True;
foreach ($companystatic->SupplierCategories as $rowid => $label)
{
$var=!$var;
print "<tr $bc[$var]>\n";
print '<td><a href="liste.php?cat='.$rowid.'">'.stripslashes($label).'</a>';
print '</td><td align="right">';
print '<a href="stats.php?cat='.$rowid.'">('.$langs->trans("Stats").')</a>';
print "</tr>\n";
}
print "</table>\n";
print "<br>\n";
}
print "</td></tr>\n"; print "</td></tr>\n";
print "</table>\n"; print "</table>\n";

View File

@ -67,7 +67,7 @@ class box_clients extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.datec as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.tms";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -77,7 +77,7 @@ class box_clients extends ModeleBoxes {
{ {
$sql .= " AND s.rowid = $user->societe_id"; $sql .= " AND s.rowid = $user->societe_id";
} }
$sql .= " ORDER BY s.datec DESC "; $sql .= " ORDER BY s.tms DESC ";
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
@ -91,7 +91,7 @@ class box_clients extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->dc); $datem=$objp->tms;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -102,7 +102,7 @@ class box_clients extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($datec, "day")); 'text' => dolibarr_print_date($datem, "day"));
$i++; $i++;
} }

View File

@ -66,7 +66,7 @@ class box_fournisseurs extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.datec as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.tms";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -76,7 +76,7 @@ class box_fournisseurs extends ModeleBoxes {
{ {
$sql .= " AND s.rowid = ".$user->societe_id; $sql .= " AND s.rowid = ".$user->societe_id;
} }
$sql .= " ORDER BY s.datec DESC "; $sql .= " ORDER BY s.tms DESC ";
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
@ -89,7 +89,7 @@ class box_fournisseurs extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->dc); $datem=$objp->tms;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -100,7 +100,7 @@ class box_fournisseurs extends ModeleBoxes {
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($datec, "day")); 'text' => dolibarr_print_date($datem, "day"));
$i++; $i++;
} }

View File

@ -71,7 +71,7 @@ class box_prospect extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.tms";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -81,7 +81,7 @@ class box_prospect extends ModeleBoxes {
{ {
$sql .= " AND s.rowid = ".$user->societe_id; $sql .= " AND s.rowid = ".$user->societe_id;
} }
$sql .= " ORDER BY s.datec DESC"; $sql .= " ORDER BY s.tms DESC";
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
dolibarr_syslog("box_prospect::loadBox sql=".$sql,LOG_DEBUG); dolibarr_syslog("box_prospect::loadBox sql=".$sql,LOG_DEBUG);
@ -95,7 +95,7 @@ class box_prospect extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->dc); $datem=$objp->tms;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -106,7 +106,7 @@ class box_prospect extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($datec, "day")); 'text' => dolibarr_print_date($datem, "day"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3))); 'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3)));

View File

@ -2,3 +2,4 @@
CHARSET=UTF-8 CHARSET=UTF-8
Bookm=Bookmarks Bookm=Bookmarks
NewBookmark=New bookmark NewBookmark=New bookmark
AddThisPageToBookmarks=Add this page to bookmarks

View File

@ -2,3 +2,4 @@
CHARSET=UTF-8 CHARSET=UTF-8
Bookm=Marque pages Bookm=Marque pages
NewBookmark=Nouveau marque page NewBookmark=Nouveau marque page
AddThisPageToBookmarks=Placer cette page dans les marques-pages

View File

@ -23,13 +23,13 @@ BoxTitleNbOfCustomers=Nombre de clients
BoxTitleLastRssInfos=Les %s dernières infos de %s BoxTitleLastRssInfos=Les %s dernières infos de %s
BoxTitleLastProducts=Les %s derniers produits/services enregistrés BoxTitleLastProducts=Les %s derniers produits/services enregistrés
BoxTitleLastCustomerOrders=Les %s dernières commandes clients modifiées BoxTitleLastCustomerOrders=Les %s dernières commandes clients modifiées
BoxTitleLastSuppliers=Les %s derniers fournisseurs enregistrés BoxTitleLastSuppliers=Les %s derniers fournisseurs modifiées
BoxTitleLastCustomers=Les %s derniers clients enregistrés BoxTitleLastCustomers=Les %s derniers clients modifiées
BoxTitleLastCustomersOrProspects=Les %s derniers clients ou prospects enregistrés BoxTitleLastCustomersOrProspects=Les %s derniers clients ou prospects enregistrés
BoxTitleLastPropals=Les %s dernières propositions enregistrés BoxTitleLastPropals=Les %s dernières propositions enregistrés
BoxTitleLastCustomerBills=Les %s dernières factures clients enregistrées BoxTitleLastCustomerBills=Les %s dernières factures clients enregistrées
BoxTitleLastSupplierBills=Les %s dernières factures fournisseurs enregistrées BoxTitleLastSupplierBills=Les %s dernières factures fournisseurs enregistrées
BoxTitleLastProspects=Les %s derniers prospects enregistrés BoxTitleLastProspects=Les %s derniers prospects modifiés
BoxTitleLastProductsInContract=Les %s derniers produits/services contractés BoxTitleLastProductsInContract=Les %s derniers produits/services contractés
BoxTitleOldestUnpayedCustomerBills=Les %s plus anciennes factures clients impayées BoxTitleOldestUnpayedCustomerBills=Les %s plus anciennes factures clients impayées
BoxTitleOldestUnpayedSupplierBills=Les %s plus anciennes factures fournisseurs impayées BoxTitleOldestUnpayedSupplierBills=Les %s plus anciennes factures fournisseurs impayées

View File

@ -629,7 +629,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
/* /*
* Fiche societe en mode edition * Fiche societe en mode edition
*/ */
print_titre($langs->trans("EditCompany")); print_fiche_titre($langs->trans("EditCompany"));
if ($socid) if ($socid)
{ {