Fix: l'activation de fckeditor tait inverse entre les notes et la description produit

This commit is contained in:
Regis Houssin 2007-05-07 14:28:10 +00:00
parent 5aaa72bf86
commit 58a899f25e
7 changed files with 85 additions and 161 deletions

View File

@ -39,13 +39,15 @@ if (!$user->admin)
$modules = array(
'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProductDescription',
'DETAILS' => 'FCKeditorForDetails',
'PRODUCTNOTE' => 'FCKeditorForProductNote',
'DETAILS' => 'FCKeditorForProductDetails',
'MAILING' => 'FCKeditorForMailing'
);
// Conditions pour que l'option soit proposée
$conditions = array(
'SOCIETE' => $conf->societe->enabled,
'PRODUCTDESC' => ($conf->produit->enabled||$conf->service->enabled),
'PRODUCTNOTE' => ($conf->produit->enabled||$conf->service->enabled),
'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled),
'MAILING' => $conf->mailing->enabled
);
@ -83,13 +85,6 @@ $head[$h][1] = $langs->trans("Activation");
$hselected=$h;
$h++;
/*
En attendant d'avoir quelquechose de gérer par cette page, je commente
$head[$h][0] = DOL_URL_ROOT."/admin/fckeditor_cfg.php";
$head[$h][1] = $langs->trans("Setup");
$h++;
*/
dolibarr_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*

View File

@ -1,102 +0,0 @@
<?php
/* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
*
* 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.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/fckeditor_cfg.php
\ingroup fckeditor
\brief Page de configuration du module FCKeditor
\version $Revision$
*/
require("./pre.inc.php");
$langs->load("admin");
$langs->load("fckeditor");
if (!$user->admin)
accessforbidden();
if ($_GET["action"] == 'activate_sending')
{
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1");
Header("Location: confexped.php");
exit;
}
else if ($_GET["action"] == 'disable_sending')
{
dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION");
Header("Location: confexped.php");
exit;
}
else if ($_GET["action"] == 'activate_delivery')
{
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1");
Header("Location: confexped.php");
exit;
}
else if ($_GET["action"] == 'disable_delivery')
{
dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON");
Header("Location: confexped.php");
exit;
}
/*
* Affiche page
*/
llxHeader("","");
$html=new Form($db);
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/fckeditor.php";
$head[$h][1] = $langs->trans("Activation");
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/fckeditor_cfg.php";
$head[$h][1] = $langs->trans("Setup");
$hselected=$h;
$h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Feature").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Action").'</td>';
print "</tr>\n";
print '</table>';
$db->close();
llxFooter();
?>

View File

@ -687,8 +687,9 @@ DeliveriesOrderAbility=Products deliveries receipt ability
##### FCKeditor #####
ActivateFCKeditor=Activate FCKeditor for:
FCKeditorForCompany=WYSIWIG creation/edition of companies description and note
FCKeditorForProductDescription=WYSIWIG creation/edition of products/services description and note
FCKeditorForDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...)
FCKeditorForProductDescription=WYSIWIG creation/edition of products/services description
FCKeditorForProductNote=WYSIWIG creation/edition of products/services note
FCKeditorForProductDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...)
FCKeditorForMailing=WYSIWIG creation/edition of mailings
##### OSCommerce 1 #####
OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be an OSCommerce database.

View File

@ -688,8 +688,9 @@ DeliveriesOrderAbility=Prise en charge des bons de r
##### FCKeditor #####
ActivateFCKeditor=Activer FCKeditor pour :
FCKeditorForCompany=Création/édition WYSIWIG des descriptions et notes des tiers
FCKeditorForProductDescription=Création/édition WYSIWIG des notes des produits/services
FCKeditorForDetails=Création/édition WYSIWIG des lignes details des produits (sur commandes, propales, factures, etc...)
FCKeditorForProductDescription=Création/édition WYSIWIG des descriptions des produits/services
FCKeditorForProductNote=Création/édition WYSIWIG des notes des produits/services
FCKeditorForProductDetails=Création/édition WYSIWIG des lignes details des produits (sur commandes, propales, factures, etc...)
FCKeditorForMailing=Création/édition WYSIWIG des mailings
##### OSCommerce 1 #####
OSCommerceErrorConnectOkButWrongDatabase=La connexion a réussie mais la base ne semble pas etre une base OSCommerce.

View File

