Reduce amount of memory.

This commit is contained in:
Laurent Destailleur 2008-10-25 17:27:15 +00:00
parent 6761e14a9d
commit 211be07fb1
22 changed files with 882 additions and 711 deletions

View File

@ -20,13 +20,14 @@
*/
/**
\file htdocs/admin/dict.php
\ingroup setup
\brief Page to administer data tables
\version $Id$
*/
* \file htdocs/admin/dict.php
* \ingroup setup
* \brief Page to administer data tables
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
$langs->load("other");
$langs->load("admin");
@ -411,6 +412,7 @@ if ($_GET["action"] == $acts[1]) // disable
*/
$html = new Form($db);
$formadmin=new FormAdmin($db);
llxHeader();
@ -712,7 +714,8 @@ function fieldList($fieldlist,$obj='')
global $region_id;
$html = new Form($db);
$formadmin = new FormAdmin($db);
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'pays') {
@ -736,7 +739,7 @@ function fieldList($fieldlist,$obj='')
}
elseif ($fieldlist[$field] == 'lang') {
print '<td>';
$html->select_lang($conf->global->MAIN_LANG_DEFAULT,'lang');
$formadmin->select_lang($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de l'element (pour les type de contact).'

View File

@ -25,6 +25,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
$langs->load("companies");
$langs->load("products");
@ -73,9 +74,14 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update')
}
/*
* View
*/
llxHeader();
$html=new Form($db);
$formadmin=new FormAdmin($db);
print_fiche_titre($langs->trans("GUISetup"),'','setup');
@ -99,7 +105,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
// Langue par defaut
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>';
$html->select_lang($conf->global->MAIN_LANG_DEFAULT,'main_lang_default',1);
$formadmin->select_lang($conf->global->MAIN_LANG_DEFAULT,'main_lang_default',1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';

View File

@ -31,6 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/user.class.php");
require_once(DOL_DOCUMENT_ROOT."/cactioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formactions.class.php");
$langs->load("companies");
$langs->load("commercial");
@ -409,6 +410,7 @@ if ($_POST["action"] == 'update')
llxHeader();
$html = new Form($db);
$htmlactions = new FormActions($db);
/* ************************************************************************** */
/* */
@ -549,7 +551,7 @@ if ($_GET["action"] == 'create')
if ($_REQUEST["afaire"] == 1) $percent=0;
if ($_REQUEST["afaire"] == 2) $percent=100;
}
print $html->form_select_status_action('formaction',$percent,1);
print $htmlactions->form_select_status_action('formaction',$percent,1);
print '</td></tr>';
// Priority
@ -721,7 +723,7 @@ if ($_GET["id"])
// Status
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent=isset($_REQUEST["percentage"])?$_REQUEST["percentage"]:$act->percentage;
print $html->form_select_status_action('formaction',$percent,1);
print $htmlactions->form_select_status_action('formaction',$percent,1);
print '</td></tr>';
// Priority

View File

@ -19,11 +19,11 @@
*/
/**
\file htdocs/compta/commande/fiche.php
\ingroup commande
\brief Fiche commande
\version $Id$
*/
\file htdocs/compta/commande/fiche.php
\ingroup commande
\brief Fiche commande
\version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
@ -43,8 +43,8 @@ if (! $user->rights->commande->lire) accessforbidden();
// Sécurité accès client
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
$action = '';
$socid = $user->societe_id;
}
@ -54,9 +54,9 @@ if ($user->societe_id > 0)
if ($_GET["action"] == 'facturee')
{
$commande = new Commande($db);
$commande->fetch($_GET["id"]);
$commande->classer_facturee();
$commande = new Commande($db);
$commande->fetch($_GET["id"]);
$commande->classer_facturee();
}
// Positionne ref commande client
@ -119,281 +119,295 @@ $formfile = new FormFile($db);
if ($_GET["id"] > 0)
{
$commande = new Commande($db);
if ( $commande->fetch($_GET["id"]) > 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
$commande = new Commande($db);
if ( $commande->fetch($_GET["id"]) > 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$author = new User($db);
$author->id = $commande->user_author_id;
$author->fetch();
$head = commande_prepare_head($commande);
dolibarr_fiche_head($head, 'accountancy', $langs->trans("CustomerOrder"));
dolibarr_fiche_head($head, 'accountancy', $langs->trans("CustomerOrder"));
/*
* Commande
*/
$nbrow=8;
if ($conf->projet->enabled) $nbrow++;
/*
* Commande
*/
$nbrow=8;
if ($conf->projet->enabled) $nbrow++;
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '</tr>';
// Ref
print '<tr><td width="18%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '</tr>';
// Ref commande client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=RefCustomerOrder&amp;id='.$commande->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
// Ref commande client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=RefCustomerOrder&amp;id='.$commande->id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder')
{
print '<form action="fiche.php?id='.$id.'" method="post">';
print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print $commande->ref_client;
}
print '</td>';
print '</tr>';
// Third party
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
print '</tr>';
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
print '. ';
if ($absolute_discount)
{
if ($commande->statut > 0)
{
print '<form action="fiche.php?id='.$id.'" method="post">';
print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="'.$commande->ref_client.'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
}
else
{
print $commande->ref_client;
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter);
}
print '</td>';
print '</tr>';
}
if ($absolute_creditnote)
{
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0)
{
// Si source = propal
$propal = new Propal($db);
$propal->fetch($commande->propale_id);
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>';
}
print '</td>';
print '</tr>';
// Date de livraison
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate');
print '</td>';
if (1 == 2 && $_GET['action'] != 'editdate_livraison' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdate_livraison')
{
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="action" value="setdate_livraison">';
$html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print dolibarr_print_date($commande->date_livraison,'daytext');
}
print '</td>';
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
print nl2br($commande->note_public);
print '</td>';
print '</tr>';
// Société
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
print '</tr>';
// Adresse de livraison
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress');
print '</td>';
// Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
print '. ';
if ($absolute_discount)
{
if ($commande->statut > 0)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
}
else
{
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter);
}
}
if ($absolute_creditnote)
{
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&amp;socid='.$commande->socid.'&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0)
{
// Si source = propal
$propal = new Propal($db);
$propal->fetch($commande->propale_id);
print ' -> <a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id.'">'.$propal->ref.'</a>';
}
print '</td>';
print '</tr>';
if ($_GET['action'] == 'editdelivery_adress')
{
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
}
else
{
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
}
print '</td></tr>';
// Date de livraison
// Conditions et modes de règlement
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($_GET['action'] != 'editconditions' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editconditions')
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id');
}
else
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
}
print '</td></tr>';
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($_GET['action'] != 'editmode' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editmode')
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id');
}
else
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none');
}
print '</td></tr>';
// Projet
if ($conf->projet->enabled)
{
$langs->load('projects');
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate');
print $langs->trans('Project');
print '</td>';
if (1 == 2 && $_GET['action'] != 'editdate_livraison' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
if ($_GET['action'] != 'classer' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classer&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdate_livraison')
if ($_GET['action'] == 'classer')
{
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="action" value="setdate_livraison">';
$html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
}
else
{
print dolibarr_print_date($commande->date_livraison,'daytext');
}
print '</td>';
print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
print nl2br($commande->note_public);
print '</td>';
print '</tr>';
// Adresse de livraison
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress');
print '</td>';
if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_adress&amp;socid='.$commande->socid.'&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editdelivery_adress')
{
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','commande',$commande->id);
}
else
{
$html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->adresse_livraison_id,$_GET['socid'],'none','commande',$commande->id);
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
}
print '</td></tr>';
}
// Conditions et modes de règlement
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
// Lignes de 3 colonnes
if ($_GET['action'] != 'editconditions' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editconditions')
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id');
}
else
{
$html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none');
}
print '</td></tr>';
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($_GET['action'] != 'editmode' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'editmode')
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id');
}
else
{
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none');
}
print '</td></tr>';
// Total HT
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Projet
if ($conf->projet->enabled)
{
$langs->load('projects');
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project');
print '</td>';
if ($_GET['action'] != 'classer' && $commande->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classer&amp;id='.$commande->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($_GET['action'] == 'classer')
{
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
}
else
{
$html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
}
print '</td></tr>';
}
// Total TVA
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right">'.price($commande->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Lignes de 3 colonnes
// Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right">'.price($commande->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Total HT
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td colspan="2">'.$commande->getLibStatut(4).'</td>';
print '</tr>';
// Total TVA
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right">'.price($commande->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right">'.price($commande->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td colspan="2">'.$commande->getLibStatut(4).'</td>';
print '</tr>';
print '</table>';
print '</table>';
/*
* 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, l.fk_remise_except, l.remise_percent, l.subprice,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
$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";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= " WHERE l.fk_commande = ".$commande->id;
$sql.= " ORDER BY l.rang, l.rowid";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
if ($num) print '<br>';
print '<table class="noborder" width="100%">';
if ($num)
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
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="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
$var=true;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
if ($num) print '<br>';
print '<table class="noborder" width="100%">';
if ($num)
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
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="48" colspan="3">&nbsp;</td>';
print "</tr>\n";
}
$var=!$var;
print '<tr '.$bc[$var].'>';
if ($objp->fk_product > 0)
{
print '<td><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>'.stripslashes(nl2br($objp->description)):'';
print '</td>';
}
else
{
print '<td>';
$var=true;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
if ($objp->fk_product > 0)
{
print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
if ($objp->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$objp->ref.'</a>';
$text.= ' - '.$objp->product;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $html->textwithtooltip($text,$description,3,'','',$i);
// Print the start and end dates
print_date_range($objp->date_start,$objp->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}
print '</td>';
}
else
{
print '<td>';
if (($objp->info_bits & 2) == 2)
{
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$commande->socid.'">';
@ -418,77 +432,77 @@ if ($_GET["id"] > 0)
{
print nl2br($objp->description);
}
print "</td>\n";
}
print '<td align="right">'.vatrate($objp->tva_tx).'%</td>';
print "</td>\n";
}
print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx).'%</td>';
print '<td align="right">'.price($objp->subprice)."</td>\n";
print '<td align="right" nowrap="nowrap">'.price($objp->subprice)."</td>\n";
print '<td align="right">';
print '<td align="right">';
if (($objp->info_bits & 2) != 2)
{
print $objp->qty;
}
else print '&nbsp;';
print '</td>';
if ($objp->remise_percent > 0)
{
print '<td align="right">'.$objp->remise_percent."%</td>\n";
}
else
{
print '<td>&nbsp;</td>';
}
if ($objp->remise_percent > 0)
{
print '<td align="right">'.$objp->remise_percent."%</td>\n";
}
else
{
print '<td>&nbsp;</td>';
}
print '<td align="right">'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."</td>\n";
print '<td align="right" nowrap="nowrap">'.price($objp->total_ht)."</td>\n";
print '<td colspan="3">&nbsp;</td>';
print '</tr>';
print '<td colspan="3">&nbsp;</td>';
print '</tr>';
$total = $total + ($objp->qty * $objp->price);
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
print '</table>';
print '</table>';
print '</div>';
print '</div>';
/*
* Boutons actions
*/
/*
* Boutons actions
*/
if (! $user->societe_id && ! $commande->facturee)
{
print "<div class=\"tabsAction\">\n";
if (! $user->societe_id && ! $commande->facturee)
{
print "<div class=\"tabsAction\">\n";
if ($commande->statut > 0 && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;commandeid='.$commande->id.'&amp;socid='.$commande->socid.'">'.$langs->trans("CreateBill").'</a>';
}
if ($commande->statut > 0 && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;commandeid='.$commande->id.'&amp;socid='.$commande->socid.'">'.$langs->trans("CreateBill").'</a>';
}
if ($commande->statut > 0 && $user->rights->commande->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/commande/fiche.php?action=facturee&amp;id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>';
}
print '</div>';
}
if ($commande->statut > 0 && $user->rights->commande->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/commande/fiche.php?action=facturee&amp;id='.$commande->id.'">'.$langs->trans("ClassifyBilled").'</a>';
}
print '</div>';
}
print '<table width="100%"><tr><td width="50%" valign="top">';
/*
* Documents générés
*
*/
* Documents générés
*
*/
$comref = sanitize_string($commande->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
$relativepath = $comref.'/'.$comref.'.pdf';
@ -496,67 +510,67 @@ if ($_GET["id"] > 0)
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
$genallowed=0;
$delallowed=0;
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
/*
* Liste des factures
*/
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate("f.datef")." as df";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."co_fa as cf";
$sql .= " WHERE f.rowid = cf.fk_facture AND cf.fk_commande = ". $commande->id;
/*
* Liste des factures
*/
$sql = "SELECT f.rowid,f.facnumber, f.total_ttc, ".$db->pdate("f.datef")." as df";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."co_fa as cf";
$sql .= " WHERE f.rowid = cf.fk_facture AND cf.fk_commande = ". $commande->id;
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($num)
{
print '<br>';
print_titre($langs->trans("RelatedBills"));
$i = 0; $total = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Ref")."</td>";
print '<td align="center">'.$langs->trans("Date").'</td>';
print '<td align="right">'.$langs->trans("Price").'</td>';
print "</tr>\n";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($num)
{
print '<br>';
print_titre($langs->trans("RelatedBills"));
$i = 0; $total = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Ref")."</td>";
print '<td align="center">'.$langs->trans("Date").'</td>';
print '<td align="right">'.$langs->trans("Price").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="../facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.'</a></td>';
print '<td align="center">'.dolibarr_print_date($objp->df).'</td>';
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
$i++;
}
print "</table>";
}
}
else
{
dolibarr_print_error($db);
}
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="../facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.'</a></td>';
print '<td align="center">'.dolibarr_print_date($objp->df).'</td>';
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
$i++;
}
print "</table>";
}
}
else
{
dolibarr_print_error($db);
}
print '</td><td valign="top" width="50%">';
print '</td><td valign="top" width="50%">';
// List of actions on element
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($commande,'order',$socid);
print "</td></tr></table>";
print "</td></tr></table>";
show_list_sending_receive('commande',$commande->id);
}
else
{
// Commande non trouvée
print "Commande inexistante";
}
}
else
{
// Commande non trouvée
print "Commande inexistante";
}
}
$db->close();

