From 211be07fb12714a1cd796c36eafceb380bcb8c27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Oct 2008 17:27:15 +0000 Subject: [PATCH] Reduce amount of memory. --- htdocs/admin/dict.php | 17 +- htdocs/admin/ihm.php | 8 +- htdocs/comm/action/fiche.php | 6 +- htdocs/compta/commande/fiche.php | 684 +++++++++++++++--------------- htdocs/expedition/commande.php | 79 +++- htdocs/expedition/fiche.php | 32 +- htdocs/exports/export.php | 4 +- htdocs/html.form.class.php | 211 +-------- htdocs/html.formactions.class.php | 42 ++ htdocs/html.formadmin.class.php | 40 ++ htdocs/html.formother.class.php | 158 +++++++ htdocs/html.formproduct.class.php | 43 ++ htdocs/install/index.php | 22 +- htdocs/lib/fichinter.lib.php | 2 +- htdocs/lib/fourn.lib.php | 2 +- htdocs/lib/functions.lib.php | 10 + htdocs/lib/invoice.lib.php | 106 ++--- htdocs/lib/order.lib.php | 17 +- htdocs/lib/propal.lib.php | 2 +- htdocs/product/fiche.php | 14 +- htdocs/product/traduction.php | 90 ++-- htdocs/user/param_ihm.php | 4 +- 22 files changed, 882 insertions(+), 711 deletions(-) create mode 100644 htdocs/html.formother.class.php diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index a186668c890..e5f43346673 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -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 ''; - $html->select_lang($conf->global->MAIN_LANG_DEFAULT,'lang'); + $formadmin->select_lang($conf->global->MAIN_LANG_DEFAULT,'lang'); print ''; } // Le type de l'element (pour les type de contact).' diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index cb2cc6a71f9..a8c1c91e0e2 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -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 ''.$langs->trans("DefaultLanguage").''; - $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 ''; print ' '; print ''; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 9e7db4266c0..4f115db8b96 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -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 ''; // Priority @@ -721,7 +723,7 @@ if ($_GET["id"]) // Status print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $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 ''; // Priority diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 31de82f8eac..c0cb2bee667 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -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 ''; + print '
'; - // Ref - print ''; - print ''; - print ''; + // Ref + print ''; + print ''; + print ''; - // Ref commande client - print ''; + print ''; + + + // Third party + print ''; + print ''; + print ''; + + // Discounts for third party + print ''; - print ''; + } + 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 ''; + + // Date + print ''; + print ''; + print ''; + print ''; + + // Date de livraison + print ''; + print ''; + print ''; - // Société - print ''; - print ''; - print ''; + // Adresse de livraison + print ''; - print ''; - print ''; - print ''; + 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 ''; - // Date de livraison + // Conditions et modes de règlement + print ''; + print ''; + + // Projet + if ($conf->projet->enabled) + { + $langs->load('projects'); print ''; - print ''; - print ''; - - - // Adresse de livraison - print ''; + } - // Conditions et modes de règlement - print ''; - print ''; + // Total HT + print ''; + print ''; + print ''; - // Projet - if ($conf->projet->enabled) - { - $langs->load('projects'); - print ''; - } + // Total TVA + print ''; + print ''; - // Lignes de 3 colonnes + // Total TTC + print ''; + print ''; - // Total HT - print ''; - print ''; - print ''; + // Statut + print ''; + print ''; + print ''; - // Total TVA - print ''; - print ''; - - // Total TTC - print ''; - print ''; - - // Statut - print ''; - print ''; - print ''; - - print '
'.$langs->trans('Ref').''.$commande->ref.'
'.$langs->trans('Ref').''.$commande->ref.'
'; - print ''; - if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder') + // Ref commande client + print '
'; + print ''; + if ($_GET['action'] != 'RefCustomerOrder' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('RefCustomer').''; + print ''.img_edit($langs->trans('Modify')).'
'; + print '
'; + if ($user->rights->commande->creer && $_GET['action'] == 'RefCustomerOrder') + { + print '
'; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $commande->ref_client; + } + print '
'.$langs->trans('Company').''.$soc->getNomUrl(1,'compta').'
'.$langs->trans('Discounts').''; + 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 '
'; - print ''; - print ''; - print ' '; - print '
'; + 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 '
'; + $html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter); } - print '
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'daytext').''.$langs->trans('Source').' : '.$commande->getLabelSource(); + if ($commande->source == 0) + { + // Si source = propal + $propal = new Propal($db); + $propal->fetch($commande->propale_id); + print ' -> '.$propal->ref.''; + } + print '
'; + print ''; + + if (1 == 2 && $_GET['action'] != 'editdate_livraison' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryDate'); + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; + print '
'; + if ($_GET['action'] == 'editdate_livraison') + { + print '
'; + print ''; + $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison"); + print ''; + print '
'; + } + else + { + print dolibarr_print_date($commande->date_livraison,'daytext'); + } + print '
'.$langs->trans('NotePublic').' :
'; + print nl2br($commande->note_public); + print '
'.$langs->trans('Company').''.$soc->getNomUrl(1,'compta').'
'; + print ''; - // Ligne info remises tiers - print ''; + if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('DeliveryAddress'); + print '
'.$langs->trans('Discounts').''; - 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 '
'; - $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 '
socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; + print '
'; - // Date - print '
'.$langs->trans('Date').''.dolibarr_print_date($commande->date,'daytext').''.$langs->trans('Source').' : '.$commande->getLabelSource(); - if ($commande->source == 0) - { - // Si source = propal - $propal = new Propal($db); - $propal->fetch($commande->propale_id); - print ' -> '.$propal->ref.''; - } - print '
'; + print ''; + + if ($_GET['action'] != 'editconditions' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentConditionsShort'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + 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 '
'; + print ''; + if ($_GET['action'] != 'editmode' && $commande->brouillon) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print '
'; + 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 '
'; print ''; - - if (1 == 2 && $_GET['action'] != 'editdate_livraison' && $commande->brouillon) print ''; + if ($_GET['action'] != 'classer' && $commande->brouillon) print ''; print '
'; - print $langs->trans('DeliveryDate'); + print $langs->trans('Project'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).''.img_edit($langs->trans('SetProject')).'
'; print '
'; - if ($_GET['action'] == 'editdate_livraison') + if ($_GET['action'] == 'classer') { - print '
'; - print ''; - $html->select_date($commande->date_livraison,'liv_','','','',"setdate_livraison"); - print ''; - print '
'; + $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 '
'.$langs->trans('NotePublic').' :
'; - print nl2br($commande->note_public); - print '
'; - print ''; - - if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; - print '
'; - - 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 '
'; - print ''; + // Lignes de 3 colonnes - if ($_GET['action'] != 'editconditions' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print '
'; - 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 '
'; - print ''; - if ($_GET['action'] != 'editmode' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; - print '
'; - 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 '
'.$langs->trans('AmountHT').''.price($commande->total_ht).''.$langs->trans('Currency'.$conf->monnaie).'
'; - print ''; - if ($_GET['action'] != 'classer' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('Project'); - print ''.img_edit($langs->trans('SetProject')).'
'; - print '
'; - 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 '
'.$langs->trans('AmountVAT').''.price($commande->total_tva).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('AmountTTC').''.price($commande->total_ttc).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('AmountHT').''.price($commande->total_ht).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'
'.$langs->trans('AmountVAT').''.price($commande->total_tva).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('AmountTTC').''.price($commande->total_ttc).''.$langs->trans('Currency'.$conf->monnaie).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'
'; + print ''; /* * 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 '
'; - print ''; - if ($num) - { - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\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 '
'; + print '
'.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').''.$langs->trans('AmountHT').' 
'; + if ($num) + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } - $var=!$var; - print ''; - if ($objp->fk_product > 0) - { - print ''; - } - else - { - print ''; + if ($objp->fk_product > 0) + { + print ''; + } + else + { + print '\n"; - } - print ''; + print "\n"; + } + print ''; - print '\n"; + print '\n"; - print ''; - - if ($objp->remise_percent > 0) - { - print '\n"; - } - else - { - print ''; - } + + if ($objp->remise_percent > 0) + { + print '\n"; + } + else + { + print ''; + } - print '\n"; + print '\n"; - print ''; - print ''; + print ''; + print ''; $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 '
'.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').''.$langs->trans('AmountHT').' 
'; - if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service'); - else print img_object($langs->trans('ShowProduct'),'product'); - print ' '.$objp->ref.' - '.nl2br($objp->product); - print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; - print '
'; + $var=true; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + + $var=!$var; + print '
'; + print ''; // ancre pour retourner sur la ligne + + // Affiche ligne produit + $text = ''; + if ($objp->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); + else $text.= img_object($langs->trans('ShowProduct'),'product'); + $text.= ' '.$objp->ref.''; + $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)?'
'.dol_htmlentitiesbr($objp->description):''; + } + + print '
'; if (($objp->info_bits & 2) == 2) { print ''; @@ -418,77 +432,77 @@ if ($_GET["id"] > 0) { print nl2br($objp->description); } - print "'.vatrate($objp->tva_tx).'%'.vatrate($objp->tva_tx).'%'.price($objp->subprice)."'.price($objp->subprice)."'; + print ''; if (($objp->info_bits & 2) != 2) { print $objp->qty; } else print ' '; print ''.$objp->remise_percent."% '.$objp->remise_percent."% '.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."'.price($objp->total_ht)." 
 
