diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 37497491299..d7fd81f6cb8 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -648,7 +648,7 @@ if ($action == 'create')
print "\n";
}
- if ($total_debit != $total_credit)
+ if (price2num($total_debit) != price2num($total_credit))
{
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
}
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 8aafef55fba..be8a4b58627 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -99,7 +99,7 @@ if ($action == 'add')
$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; }
@@ -627,7 +627,7 @@ else
print '
';
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 {
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 8365a52f277..22edcdbd925 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1132,6 +1132,7 @@ if (empty($reshook))
$TTotalByTva = array();
foreach ($srcobject->lines as &$line)
{
+ if(! empty($line->special_code)) continue;
$TTotalByTva[$line->tva_tx] += $line->total_ttc ;
}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 4b19b6fb8fb..932373665e5 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -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 . '%';
@@ -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);
}
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 45568f5eadf..f5797e0fb2e 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -670,13 +670,13 @@ class pdf_einstein extends ModelePDFCommandes
$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;
}
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index f5d6ec70f04..d1285085014 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -897,13 +897,13 @@ class pdf_crabe extends ModelePDFFactures
$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;
}
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 3e7a0130a04..76ab2ae7655 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -858,13 +858,13 @@ class pdf_azur extends ModelePDFPropales
$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;
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 29a058f2d33..dc2c0a22f66 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -234,8 +234,12 @@ if (empty($reshook))
$db->begin();
$id = $object->create($user);
+ if ($id <= 0)
+ {
+ $error++;
+ }
- if ($id > 0)
+ if (! $error)
{
$db->commit();
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 437114ab7df..b2d6f052a2a 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -215,7 +215,8 @@ class ExpenseReport extends CommonObject
$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);
@@ -233,6 +234,12 @@ class ExpenseReport extends CommonObject
}
}
+ if (! $error)
+ {
+ $result=$this->insertExtraFields();
+ if ($result < 0) $error++;
+ }
+
if (! $error)
{
$result=$this->update_price();
|