Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Mar 20, 2017
2 parents b9a9997 + e85206d commit 1b0b4c9
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 88 deletions.
4 changes: 2 additions & 2 deletions htdocs/admin/mails.php
Expand Up @@ -228,7 +228,7 @@ function initfields()
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';

dol_fiche_head($head, 'common', '');
dol_fiche_head($head, 'common', '', -1);

print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
Expand Down Expand Up @@ -453,7 +453,7 @@ function initfields()
}
else
{
dol_fiche_head($head, 'common', '');
dol_fiche_head($head, 'common', '', -1);

print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/mails_templates.php
Expand Up @@ -405,7 +405,7 @@
$h++;


dol_fiche_head($head, 'templates', '');
dol_fiche_head($head, 'templates', '', -1);

// Confirmation de la suppression de la ligne
if ($action == 'delete')
Expand Down
21 changes: 21 additions & 0 deletions htdocs/core/class/smtps.class.php
Expand Up @@ -427,6 +427,25 @@ function _server_authenticate()
{
if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS))
{
/*
The following dialog illustrates how a client and server can start a TLS STARTTLS session
S: <waits for connection on TCP port 25>
C: <opens connection>
S: 220 mail.imc.org SMTP service ready
C: EHLO mail.ietf.org
S: 250-mail.imc.org offers a warm hug of welcome
S: 250 STARTTLS
C: STARTTLS
S: 220 Go ahead
C: <starts TLS negotiation>
C & S: <negotiate a TLS session>
C & S: <check result of negotiation>
// Second pass EHLO
C: EHLO client-domain.com
S: 250-server-domain.com
S: 250 AUTH LOGIN
C: <continues by sending an SMTP command
*/
if (!$_retVal = $this->socket_send_str('STARTTLS', 220))
{
$this->_setErr(131, 'STARTTLS connection is not supported.');
Expand All @@ -437,6 +456,8 @@ function _server_authenticate()
$this->_setErr(132, 'STARTTLS connection failed.');
return $_retVal;
}
// Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250'))
{
$this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
Expand Down
9 changes: 6 additions & 3 deletions htdocs/core/modules/dons/html_cerfafr.modules.php
Expand Up @@ -69,9 +69,10 @@ function isEnabled()
*
* @param Don $don Donation object
* @param Translate $outputlangs Lang object for output language
* @param string $currency Currency code
* @return int >0 if OK, <0 if KO
*/
function write_file($don,$outputlangs)
function write_file($don,$outputlangs,$currency='')
{
global $user,$conf,$langs,$mysoc;

Expand All @@ -87,7 +88,9 @@ function write_file($don,$outputlangs)
$outputlangs->load("products");
$outputlangs->load("donations");

if (! empty($conf->don->dir_output))
$currency = !empty($currency) ? $currency : $conf->currency;

if (! empty($conf->don->dir_output))
{
// Definition of the object don (for upward compatibility)
if (! is_object($don))
Expand Down Expand Up @@ -165,7 +168,7 @@ function write_file($don,$outputlangs)
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
$form = str_replace('__AMOUNT__',$don->amount,$form);
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form);
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$conf->currency),$form);
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form);
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form);
Expand Down
Expand Up @@ -725,6 +725,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
* @param Translate $outputlangs Output langs
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Expand All @@ -735,12 +736,13 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
$hidebottom=0;
if ($hidetop) $hidetop=-1;

$currency = !empty($currency) ? $currency : $conf->currency;
$default_font_size = pdf_getPDFFontSize($outputlangs);

// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top -4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);

Expand Down
2 changes: 2 additions & 0 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -1070,6 +1070,8 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
}
else
{
// FIXME amount of vat not supported with multicurrency

//Local tax 1 before VAT
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
//{
Expand Down
28 changes: 17 additions & 11 deletions htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
Expand Up @@ -388,8 +388,9 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=
}

// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);

// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
Expand Down Expand Up @@ -466,11 +467,11 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
Expand All @@ -482,11 +483,11 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
Expand All @@ -500,12 +501,12 @@ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}

Expand Down Expand Up @@ -593,8 +594,10 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);

$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1);

// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
Expand Down Expand Up @@ -719,8 +722,9 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);

$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);

if ($deja_regle > 0)
{
Expand Down Expand Up @@ -757,16 +761,18 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
{
global $conf;

// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;

$currency = !empty($currency) ? $currency : $conf->currency;
$default_font_size = pdf_getPDFFontSize($outputlangs);

// Amount in (at tab_top - 1)
Expand All @@ -775,7 +781,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,

if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);

Expand Down
31 changes: 18 additions & 13 deletions htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
Expand Up @@ -400,8 +400,9 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
}

// Unit price before discount
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->subprice), 0, 'R', 0);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);

// Quantity
$pdf->SetXY($this->posxqty, $curY);
Expand Down Expand Up @@ -489,11 +490,11 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
Expand All @@ -505,11 +506,11 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
Expand All @@ -523,12 +524,12 @@ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}

Expand Down Expand Up @@ -691,8 +692,9 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);

$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);

// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
Expand Down Expand Up @@ -826,8 +828,9 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);

$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0);

Expand Down Expand Up @@ -876,16 +879,18 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
{
global $conf;

// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;

$currency = !empty($currency) ? $currency : $conf->currency;
$default_font_size = pdf_getPDFFontSize($outputlangs);

// Amount in (at tab_top - 1)
Expand All @@ -894,7 +899,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,

if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);

Expand Down Expand Up @@ -1073,14 +1078,14 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)

if (! empty($object->date_commande))
{
$posy+=4;
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R');
}
else
{
$posy+=4;
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(255,0,0);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R');
Expand Down
6 changes: 4 additions & 2 deletions htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php
Expand Up @@ -530,16 +530,18 @@ function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
{
global $conf,$mysoc;

// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;

$currency = !empty($currency) ? $currency : $conf->currency;
$default_font_size = pdf_getPDFFontSize($outputlangs);

// Amount in (at tab_top - 1)
Expand All @@ -550,7 +552,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top-6);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);

$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);

Expand Down

0 comments on commit 1b0b4c9

Please sign in to comment.