Amlioration de la possibilit d'diter ou non les description produit dans les formulaires

Ajout de la possibilit d'afficher ou pas la description produit dans les formulaire
Ajout de la possibilit d'utiliser fckeditor dans la description des produits personnaliss des formulaires
Modifs esthtiques mineures
This commit is contained in:
Regis Houssin 2007-07-26 16:32:30 +00:00
parent 3d914a73ea
commit 75b5b3c4c7
10 changed files with 331 additions and 197 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
*
* 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,6 +40,7 @@ $modules = array(
'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails',
'DETAILS_PERSO' => 'FCKeditorForProductDetailsPerso',
'MAILING' => 'FCKeditorForMailing',
'MEMBER' => 'FCKeditorForMembers'
);
@ -48,6 +49,7 @@ $conditions = array(
'SOCIETE' => $conf->societe->enabled,
'PRODUCTDESC' => ($conf->produit->enabled||$conf->service->enabled),
'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled),
'DETAILS_PERSO' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled),
'MAILING' => $conf->mailing->enabled,
'MEMBER' => $conf->adherent->enabled
);
@ -56,6 +58,7 @@ $picto = array(
'SOCIETE' => 'company',
'PRODUCTDESC' => 'product',
'DETAILS' => 'generic',
'DETAILS_PERSO' => 'generic',
'MAILING' => 'email',
'MEMBER' => 'user'
);
@ -66,7 +69,7 @@ foreach($modules as $const => $desc)
if ($_GET["action"] == 'activate_'.strtolower($const))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1");
//si fckeditor est activé dans la description produit/service, on l'active dans les documents
// Si fckeditor est activé dans la description produit/service, on l'active dans les formulaires
if ($const == 'PRODUCTDESC')
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1");
@ -77,10 +80,12 @@ foreach($modules as $const => $desc)
if ($_GET["action"] == 'disable_'.strtolower($const))
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const);
//si fckeditor est desactivé dans les documents, on le désactive dans la description produit/service
// Si fckeditor est desactivé dans les formulaires,
// on le désactive dans la description produit/service et dans la description personnalisée
if ($const == 'DETAILS')
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_PRODUCTDESC");
dolibarr_del_const($db, "FCKEDITOR_ENABLE_DETAILS_PERSO");
}
Header("Location: fckeditor.php");
exit;

View File

@ -113,7 +113,6 @@ else if ($_POST["action"] == 'sousproduits')
else if ($_POST["action"] == 'changeproductdesc')
{
dolibarr_set_const($db, "PRODUIT_CHANGE_PROD_DESC", $_POST["activate_changeproductdesc"]);
dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", 0);
Header("Location: produit.php");
exit;
}
@ -264,22 +263,20 @@ print "</td>";
print '</tr>';
print '</form>';
if ($conf->global->PRODUIT_CHANGE_PROD_DESC == 0)
{
// Visualiser description produit dans les formulaires activation/desactivation
$var=!$var;
print "<form method=\"post\" action=\"produit.php\">";
print "<input type=\"hidden\" name=\"action\" value=\"viewProdDescInForm\">";
print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("ViewProductDescInFormAbility").'</td>';
print '<td width="60" align="right">';
print $html->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>";
print '</tr>';
print '</form>';
}
// Visualiser description produit dans les formulaires activation/desactivation
$var=!$var;
print "<form method=\"post\" action=\"produit.php\">";
print "<input type=\"hidden\" name=\"action\" value=\"viewProdDescInForm\">";
print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("ViewProductDescInFormAbility").'</td>';
print '<td width="60" align="right">';
print $html->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>";
print '</tr>';
print '</form>';
// Utilisation de l'écotaxe
$var=!$var;

View File