'; + print ''; - print ''; + print ''; - /* - * Boutons actions - */ + /* + * Boutons actions + */ - if (! $user->societe_id && ! $commande->facturee) - { - print "
\n"; + if (! $user->societe_id && ! $commande->facturee) + { + print "
\n"; - if ($commande->statut > 0 && $user->rights->facture->creer) - { - print ''.$langs->trans("CreateBill").''; - } + if ($commande->statut > 0 && $user->rights->facture->creer) + { + print ''.$langs->trans("CreateBill").''; + } - if ($commande->statut > 0 && $user->rights->commande->creer) - { - print ''.$langs->trans("ClassifyBilled").''; - } - print '
'; - } + if ($commande->statut > 0 && $user->rights->commande->creer) + { + print ''.$langs->trans("ClassifyBilled").''; + } + print '
'; + } print '"; + print ''; + print ''; + print ''; + $i++; + } + print "
'; - - + + /* - * 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 '
'; - print_titre($langs->trans("RelatedBills")); - $i = 0; $total = 0; - print ''; - print '"; - print ''; - print ''; - print "\n"; + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + if ($num) + { + print '
'; + print_titre($langs->trans("RelatedBills")); + $i = 0; $total = 0; + print '
'.$langs->trans("Ref")."'.$langs->trans("Date").''.$langs->trans("Price").'
'; + print '"; + print ''; + print ''; + print "\n"; - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - $i++; - } - print "
'.$langs->trans("Ref")."'.$langs->trans("Date").''.$langs->trans("Price").'
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.''.dolibarr_print_date($objp->df).''.$objp->total_ttc.'
"; - } - } - else - { - dolibarr_print_error($db); - } + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print "
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->facnumber.''.dolibarr_print_date($objp->df).''.$objp->total_ttc.'
"; + } + } + else + { + dolibarr_print_error($db); + } - print ''; + print ''; // 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 ""; - - + print ""; + + 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(); diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 608f8d82019..7e05b69a90d 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -184,11 +184,39 @@ if ($_GET["id"] > 0) print ''; print ''; - // Société + // Third party print ''.$langs->trans('Company').''; print ''.$soc->getNomUrl(1).''; print ''; + // Discounts for third party + print ''.$langs->trans('Discounts').''; + 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 '
'; + $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 ''; + // Date print ''.$langs->trans('Date').''; print ''.dolibarr_print_date($commande->date,'daytext').''; @@ -336,14 +364,16 @@ if ($_GET["id"] > 0) */ print ''; - $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 ""; + print ""; if ($objp->fk_product > 0) { - $product = new Product($db); - $product->fetch($objp->fk_product); print ''; } else @@ -421,18 +466,20 @@ if ($_GET["id"] > 0) print ""; // 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); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 61cb611ba55..0adc64a2101 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -270,7 +270,7 @@ if ($_GET["action"] == 'create') print ""; print '\n"; - // Entrepot (si forc�) + // Warehouse (id forced) if ($conf->stock->enabled && $_GET["entrepot_id"]) { print ''; @@ -288,10 +288,10 @@ if ($_GET["action"] == 'create') // Delivery method print ""; print '\n"; + // Tracking number print ""; print '\n"; if ($ligne->fk_product > 0) { - $product = new Product($db); $product->fetch($ligne->fk_product); print ''; } else - {var_dump($ligne); - print "\n"; + { //var_dump($ligne); + print "\n"; } print ''; @@ -376,7 +377,7 @@ if ($_GET["action"] == 'create') if ($defaultqty < 0) $defaultqty=0; } - // Quantit� � livrer + // Quantity print '\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++; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index b8b79562b3b..50be99dd805 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -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 '
'; - print ''; - print img_object($langs->trans("Product"),"product").' '.$product->ref.''; - print $product->libelle?' - '.$product->libelle:''; + print ''; // ancre pour retourner sur la ligne + + $product->fetch($objp->fk_product); + // LDR Add a product line from object product + $text = ''; + if ($product->type==1) $text.= img_object($langs->trans('ShowService'),'service'); + else $text.= img_object($langs->trans('ShowProduct'),'product'); + $text.= ' '.$product->ref.''; + $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)?'
'.dol_htmlentitiesbr($objp->description):''; + } + print '
".$langs->trans("Date")."'.dolibarr_print_date($object->date,"day")."
'.$langs->trans("Warehouse").'
".$langs->trans("DeliveryMethod")."'; - $expe->fetch_delivery_methods(); $html->select_array("expedition_method_id",$expe->meths,'',0,0,0,0,"",1); print "
".$langs->trans("TrackingNumber")."'; @@ -336,22 +336,23 @@ if ($_GET["action"] == 'create') $indiceAsked = 0; while ($indiceAsked < $numAsked) { + $product = new Product($db); + $ligne = $object->lignes[$indiceAsked]; $var=!$var; print "
'; print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; - if ($ligne->desc) print nl2br($ligne->desc); + if ($ligne->desc) print dol_nl2br(dol_htmlcleanlastbr($ligne->desc),1); print '".nl2br($ligne->desc)."".nl2br($ligne->desc)."'.$ligne->qty.''; print ''; print ''; @@ -429,7 +430,7 @@ if ($_GET["action"] == 'create') } else { - // Quantit� � livrer + // Quantity print ''; print ''; print ''; @@ -439,16 +440,19 @@ if ($_GET["action"] == 'create') print "
'; print $langs->trans("SelectExportFields"); print ''; - $html->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1); + $htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1); print ''; print '
'; print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 10e4f6d56f9..d89c913af53 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -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 ''; - } - - /** * \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 ''."\n"; - print ''; - if ($selected == 0 || $selected == 100) $canedit=0; - print ' %'; - print ' '; - } - else - { - print ' %'; - } - } - - /** * \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 ''; } - - /** - * \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 '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; - print '%'; - print '
'; - } - 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 ''; - } - - /** * 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 ''; - return 0; - } - else - { - dolibarr_print_error($this->db); - return 1; - } - } - } ?> diff --git a/htdocs/html.formactions.class.php b/htdocs/html.formactions.class.php index 19cf0b79c32..09c7de801df 100644 --- a/htdocs/html.formactions.class.php +++ b/htdocs/html.formactions.class.php @@ -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 ''."\n"; + print ''; + if ($selected == 0 || $selected == 100) $canedit=0; + print ' %'; + print ' '; + } + else + { + print ' %'; + } + } + + /** * \brief Show list of actions for element * \param object Object diff --git a/htdocs/html.formadmin.class.php b/htdocs/html.formadmin.class.php index bf8c2e39c19..d89a6cf24c9 100644 --- a/htdocs/html.formadmin.class.php +++ b/htdocs/html.formadmin.class.php @@ -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 ''; + } + /** * \brief Retourne la liste d�roulante des menus disponibles (eldy_backoffice, ...) * \param selected Menu pr�-s�lectionn�e diff --git a/htdocs/html.formother.class.php b/htdocs/html.formother.class.php new file mode 100644 index 00000000000..13930a4b6a5 --- /dev/null +++ b/htdocs/html.formother.class.php @@ -0,0 +1,158 @@ + + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2006 Marc Barilley/Ocebo + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2007 Patrick Raguin + * + * 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 '"; + } + 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 ''; + return 0; + } + else + { + dolibarr_print_error($this->db); + return 1; + } + } + +} + +?> diff --git a/htdocs/html.formproduct.class.php b/htdocs/html.formproduct.class.php index 73bfbc49076..6dd0eaa5d87 100644 --- a/htdocs/html.formproduct.class.php +++ b/htdocs/html.formproduct.class.php @@ -118,6 +118,49 @@ class FormProduct print ''; } + + /** + * \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 ''; + } + } ?> diff --git a/htdocs/install/index.php b/htdocs/install/index.php index 77a47ab16c5..32fcdc5c401 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -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 '

