Support bookmark add of product cards

This commit is contained in:
Laurent Destailleur 2008-09-04 17:56:55 +00:00
parent 33ad422c76
commit 31eaa7c163
8 changed files with 79 additions and 49 deletions

View File

@ -1,5 +1,18 @@
English Dolibarr changelog
***** Changelog for 2.5 compared to 2.4 *****
For users:
- Support bookmark add of product cards.
- New view in ecm module.
For translators:
- The errors language file contains only error or warning messages with
prefix Error or Warning.
For developers:
- Update skeletons.
***** Changelog for 2.4 compared to 2.2 *****

View File

@ -40,31 +40,45 @@ $target=isset($_GET["target"])?$_GET["target"]:$_POST["target"];
* Actions
*/
if ($action == 'add')
if ($action == 'add' || $action == 'addproduct')
{
$mesg='';
$bookmark=new Bookmark($db);
$bookmark->fk_user=$user->id;
if ($_GET["socid"]) // Lien vers fiche comm société
$bookmark->title=$title;
$bookmark->url=$url;
$bookmark->target=$target;
if ($action == 'add' && $_GET["socid"]) // Link to third party card
{
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
$langs->load("companies");
$societe=new Societe($db);
$societe->fetch($_GET["socid"]);
$bookmark->fk_soc=$societe->id;
$bookmark->url=DOL_URL_ROOT.'/soc.php?socid='.$societe->id;
$bookmark->target='0';
$bookmark->title=$societe->nom;
$bookmark->title=$langs->trans("ThirdParty").' '.$societe->nom;
//$bookmark->title=$societe->nom;
$title=$bookmark->title;
$url=$bookmark->url;
}
else
if ($action == 'addproduct' && $_GET["id"]) // Link to product card
{
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle"));
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink"));
$bookmark->title=$title;
$bookmark->url=$url;
$bookmark->target=$target;
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
$langs->load("products");
$product=new Product($db);
$product->fetch($_GET["id"]);
$bookmark->url=DOL_URL_ROOT.'/product/fiche.php?id='.$product->id;
$bookmark->target='0';
$bookmark->title=($product->type != 1 ?$langs->trans("Product"):$langs->trans("Service")).' '.$product->ref;
//$bookmark->title=$product->ref;
$title=$bookmark->title;
$url=$bookmark->url;
}
if (! $title) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle"));
if (! $url) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink"));
if (! $mesg)
{
@ -89,8 +103,6 @@ if ($action == 'add')
$mesg='<div class="error">'.$bookmark->error.'</div>';
}
$action='create';
$title=$bookmark->title;
$url=$bookmark->url;
}
}
else
@ -160,7 +172,7 @@ if ($action == 'create')
}
if ($_GET["id"] > 0)
if ($_GET["id"] > 0 && ! eregi('^add',$_GET["action"]))
{
/*
* Fiche bookmark en mode edition
@ -200,5 +212,4 @@ $db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -14,18 +14,15 @@
* 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.
*
* $Id$
* $Source$
*/
/**
\file htdocs/bookmarks/liste.php
\brief Page affichage des bookmarks
\ingroup bookmark
\version $Revision$
*/
* \file htdocs/bookmarks/liste.php
* \brief Page affichage des bookmarks
* \ingroup bookmark
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/bookmarks/bookmark.class.php");
@ -54,6 +51,7 @@ if ($_GET["action"] == 'delete')
if ($res > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
@ -63,7 +61,7 @@ if ($_GET["action"] == 'delete')
/*
* Affichage liste
* View
*/
llxHeader();
@ -124,7 +122,7 @@ if ($resql)
$lien="Dolibarr";
if (! $obj->title)
{
// Pour compatibilite avec anciens bookmarks
// For compatibility with old Dolibarr bookmarks
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
$societe=new Societe($db);
$societe->fetch($obj->rowid);
@ -150,11 +148,11 @@ if ($resql)
if ($obj->target == 1) print $langs->trans("BookmarkTargetNewWindowShort");
print "</td>\n";
// Auteur
// Author
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->login."</a></td>\n";
// Date creation
print '<td align="center">'.dolibarr_print_date($obj->dateb) ."</td>";
print '<td align="center">'.dolibarr_print_date($obj->dateb,'day') ."</td>";
// Actions
print "<td>";

View File

@ -18,7 +18,7 @@ ErrorSupplierCodeAlreadyUsed=Supplier code already used
ErrorBadParameters=Bad parameters
ErrorFailedToWriteInDir=Failed to write in directory %s
ErrorFoundBadEmailInFile=Found incorrect email syntax for %s lines in file (example line %s with email=%s)
UserCannotBeDelete=User can not be deleted. May be it is associated on Dolibarr entities.
ErrorUserCannotBeDelete=User can not be deleted. May be it is associated on Dolibarr entities.
ErrorFieldsRequired=Some required fields were not filled.
ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter <b>safe_mode</b> is enabled on this PHP, check that Dolibarr php files owns to web server user (or group).
ErrorNoMailDefinedForThisUser=No mail defined for this user
@ -28,6 +28,7 @@ ErrorLeftMenuMustHaveAParentId=A menu of type 'Left' must have a parent id.
ErrorGenbarCodeNotfound=File not found (Bad path, wrong permissions or access denied by openbasedir parameter)
ErrorFunctionNotAvailableInPHP=Function <b>%s</b> is required for this feature but is not available in this version/setup of PHP.
ErrorDirAlreadyExists=A directory with this name already exists.
WarningAllowUrlFopenMustBeOn=Parameter <b>allow_url_fopen</b> must be set to <b>on</b> in filer <b>php.ini</b> for having this module working completely. You must modify this file manually.
ErrorFieldCanNotContainSpecialCharacters=Field <b>%s</b> must not contains special characters.
WarningBuildScriptNotRunned=Script <b>%s</b> was not yet ran to build graphics.
WarningAllowUrlFopenMustBeOn=Parameter <b>allow_url_fopen</b> must be set to <b>on</b> in filer <b>php.ini</b> for having this module working completely. You must modify this file manually.
WarningBuildScriptNotRunned=Script <b>%s</b> was not yet ran to build graphics.
WarningBookmarkAlreadyExists=A bookmark with this title or this target (URL) already exists.

View File

@ -1,6 +1,4 @@
# Dolibarr language file - es_ES - errors
ErrorDuplicateTrigger=Un archvio trigger de nombre '<b>%s</b>' está cargado. Elimine el dobre de la carpeta '<b>%s</b>'.
ErrorFailToDeleteFile=Error al eliminar el archivo '<b>%s</b>'.
ErrorThisContactIsAlreadyDefinedAsThisType=Este contacto ya está definido como contacto para este tipo.
@ -16,7 +14,7 @@ ErrorSupplierCodeRequired=C
ErrorSupplierCodeAlreadyUsed=Código de proveedor ya utilizado
ErrorBadParameters=Parámetros incorrectos
ErrorFailedToWriteInDir=Imposible escribir en la carpeta %s
UserCannotBeDelete=El usuario no puede ser eliminado. Quizá esé asociado a elementos de Dolibarr.
ErrorUserCannotBeDelete=El usuario no puede ser eliminado. Quizá esé asociado a elementos de Dolibarr.
ErrorFieldsRequired=No se indicaron algunos campos obligatorios
ErrorFailedToCreateDir=Error en la creación de una carpeta. Compruebe que el usuario del servidor Web tiene derechos de escritura en las carpetas de documentos de Dolibarr. Si el parámetro <b>safe_mode</b> está activo en este PHP, Compruebe que los archivos php dolibarr pertenecen al usuario del servidor Web.
ErrorNoMailDefinedForThisUser=E-Mail no definido para este usuario

View File

@ -18,7 +18,7 @@ ErrorSupplierCodeAlreadyUsed=Code fournisseur deja utilise
ErrorBadParameters=Parametres incorrects
ErrorFailedToWriteInDir=Impossible d'écrire dans le répertoire %s
ErrorFoundBadEmailInFile=Syntaxe de mail incorrecte trouvée pour %s lignes dans le fichier (exemple line %s avec email=%s)
UserCannotBeDelete=L'utilisateur ne peut pas etre supprimée. Peut-être est-il associé à des éléments de Dolibarr.
ErrorUserCannotBeDelete=L'utilisateur ne peut pas etre supprimée. Peut-être est-il associé à des éléments de Dolibarr.
ErrorFieldsRequired=Des champs obligatoires n'ont pas été renseignés
ErrorFailedToCreateDir=Echec a la creation d'un repertoire. Verifiez que le user du serveur Web a bien les droits d'ecriture dans les repertoires documents de Dolibarr. Si le parametre <b>safe_mode</b> a été activé sur ce PHP, vérifier que les fichiers php dolibarr appartiennent à l'utilisateur du serveur Web.
ErrorNoMailDefinedForThisUser=EMail non defini pour cet utilisateur
@ -28,6 +28,7 @@ ErrorLeftMenuMustHaveAParentId=Un menu de type 'Left' doit avoir un id de p
ErrorGenbarCodeNotfound=Fichier introuvable (Mauvais chemin, permissions incorrectes ou accès interdit par le paramètre openbasedir)
ErrorFunctionNotAvailableInPHP=La fonction <b>%s</b> est requise pour cette fonctionnalité mais n'est pas disponible dans cette version/installation de PHP.
ErrorDirAlreadyExists=Un répertoire portant ce nom existe déjà.
WarningAllowUrlFopenMustBeOn=Attention, le paramètre <b>allow_url_fopen</b> doit etre positionné à <b>on</b> dans le fichier <b>php.ini</b> pour que ce module soit pleinement opérationnel. Vous devez modifier ce fichier manuellement.
ErrorFieldCanNotContainSpecialCharacters=Le champ <b>%s</b> ne peut contenir de caractères spéciaux.
WarningBuildScriptNotRunned=Le script <b>%s</b> n'a pas encore été lancé pour générer les graphiques.
WarningAllowUrlFopenMustBeOn=Attention, le paramètre <b>allow_url_fopen</b> doit etre positionné à <b>on</b> dans le fichier <b>php.ini</b> pour que ce module soit pleinement opérationnel. Vous devez modifier ce fichier manuellement.
WarningBuildScriptNotRunned=Le script <b>%s</b> n'a pas encore été lancé pour générer les graphiques.
WarningBookmarkAlreadyExists=Un marque-page avec ce titre ou cette destination (URL) existe déjà.

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
@ -19,9 +19,9 @@
*/
/**
\file htdocs/lib/product.lib.php
\brief Ensemble de fonctions de base pour le module produit et service
\version $Id$
* \file htdocs/lib/product.lib.php
* \brief Ensemble de fonctions de base pour le module produit et service
* \version $Id$
*/
function product_prepare_head($product, $user)
@ -45,7 +45,7 @@ function product_prepare_head($product, $user)
$head[$h][2] = 'photos';
$h++;
//affichage onglet cat<61>gorie
// Show category tab
if ($conf->categorie->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$product->id;
@ -54,7 +54,7 @@ function product_prepare_head($product, $user)
$h++;
}
// Affichage onglet code barre
// Show barcode tab
if ($conf->global->MAIN_MODULE_BARCODE)
{
$head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id;
@ -72,7 +72,7 @@ function product_prepare_head($product, $user)
$h++;
}
// sousproduits
// Sub products
if($conf->global->PRODUIT_SOUSPRODUITS == 1)
{
$head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id;
@ -122,11 +122,19 @@ function product_prepare_head($product, $user)
{
foreach ($product->onglets as $onglet)
{
$head[$h] = $onglet;
$h++;
$head[$h] = $onglet;
$h++;
}
}
if ($conf->bookmark->enabled && $user->rights->bookmark->creer)
{
$head[$h][0] = DOL_URL_ROOT."/bookmarks/fiche.php?action=addproduct&amp;id=".$product->id."&amp;urlsource=".$_SERVER["PHP_SELF"]."?id=".$product->id;
$head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark');
$head[$h][2] = 'image';
$h++;
}
return $head;
}

View File

@ -115,7 +115,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
if ($result < 0)
{
$langs->load("errors");
$message='<div class="error">'.$langs->trans("UserCannotBeDelete").'</div>';
$message='<div class="error">'.$langs->trans("ErrorUserCannotBeDelete").'</div>';
}
else
{