Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 12, 2017
2 parents 53a523b + 36b4d50 commit f33182a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/card.php
Expand Up @@ -648,7 +648,7 @@
print "</tr>\n";
}

if ($total_debit != $total_credit)
if (price2num($total_debit) != price2num($total_credit))
{
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/compta/bank/card.php
Expand Up @@ -99,7 +99,7 @@
$object->owner_address = trim($_POST["owner_address"]);

$account_number = GETPOST('account_number','alpha');
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; }
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }

Expand Down Expand Up @@ -627,7 +627,7 @@
print '<td>';
if (! empty($conf->accounting->enabled)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->account_number);
$accountingaccount->fetch('',$object->account_number, 1);

print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/card.php
Expand Up @@ -1132,6 +1132,7 @@
$TTotalByTva = array();
foreach ($srcobject->lines as &$line)
{
if(! empty($line->special_code)) continue;
$TTotalByTva[$line->tva_tx] += $line->total_ttc ;
}

Expand Down
25 changes: 17 additions & 8 deletions htdocs/core/lib/pdf.lib.php
Expand Up @@ -1844,10 +1844,14 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1)
{
if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%';
$prev_progress = 0;
if (method_exists($object, 'get_prev_progress'))
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
}
$result = ($object->lines[$i]->situation_percent - $prev_progress) . '%';
}
else
$result = $object->lines[$i]->situation_percent . '%';
Expand Down Expand Up @@ -1894,12 +1898,17 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
if (empty($hidedetails) || $hidedetails > 1)
{
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
if ($object->lines[$i]->situation_percent > 0 )
if ($object->lines[$i]->situation_percent > 0)
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100;
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
}
$prev_progress = 0;
$progress = 1;
if (method_exists($object, 'get_prev_progress'))
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
}
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
}
else
$result.=price($sign * $total_ht, 0, $outputlangs);
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -670,13 +670,13 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentConditions").':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->MultiCell(43, 4, $titre, 0, 'L');

$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');

$posy=$pdf->GetY()+3;
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -897,13 +897,13 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentConditions").':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->MultiCell(43, 4, $titre, 0, 'L');

$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');

$posy=$pdf->GetY()+3;
}
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -858,13 +858,13 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentConditions").':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->MultiCell(43, 4, $titre, 0, 'L');

$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
$pdf->MultiCell(67, 4, $lib_condition_paiement,0,'L');

$posy=$pdf->GetY()+3;
}
Expand Down
6 changes: 5 additions & 1 deletion htdocs/expensereport/card.php
Expand Up @@ -234,8 +234,12 @@
$db->begin();

$id = $object->create($user);
if ($id <= 0)
{
$error++;
}

if ($id > 0)
if (! $error)
{
$db->commit();
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
Expand Down
9 changes: 8 additions & 1 deletion htdocs/expensereport/class/expensereport.class.php
Expand Up @@ -215,7 +215,8 @@ function create($user, $notrigger=0)
$resql=$this->db->query($sql);
if (!$resql) $error++;

if (is_array($this->lines) && count($this->lines)>0) {
if (is_array($this->lines) && count($this->lines)>0)
{
foreach ($this->lines as $i => $val)
{
$newndfline=new ExpenseReportLine($this->db);
Expand All @@ -233,6 +234,12 @@ function create($user, $notrigger=0)
}
}

if (! $error)
{
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}

if (! $error)
{
$result=$this->update_price();
Expand Down

0 comments on commit f33182a

Please sign in to comment.