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

This commit is contained in:
Grand Philippe
2013-03-16 10:35:12 +01:00
16 changed files with 78 additions and 4988 deletions

View File

@@ -62,7 +62,7 @@ class CMailFile
var $css;
//! Defined css style for body background
var $styleCSS;
//! Defined bacckground directly in body tag
//! Defined background directly in body tag
var $bodyCSS;
// Image
@@ -256,7 +256,7 @@ class CMailFile
if (!empty($css))
{
$this->css = $css;
$this->styleCSS = $this->buildCSS();
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
@@ -308,7 +308,7 @@ class CMailFile
if (!empty($css))
{
$this->css = $css;
$this->styleCSS = $this->buildCSS();
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
@@ -624,7 +624,7 @@ class CMailFile
if ($this->css['bgcolor'])
{
$this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS.= ' BGCOLOR="'.$this->css['bgcolor'].'"';
$this->bodyCSS.= ' bgcolor="'.$this->css['bgcolor'].'"';
}
if ($this->css['bgimage'])
{

View File

@@ -2554,20 +2554,21 @@ function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
/**
* Fonction qui formate un montant pour visualisation
* Fonction utilisee dans les pdf et les pages html
* Function to format a value into an amount for visual output
* Function used into PDF and HTML pages
*
* @param float $amount Montant a formater
* @param string $form Type de formatage, html ou pas (par defaut)
* @param Translate $outlangs Objet langs pour formatage text
* @param int $trunc 1=Tronque affichage si trop de decimales,0=Force le non troncage
* @param int $rounding Minimum number of decimal. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
* @param float $amount Amount to format
* @param string $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output
* @param int $trunc 1=Truncate if there is too much decimals (default), 0=Does not truncate
* @param int $rounding Minimum number of decimal to show. If not defined we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOTAL)
* @param int $forcerounding Force the number of decimal
* @param string $currency_code To add currency symbol (''=add nothing, 'XXX'=add currency symbols for XXX currency)
* @return string Chaine avec montant formate
*
* @see price2num Revert function of price
*/
function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1)
function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
{
global $langs,$conf;
@@ -2623,8 +2624,16 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
{
$output=number_format($amount, $nbdecimal, $dec, $thousand);
}
$output.=$end;
// Add symbol of currency if requested
$cursymbolbefore=$cursymbolafter='';
if ($currency_code)
{
$listofcurrenciesbefore=array('USD');
if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code);
else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code);
}
$output.=$cursymbolbefore.$end.$cursymbolafter;
return $output;
}
@@ -2776,7 +2785,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
*
* @param real $vatrate VAT Rate
* @param int $local Number of localtax (1 / 2)
* @param int $local Number of localtax (1 or 2, or 0 to return 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)
* @deprecated TODO We should remove this function by storing rate and type into detail lines.
@@ -2799,6 +2808,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
$obj = $db->fetch_object($resql);
if ($local == 1) return array($obj->localtax1_type, $obj->localtax1);
elseif ($local == 2) return array($obj->localtax2_type, $obj->localtax2);
else return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2);
}
return 0;

View File