@ -423,20 +423,27 @@ class Product
*/
function delete($id)
{
global $user;
global $conf,$user;
if ($user->rights->produit->supprimer)
{
$prod_use = $this->verif_prod_use($id);
if ($prod_use == 0)
{
$sqld = "DELETE from ".MAIN_DB_PREFIX."product ";
$sqld.= " WHERE rowid = ".$id;
$result = $this->db->query($sqld);
$sqla = "DELETE from ".MAIN_DB_PREFIX."product ";
$sqla.= " WHERE rowid = ".$id;
$resulta = $this->db->query($sqla);
$sqlc = "DELETE from ".MAIN_DB_PREFIX."product_price ";
$sqlc.= " WHERE fk_product = ".$id;
$result = $this->db->query($sqlc);
$sqlb = "DELETE from ".MAIN_DB_PREFIX."product_price ";
$sqlb.= " WHERE fk_product = ".$id;
$resultb = $this->db->query($sqlb);
if ($conf->global->MAIN_MULTILANGS)
{
$sqlc = "DELETE from ".MAIN_DB_PREFIX."product_det ";
$sqlc.= " WHERE fk_product = ".$id;
$resultc = $this->db->query($sqlc);
}
return 0;
}
@ -458,48 +465,48 @@ class Product
$current_lang = $langs->getDefaultLang();
foreach ($langs_available as $value)
{
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
{
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
$result = $this->db->query($sql);
$result = $this->db->query($sql);
if ($value == $current_lang)
if ($value == $current_lang)
{
if (mysql_num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."product_det";
$sql2.= " SET label='".addslashes($this->libelle)."',";
$sql2.= " description='".addslashes($this->description)."',";
$sql2.= " note='".addslashes($this->note)."'";
$sql2.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
}
if ($this->db->num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."product_det";
$sql2.= " SET label='".addslashes($this->libelle)."',";
$sql2.= " description='".addslashes($this->description)."',";
$sql2.= " note='".addslashes($this->note)."'";
$sql2.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
$sql2.= " VALUES(".$this->id.",'".$value."','". addslashes($this->libelle);
$sql2.= "','".addslashes($this->description);
$sql2.= "','".addslashes($this->note)."')";
}
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
$sql2.= " VALUES(".$this->id.",'".$value."','". addslashes($this->libelle);
$sql2.= "','".addslashes($this->description);
$sql2.= "','".addslashes($this->note)."')";
}
if (!$this->db->query($sql2)) return -1;
}
else
else
{
if (mysql_num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."product_det";
$sql2.= " SET label='".addslashes($this->multilangs["$value"]["libelle"])."',";
$sql2.= " description='".addslashes($this->multilangs["$value"]["description"])."',";
$sql2.= " note='".addslashes($this->multilangs["$value"]["note"])."'";
$sql2.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
}
if ($this->db->num_rows($result)) // si aucune ligne dans la base
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."product_det";
$sql2.= " SET label='".addslashes($this->multilangs["$value"]["libelle"])."',";
$sql2.= " description='".addslashes($this->multilangs["$value"]["description"])."',";
$sql2.= " note='".addslashes($this->multilangs["$value"]["note"])."'";
$sql2.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
$sql2.= " VALUES(".$this->id.",'".$value."','". addslashes($this->multilangs["$value"]["libelle"]);
$sql2.= "','".addslashes($this->multilangs["$value"]["description"]);
$sql2.= "','".addslashes($this->multilangs["$value"]["note"])."')";
}
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
$sql2.= " VALUES(".$this->id.",'".$value."','". addslashes($this->multilangs["$value"]["libelle"]);
$sql2.= "','".addslashes($this->multilangs["$value"]["description"]);
$sql2.= "','".addslashes($this->multilangs["$value"]["note"])."')";
}
// on ne sauvegarde pas des champs vides
if ( $this->multilangs["$value"]["libelle"] || $this->multilangs["$value"]["description"] || $this->multilangs["$value"]["note"] )

View File

@ -495,7 +495,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
// Description (utilisé dans facture, propale...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc','',160,'dolibarr_notes','',false);
@ -529,7 +529,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
// Note (invisible sur facture, propales...)
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTNOTE)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note','',200,'dolibarr_notes','',false);
@ -846,7 +846,7 @@ if ($_GET["id"] || $_GET["ref"])
// Description (utilisé dans facture, propale...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
print "\n";
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc',$product->description,160,'dolibarr_notes','',false);
@ -886,7 +886,7 @@ if ($_GET["id"] || $_GET["ref"])
// Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTNOTE)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$product->note,200,'dolibarr_notes','',false);

View File

@ -172,8 +172,30 @@ if ($_GET["action"] == 'edit')
print "<br /><b><u>$key :</u></b><br />";
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td><textarea name="desc-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["description"].'</textarea></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td><textarea name="note-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["note"].'</textarea></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc-'.$key.'',$product->multilangs[$key]["description"],160,'dolibarr_notes','',false);
$doleditor->Create();
}
else
{
print '<textarea name="desc-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["description"].'</textarea>';
}
print '</td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTNOTE)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note-'.$key.'',$product->multilangs[$key]["note"],160,'dolibarr_notes','',false);
$doleditor->Create();
}
else
{
print '<textarea name="note-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["note"].'</textarea>';
}
print '</td></tr>';
print '</tr>';
print '</table>';
}