'; print ''; print ''; print '
'.$langs->trans("DefaultLanguage").' : '; -$html=new Form(''); -$html->select_lang('auto','selectlang',1); +$formadmin->select_lang('auto','selectlang',1); print '
'; diff --git a/htdocs/lib/fichinter.lib.php b/htdocs/lib/fichinter.lib.php index 6912123f21a..fe679093936 100644 --- a/htdocs/lib/fichinter.lib.php +++ b/htdocs/lib/fichinter.lib.php @@ -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++; diff --git a/htdocs/lib/fourn.lib.php b/htdocs/lib/fourn.lib.php index e8c1d930af0..d66e87295db 100644 --- a/htdocs/lib/fourn.lib.php +++ b/htdocs/lib/fourn.lib.php @@ -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++; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index b01c330da1b..81d210be37d 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -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('(
| * * 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; +} + ?> \ No newline at end of file diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php index 10a0636cb4f..39de04ab135 100644 --- a/htdocs/lib/order.lib.php +++ b/htdocs/lib/order.lib.php @@ -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++; diff --git a/htdocs/lib/propal.lib.php b/htdocs/lib/propal.lib.php index 85c6b20ec06..b65fa101cfb 100644 --- a/htdocs/lib/propal.lib.php +++ b/htdocs/lib/propal.lib.php @@ -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++; diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 636b218cd37..de42e068769 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -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 ''.$langs->trans("Weight").''; print ''; - print $html->select_measuring_units("weight_units","weight"); + print $formproduct->select_measuring_units("weight_units","weight"); print ''; print ''.$langs->trans("Volume").''; print ''; - print $html->select_measuring_units("volume_units","volume"); + print $formproduct->select_measuring_units("volume_units","volume"); print ''; } @@ -1041,11 +1047,11 @@ if ($_GET["id"] || $_GET["ref"]) // Weight / Volume print ''.$langs->trans("Weight").''; print ' '; - print $html->select_measuring_units("weight_units", "weight", $product->weight_units); + print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units); print ''; print ''.$langs->trans("Volume").''; print ' '; - print $html->select_measuring_units("volume_units", "volume", $product->volume_units); + print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units); print ''; } diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index daacdadb17e..71d1e64f5dd 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -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 ''.$langs->trans('Label').''; print ''.$langs->trans('Description').''; 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 ''; - } - print ''; + { + 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 ''; + } + print ''; print ''.$langs->trans('Note').''; 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 ''; - } - print ''; + { + 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 ''; + } + print ''; print ''; print ''; } @@ -207,7 +207,7 @@ else print ''.$langs->trans('Note').''.$product->multilangs[$key]["note"].''; print ''; } - if ( !$cnt_trans ) print '
'. $langs->trans('NoTranslation'); + if ( !$cnt_trans ) print '
'. $langs->trans('NoTranslation'); } print "\n"; @@ -221,11 +221,11 @@ print "\n"; print "\n
\n"; if ($_GET["action"] == '') - if ($user->rights->produit->modifier || $user->rights->produit->creer) - { - print ''.$langs->trans("Update").''; - print ''.$langs->trans("Add").''; - } +if ($user->rights->produit->modifier || $user->rights->produit->creer) +{ + print ''.$langs->trans("Update").''; + print ''.$langs->trans("Add").''; +} print "\n
\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 = ''; print '
'; @@ -260,7 +260,7 @@ if ($_GET["action"] == 'add' || $user->rights->produit->modifier) print ''; print ''; print '
'; - + } llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 94447f5d3f0..0d813ccf52e 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -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").''; print ''; $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 ''; // Taille max des listes