View File

@ -184,11 +184,39 @@ if ($_GET["id"] > 0)
print '</td>';
print '</tr>';
// Société
// Third party
print '<tr><td>'.$langs->trans('Company').'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL');
$absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
print '. ';
if ($absolute_discount)
{
if ($commande->statut > 0)
{
print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->monnaie));
}
else
{
// Remise dispo de type non avoir
$filter='fk_facture_source IS NULL';
print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter);
}
}
if ($absolute_creditnote)
{
print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->monnaie)).'. ';
}
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print '</td></tr>';
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
@ -336,14 +364,16 @@ if ($_GET["id"] > 0)
*/
print '<table class="liste" width="100%">';
$sql = "SELECT cd.fk_product, cd.description, cd.price, sum(cd.qty) as qty, cd.rowid, cd.tva_tx, cd.subprice";
$sql = "SELECT cd.rowid, cd.fk_product, cd.description, cd.price, cd.tva_tx, cd.subprice,";
$sql.= " qty";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.fk_commande = ".$commande->id;
// $sql.= " AND p.fk_product_type <> 1"; Why this line ?
$sql.= " group by (cd.fk_product)";
$sql.= " GROUP by cd.rowid, cd.fk_product";
$sql.= " ORDER BY cd.rowid";
//print $sql;
dolibarr_syslog("commande.php sql=".$sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@ -370,18 +400,33 @@ if ($_GET["id"] > 0)
$reste_a_livrer = array();
while ($i < $num)
{
$product = new Product($db);
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
if ($objp->fk_product > 0)
{
$product = new Product($db);
$product->fetch($objp->fk_product);
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
print img_object($langs->trans("Product"),"product").' '.$product->ref.'</a>';
print $product->libelle?' - '.$product->libelle:'';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
$product->fetch($objp->fk_product);
// LDR Add a product line from object product
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$product->id.'">';
if ($product->type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$product->ref.'</a>';
$text.= ' - '.$product->libelle;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $html->textwithtooltip($text,$description,3,'','',$i);
// Print the start and end dates
print_date_range($objp->date_start,$objp->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}
print '</td>';
}
else
@ -421,18 +466,20 @@ if ($_GET["id"] > 0)
print "</tr>";
// associations sous produits
$product->get_sousproduits_arbo ();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(sizeof($prods_arbo) > 0)
if ($objp->fk_product > 0)
{
foreach($prods_arbo as $key => $value)
$product->get_sousproduits_arbo ();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(sizeof($prods_arbo) > 0)
{
print $value[0];
foreach($prods_arbo as $key => $value)
{
print $value[0];
}
}
}
$i++;
$var=!$var;
}
$db->free($resql);

View File

@ -270,7 +270,7 @@ if ($_GET["action"] == 'create')
print "<tr><td>".$langs->trans("Date")."</td>";
print '<td colspan="3">'.dolibarr_print_date($object->date,"day")."</td></tr>\n";
// Entrepot (si forc<72>)
// Warehouse (id forced)
if ($conf->stock->enabled && $_GET["entrepot_id"])
{
print '<tr><td>'.$langs->trans("Warehouse").'</td>';
@ -288,10 +288,10 @@ if ($_GET["action"] == 'create')
// Delivery method
print "<tr><td>".$langs->trans("DeliveryMethod")."</td>";
print '<td colspan="3">';
$expe->fetch_delivery_methods();
$html->select_array("expedition_method_id",$expe->meths,'',0,0,0,0,"",1);
print "</td></tr>\n";
// Tracking number
print "<tr><td>".$langs->trans("TrackingNumber")."</td>";
print '<td colspan="3">';
@ -336,22 +336,23 @@ if ($_GET["action"] == 'create')
$indiceAsked = 0;
while ($indiceAsked < $numAsked)
{
$product = new Product($db);
$ligne = $object->lignes[$indiceAsked];
$var=!$var;
print "<tr ".$bc[$var].">\n";
if ($ligne->fk_product > 0)
{
$product = new Product($db);
$product->fetch($ligne->fk_product);
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
if ($ligne->desc) print nl2br($ligne->desc);
if ($ligne->desc) print dol_nl2br(dol_htmlcleanlastbr($ligne->desc),1);
print '</td>';
}
else
{var_dump($ligne);
print "<td>".nl2br($ligne->desc)."</td>\n";
{ //var_dump($ligne);
print "<td>".nl2br($ligne->desc)."</td>\n";
}
print '<td align="center">'.$ligne->qty.'</td>';
@ -376,7 +377,7 @@ if ($_GET["action"] == 'create')
if ($defaultqty < 0) $defaultqty=0;
}
// Quantit<EFBFBD> <20> livrer
// Quantity
print '<td align="center">';
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
@ -429,7 +430,7 @@ if ($_GET["action"] == 'create')
}
else
{
// Quantit<EFBFBD> <20> livrer
// Quantity
print '<td align="center">';
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$ligne->id.'">';
print '<input name="qtyl'.$indiceAsked.'" type="text" size="6" value="'.$quantityToBeDelivered.'">';
@ -439,16 +440,19 @@ if ($_GET["action"] == 'create')
print "</tr>\n";
// associations sous produits
$product->get_sousproduits_arbo ();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(sizeof($prods_arbo) > 0)
if ($ligne->fk_product > 0)
{
foreach($prods_arbo as $key => $value)
$product->get_sousproduits_arbo ();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(sizeof($prods_arbo) > 0)
{
print $value[0];
foreach($prods_arbo as $key => $value)
{
print $value[0];
}
}
}
$indiceAsked++;
}

View File

@ -26,6 +26,7 @@
require_once("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
require_once(DOL_DOCUMENT_ROOT."/exports/export.class.php");
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/export/modules_export.php');
@ -73,6 +74,7 @@ $objexport->load_arrays($user,$datatoexport);
$objmodelexport=new ModeleExports();
$html = new Form($db);
$htmlother = new FormOther($db);
$formfile = new FormFile($db);
@ -336,7 +338,7 @@ if ($step == 2 && $datatoexport)
print '<table><tr><td>';
print $langs->trans("SelectExportFields");
print '</td><td>';
$html->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
$htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
print '</td></tr></table>';
print '</form>';

View File

@ -481,46 +481,6 @@ class Form
}
/**
* \brief Retourne la liste déroulante des langues disponibles
* \param selected Langue pré-sélectionnée
* \param htmlname Nom de la zone select
* \param showauto Affiche choix auto
*/
function select_lang($selected='',$htmlname='lang_id',$showauto=0)
{
global $langs;
$langs_available=$langs->get_available_languages();
print '<select class="flat" name="'.$htmlname.'">';
if ($showauto)
{
print '<option value="auto"';
if ($selected == 'auto') print ' selected="true"';
print '>'.$langs->trans("AutoDetectLang").'</option>';
}
$num = count($langs_available);
$i = 0;
if ($num)
{
while ($i < $num)
{
if ($selected == $langs_available[$i])
{
print '<option value="'.$langs_available[$i].'" selected="true">'.$langs_available[$i].'</option>';
}
else
{
print '<option value="'.$langs_available[$i].'">'.$langs_available[$i].'</option>';
}
$i++;
}
}
print '</select>';
}
/**
* \brief Retourne la liste des types de comptes financiers
* \param selected Type pré-sélectionné
@ -1583,45 +1543,6 @@ class Form
}
/**
* \brief Show list of action status
*/
function form_select_status_action($formname,$selected,$canedit=1)
{
global $langs,$conf;
$listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort"));
if ($conf->use_javascript_ajax)
{
print "\n";
print '<script type="text/javascript">'."\n";
print 'function select_status(mypercentage) {'."\n";
print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n";
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
print '}'."\n";
print '</script>'."\n";
print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
foreach($listofstatus as $key => $val)
{
print '<option value="'.$key.'"'.($selected == $key?' selected="true"':'').'>'.$val.'</option>';
}
print '</select>';
if ($selected == 0 || $selected == 100) $canedit=0;
print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
}
else
{
print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%';
}
}
/**
* \brief Retourne la liste des types de paiements possibles
* \param selected Id du type de paiement pré-sélectionné
@ -2274,39 +2195,6 @@ class Form
print '</tr></table></form>';
}
/**
* \brief Affiche formulaire de selection de la remise relative
* \param page Page
* \param selected Valeur remise
* \param htmlname Nom du formulaire select. Si none, non modifiable
*/
function form_remise_percent($page, $selected='', $htmlname='remise_percent')
{
global $langs;
if ($htmlname != "none")
{
print '<form method="post" action="'.$page.'">';
print '<input type="hidden" name="action" value="setremisepercent">';
print '<table class="noborder" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print '<input type="text" name="'.$htmlname.'" size="1" value="'.$selected.'">%';
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
else
{
if ($selected)
{
print $selected;
} else {
print "0%";
}
}
}
/**
* \brief Affiche formulaire de selection de la remise fixe
* \param page Page URL where form is shown
@ -2497,7 +2385,7 @@ class Form
/**
* \brief Selection du taux de tva à appliquer
* \brief Output an HTML select vat rate
* \param name Nom champ html
* \param selectedrate Forçage du taux tva pré-sélectionné. Mettre '' pour aucun forcage.
* \param societe_vendeuse Objet société vendeuse
@ -2619,51 +2507,6 @@ class Form
}
/**
* \brief Selection des unites de mesure
* \param name Nom champ html
* \param measuring_style Le style de mesure : weight, volume,...
* \param default Forçage de l'unite
* \remarks pour l'instant on ne definit pas les unites dans la base
*/
function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
{
global $langs,$conf,$mysoc;
$langs->load("other");
if ($measuring_style == 'weight')
{
$measuring_units[3] = $langs->trans("WeightUnitton");
$measuring_units[0] = $langs->trans("WeightUnitkg");
$measuring_units[-3] = $langs->trans("WeightUnitg");
$measuring_units[-6] = $langs->trans("WeightUnitmg");
}
else if ($measuring_style == 'volume')
{
$measuring_units[0] = $langs->trans("VolumeUnitm3");
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
}
print '<select class="flat" name="'.$name.'">';
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
foreach ($measuring_units as $key => $value)
{
print '<option value="'.$key.'"';
if ($key == $default)
{
print ' selected="true"';
}
print '>'.$value.'</option>';
}
print '</select>';
}
/**
* Affiche zone de selection de date
* Liste deroulante pour les jours, mois, annee et eventuellement heurs et minutes
@ -3180,58 +3023,6 @@ class Form
return $ret;
}
/**
* \brief Retourne la liste des ecotaxes avec tooltip sur le libelle
* \param selected code ecotaxes pre-selectionne
* \param htmlname nom de la liste deroulante
*/
function select_ecotaxes($selected='',$htmlname='ecotaxe_id')
{
global $langs;
$sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,";
$sql.= " p.libelle as pays";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_pays as p";
$sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid";
$sql.= " ORDER BY pays, e.organization ASC, e.code ASC";
if ($this->db->query($sql))
{
print '<select class="flat" name="'.$htmlname.'">';
$num = $this->db->num_rows();
$i = 0;
print '<option value="-1">&nbsp;</option>'."\n";
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object();
if ($selected && $selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" selected="true">';
}
else
{
print '<option value="'.$obj->rowid.'">';
//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
}
$selectOptionValue = $obj->code.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
print $selectOptionValue;
print '</option>';
$i++;
}
}
print '</select>';
return 0;
}
else
{
dolibarr_print_error($this->db);
return 1;
}
}
}
?>

View File

@ -44,6 +44,48 @@ class FormActions
return 1;
}
/**
* \brief Show list of action status
* \param formname Name of form where select in included
* \param selected Preselected value
* \param canedit 1=can edit, 0=read only
*/
function form_select_status_action($formname,$selected,$canedit=1)
{
global $langs,$conf;
$listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort"));
if ($conf->use_javascript_ajax)
{
print "\n";
print '<script type="text/javascript">'."\n";
print 'function select_status(mypercentage) {'."\n";
print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n";
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
print '}'."\n";
print '</script>'."\n";
print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
foreach($listofstatus as $key => $val)
{
print '<option value="'.$key.'"'.($selected == $key?' selected="true"':'').'>'.$val.'</option>';
}
print '</select>';
if ($selected == 0 || $selected == 100) $canedit=0;
print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
}
else
{
print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%';
}
}
/**
* \brief Show list of actions for element
* \param object Object

View File

@ -45,6 +45,46 @@ class FormAdmin
return 1;
}
/**
* \brief Retourne la liste déroulante des langues disponibles
* \param selected Langue pré-sélectionnée
* \param htmlname Nom de la zone select
* \param showauto Affiche choix auto
*/
function select_lang($selected='',$htmlname='lang_id',$showauto=0)
{
global $langs;
$langs_available=$langs->get_available_languages();
print '<select class="flat" name="'.$htmlname.'">';
if ($showauto)
{
print '<option value="auto"';
if ($selected == 'auto') print ' selected="true"';
print '>'.$langs->trans("AutoDetectLang").'</option>';
}
$num = count($langs_available);
$i = 0;
if ($num)
{
while ($i < $num)
{
if ($selected == $langs_available[$i])
{
print '<option value="'.$langs_available[$i].'" selected="true">'.$langs_available[$i].'</option>';
}
else
{
print '<option value="'.$langs_available[$i].'">'.$langs_available[$i].'</option>';
}
$i++;
}
}
print '</select>';
}
/**
* \brief Retourne la liste d<EFBFBD>roulante des menus disponibles (eldy_backoffice, ...)
* \param selected Menu pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>e

View File

@ -0,0 +1,158 @@
<?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.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
* 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.
*/
/**
* \file htdocs/html.formother.class.php
* \brief Fichier de la classe des fonctions prédéfinie de composants html autre
* \version $Id$
*/
/**
* \class FormOther
* \brief Classe permettant la génération de composants html autre
* \remarks Only common components must be here.
*/
class FormOther
{
var $db;
var $error;
/**
* \brief Constructeur
* \param DB handler d'accès base de donnée
*/
function FormOther($DB)
{
$this->db = $DB;
return 1;
}
/**
* \brief Retourne la liste des modèles d'export
* \param selected Id modèle pré-sélectionné
* \param htmlname Nom de la zone select
* \param type Type des modèles recherchés
* \param useempty Affiche valeur vide dans liste
*/
function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0)
{
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " ORDER BY rowid";
$result = $this->db->query($sql);
if ($result)
{
print '<select class="flat" name="'.$htmlname.'">';
if ($useempty)
{
print '<option value="-1">&nbsp;</option>';
}
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" selected="true">';
}
else
{
print '<option value="'.$obj->rowid.'">';
}
print $obj->label;
print '</option>';
$i++;
}
print "</select>";
}
else {
dolibarr_print_error($this->db);
}
}
/**
* \brief Retourne la liste des ecotaxes avec tooltip sur le libelle
* \param selected code ecotaxes pre-selectionne
* \param htmlname nom de la liste deroulante
*/
function select_ecotaxes($selected='',$htmlname='ecotaxe_id')
{
global $langs;
$sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,";
$sql.= " p.libelle as pays";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_pays as p";
$sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid";
$sql.= " ORDER BY pays, e.organization ASC, e.code ASC";
if ($this->db->query($sql))
{
print '<select class="flat" name="'.$htmlname.'">';
$num = $this->db->num_rows();
$i = 0;
print '<option value="-1">&nbsp;</option>'."\n";
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object();
if ($selected && $selected == $obj->rowid)
{
print '<option value="'.$obj->rowid.'" selected="true">';
}
else
{
print '<option value="'.$obj->rowid.'">';
//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
}
$selectOptionValue = $obj->code.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
print $selectOptionValue;
print '</option>';
$i++;
}
}
print '</select>';
return 0;
}
else
{
dolibarr_print_error($this->db);
return 1;
}
}
}
?>

