From d5822b7fbd760f34175ce5106a3900de3bb404cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2013 18:13:27 +0100 Subject: [PATCH 01/13] Fix: Syntax sql error when adding/editing line of contract and when company does not use vat. --- htdocs/contrat/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 8aaf4a338ce..499f736d64b 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -299,7 +299,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) { $pu_ht=GETPOST('price_ht'); $price_base_type = 'HT'; - $tva_tx=str_replace('*','',GETPOST('tva_tx')); + $tva_tx=GETPOST('tva_tx')?str_replace('*','',GETPOST('tva_tx')):0; // tva_tx field may be disabled, so we use vat rate 0 $tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0; $desc=GETPOST('dp_desc'); } @@ -396,7 +396,7 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST( $objectline->subprice=GETPOST('elprice'); $objectline->qty=GETPOST('elqty'); $objectline->remise_percent=GETPOST('elremise_percent'); - $objectline->tva_tx=GETPOST('eltva_tx'); + $objectline->tva_tx=GETPOST('eltva_tx')?GETPOST('eltva_tx'):0; // Field may be disabled, so we use vat rate 0 $objectline->localtax1_tx=$localtax1_tx; $objectline->localtax2_tx=$localtax2_tx; $objectline->date_ouverture_prevue=$date_start_update; From 617a71478bef981ffafc1ad5ece5ba2176d7a012 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 5 Mar 2013 19:05:12 +0100 Subject: [PATCH 02/13] fix [ bug #749 ] --- htdocs/core/lib/admin.lib.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 0aa88aeeafa..cf817ae494d 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1147,19 +1147,21 @@ function showModulesExludedForExternal($modules) $text=$langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); $listofmodules=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL); $i=0; - foreach($modules as $module) - { - $moduleconst=$module->const_name; - $modulename=strtolower($module->name); - //print 'modulename='.$modulename; - - //if (empty($conf->global->$moduleconst)) continue; - if (! in_array($modulename,$listofmodules)) continue; - - if ($i > 0) $text.=', '; - else $text.=' '; - $i++; - $text .= $langs->trans('Module'.$module->numero.'Name'); + if (!empty($modules)) { + foreach($modules as $module) + { + $moduleconst=$module->const_name; + $modulename=strtolower($module->name); + //print 'modulename='.$modulename; + + //if (empty($conf->global->$moduleconst)) continue; + if (! in_array($modulename,$listofmodules)) continue; + + if ($i > 0) $text.=', '; + else $text.=' '; + $i++; + $text .= $langs->trans('Module'.$module->numero.'Name'); + } } return img_picto($langs->trans('InfoAdmin'), 'star').' '.$text; } From b6581c2b265202be55cf9097dca881bba1abc013 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Wed, 6 Mar 2013 16:38:15 +0100 Subject: [PATCH 03/13] fix : deprecated --- htdocs/adherents/cartes/carte.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index c45f1aed993..7c1d95502ca 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -107,13 +107,8 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg '%MONTH%'=>$month, '%DAY%'=>$day, '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, - '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/", // deprecated - // For backward compatibility - '%SOCIETE%'=>$objp->company, - '%ZIP%'=>$objp->zip, - '%COUNTRY%'=>$objp->country, - '%ANNEE%'=>$year, - '%SERVEUR%'=>"http://".$_SERVER["SERVER_NAME"]."/" // deprecated + '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/", + '%SOCIETE%'=>$objp->company ); complete_substitutions_array($substitutionarray, $langs); From a080021511df776e07abe23c8cb46bb2c7e98dc4 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Wed, 6 Mar 2013 17:17:34 +0100 Subject: [PATCH 04/13] fix : deprecated --- htdocs/contact/class/contact.class.php | 4 +--- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 1 + htdocs/societe/class/address.class.php | 18 +++++------------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 58183a3df25..eca2da8e19a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -37,10 +37,8 @@ class Contact extends CommonObject public $table_element='socpeople'; var $id; - var $civilite_id; // In fact we stor civility_code + var $civilite_id; // In fact we store civility_code var $lastname; - var $name; // TODO deprecated - var $nom; // TODO deprecated var $firstname; var $address; var $zip; diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index c968f75f9dc..5808ec09794 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -77,6 +77,7 @@ alter table llx_bank_account CHANGE COLUMN fk_departement state_id varchar(50); alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text; alter table llx_societe_address CHANGE COLUMN ville town text; alter table llx_societe_address CHANGE COLUMN cp zip varchar(10); +alter table llx_societe CHANGE COLUMN tel phone varchar(20); ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL AFTER description; ALTER TABLE llx_c_shipment_mode MODIFY COLUMN rowid INT(11) NOT NULL AUTO_INCREMENT; diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 4c3e7cc45ae..4f9b100cd83 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -42,7 +42,6 @@ class Address var $town; var $country_id; var $country_code; - var $tel; // deprecated var $phone; var $fax; var $note; @@ -195,7 +194,7 @@ class Address $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); $sql.= ", fk_pays = '" . ($this->country_id?$this->country_id:'0') ."'"; $sql.= ", note = ".($this->note?"'".$this->db->escape($this->note)."'":"null"); - $sql.= ", tel = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); + $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); $sql.= ", fax = ".($this->fax?"'".$this->db->escape($this->fax)."'":"null"); if ($user) $sql .= ",fk_user_modif = '".$user->id."'"; $sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $id ."'"; @@ -267,7 +266,7 @@ class Address { $sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as dc'; $sql .= ', a.tms as date_update, a.fk_soc'; - $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.tel, a.fax'; + $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; $sql .= ', p.code as country_code, p.libelle as country'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid'; @@ -295,14 +294,10 @@ class Address $line->country_id = $objp->country_id; $line->country_code = $objp->country_id?$objp->country_code:''; $line->country = $objp->country_id?($langs->trans('Country'.$objp->country_code)!='Country'.$objp->country_code?$langs->trans('Country'.$objp->country_code):$objp->country):''; - $line->phone = $objp->tel; + $line->phone = $objp->phone; $line->fax = $objp->fax; $line->note = $objp->note; - // deprecated - $line->pays = $line->country; - $line->tel = $line->phone; - $this->lines[$i] = $line; $i++; } @@ -342,7 +337,7 @@ class Address $sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation'; $sql .= ', a.tms as date_update'; - $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.tel, a.fax'; + $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; $sql .= ', p.code as country_code, p.libelle as country'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid'; @@ -370,13 +365,10 @@ class Address $this->country_code = $obj->country_id?$obj->country_code:''; $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):''; - $this->phone = $obj->tel; + $this->phone = $obj->phone; $this->fax = $obj->fax; $this->note = $obj->note; - // deprecated - $this->tel = $this->phone; - $result = 1; } else From 05c6706727de1b3d55b5c6496c9dfe0c7531ad6f Mon Sep 17 00:00:00 2001 From: eldy Date: Wed, 6 Mar 2013 20:08:38 +0100 Subject: [PATCH 05/13] Fix: error with pgsql --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 18e984858ed..f2a48bed29c 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -11,6 +11,8 @@ -- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; -- To restrict request to Mysql version x.y use -- VMYSQLx.y -- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make a primary key (mysql): VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY_KEY; +-- To make a primary key (postgres) VPGSQL8.2 ALTER TABLE llx_table CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY; -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); @@ -78,5 +80,7 @@ alter table llx_societe_rib CHANGE COLUMN adresse_proprio owner_address text; alter table llx_societe_address CHANGE COLUMN ville town text; alter table llx_societe_address CHANGE COLUMN cp zip varchar(10); -ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL AFTER description; -ALTER TABLE llx_c_shipment_mode MODIFY COLUMN rowid INT(11) NOT NULL AUTO_INCREMENT; +ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; +ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER NOT NULL; +-- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY_KEY; +-- VPGSQL8.2 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid INTEGER SERIAL PRIMARY KEY; From 9b8dd9475107c406d85467a3c8f06492c44751c3 Mon Sep 17 00:00:00 2001 From: eldy Date: Wed, 6 Mar 2013 21:26:05 +0100 Subject: [PATCH 06/13] Fix: no null into not null field --- htdocs/contact/class/contact.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 58183a3df25..5adfe49b86a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -247,7 +247,7 @@ class Contact extends CommonObject $sql .= ", priv = '".$this->priv."'"; $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"null"); $sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"null"); - $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"null"); + $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"0"); $sql .= " WHERE rowid=".$id; dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG); From 9d047d740b8c2e55f3f56743bd23ab6393514d21 Mon Sep 17 00:00:00 2001 From: eldy Date: Wed, 6 Mar 2013 21:26:05 +0100 Subject: [PATCH 07/13] Fix: no null into not null field --- htdocs/contact/class/contact.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c1eb6426c7b..8afb74a029f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -253,7 +253,7 @@ class Contact extends CommonObject $sql .= ", priv = '".$this->priv."'"; $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"null"); $sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"null"); - $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"null"); + $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"0"); $sql .= " WHERE rowid=".$id; dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG); From 6c2841d4d6363ed3cb2df84ddbc78e3486260c13 Mon Sep 17 00:00:00 2001 From: eldy Date: Wed, 6 Mar 2013 22:28:15 +0100 Subject: [PATCH 08/13] New: Type of fields are received by export format handlers --- ChangeLog | 1 + .../core/modules/export/export_csv.modules.php | 9 ++++++--- .../modules/export/export_excel.modules.php | 6 ++++-- .../export/export_excel2007.modules.php | 4 ++-- .../core/modules/export/export_tsv.modules.php | 18 ++++++++++++------ htdocs/core/modules/modSociete.class.php | 1 + 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55975d60898..69972372eb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,7 @@ For developers: into conf->liste_limit). - New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page. - New: dol_syslog method accept a suffix to use different log files for log. +- New: Type of fields are received by export format handlers For translators: - Update language files. diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 20d57fda97c..ef422a4fd38 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2013 Laurent Destailleur * * 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 @@ -220,9 +220,10 @@ class ExportCsv extends ModeleExports * @param array $array_selected_sorted Array with list of field to export * @param resource $objp A record from a fetch with all fields from select * @param Translate $outputlangs Object lang to translate values + * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - function write_record($array_selected_sorted,$objp,$outputlangs) + function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { global $conf; @@ -241,8 +242,10 @@ class ExportCsv extends ModeleExports if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code); else $alias=substr($code, strpos($code, ' as ') + 4); if (empty($alias)) dol_print_error('','Bad value for field with key='.$code.'. Try to redefine export.'); + $newvalue=$outputlangs->convToOutputCharset($objp->$alias); - + $typefield=isset($array_types[$code])?$array_types[$code]:''; + // Translation newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 9e489f0b3e8..51dee6a16ef 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -260,9 +260,10 @@ class ExportExcel extends ModeleExports * @param array $array_selected_sorted Array with list of field to export * @param resource $objp A record from a fetch with all fields from select * @param Translate $outputlangs Object lang to translate values + * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - function write_record($array_selected_sorted,$objp,$outputlangs) + function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { // Create a format for the column headings if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) @@ -281,7 +282,8 @@ class ExportExcel extends ModeleExports $newvalue=$objp->$alias; $newvalue=$this->excel_clean($newvalue); - + $typefield=isset($array_types[$code])?$array_types[$code]:''; + // Traduction newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 45f6e04d054..1e3605a7d1d 100755 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -350,8 +350,8 @@ class ExportExcel2007 extends ExportExcel //$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue); if ($typefield == 'Text') { - var_dump($code.' '.$alias.' '.$newvalue.' '.$typefield); - $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue); + //var_dump($code.' '.$alias.' '.$newvalue.' '.$typefield); + //$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, (string) $newvalue); $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING); } else diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index c0b8eb5f617..090ed17bf46 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -204,25 +204,30 @@ class ExportTsv extends ModeleExports * @param array $array_selected_sorted Array with list of field to export * @param resource $objp A record from a fetch with all fields from select * @param Translate $outputlangs Object lang to translate values + * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - function write_record($array_selected_sorted,$objp,$outputlangs) + function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { + global $conf; + $this->col=0; foreach($array_selected_sorted as $code => $value) { if (strpos($code,' as ') == 0) $alias=str_replace(array('.','-'),'_',$code); else $alias=substr($code, strpos($code, ' as ') + 4); if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.'); - $newvalue=$objp->$alias; - + + $newvalue=$outputlangs->convToOutputCharset($objp->$alias); + $typefield=isset($array_types[$code])?$array_types[$code]:''; + // Translation newvalue if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) { $newvalue=$outputlangs->transnoentities($reg[1]); } - $newvalue=$this->tsv_clean($newvalue); + $newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output); fwrite($this->handle,$newvalue.$this->separator); $this->col++; @@ -257,12 +262,13 @@ class ExportTsv extends ModeleExports * Clean a cell to respect rules of TSV file cells * * @param string $newvalue String to clean + * @param string $charset Output character set * @return string Value cleaned */ - function tsv_clean($newvalue) + function tsv_clean($newvalue, $charset) { // Rule Dolibarr: No HTML - $newvalue=dol_string_nohtmltag($newvalue); + $newvalue=dol_string_nohtmltag($newvalue, 1, $charset); // Rule 1 TSV: No CR, LF in cells $newvalue=str_replace("\r",'',$newvalue); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 0498b59ccde..7966d7deacb 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -284,6 +284,7 @@ class modSociete extends DolibarrModules $this->export_icon[$r]='contact'; $this->export_permission[$r]=array(array("societe","contact","export")); $this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civilite'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.email'=>"EMail",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode"); + $this->export_TypeFields_array[$r]=array('c.lastname'=>"Text",'c.firstname'=>"Text",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company"); // We define here only fields that use another picto if (empty($conf->fournisseur->enabled)) { From 47ec826c17d647cdc02ed2291ccd7c6d138c4fab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 10:47:05 +0100 Subject: [PATCH 09/13] New: Add link to check professional id for india. --- ChangeLog | 1 + htdocs/societe/class/societe.class.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 69972372eb8..14688a7a335 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ For users: - New: Can define of we want to use VAT or not for subscriptions (foundation module). - New: Can define a default choice for choice "More action when recording a subscription" (foundation module). +- New: Add link to check professional id for india. For developers: - System of menu managers has been rewritten to reduce code to do same things. diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8d39c99462c..16db3e5b0f5 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2267,7 +2267,8 @@ class Societe extends CommonObject if ($idprof == 1 && $soc->country_code == 'FR') $url='http://www.societe.com/cgi-bin/recherche?rncs='.$soc->idprof1; if ($idprof == 1 && $soc->country_code == 'GB') $url='http://www.companieshouse.gov.uk/WebCHeck/findinfolink/'; if ($idprof == 1 && $soc->country_code == 'ES') $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$soc->idprof1; - + if ($idprof == 1 && $soc->country_code == 'IN') $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$soc->idprof1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + if ($url) return '['.$langs->trans("Check").']'; return ''; } From a3244a4b4720bac74654ca972b97cd04a131eb44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 11:05:20 +0100 Subject: [PATCH 10/13] Fix: Missing genereic translation --- htdocs/langs/en_US/main.lang | 2 ++ htdocs/langs/fr_FR/main.lang | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 98c28b231b2..ce12e10119d 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -281,6 +281,8 @@ AmountTTCShort=Amount (inc. tax) AmountHT=Amount (net of tax) AmountTTC=Amount (inc. tax) AmountVAT=Amount tax +AmountLT1=Amount tax 2 +AmountLT2=Amount tax 3 AmountLT1ES=Amount RE AmountLT2ES=Amount IRPF AmountTotal=Total amount diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 301b97c1e3a..c6a9933aa65 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -283,6 +283,8 @@ AmountTTCShort=Montant TTC AmountHT=Montant HT AmountTTC=Montant TTC AmountVAT=Montant TVA +AmountLT1=Montant Tax 2 +AmountLT2=Montant Tax 3 AmountLT1ES=Montant RE AmountLT2ES=Montant IRPF AmountTotal=Montant total From c762c93eb1fb4a654f08a91e4dfe5a2b3989501c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 12:04:12 +0100 Subject: [PATCH 11/13] Fix: Several problem with localtax into PDF generation --- .../commande/doc/pdf_einstein.modules.php | 50 +++++++++--------- .../modules/facture/doc/pdf_crabe.modules.php | 51 +++++++++---------- .../modules/propale/doc/pdf_azur.modules.php | 50 +++++++++--------- .../pdf/pdf_canelle.modules.php | 28 +++++----- .../pdf/pdf_muscadet.modules.php | 28 +++++----- 5 files changed, 101 insertions(+), 106 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 4475f3ad8db..ceccee1602c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -719,12 +719,11 @@ class pdf_einstein extends ModelePDFCommandes else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 @@ -740,8 +739,8 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -749,14 +748,13 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 @@ -774,8 +772,8 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -784,7 +782,7 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -811,15 +809,15 @@ class pdf_einstein extends ModelePDFCommandes } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -832,7 +830,7 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -841,7 +839,7 @@ class pdf_einstein extends ModelePDFCommandes } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -849,17 +847,17 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -872,7 +870,7 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -881,7 +879,7 @@ class pdf_einstein extends ModelePDFCommandes } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -890,7 +888,7 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} // Total TTC $index++; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3ca242e68c2..3d7587b249e 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -850,12 +850,11 @@ class pdf_crabe extends ModelePDFFactures else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -872,8 +871,9 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -881,14 +881,13 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -907,8 +906,8 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -917,7 +916,7 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -944,15 +943,15 @@ class pdf_crabe extends ModelePDFFactures } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -965,7 +964,7 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -974,7 +973,7 @@ class pdf_crabe extends ModelePDFFactures } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -982,10 +981,10 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; @@ -993,7 +992,7 @@ class pdf_crabe extends ModelePDFFactures foreach( $localtax_rate as $tvakey => $tvaval ) { // retrieve global local tax - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1006,7 +1005,7 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1015,7 +1014,7 @@ class pdf_crabe extends ModelePDFFactures } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1023,7 +1022,7 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} } // Total TTC diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 06272e24983..134c95e9a1e 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -747,12 +747,11 @@ class pdf_azur extends ModelePDFPropales else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -769,8 +768,8 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -778,14 +777,13 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -804,8 +802,8 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2".$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -814,7 +812,7 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -841,15 +839,15 @@ class pdf_azur extends ModelePDFPropales } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -862,7 +860,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -871,7 +869,7 @@ class pdf_azur extends ModelePDFPropales } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -879,17 +877,17 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -902,7 +900,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -911,7 +909,7 @@ class pdf_azur extends ModelePDFPropales } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -920,7 +918,7 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} // Total TTC $index++; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index bd2b3c10507..2ed53db1e46 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -523,7 +523,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } @@ -533,19 +533,19 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else { - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ //Local tax 1 foreach( $this->localtax1 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -558,22 +558,22 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transnoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ //Local tax 2 foreach( $this->localtax2 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -586,15 +586,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transnoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} } $useborder=0; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 67c96890f49..fcf0c6763f5 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -691,7 +691,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); } @@ -701,19 +701,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } } else { - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ //Local tax 1 foreach( $this->localtax1 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -726,22 +726,22 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ //Local tax 2 foreach( $this->localtax2 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -754,15 +754,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} } // Total TTC From 0c8d3336c22df468c9faff977386f57cb24313de Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 7 Mar 2013 18:41:56 +0100 Subject: [PATCH 12/13] [ task #707 ] Create option ProfIdx are mandatory to validate a invoice --- htdocs/compta/facture.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7766cfeb862..7585b71cf68 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -372,7 +372,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu { $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_INVOICE_MANDATORY'; - if (! $object->thirdparty->idprof.$i && ! empty($conf->global->$idprof_mandatory)) + $idprof='idprof'.$i; + if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) { if (! $error) $langs->load("errors"); $error++; From b060e5961b7bed9083acbe2aded297416e875388 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 19:47:03 +0100 Subject: [PATCH 13/13] Qual: Another step in men manager rewrite. --- htdocs/compta/bank/pre.inc.php | 1 + htdocs/compta/paiement/cheque/pre.inc.php | 1 + htdocs/core/menus/smartphone/index.php | 1 - .../core/menus/smartphone/smartphone.lib.php | 215 ------------------ .../core/menus/smartphone/smartphone_menu.php | 132 ----------- htdocs/core/menus/standard/auguria_menu.php | 1 + htdocs/core/menus/standard/eldy_menu.php | 1 + htdocs/core/menus/standard/empty.php | 1 + htdocs/ftp/pre.inc.php | 1 + htdocs/main.inc.php | 1 - 10 files changed, 6 insertions(+), 349 deletions(-) delete mode 100644 htdocs/core/menus/smartphone/index.php delete mode 100755 htdocs/core/menus/smartphone/smartphone.lib.php delete mode 100755 htdocs/core/menus/smartphone/smartphone_menu.php diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php index f995c226c4d..a507c4c0a71 100644 --- a/htdocs/compta/bank/pre.inc.php +++ b/htdocs/compta/bank/pre.inc.php @@ -51,6 +51,7 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $menu = new Menu(); // Entry for each bank account diff --git a/htdocs/compta/paiement/cheque/pre.inc.php b/htdocs/compta/paiement/cheque/pre.inc.php index ad915f21299..bc730c9740d 100644 --- a/htdocs/compta/paiement/cheque/pre.inc.php +++ b/htdocs/compta/paiement/cheque/pre.inc.php @@ -50,6 +50,7 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $menu = new Menu(); // Entry for each bank account diff --git a/htdocs/core/menus/smartphone/index.php b/htdocs/core/menus/smartphone/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/core/menus/smartphone/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/core/menus/smartphone/smartphone.lib.php b/htdocs/core/menus/smartphone/smartphone.lib.php deleted file mode 100755 index ad71482fe10..00000000000 --- a/htdocs/core/menus/smartphone/smartphone.lib.php +++ /dev/null @@ -1,215 +0,0 @@ - - * Copyright (C) 2010 Regis Houssin - * - * 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 3 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, see . - * or see http://www.gnu.org/ - */ - -/** - * \file htdocs/core/menus/smartphone/smartphone.lib.php - * \brief Library for file smartphone menus - */ - - -/** - * Core function to output top menu smartphone - * - * @param DoliDB $db Database handler - * @param string $atarget Target - * @param int $type_user 0=Internal,1=External,2=All - * @param string $limitmenuto To limit menu to a top or left menu value - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return void - */ -function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto,&$tabMenu,&$menu) -{ - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; - - global $user,$conf,$langs,$dolibarr_main_db_name; - - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; - - $submenus=''; - - //$tabMenu=array(); - - $menutop = new Menubase($db,'smartphone'); - $menuleft = new Menubase($db,'smartphone'); - $newTabMenu = $menutop->menuTopCharger('', '', $type_user, 'smartphone',$tabMenu); - $numTabMenu = count($newTabMenu); - - print_start_menu_array(); - for($i=0; $i<$numTabMenu; $i++) - { - if ($newTabMenu[$i]['enabled'] == true) - { - if ($newTabMenu[$i]['perms'] == true) // Is allowed - { - // Define url - if (preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) - { - $url = dol_buildpath($newTabMenu[$i]['url'],1); - $url=preg_replace('/&.*/i','',$url); - } - else - { - $menus=''; - - if ($limitmenuto > 0) - { - $newmenu = new Menu(); - $leftmenu = $menuleft->menuLeftCharger($newmenu,$newTabMenu[$i]['mainmenu'],'',($user->societe_id?1:0),'smartphone',$tabMenu); - $menus = $leftmenu->liste; - //var_dump($menus); - } - - print_start_menu_entry(); - - if (is_array($menus) && !empty($menus) && $limitmenuto > 0) - { - $title=$newTabMenu[$i]['titre']; - // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($newTabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&'))); - print_text_menu_entry($title); - - $num = count($menus); - //var_dump($menus); - - if ($num > 0) print_start_submenu_array(); - - for($j=0; $j<$num; $j++) - { - $url=dol_buildpath($menus[$j]['url'],1); - $url=preg_replace('/&.*/i','',$url); - - if ($menus[$j]['level'] == 0) - { - print_start_menu_entry(); - if (empty($menus[$j+1]['level'])) print ''; - $title=$menus[$j]['titre']; - // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($menus[$j]['titre'],ENT_QUOTES,'UTF-8'),'',array('&'))); - print_text_menu_entry($title); - if (empty($menus[$j+1]['level'])) print ''; - } - - if ($menus[$j]['level'] > 0) - { - if ($menus[$j-1]['level'] == 0) print_start_submenu_array(); - - print_start_menu_entry(); - print ''; - $title=$menus[$j]['titre']; - // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($menus[$j]['titre'],ENT_QUOTES,'UTF-8'),'',array('&'))); - print_text_menu_entry($title); - print ''; - print_end_menu_entry(); - - if (empty($menus[$j+1]['level'])) print_end_menu(); - } - - if (empty($menus[$j+1]['level'])) print_end_menu_entry(); - } - - if ($num > 0) print_end_menu(); - } - else - { - $url=dol_buildpath($newTabMenu[$i]['url'],1); - $url=preg_replace('/&.*/i','',$url); - - print ''; - $title=$newTabMenu[$i]['titre']; - // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($newTabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&'))); - print_text_menu_entry($title); - print ''; - } - - print_end_menu_entry(); - } - } - } - } - - print_end_menu(); - print "\n"; -} - -/** - * Output menu entry - * - * @param string $theme Theme - * @return void - */ -function print_start_menu_array($theme='c') -{ - print '
    '; - print "\n"; -} - -/** - * Output start submenu entry - * - * @return void - */ -function print_start_submenu_array() -{ - print '
      '; - print "\n"; -} - -/** - * Output start menu entry - * - * @return void - */ -function print_start_menu_entry() -{ - print '
    • '; -} - -/** - * Output menu entry - * - * @param string $text Text - * @return void - */ -function print_text_menu_entry($text) -{ - print $text; -} - -/** - * Output end menu entry - * - * @return void - */ -function print_end_menu_entry() -{ - print '
    • '; - print "\n"; -} - -/** - * Output end menu - * - * @return void - */ -function print_end_menu() -{ - print '
    '; - print "\n"; -} - -?> diff --git a/htdocs/core/menus/smartphone/smartphone_menu.php b/htdocs/core/menus/smartphone/smartphone_menu.php deleted file mode 100755 index 1b8b87de0dd..00000000000 --- a/htdocs/core/menus/smartphone/smartphone_menu.php +++ /dev/null @@ -1,132 +0,0 @@ - - * Copyright (C) 2007-2010 Regis Houssin - * - * 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 3 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, see . - */ - -/** - * \file htdocs/core/menus/smartphone/smartphone_menu.php - * \brief Menu smartphone manager - */ - - -/** - * Class to manage smartphone menu smartphone - */ -class MenuSmart -{ - - var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu - var $atarget=""; // Valeur du target a utiliser dans les liens - var $name="smartphone"; - - var $tabMenu; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param int $type_user Type of user - */ - function __construct($db, $type_user) - { - $this->type_user=$type_user; - $this->db=$db; - } - - /** - * Load this->tabMenu - * - * @return void - */ - function loadMenu() - { - // On sauve en session le menu principal choisi - if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; - if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; - - // Read mainmenu and leftmenu that define which menu to show - if (isset($_GET["mainmenu"])) - { - // On sauve en session le menu principal choisi - $mainmenu=$_GET["mainmenu"]; - $_SESSION["mainmenu"]=$mainmenu; - $_SESSION["leftmenuopened"]=""; - } - else - { - // On va le chercher en session si non defini par le lien - $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:''; - } - - if (isset($_GET["leftmenu"])) - { - // On sauve en session le menu principal choisi - $leftmenu=$_GET["leftmenu"]; - $_SESSION["leftmenu"]=$leftmenu; - - if ($_SESSION["leftmenuopened"]==$leftmenu) // To collapse - { - //$leftmenu=""; - $_SESSION["leftmenuopened"]=""; - } - else - { - $_SESSION["leftmenuopened"]=$leftmenu; - } - } else { - // On va le chercher en session si non defini par le lien - $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; - } - - require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; - $tabMenu=array(); - $menuArbo = new Menubase($this->db,'smartphone'); - $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'smartphone', $tabMenu); - $this->tabMenu=$tabMenu; - } - - - /** - * Show menu - * - * @param string $mode 'top' or 'left' - * @return int Number of menu entries shown - */ - function showmenu($mode) - { - global $conf; - - require_once DOL_DOCUMENT_ROOT.'/core/menus/smartphone/smartphone.lib.php'; - - if ($this->type_user == 1) - { - $conf->global->MAIN_SEARCHFORM_SOCIETE=0; - $conf->global->MAIN_SEARCHFORM_CONTACT=0; - } - - $this->menu=new Menu(); - - print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$mode,$this->tabMenu,$this->menu); - - unset($this->menu); - - return 1; - } - -} - -?> \ No newline at end of file diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index b7c76af0d32..1aeb8d8ac98 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -168,6 +168,7 @@ class MenuManager $res='ErrorBadParameterForMode'; + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index ffe5470728e..2b4ad8c97a7 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -124,6 +124,7 @@ class MenuManager $res='ErrorBadParameterForMode'; + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu); diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 83b49382da3..c0198ead137 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -69,6 +69,7 @@ class MenuManager $id='mainmenu'; + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); if ($mode == 'top') diff --git a/htdocs/ftp/pre.inc.php b/htdocs/ftp/pre.inc.php index 261188b8e91..19a9d2547fb 100644 --- a/htdocs/ftp/pre.inc.php +++ b/htdocs/ftp/pre.inc.php @@ -47,6 +47,7 @@ function llxHeader($head = '', $title='', $help_url='', $morehtml='', $target='' top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $menu = new Menu(); $MAXFTP=20; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a3262e69ec1..2a7b8ca2ea8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -242,7 +242,6 @@ if (! empty($conf->file->main_force_https)) // Chargement des includes complementaires de presentation -if (! defined('NOREQUIREMENU')) require_once DOL_DOCUMENT_ROOT .'/core/class/menu.class.php'; // Need 10ko memory (11ko in 2.2) if (! defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory