Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-03-07 22:40:12 +01:00
commit 710585d4c2
32 changed files with 200 additions and 519 deletions

View File

@ -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.
@ -35,6 +36,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.

View File

@ -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);

View File

@ -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

View File

@ -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++;

View File

@ -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

View File

@ -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;
@ -247,7 +245,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);

View File

@ -306,7 +306,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');
}
@ -424,7 +424,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;

View File

@ -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;
}

View File

@ -1 +0,0 @@
Url not available

View File

@ -1,215 +0,0 @@
<?php
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>.
* 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('/&amp.*/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('/&amp.*/i','',$url);
if ($menus[$j]['level'] == 0)
{
print_start_menu_entry();
if (empty($menus[$j+1]['level'])) print '<a href="'.$url.'"'.($menus[$j]['target']?" target='".$menus[$j]['target']."'":($atarget?" target=$atarget":'')).'>';
$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 '</a>';
}
if ($menus[$j]['level'] > 0)
{
if ($menus[$j-1]['level'] == 0) print_start_submenu_array();
print_start_menu_entry();
print '<a href="'.$url.'"'.($menus[$j]['target']?" target='".$menus[$j]['target']."'":($atarget?" target=$atarget":'')).'>';
$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 '</a>';
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('/&amp.*/i','',$url);
print '<a href="'.$url.'"'.($newTabMenu[$i]['target']?" target='".$newTabMenu[$i]['target']."'":($atarget?" target=$atarget":'')).'>';
$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 '</a>';
}
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 '<ul data-role="listview" data-theme="'.$theme.'">';
print "\n";
}
/**
* Output start submenu entry
*
* @return void
*/
function print_start_submenu_array()
{
print '<ul>';
print "\n";
}
/**
* Output start menu entry
*
* @return void
*/
function print_start_menu_entry()
{
print '<li>';
}
/**
* 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 '</li>';
print "\n";
}
/**
* Output end menu
*
* @return void
*/
function print_end_menu()
{
print '</ul>';
print "\n";
}
?>

View File

@ -1,132 +0,0 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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;
}
}
?>

View File

@ -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);

View File

@ -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);

View File

@ -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')

View File

@ -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++;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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))
{

View File

@ -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))
{

View File

@ -261,9 +261,10 @@ class ExportExcel2007 extends ExportExcel
* @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))
@ -282,7 +283,8 @@ class ExportExcel2007 extends ExportExcel
$newvalue=$objp->$alias;
$newvalue=$this->excel_clean($newvalue);
$typefield=isset($array_types[$code])?$array_types[$code]:'';
// Traduction newvalue
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
{
@ -293,6 +295,8 @@ class ExportExcel2007 extends ExportExcel
$newvalue=$outputlangs->convToOutputCharset($newvalue);
}
//var_dump($code.' '.$alias.' '.$newvalue.' '.$typefield);
if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i',$newvalue))
{
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
@ -341,7 +345,21 @@ class ExportExcel2007 extends ExportExcel
}
else
{
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
//$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
//if ($typefield == 'Text') $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
//$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, (string) $newvalue);
$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
}
else
{
//$coord=$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->getCoordinate();
//if ($typefield == 'Text') $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row+1, $newvalue);
}
}
}
$this->col++;

View File

@ -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);

View File

@ -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

View File

@ -283,7 +283,8 @@ class modSociete extends DolibarrModules
$this->export_label[$r]='ExportDataset_company_2';
$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.name'=>'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_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))
{

View File

@ -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++;

View File

@ -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;

View File

@ -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

View File

@ -200,8 +200,8 @@ class Export
* Arrays this->array_export_xxx are already loaded for required datatoexport
*
* @param int $indice Indice of export
* @param array $array_selected Filter on array of fields to export
* @param array $array_filterValue Filter on array of fields to export
* @param array $array_selected Filter fields on array of fields to export
* @param array $array_filterValue Filter records on array of value for fields
* @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..."
*/
function build_sql($indice, $array_selected, $array_filterValue)
@ -230,7 +230,7 @@ class Export
// pour ne pas a gerer le nombre de condition
foreach ($array_filterValue as $key => $value)
{
$sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[0][$key], $key, $array_filterValue[$key]);
$sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
}
$sql.=$sqlWhere;
}
@ -464,7 +464,7 @@ class Export
* @param string $datatoexport Name of dataset to export
* @param array $array_selected Filter on array of fields to export
* @param array $array_filterValue Filter on array of fields with a filter
* @param string $sqlquery If set, transmit a sql query instead of building it from arrays
* @param string $sqlquery If set, transmit the sql request for select (otherwise, sql request is generated from arrays)
* @return int <0 if KO, >0 if OK
*/
function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
@ -547,8 +547,7 @@ class Export
}
}
// end of special operation processing
$objmodel->write_record($array_selected,$objp,$outputlangs);
$objmodel->write_record($array_selected,$objp,$outputlangs,$this->array_export_TypeFields[$indice]);
}
// Genere en-tete

View File

@ -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;

View File

@ -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);
@ -77,9 +79,12 @@ 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;
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;
ALTER TABLE llx_stock_mouvement MODIFY COLUMN value real;

View File

@ -282,6 +282,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

View File

@ -284,6 +284,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

View File

@ -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

View File

@ -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

View File

@ -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 '<a target="_blank" href="'.$url.'">['.$langs->trans("Check").']</a>';
return '';
}