forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("members");
|
||||
|
||||
@@ -42,7 +42,7 @@ function commissions_admin_prepare_head()
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin','remove');
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ function categories_prepare_head($object,$type)
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type);
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ function contact_prepare_head($object)
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact','remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -4217,6 +4217,35 @@ function getCurrencySymbol($currency_code)
|
||||
|
||||
return $currency_sign;
|
||||
}
|
||||
/**
|
||||
* Get type of one localtax
|
||||
*
|
||||
* @param int $vatrate VAT Rate
|
||||
* @param int $number Number of localtax (1 / 2)
|
||||
* @param int $thirdparty company object
|
||||
* @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax)
|
||||
*/
|
||||
|
||||
function getTypeOfLocalTaxFromRate($vatrate, $number, $thirdparty)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($number == 1) return array($obj->localtax1_type, $obj->localtax1);
|
||||
elseif ($number == 2) return array($obj->localtax2_type, $obj->localtax2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! function_exists('getmypid'))
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ function facture_prepare_head($object)
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ function propal_prepare_head($object)
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal','remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ function user_prepare_head($object)
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@@ -152,37 +152,37 @@ function group_prepare_head($object)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
*/
|
||||
function user_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$langs->load("users");
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array Array of tabs to shoc
|
||||
*/
|
||||
function user_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$langs->load("users");
|
||||
$h=0;
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
|
||||
$head[$h][1] = $langs->trans("Parameters");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin','remove');
|
||||
|
||||
return $head;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -117,10 +118,6 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
$this->tva=array();
|
||||
$this->localtax1=array();
|
||||
$this->localtax2=array();
|
||||
$this->localtax1_type=array();
|
||||
$this->localtax2_type=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
@@ -139,7 +136,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$langs,$conf,$mysoc,$db;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@@ -152,6 +149,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("orders");
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
@@ -186,8 +185,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
@@ -365,6 +363,10 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne=$object->lines[$i]->total_localtax2;
|
||||
$localtax1_rate=$object->lines[$i]->localtax1_tx;
|
||||
$localtax2_rate=$object->lines[$i]->localtax2_tx;
|
||||
$localtax1_type=$object->lines[$i]->localtax1_type;
|
||||
$localtax2_type=$object->lines[$i]->localtax2_type;
|
||||
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
|
||||
@@ -372,24 +374,30 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
|
||||
// TODO : store local taxes types into object lines and remove this
|
||||
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
|
||||
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
|
||||
if (empty($localtax1_type))
|
||||
$localtax1_type = $localtax1_array[0];
|
||||
if (empty($localtax2_type))
|
||||
$localtax2_type = $localtax2_array[0];
|
||||
//end TODO
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type == '7')
|
||||
$localtax1_rate = $localtax1_array[1];
|
||||
if ($localtax2_type == '7')
|
||||
$localtax2_rate = $localtax2_array[1];
|
||||
|
||||
if ($localtax1ligne != 0 || $localtax1_type == '7')
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
|
||||
if ($localtax2ligne != 0 || $localtax2_type == '7')
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
|
||||
$resqlt=$this->db->query($sql);
|
||||
if ($resqlt)
|
||||
{
|
||||
$objt = $this->db->fetch_object($resqlt);
|
||||
$this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne;
|
||||
$this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne;
|
||||
}
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -138,7 +139,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$langs,$conf,$mysoc,$db;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@@ -365,22 +366,40 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$tvaligne=$object->lines[$i]->total_tva;
|
||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne=$object->lines[$i]->total_localtax2;
|
||||
$localtax1_rate=$object->lines[$i]->localtax1_tx;
|
||||
$localtax2_rate=$object->lines[$i]->localtax2_tx;
|
||||
$localtax1_type=$object->lines[$i]->localtax1_type;
|
||||
$localtax2_type=$object->lines[$i]->localtax2_type;
|
||||
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
$localtax1rate=(string) $object->lines[$i]->localtax1_tx;
|
||||
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
|
||||
|
||||
// TODO : store local taxes types into object lines and remove this
|
||||
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
|
||||
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
|
||||
if (empty($localtax1_type))
|
||||
$localtax1_type = $localtax1_array[0];
|
||||
if (empty($localtax2_type))
|
||||
$localtax2_type = $localtax2_array[0];
|
||||
//end TODO
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type == '7')
|
||||
$localtax1_rate = $localtax1_array[1];
|
||||
if ($localtax2_type == '7')
|
||||
$localtax2_rate = $localtax2_array[1];
|
||||
|
||||
if ($localtax1ligne != 0 || $localtax1_type == '7')
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
|
||||
if ($localtax2ligne != 0 || $localtax2_type == '7')
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
|
||||
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
$this->localtax1[$localtax1rate]+=$localtax1ligne;
|
||||
$this->localtax2[$localtax2rate]+=$localtax2ligne;
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
@@ -822,6 +841,84 @@ 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')
|
||||
{
|
||||
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
|
||||
switch ($localtax_type) {
|
||||
case '1':
|
||||
case '3':
|
||||
case '5':
|
||||
case '7':
|
||||
continue 2;
|
||||
break;
|
||||
}
|
||||
foreach( $localtax_rate as $tvakey => $tvaval )
|
||||
{
|
||||
if ($tvakey>0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl='';
|
||||
if (preg_match('/\*/',$tvakey))
|
||||
{
|
||||
$tvakey=str_replace('*','',$tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
|
||||
$totalvat.=vatrate($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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Local tax 2 before VAT
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||
{
|
||||
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
|
||||
switch ($localtax_type) {
|
||||
case '1':
|
||||
case '3':
|
||||
case '5':
|
||||
case '7':
|
||||
continue 2;
|
||||
break;
|
||||
}
|
||||
foreach( $localtax_rate as $tvakey => $tvaval )
|
||||
{
|
||||
if ($tvakey>0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl='';
|
||||
if (preg_match('/\*/',$tvakey))
|
||||
{
|
||||
$tvakey=str_replace('*','',$tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
|
||||
$totalvat.=vatrate($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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey > 0) // On affiche pas taux 0
|
||||
@@ -830,6 +927,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl='';
|
||||
if (preg_match('/\*/',$tvakey))
|
||||
{
|
||||
@@ -839,52 +937,31 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
|
||||
$totalvat.=vatrate($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($sign * $tvaval), 0, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $this->atleastoneratenotnull) // If no vat at all
|
||||
//Local tax 1 after VAT
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
|
||||
|
||||
// Total LocalTax1
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1);
|
||||
}
|
||||
|
||||
// Total LocalTax2
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
|
||||
{
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||
{
|
||||
//Local tax 1
|
||||
foreach($this->localtax1 as $tvakey => $tvaval)
|
||||
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
|
||||
switch ($localtax_type) {
|
||||
case '2':
|
||||
case '4':
|
||||
case '6':
|
||||
continue 2;
|
||||
break;
|
||||
}
|
||||
foreach( $localtax_rate as $tvakey => $tvaval )
|
||||
{
|
||||
if ($tvakey!=0) // On affiche pas taux 0
|
||||
if ($tvakey>0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl='';
|
||||
if (preg_match('/\*/',$tvakey))
|
||||
@@ -892,27 +969,44 @@ 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;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
|
||||
if ($localtax_type == '7') { // amount on order
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$totalvat.=vatrate($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')
|
||||
{
|
||||
//Local tax 2
|
||||
foreach($this->localtax2 as $tvakey => $tvaval)
|
||||
}
|
||||
//Local tax 2 after VAT
|
||||
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||
{
|
||||
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
|
||||
switch ($localtax_type) {
|
||||
case '2':
|
||||
case '4':
|
||||
case '6':
|
||||
continue 2;
|
||||
break;
|
||||
}
|
||||
foreach( $localtax_rate as $tvakey => $tvaval )
|
||||
{
|
||||
if ($tvakey!=0) // On affiche pas taux 0
|
||||
// retrieve global local tax
|
||||
if ($tvakey>0) // On affiche pas taux 0
|
||||
{
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl='';
|
||||
if (preg_match('/\*/',$tvakey))
|
||||
@@ -920,12 +1014,21 @@ 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;
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
|
||||
if ($localtax_type == '7') { // amount on order
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
|
||||
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$totalvat.=vatrate($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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -936,11 +1039,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFillColor(224,224,224);
|
||||
$text=$outputlangs->transnoentities("TotalTTC");
|
||||
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
|
||||
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,10 +117,6 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
|
||||
$this->tva=array();
|
||||
$this->localtax1=array();
|
||||
$this->localtax2=array();
|
||||
$this->localtax1_type=array();
|
||||
$this->localtax2_type=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
@@ -139,7 +135,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
*/
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$langs,$conf,$mysoc,$db;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@@ -364,31 +360,40 @@ class pdf_azur extends ModelePDFPropales
|
||||
$tvaligne=$object->lines[$i]->total_tva;
|
||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne=$object->lines[$i]->total_localtax2;
|
||||
$localtax1_rate=$object->lines[$i]->localtax1_tx;
|
||||
$localtax2_rate=$object->lines[$i]->localtax2_tx;
|
||||
$localtax1_type=$object->lines[$i]->localtax1_type;
|
||||
$localtax2_type=$object->lines[$i]->localtax2_type;
|
||||
|
||||
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
|
||||
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
|
||||
|
||||
$vatrate=(string) $object->lines[$i]->tva_tx;
|
||||
// TODO : store local taxes types into object lines and remove this
|
||||
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
|
||||
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
|
||||
if (empty($localtax1_type))
|
||||
$localtax1_type = $localtax1_array[0];
|
||||
if (empty($localtax2_type))
|
||||
$localtax2_type = $localtax2_array[0];
|
||||
//end TODO
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type == '7')
|
||||
$localtax1_rate = $localtax1_array[1];
|
||||
if ($localtax2_type == '7')
|
||||
$localtax2_rate = $localtax2_array[1];
|
||||
|
||||
if ($localtax1ligne != 0 || $localtax1_type == '7')
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
|
||||
if ($localtax2ligne != 0 || $localtax2_type == '7')
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
|
||||
$resqlt=$this->db->query($sql);
|
||||
if ($resqlt)
|
||||
{
|
||||
$objt = $this->db->fetch_object($resqlt);
|
||||
$this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne;
|
||||
$this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne;
|
||||
}
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
{
|
||||
|
||||
@@ -830,7 +830,7 @@ else
|
||||
if ($ret == 'html') print '<br />';
|
||||
}
|
||||
|
||||
$head=holiday_prepare_head($cp);
|
||||
$head=holiday_prepare_head($cp);
|
||||
|
||||
dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday');
|
||||
|
||||
|
||||
@@ -183,9 +183,9 @@ function paypaladmin_prepare_head()
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'paypaladmin');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'paypaladmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'paypaladmin','remove');
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'paypaladmin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -195,21 +195,21 @@ if ($action == 'setprofid')
|
||||
}
|
||||
}
|
||||
|
||||
//Activate ProfId
|
||||
if ($action == 'setprofidmandatory')
|
||||
{
|
||||
$status = GETPOST('status','alpha');
|
||||
|
||||
$idprof="SOCIETE_IDPROF".$value."_MANDATORY";
|
||||
if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
//Activate ProfId
|
||||
if ($action == 'setprofidmandatory')
|
||||
{
|
||||
$status = GETPOST('status','alpha');
|
||||
|
||||
$idprof="SOCIETE_IDPROF".$value."_MANDATORY";
|
||||
if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -550,9 +550,9 @@ $profid[2][0]=$langs->trans("ProfId3");
|
||||
$profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code);
|
||||
$profid[3][0]=$langs->trans("ProfId4");
|
||||
$profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code);
|
||||
$profid[4][0]=$langs->trans("ProfId5");
|
||||
$profid[4][0]=$langs->trans("ProfId5");
|
||||
$profid[4][1]=$langs->transcountry('ProfId5', $mysoc->country_code);
|
||||
$profid[5][0]=$langs->trans("ProfId6");
|
||||
$profid[5][0]=$langs->trans("ProfId6");
|
||||
$profid[5][1]=$langs->transcountry('ProfId6', $mysoc->country_code);
|
||||
|
||||
$var = true;
|
||||
@@ -588,17 +588,17 @@ while ($i < $nbofloop)
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
if ($mandatory)
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.($i+1).'&status=0">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.($i+1).'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a></td>';
|
||||
if ($mandatory)
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.($i+1).'&status=0">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.($i+1).'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@@ -203,13 +203,13 @@ if (empty($reshook))
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
}
|
||||
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->country_code=$tmparray['code'];
|
||||
$object->country=$tmparray['label'];
|
||||
// We set country_id, country_code and country for the selected country
|
||||
$object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id;
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id,'all');
|
||||
$object->country_code=$tmparray['code'];
|
||||
$object->country=$tmparray['label'];
|
||||
}
|
||||
|
||||
// Check for duplicate or mandatory prof id
|
||||
@@ -229,12 +229,12 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
|
||||
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code));
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code));
|
||||
$action = ($action=='add'?'create':'edit');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -934,22 +934,22 @@ else
|
||||
// Local Taxes
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print $form->selectyesno('localtax1assuj_value',0,1);
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsed").'</td><td>';
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print $form->selectyesno('localtax2assuj_value',0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print $form->selectyesno('localtax1assuj_value',0,1);
|
||||
print '</td><tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsed").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print $form->selectyesno('localtax2assuj_value',0,1);
|
||||
print '</td><tr>';
|
||||
}
|
||||
@@ -1297,10 +1297,10 @@ else
|
||||
{
|
||||
if (($j % 2) == 0) print '<tr>';
|
||||
|
||||
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
|
||||
if(empty($conf->global->$idprof_mandatory))
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
else
|
||||
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
|
||||
if(empty($conf->global->$idprof_mandatory))
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
else
|
||||
print '<td><span class="fieldrequired">'.$idprof.'</td><td>';
|
||||
|
||||
$key='idprof'.$i;
|
||||
@@ -1351,23 +1351,23 @@ else
|
||||
// Local Taxes
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@@ -1667,22 +1667,22 @@ else
|
||||
// Local Taxes
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
||||
print '</td><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td>';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($object->localtax1_assuj);
|
||||
print '</td><tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
|
||||
print yn($object->localtax2_assuj);
|
||||
print '</td><tr>';
|
||||
}
|
||||
|
||||
@@ -1217,24 +1217,24 @@ class User extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('userdao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->initHooks(array('userdao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ $langs->load("companies");
|
||||
$langs->load("ldap");
|
||||
|
||||
$form = new Form($db);
|
||||
$object = new User($db);
|
||||
$object = new User($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
@@ -187,13 +187,13 @@ if ($action == 'add' && $canadduser)
|
||||
$object->note = $_POST["note"];
|
||||
$object->ldap_sid = $_POST["ldap_sid"];
|
||||
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (preg_match("/^options_/",$key))
|
||||
{
|
||||
$object->array_options[$key]=GETPOST($key);
|
||||
}
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (preg_match("/^options_/",$key))
|
||||
{
|
||||
$object->array_options[$key]=GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME external module
|
||||
@@ -315,13 +315,13 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
$object->signature = $_POST["signature"];
|
||||
$object->openid = $_POST["openid"];
|
||||
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (preg_match("/^options_/",$key))
|
||||
{
|
||||
$object->array_options[$key]=GETPOST($key);
|
||||
}
|
||||
// Get extra fields
|
||||
foreach($_POST as $key => $value)
|
||||
{
|
||||
if (preg_match("/^options_/",$key))
|
||||
{
|
||||
$object->array_options[$key]=GETPOST($key);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME external module
|
||||
@@ -530,8 +530,8 @@ if ($action == 'adduserldap')
|
||||
* View
|
||||
*/
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('user');
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('user');
|
||||
|
||||
llxHeader('',$langs->trans("UserCard"));
|
||||
|
||||
@@ -869,21 +869,21 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
||||
$doleditor->Create();
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
// Other attributes
|
||||
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Module Webcalendar
|
||||
// TODO external module
|
||||
@@ -920,7 +920,7 @@ else
|
||||
{
|
||||
$object->fetch($id);
|
||||
if ($res < 0) { dol_print_error($db,$object->error); exit; }
|
||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||
|
||||
// Connexion ldap
|
||||
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
||||
@@ -1883,21 +1883,21 @@ else
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="2"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="2"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
print $extrafields->showInputField($key,$value);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user