@@ -85,7 +85,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
else if ($showmode == 2) $classname='class="tmenu"';
print_start_menu_entry_auguria($idsel,$classname);
print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, $atarget, $newTabMenu[$i]['target']);
print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
print_end_menu_entry_auguria();
}
@@ -129,19 +129,18 @@ function print_start_menu_entry_auguria($idsel,$classname)
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param string $menutarget Menu target (may be empty)
* @return void
*/
function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menutarget='')
function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
global $langs;
if ($showmode == 1)
{
print '<a class="tmenuimage" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="mainmenu_'.$idsel.' '.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<span class="mainmenuaspan">';
print $text;
print '</span>';

View File

@@ -56,7 +56,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
// Third parties
$tmpentry=array('enabled'=>(! empty($conf->societe->enabled) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
@@ -102,6 +103,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Commercial
@@ -125,6 +127,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Financial
@@ -144,6 +147,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Bank
@@ -164,6 +168,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Projects
@@ -183,6 +188,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Tools
@@ -202,6 +208,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// OSCommerce 1
@@ -221,6 +228,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("OSCommerce"), $showmode, DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&amp;leftmenu=', $langs->trans("OSCommerce"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
// Members
@@ -238,6 +246,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu=', $id, $idsel, $classname, $atarget);
print_end_menu_entry();
$menu->add(DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
}
@@ -278,8 +287,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
else if ($showmode == 2) $classname='class="tmenu"';
print_start_menu_entry($idsel,$classname);
print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, $atarget, $newTabMenu[$i]['target']);
print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
print_end_menu_entry();
$menu->add($url, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), $mainmenu, $leftmenu);
}
print_end_menu_array();
@@ -320,19 +330,18 @@ function print_start_menu_entry($idsel,$classname)
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param string $menutarget Menu target (may be empty)
* @return void
*/
function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menutarget='')
function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
global $langs;
if ($showmode == 1)
{
print '<a class="tmenuimage" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<span class="mainmenuaspan">';
print $text;
print '</span>';

View File

@@ -208,19 +208,18 @@ function print_start_menu_entry_empty($idsel,$classname)
* @param string $idsel Id sel
* @param string $classname Class name
* @param string $atarget Target
* @param string $menutarget Menu target (may be empty)
* @return void
*/
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget, $menutarget='')
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
global $conf;
if ($showmode == 1)
{
print '<a class="tmenuimage" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($menutarget?" target='".$menutarget."'":($atarget?' target="'.$atarget.'"':'')).'>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
print '<span class="mainmenuaspan">';
print $text;
print '</span>';

View File

@@ -375,23 +375,18 @@ 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=getLocalTaxesFromRate($vatrate,1,$mysoc);
$localtax2_array=getLocalTaxesFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc);
if ((! isset($localtax1_type)) || $localtax1_type=='') $localtax1_type = $localtaxtmp_array[0];
if ((! isset($localtax2_type)) || $localtax2_type=='') $localtax2_type = $localtaxtmp_array[2];
//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 ($localtax1_type == '7') $localtax1_rate = $localtaxtmp_array[1];
if ($localtax2_type == '7') $localtax2_rate = $localtaxtmp_array[3];
if ($localtax1ligne != 0 || $localtax1_type == '7')
if ($localtax1_type && ($localtax1ligne != 0 || $localtax1_type == '7'))
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
if ($localtax2_type && ($localtax2ligne != 0 || $localtax2_type == '7'))
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';

View File

@@ -377,23 +377,18 @@ class pdf_crabe extends ModelePDFFactures
$vatrate=(string) $object->lines[$i]->tva_tx;
// TODO : store local taxes types into object lines and remove this
$localtax1_array=getLocalTaxesFromRate($vatrate,1,$mysoc);
$localtax2_array=getLocalTaxesFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc);
if ((! isset($localtax1_type)) || $localtax1_type=='') $localtax1_type = $localtaxtmp_array[0];
if ((! isset($localtax2_type)) || $localtax2_type=='') $localtax2_type = $localtaxtmp_array[2];
//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 ($localtax1_type == '7') $localtax1_rate = $localtaxtmp_array[1];
if ($localtax2_type == '7') $localtax2_rate = $localtaxtmp_array[3];
if ($localtax1ligne != 0 || $localtax1_type == '7')
if ($localtax1_type && ($localtax1ligne != 0 || $localtax1_type == '7'))
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
if ($localtax2_type && ($localtax2ligne != 0 || $localtax2_type == '7'))
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';

View File

@@ -371,24 +371,20 @@ class pdf_azur extends ModelePDFPropales
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=getLocalTaxesFromRate($vatrate,1,$mysoc);
$localtax2_array=getLocalTaxesFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
$localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc);
if ((! isset($localtax1_type)) || $localtax1_type=='') $localtax1_type = $localtaxtmp_array[0];
if ((! isset($localtax2_type)) || $localtax2_type=='') $localtax2_type = $localtaxtmp_array[2];
//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 ($localtax1_type == '7') $localtax1_rate = $localtaxtmp_array[1];
if ($localtax2_type == '7') $localtax2_rate = $localtaxtmp_array[3];
if ($localtax1ligne != 0 || $localtax1_type == '7')
if ($localtax1_type && ($localtax1ligne != 0 || $localtax1_type == '7'))
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
if ($localtax2_type && ($localtax2ligne != 0 || $localtax2_type == '7'))
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';