diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b0a91f7ce36..476df6d3cab 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -621,7 +621,6 @@ if ($num > 0) $object->id = $line->id; $object->piece_num = $line->piece_num; print $object->getNomUrl(1,'',0,'',1); - //print '' . $line->piece_num . ''; print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 7c4912411f6..2fdd1591ead 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -561,12 +561,11 @@ if (! empty($conf->global->MAIN_FEATURES_LEVEL)) print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation - $sql1 = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y') as dm"; + $sql1 = "SELECT SUM(amount) as mm"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f"; $sql1 .= " WHERE f.entity = " . $conf->entity; $sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'"; $sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'"; - $sql1 .= " GROUP BY dm ORDER BY dm ASC"; $result = $db->query($sql1); if ($result) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8ecae833805..48eabbefe9e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1910,26 +1910,35 @@ class ExtraFields /** * return array_options array of data of extrafields value of object sent by a search form * - * @param array $extralabels $array of extrafields (@deprecated) - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @return array|int array_options set or 0 if no value + * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage) + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @return array|int array_options set or 0 if no value */ - function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='') + function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='') { global $_POST; - if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; + if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label'])) + { + $extralabels = $this->attributes[$extrafieldsobjectkey]['label']; + } + else + { + $extralabels = $extrafieldsobjectkey; + } - $array_options = array(); if (is_array($extralabels)) { + $array_options = array(); + // Get extra fields foreach ($extralabels as $key => $value) { - $key_type=$this->attribute_type[$key]; - if (! empty($object->table_element) && is_array($this->attributes) && array_key_exists($object->table_element, $this->attributes)) { - $key_type=$this->attributes[$object->table_element]['type'][$key]; + $key_type = ''; + if (is_string($extrafieldsobjectkey)) + { + $key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; } if (in_array($key_type,array('date','datetime'))) @@ -1959,8 +1968,7 @@ class ExtraFields return $array_options; } - else { - return 0; - } + + return 0; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 90167504f3f..b9685a043d0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -321,13 +321,18 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu } } } - if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage + // If there is saved contextpage, page or limit + if ($paramname == 'contextpage' && ! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { - if ($paramname == 'contextpage') - { - $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; - //var_dump($paramname.' '.$out); - } + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; + } + elseif ($paramname == 'page' && ! empty($_SESSION['lastsearch_page_'.$relativepathstring])) + { + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; + } + elseif ($paramname == 'limit' && ! empty($_SESSION['lastsearch_limit_'.$relativepathstring])) + { + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; } } // Else, retreive default values if we are not doing a sort diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4a814954072..34f4dca8510 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -477,14 +477,11 @@ class modSociete extends DolibarrModules $this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib'); $this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank", 'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*", - 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default', - 'sr.fk_departement'=>"StateId",'sr.fk_pays'=>"CountryCode" + 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default' ); $this->import_convertvalue_array[$r]=array( - 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), - 'sr.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'), - 'sr.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'), + 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') ); $this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING", 'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333", diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 72bd20fc25c..086f154184d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3035,10 +3035,10 @@ class SupplierInvoiceLine extends CommonObjectLine $sql.= " ".$this->product_type.","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->subprice).","; - $sql.= " ".price2num($this->total_ttc/$this->qty).","; + $sql.= " ".(! empty($this->qty)?price2num($this->total_ttc / $this->qty):price2num($this->total_ttc)).","; $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; - $sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; + $sql.= ' '.(! empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; $sql.= ' '.$this->rang.','; $sql.= ' '.$this->special_code.','; $sql.= " '".$this->db->escape($this->info_bits)."',"; diff --git a/htdocs/langs/es_ES/banks.lang b/htdocs/langs/es_ES/banks.lang index 8add13345b2..e5e289f0c4b 100644 --- a/htdocs/langs/es_ES/banks.lang +++ b/htdocs/langs/es_ES/banks.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - banks Bank=Banco -MenuBankCash=Bank | Cash +MenuBankCash=Bancos | Cajas MenuVariousPayment=Pagos varios MenuNewVariousPayment=Nuevo pago varios BankName=Nombre del banco diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 826f83356c4..0e586e6f4a4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -723,18 +723,27 @@ if (! defined('NOLOGIN')) $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); //var_dump($relativepathstring); - // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp + // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); } - // We also save contextpage if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) { $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); } + if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) + { + $_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); + } + if (! empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) + { + $_SESSION['lastsearch_limit_'.$relativepathstring]=$_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); + } } $action = ''; @@ -1951,7 +1960,8 @@ if (! function_exists("llxFooter")) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) { global $conf, $langs, $user, $object; - global $delayedhtmlcontent, $contextpage; + global $delayedhtmlcontent; + global $contextpage, $page, $limit; $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); @@ -1986,8 +1996,16 @@ if (! function_exists("llxFooter")) if (preg_match('/list\.php$/', $relativepathstring)) { unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); - if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); + + if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + if (! empty($page) && $page > 1) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page; + if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit; + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); + unset($_SESSION['lastsearch_page_'.$relativepathstring]); + unset($_SESSION['lastsearch_limit_'.$relativepathstring]); } // Core error message diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a7282783166..6dfcf3ae7c0 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2018 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2015-2017 Jean-François Ferry @@ -152,7 +152,7 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors'); } else { - header("Location: index.php?restore_lastsearch_values=1"); + header("Location: ".DOL_URL_ROOT."/user/list.php?restore_lastsearch_values=1"); exit; } } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 47a5a5df9eb..d5f7a5b8570 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011 Herve Prot * Copyright (C) 2012 Florian Henry + * Copyright (C) 2018 Juanjo Menent * * 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 @@ -110,7 +111,7 @@ if (empty($reshook)) { { $object->fetch($id); $object->delete(); - header("Location: index.php?restore_lastsearch_values=1"); + header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1"); exit; } else