@ -505,13 +505,15 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
}
// La description de la ligne est celle saisie ou
// celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini)
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
$desc=$_POST['np_desc'];
if (! $desc && $conf->global->PRODUIT_CHANGE_PROD_DESC)
// celle du produit si PRODUIT_CHANGE_PROD_DESC est défini
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
$desc = $prod->description;
}
else
{
$desc = $_POST['np_desc'];
}
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
}
@ -851,7 +853,7 @@ if ($_GET['propalid'] > 0)
print '</tr>';
// date de livraison (conditonné sur PROPALE_ADD_SHIPPING_DATE car carac à
// date de livraison (conditionné sur PROPALE_ADD_SHIPPING_DATE car carac à
// gérer par les commandes et non les propal
if ($conf->expedition->enabled)
{
@ -1045,9 +1047,7 @@ if ($_GET['propalid'] > 0)
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
$var=true;
@ -1068,26 +1068,21 @@ if ($_GET['propalid'] > 0)
if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service');
else print img_object($langs->trans('ShowProduct'),'product');
print ' '.$objp->ref.'</a>';
print ' - '.nl2br($objp->product);
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{
print '<br>'.nl2br($objp->product_desc);
}
print ' - '.nl2br(stripslashes($objp->product));
print_date_range($objp->date_start,$objp->date_end);
if ($objp->date_start && $objp->date_end)
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
}
else
{
print '<br>'.nl2br($objp->product_desc);
}
}
if ($objp->date_start && ! $objp->date_end)
{
print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
}
if (! $objp->date_start && $objp->date_end)
{
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
}
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
print '</td>';
}
else
@ -1116,18 +1111,7 @@ if ($_GET['propalid'] > 0)
else
{
print nl2br($objp->description);
if ($objp->date_start && $objp->date_end)
{
print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
}
if ($objp->date_start && ! $objp->date_end)
{
print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
}
if (! $objp->date_start && $objp->date_end)
{
print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
}
print_date_range($objp->date_start,$objp->date_end);
}
print "</td>\n";
}
@ -1293,13 +1277,10 @@ if ($_GET['propalid'] > 0)
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td colspan="4">&nbsp;</td>';
print "</tr>\n";
// Ajout produit produits/services personalisés
// Ajout produit produits/services personnalisés
print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#add" method="post">';
print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
print '<input type="hidden" name="action" value="addligne">';
@ -1307,7 +1288,19 @@ if ($_GET['propalid'] > 0)
$var=true;
print '<tr '.$bc[$var].">\n";
print '<td><textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea></td>';
print '<td>';
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
}
print '</td>';
print '<td align="center">';
if($societe->tva_assuj == "0")
{
@ -1329,6 +1322,21 @@ if ($_GET['propalid'] > 0)
// Ajout de produits/services prédéfinis
if ($conf->produit->enabled)
{
print '<tr class="liste_titre">';
print '<td colspan="3">';
if ($conf->service->enabled)
{
print $langs->trans('RecordedProductsAndServices');
}
else
{
print $langs->trans('RecordedProducts');
}
print '</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#add" method="post">';
print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
print '<input type="hidden" name="action" value="addligne">';
@ -1336,7 +1344,7 @@ if ($_GET['propalid'] > 0)
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td colspan="2">';
print '<td colspan="3">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
{
@ -1347,9 +1355,23 @@ if ($_GET['propalid'] > 0)
$html->select_produits('','idprod','',$conf->produit->limit_size);
}
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
print '<textarea cols="70" name="np_desc" rows="'.ROWS_2.'" class="flat"></textarea>';
if (! $conf->global->PRODUIT_CHANGE_PROD_DESC)
{
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea cols="70" name="np_desc" rows="'.ROWS_2.'" class="flat"></textarea>';
}
}
print '</td>';
print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" size="2" name="qty" value="1"></td>';
print '<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="'.$societe->remise_client.'">%</td>';
@ -1396,7 +1418,7 @@ if ($_GET['propalid'] > 0)
*/
print '<div class="tabsAction">';
if ($_GET['action'] != 'statut')
if ($_GET['action'] != 'statut' && $_GET['action'] <> 'editline')
{
// Valid

View File

@ -256,56 +256,58 @@ if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->facture->creer)
*/
if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
{
if ($_POST['qty'] && (($_POST['pu'] && $_POST['desc']) || $_POST['idprod']))
if ($_POST['qty'] && (($_POST['pu'] && $_POST['np_desc']) || $_POST['idprod']))
{
$commande = new Commande($db);
$ret=$commande->fetch($_POST['id']);
$soc = new Societe($db, $commande->socid);
$soc->fetch($commande->socid);
if ($ret < 0)
{
$commande = new Commande($db);
$ret=$commande->fetch($_POST['id']);
$soc = new Societe($db, $commande->socid);
$soc->fetch($commande->socid);
dolibarr_print_error($db,$commande->error);
exit;
}
if ($ret < 0)
{
dolibarr_print_error($db,$commande->error);
exit;
}
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod->fetch($_POST['idprod']);
$libelle = $prod->libelle;
// multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1)
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod->fetch($_POST['idprod']);
$libelle = $prod->libelle;
// multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1)
{
$pu = $prod->multiprices[$soc->price_level];
}
else
else
{
$pu=$prod->price;
}
// La description de la ligne est celle saisie ou
// celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini)
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
$desc=$_POST['np_desc'];
if (! $desc && $conf->global->PRODUIT_CHANGE_PROD_DESC)
{
// La description de la ligne est celle saisie ou
// celle du produit si PRODUIT_CHANGE_PROD_DESC est défini
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
$desc = $prod->description;
}
else
{
$desc=$_POST['np_desc'];
}
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
}
else
{
$pu=$_POST['pu'];
$tva_tx=$_POST['tva_tx'];
$desc=$_POST['np_desc'];
}
$tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
}
else
{
$pu=$_POST['pu'];
$tva_tx=$_POST['tva_tx'];
$desc=$_POST['desc'];
}
$commande->addline(
$_POST['id'],
@ -1264,7 +1266,8 @@ else
/*
* Lignes de commandes
*/
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,';
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, ';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,';
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid, ';
$sql.= ' p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
@ -1288,9 +1291,7 @@ else
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
$var=true;
@ -1310,13 +1311,22 @@ else
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service');
else print img_object($langs->trans('ShowProduct'),'product');
print ' '.$objp->ref.'</a> - '.nl2br($objp->product);
print ($objp->description && $objp->description!=$objp->product)?'<br>'.nl2br($objp->description):'';
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
print ' '.$objp->ref.'</a>';
print ' - '.nl2br(stripslashes($objp->product));
print_date_range($objp->date_start,$objp->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print '<br>'.nl2br($objp->product_desc);
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
print ($objp->description && $objp->description!=$objp->product)?'<br>'.nl2br(stripslashes($objp->description)):'';
}
else
{
print '<br>'.nl2br($objp->product_desc);
}
}
print '</td>';
}
else
@ -1487,20 +1497,29 @@ else
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
// Ajout produit produits/services personalisés
// Ajout produit produits/services personnalisés
print '<form action="fiche.php?id='.$id.'#add" method="post">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="addligne">';
$var=true;
print '<tr '.$bc[$var].'>';
print ' <td><textarea cols="70" name="desc" rows="1"></textarea></td>';
print '<td>';
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
}
print '</td>';
print '<td align="center">';
if($soc->tva_assuj == "0")
print '<input type="hidden" name="tva_tx" value="0">0';
@ -1516,28 +1535,66 @@ else
print '</form>';
// Ajout de produits/services prédéfinis
print '<form action="fiche.php?id='.$id.'#add" method="post">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="addligne">';
if ($conf->produit->enabled)
{
print '<tr class="liste_titre">';
print '<td colspan="3">';
if ($conf->service->enabled)
{
print $langs->trans('RecordedProductsAndServices');
}
else
{
print $langs->trans('RecordedProducts');
}
print '</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'#add" method="post">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="addligne">';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td colspan="2">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
else
$html->select_produits('','idprod','',$conf->produit->limit_size);
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
print '<textarea cols="70" name="np_desc" rows="1"></textarea>';
print '</td>';
print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" size="2" name="qty" value="1"></td>';
print '<td align="right" nowrap="nowrap"><input type="text" size="1" name="remise_percent" value="'.$soc->remise_client.'">%</td>';
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td colspan="3">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
{
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
}
else
{
$html->select_produits('','idprod','',$conf->produit->limit_size);
}
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
if (! $conf->global->PRODUIT_CHANGE_PROD_DESC)
{
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea cols="70" name="np_desc" rows="'.ROWS_2.'" class="flat"></textarea>';
}
}
print '</td>';
print '<td align="right"><input type="text" size="2" name="qty" value="1"></td>';
print '<td align="right" nowrap="nowrap"><input type="text" size="1" name="remise_percent" value="'.$soc->remise_client.'">%</td>';
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'"></td>';
print '</tr>';
print '</form>';
print '</form>';
}
}
print '</table>';
print '</div>';
@ -1545,7 +1602,7 @@ else
/*
* Boutons actions
*/
if ($user->societe_id == 0)
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
{
print '<div class="tabsAction">';

View File

@ -713,7 +713,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
*/
if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') && $user->rights->facture->creer)
{
if ($_POST['qty'] && (($_POST['pu']!='' && $_POST['desc']) || $_POST['idprod']))
if ($_POST['qty'] && (($_POST['pu']!='' && $_POST['np_desc']) || $_POST['idprod']))
{
$fac = new Facture($db);
$ret=$fac->fetch($_POST['facid']);
@ -773,13 +773,15 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
}
// La description de la ligne est celle saisie ou
// celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini)
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
$desc=$_POST['desc'];
if (! $desc && $conf->global->PRODUIT_CHANGE_PROD_DESC)
// celle du produit si PRODUIT_CHANGE_PROD_DESC défini
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
$desc = $prod->description;
}
else
{
$desc=$_POST['np_desc'];
}
$tva_tx = get_default_tva($mysoc,$fac->client,$prod->tva_tx);
}
@ -787,7 +789,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
{
$pu=$_POST['pu'];
$tva_tx=$_POST['tva_tx'];
$desc=$_POST['desc'];
$desc=$_POST['np_desc'];
}
// Insere ligne
@ -1104,31 +1106,6 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
}
}
/*********************************************************************
*
* Fonctions internes
*
**********************************************************************/
function print_date_range($date_start,$date_end)
{
global $langs;
if ($date_start && $date_end)
{
print ' ('.$langs->trans('DateFromTo',dolibarr_print_date($date_start),dolibarr_print_date($date_end)).')';
}
if ($date_start && ! $date_end)
{
print ' ('.$langs->trans('DateFrom',dolibarr_print_date($date_start)).')';
}
if (! $date_start && $date_end)
{
print ' ('.$langs->trans('DateUntil',dolibarr_print_date($date_end)).')';
}
}
llxHeader('',$langs->trans('Bill'),'Facture');
$html = new Form($db);
@ -2231,9 +2208,7 @@ else
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td align="right" width="50">'.$langs->trans('TotalHT').'</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="16">&nbsp;</td>';
print '<td width="12">&nbsp;</td>';
print '<td width="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
@ -2257,12 +2232,17 @@ else
print ' '.$objp->ref.'</a>';
print ' - '.nl2br(stripslashes($objp->product));
print_date_range($objp->date_start,$objp->date_end);
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
// \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print '<br>'.nl2br($objp->product_desc);
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
{
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
}
else
{
print '<br>'.nl2br($objp->product_desc);
}
}
print '</td>';
@ -2445,7 +2425,7 @@ else
/*
* Ajouter une ligne
*/
if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid')
if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
{
print '<tr class="liste_titre">';
print '<td>';
@ -2455,10 +2435,7 @@ else
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td colspan="4">&nbsp;</td>';
print "</tr>\n";
// Ajout produit produits/services personalisés
@ -2468,8 +2445,19 @@ else
$var=true;
print '<tr '.$bc[$var].'>';
print '<td colspan="1">';
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
print '<td>';
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
}
print '</td>';
print '<td align="right">';
if($soc->tva_assuj == "0")
print '<input type="hidden" name="tva_tx" value="0">0';
@ -2496,29 +2484,65 @@ else
// Ajout de produits/services prédéfinis
if ($conf->produit->enabled)
{
print '<form name="addligne_predef" action="'.$_SERVER['PHP_SELF'].'#add" method="post">';
print '<tr class="liste_titre">';
print '<td colspan="3">';
if ($conf->service->enabled)
{
print $langs->trans('RecordedProductsAndServices');
}
else
{
print $langs->trans('RecordedProducts');
}
print '</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER['PHP_SELF'].'#add" method="post">';
print '<input type="hidden" name="facid" value="'.$fac->id.'">';
print '<input type="hidden" name="action" value="addligne_predef">';
$var=! $var;
print '<tr '.$bc[$var].'>';
print '<td colspan="2">';
print '<td colspan="3">';
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
{
$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
}
else
$html->select_produits('','idprod','',$conf->produit->limit_size);
{
$html->select_produits('','idprod','',$conf->produit->limit_size);
}
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
print '<td>&nbsp;</td>';
if (! $conf->global->PRODUIT_CHANGE_PROD_DESC)
{
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('np_desc','',100,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea cols="70" name="np_desc" rows="'.ROWS_2.'" class="flat"></textarea>';
}
}
print '</td>';
print '<td align="right"><input type="text" name="qty" value="'.($fac->type==2?'-1':'1').'" size="2"></td>';
print '<td align="right" nowrap><input type="text" name="remise_percent" size="1" value="'.$soc->remise_client.'">%</td>';
print '<td align="center" valign="middle" rowspan="2" colspan="5"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '<td align="center" valign="middle" colspan="5"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
if ($conf->service->enabled)
{
print '<tr '.$bc[$var].'>';
print '<td colspan="5">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
print $html->select_date('','date_start_predef',0,0,1,"addligne_predef");
print ' '.$langs->trans('to').' ';
print $html->select_date('','date_end_predef',0,0,1,"addligne_predef");

View File

@ -722,6 +722,7 @@ FCKeditorForCompany=WYSIWIG creation/edition of companies description and note
FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note
FCKeditorForMembers=WYSIWIG creation/edition of members description and note
FCKeditorForProductDetails=WYSIWIG creation/edition of details lines for all entities (proposals, orders, invoices, etc...)
FCKeditorForProductDetailsPerso=WYSIWIG creation/edition of description for all personalized products (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

@ -115,3 +115,5 @@ PriceQty=Price for this quantity
PriceQtyHT=Price for this quantity HT
PriceQtyTTC=Price for this quantity TTC
NoPriceDefinedForThisSupplier=No price/qty defined for this supplier/product
RecordedProducts=Products recorded
RecordedProductsAndServices=Products/services recorded

View File

@ -724,6 +724,7 @@ FCKeditorForCompany=Cr
FCKeditorForProduct=Création/édition WYSIWIG des descriptions et notes des produits/services
FCKeditorForMembers=Création/édition WYSIWIG des descriptions et notes des adhérents
FCKeditorForProductDetails=Création/édition WYSIWIG des lignes details des produits (sur commandes, propales, factures, etc...)
FCKeditorForProductDetailsPerso=Création/édition WYSIWIG des descriptions des produits personnalisées (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

@ -115,3 +115,5 @@ PriceQty=Prix pour la quantit
PriceQtyHT=Prix pour la quantité HT
PriceQtyTTC=Prix pour la quantité TTC
NoPriceDefinedForThisSupplier=Aucun prix/qté défini pour ce fournisseur/produit
RecordedProducts=Produits en vente
RecordedProductsAndServices=Produits/services en vente

View File

@ -2904,4 +2904,27 @@ function make_substitutions($chaine,$substitutionarray)
return $result;
}
/*
* \brief Formate l'affichage de date de début et de fin
* \param date_start date de début
* \param date_end date de fin
*/
function print_date_range($date_start,$date_end)
{
global $langs;
if ($date_start && $date_end)
{
print ' ('.$langs->trans('DateFromTo',dolibarr_print_date($date_start),dolibarr_print_date($date_end)).')';
}
if ($date_start && ! $date_end)
{
print ' ('.$langs->trans('DateFrom',dolibarr_print_date($date_start)).')';
}
if (! $date_start && $date_end)
{
print ' ('.$langs->trans('DateUntil',dolibarr_print_date($date_end)).')';
}
}
?>