View File

@ -118,6 +118,49 @@ class FormProduct
print '</select>';
}
/**
* \brief Selection des unites de mesure
* \param name Nom champ html
* \param measuring_style Le style de mesure : weight, volume,...
* \param default Forçage de l'unite
* \remarks pour l'instant on ne definit pas les unites dans la base
*/
function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
{
global $langs,$conf,$mysoc;
$langs->load("other");
if ($measuring_style == 'weight')
{
$measuring_units[3] = $langs->trans("WeightUnitton");
$measuring_units[0] = $langs->trans("WeightUnitkg");
$measuring_units[-3] = $langs->trans("WeightUnitg");
$measuring_units[-6] = $langs->trans("WeightUnitmg");
}
else if ($measuring_style == 'volume')
{
$measuring_units[0] = $langs->trans("VolumeUnitm3");
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
}
print '<select class="flat" name="'.$name.'">';
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
foreach ($measuring_units as $key => $value)
{
print '<option value="'.$key.'"';
if ($key == $default)
{
print ' selected="true"';
}
print '>'.$value.'</option>';
}
print '</select>';
}
}
?>

View File

@ -18,14 +18,15 @@
*/
/**
\file htdocs/install/index.php
\ingroup install
\brief Affichage page selectin langue si premiere install.
Si reinstall, passe directement a la page check.php
\version $Id$
*/
* \file htdocs/install/index.php
* \ingroup install
* \brief Affichage page selectin langue si premiere install.
* Si reinstall, passe directement a la page check.php
* \version $Id$
*/
include_once("./inc.php");
include_once("../html.form.class.php");
include_once("../html.formadmin.class.php");
$err = 0;
@ -39,6 +40,12 @@ if (file_exists($conffile) && isset($dolibarr_main_url_root))
}
/*
* View
*/
$formadmin=new FormAdmin($db);
pHeader("", "check"); // Etape suivante = index2
@ -51,8 +58,7 @@ $langs_available=$langs->get_available_languages("..");
print '<br><br><center>';
print '<table><tr>';
print '<td>'.$langs->trans("DefaultLanguage").' : </td><td align="left">';
$html=new Form('');
$html->select_lang('auto','selectlang',1);
$formadmin->select_lang('auto','selectlang',1);
print '</td>';
print '</tr></table></center>';

