From 24427d2c658133ba12f449adac30e757f9145398 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Mar 2013 00:35:40 +0100 Subject: [PATCH] Use combo list for revenue stamp --- htdocs/compta/facture.php | 40 ++++++-------- htdocs/core/class/html.formother.class.php | 64 +++++++++++++++++++++- 2 files changed, 79 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f792d7c6e20..319160e9a99 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -30,31 +30,25 @@ */ require '../main.inc.php'; -require DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; -require DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; -require DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; -require DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; -require DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -require DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; -require DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -require DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; - -if (! empty($conf->commande->enabled)) { - require DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; -} -if (! empty($conf->projet->enabled)) { - require DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - require DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; -} +require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; $langs->load('bills'); $langs->load('companies'); $langs->load('products'); $langs->load('main'); -if (! empty($conf->margin->enabled)) - $langs->load('margins'); +if (! empty($conf->margin->enabled)) $langs->load('margins'); $sall=trim(GETPOST('sall')); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); @@ -1777,14 +1771,15 @@ if ($action == 'update_extras') * View */ -llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); - $form = new Form($db); -$htmlother = new FormOther($db); +$formother=new FormOther($db); $formfile = new FormFile($db); $bankaccountstatic=new Account($db); $now=dol_now(); +llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); + + /********************************************************************* * @@ -3065,7 +3060,8 @@ else if ($id > 0 || ! empty($ref)) print '
'; print ''; print ''; - print ''; + print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); + //print ''; print ' '; print '
'; } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index dffb7f37982..cf7c6fb8bf6 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -153,10 +153,10 @@ class FormOther /** - * Retourne la liste des ecotaxes avec tooltip sur le libelle + * Return list of ecotaxes with label * - * @param string $selected code ecotaxes pre-selectionne - * @param string $htmlname nom de la liste deroulante + * @param string $selected Preselected ecotaxes + * @param string $htmlname Name of combo list * @return void */ function select_ecotaxes($selected='',$htmlname='ecotaxe_id') @@ -169,6 +169,7 @@ class FormOther $sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid"; $sql.= " ORDER BY pays, e.organization ASC, e.code ASC"; + dol_syslog(get_class($this).'::select_ecotaxes sql='.$sql); $resql=$this->db->query($sql); if ($resql) { @@ -206,6 +207,63 @@ class FormOther } } + + /** + * Return list of revenue stamp for country + * + * @param string $selected Value of preselected revenue stamp + * @param string $htmlname Name of combo list + * @return string HTML select list + */ + function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='') + { + global $langs; + + $out=''; + + $sql = "SELECT r.taux"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_pays as p"; + $sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid"; + $sql.= " AND p.code = '".$country_code."'"; + + dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql); + $resql=$this->db->query($sql); + if ($resql) + { + $out.=''; + return $out; + } + else + { + dol_print_error($this->db); + return ''; + } + } + + /** * Return a HTML select list to select a percent *