View File

@ -57,7 +57,7 @@ function fichinter_prepare_head($fichinter)
}
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('Note');
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;

View File

@ -41,7 +41,7 @@ function facturefourn_prepare_head($fac)
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Note');
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;

View File

@ -2678,6 +2678,16 @@ function dol_htmlentitiesbr_decode($stringtodecode,$pagecodeto='UTF-8')
return $ret;
}
/**
* \brief This function remove all ending \n and br at end
* \param stringtodecode String to decode
*/
function dol_htmlcleanlastbr($stringtodecode)
{
$ret=eregi_replace('(<br>|<br( [ a-zA-Z_="]*)?/?>|\n|\r)+$',"",$stringtodecode);
return $ret;
}
/**
* \brief This function is called to decode a HTML string (it decodes entities tags)
* \param string stringhtml

View File

@ -1,4 +1,4 @@
<?php
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -23,56 +23,56 @@
\version $Id$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function facture_prepare_head($fac)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'compta';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('BillContacts');
$head[$h][2] = 'contact';
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Preview');
$head[$h][2] = 'preview';
$h++;
}
if ($fac->mode_reglement_code == 'PRE')
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('StandingOrders');
$head[$h][2] = 'standingorders';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Note');
$head[$h][2] = 'note';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
return $head;
}
*/
function facture_prepare_head($fac)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'compta';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('BillContacts');
$head[$h][2] = 'contact';
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Preview');
$head[$h][2] = 'preview';
$h++;
}
if ($fac->mode_reglement_code == 'PRE')
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('StandingOrders');
$head[$h][2] = 'standingorders';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
return $head;
}
?>

View File

@ -16,19 +16,14 @@
* 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/order.lib.php
\brief Ensemble de fonctions de base pour le module commande
\ingroup commande
\version $Revision$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
* \file htdocs/lib/order.lib.php
* \brief Ensemble de fonctions de base pour le module commande
* \ingroup commande
* \version $Id$
*/
function commande_prepare_head($commande)
{
@ -86,7 +81,7 @@ function commande_prepare_head($commande)
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Note');
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;

View File

@ -72,7 +72,7 @@ function propal_prepare_head($propal)
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('Note');
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;

View File

@ -29,6 +29,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
@ -529,8 +530,13 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
}
/*
* View
*/
$html = new Form($db);
$formproduct = new FormProduct($db);
/*
* Fiche création du produit
@ -639,11 +645,11 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
// Le poids et le volume ne concerne que les produits et pas les services
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print '<input name="weight" size="4" value="">';
print $html->select_measuring_units("weight_units","weight");
print $formproduct->select_measuring_units("weight_units","weight");
print '</td></tr>';
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
print '<input name="volume" size="4" value="">';
print $html->select_measuring_units("volume_units","volume");
print $formproduct->select_measuring_units("volume_units","volume");
print '</td></tr>';
}
@ -1041,11 +1047,11 @@ if ($_GET["id"] || $_GET["ref"])
// Weight / Volume
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
print $html->select_measuring_units("weight_units", "weight", $product->weight_units);
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
print $html->select_measuring_units("volume_units", "volume", $product->volume_units);
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
print '</td></tr>';
}

View File

@ -22,11 +22,11 @@
*/
/**
\file htdocs/product/traduction.php
\ingroup product
\brief Page de traduction des produits
\version $Revision$
*/
\file htdocs/product/traduction.php
\ingroup product
\brief Page de traduction des produits
\version $Revision$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
@ -45,13 +45,13 @@ accessforbidden();
// retour a l'affichage des traduction si annulation
if ($_POST["cancel"] == $langs->trans("Cancel"))
{
$_GET["action"] = '';
$_GET["action"] = '';
}
// Validation de l'ajout
if ($_POST["action"] == 'vadd' &&
$_POST["cancel"] != $langs->trans("Cancel") &&
$user->rights->produit->creer)
if ($_POST["action"] == 'vadd' &&
$_POST["cancel"] != $langs->trans("Cancel") &&
$user->rights->produit->creer)
{
$product = new Product($db);
$product->fetch($_POST["id"]);
@ -70,7 +70,7 @@ if ($_POST["action"] == 'vadd' &&
$product->multilangs[$_POST["lang"]]["description"] = $_POST["desc"];
$product->multilangs[$_POST["lang"]]["note"] = $_POST["note"];
}
// sauvegarde en base
if ( $product->setMultiLangs() > 0 )
{
@ -85,14 +85,14 @@ if ($_POST["action"] == 'vadd' &&
}
// Validation de l'edition
if ($_POST["action"] == 'vedit' &&
$_POST["cancel"] != $langs->trans("Cancel") &&
$user->rights->produit->creer)
if ($_POST["action"] == 'vedit' &&
$_POST["cancel"] != $langs->trans("Cancel") &&
$user->rights->produit->creer)
{
$product = new Product($db);
$product->fetch($_POST["id"]);
$current_lang = $langs->getDefaultLang();
foreach ( $product->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet
{
if ( $key == $current_lang )
@ -108,7 +108,7 @@ if ($_POST["action"] == 'vedit' &&
$product->multilangs[$key]["note"] = $_POST["note-".$key];
}
}
if ( $product->setMultiLangs() > 0 )
{
$_GET["action"] = '';
@ -161,28 +161,28 @@ if ($_GET["action"] == 'edit')
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>';
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">'.dol_htmlentitiesbr_decode($product->multilangs[$key]["description"]).'</textarea>';
}
print '</td></tr>';
{
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">'.dol_htmlentitiesbr_decode($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_PRODUCTDESC)
{
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">'.dol_htmlentitiesbr_decode($product->multilangs[$key]["note"]).'</textarea>';
}
print '</td></tr>';
{
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">'.dol_htmlentitiesbr_decode($product->multilangs[$key]["note"]).'</textarea>';
}
print '</td></tr>';
print '</tr>';
print '</table>';
}
@ -207,7 +207,7 @@ else
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>';
print '</table>';
}
if ( !$cnt_trans ) print '<br />'. $langs->trans('NoTranslation');
if ( !$cnt_trans ) print '<br />'. $langs->trans('NoTranslation');
}
print "</div>\n";
@ -221,11 +221,11 @@ print "</div>\n";
print "\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
if ($user->rights->produit->modifier || $user->rights->produit->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=edit&id='.$product->id.'">'.$langs->trans("Update").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&id='.$product->id.'">'.$langs->trans("Add").'</a>';
}
if ($user->rights->produit->modifier || $user->rights->produit->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=edit&id='.$product->id.'">'.$langs->trans("Update").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&id='.$product->id.'">'.$langs->trans("Add").'</a>';
}
print "\n</div>\n";
@ -237,12 +237,12 @@ if ($_GET["action"] == 'add' || $user->rights->produit->modifier)
{
$langs_available = $langs->get_available_languages();
$current_lang = $langs->getDefaultLang();
// on construit la liste des traduction qui n'existe pas déjà
$select = '<select class="flat" name="lang">';
foreach ($langs_available as $value)
if ( !array_key_exists($value, $product->multilangs) ) // si la traduction n'existe pas
$select.= "<option value='$value'>$value</option>";
if ( !array_key_exists($value, $product->multilangs) ) // si la traduction n'existe pas
$select.= "<option value='$value'>$value</option>";
$select.='</select>';
print '<form action="" method="post">';
@ -260,7 +260,7 @@ if ($_GET["action"] == 'add' || $user->rights->produit->modifier)
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
llxFooter('$Date$ - $Revision$');

View File

@ -24,6 +24,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
$langs->load("companies");
$langs->load("products");
@ -60,6 +61,7 @@ $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAI
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
$html = new Form($db);
$formadmin=new FormAdmin($db);
/*
@ -156,7 +158,7 @@ if ($_GET["action"] == 'edit')
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
$html=new Form($db);
$html->select_lang($fuser->conf->MAIN_LANG_DEFAULT,'main_lang_default',1);
$formadmin->select_lang($fuser->conf->MAIN_LANG_DEFAULT,'main_lang_default',1);
print '</td></tr>';
// Taille max des listes