Qual: Removed warnings

This commit is contained in:
Laurent Destailleur 2012-09-19 12:49:58 +02:00
parent 60fc0f2b74
commit 1347ecf14e
15 changed files with 79 additions and 54 deletions

View File

@ -2682,7 +2682,7 @@ class Commande extends CommonOrder
$line->total_ht=100; $line->total_ht=100;
$line->total_ttc=119.6; $line->total_ttc=119.6;
$line->total_tva=19.6; $line->total_tva=19.6;
$line->remise_percent=00; $line->remise_percent=0;
} }
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $line->fk_product=$prodids[$prodid];
@ -2841,13 +2841,15 @@ class OrderLine
var $localtax2_tx; // Local tax 2 var $localtax2_tx; // Local tax 2
var $subprice; // U.P. HT (example 100) var $subprice; // U.P. HT (example 100)
var $remise_percent; // % for line discount (example 20%) var $remise_percent; // % for line discount (example 20%)
var $fk_remise_except;
var $rang = 0; var $rang = 0;
var $fk_fournprice; var $fk_fournprice;
var $pa_ht; var $pa_ht;
var $marge_tx; var $marge_tx;
var $marque_tx; var $marque_tx;
var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR var $info_bits = 0; // Bit 0: 0 si TVA normal - 1 si TVA NPR
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe // Bit 1: 0 ligne normale - 1 si ligne de remise fixe
var $special_code = 0;
var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_localtax1; // Total local tax 1 for the line var $total_localtax1; // Total local tax 1 for the line

View File

@ -691,7 +691,7 @@ class Facture extends CommonInvoice
// Possibility to add external linked objects with hooks // Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id; $this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects))
{ {
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
} }
@ -1330,6 +1330,8 @@ class Facture extends CommonInvoice
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id;
$cdr_nbjour=0; $cdr_fdm=0; $cdr_decalage=0;
$sqltemp = 'SELECT c.fdm,c.nbjour,c.decalage'; $sqltemp = 'SELECT c.fdm,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';
if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement;

View File

@ -24,8 +24,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/** /**
* \class CommonInvoice * Superclass for invoices classes
* \brief Superclass for invoices classes
*/ */
abstract class CommonInvoice extends CommonObject abstract class CommonInvoice extends CommonObject
{ {

View File

@ -267,7 +267,7 @@ function _unval($val)
{ {
// single, escaped unicode character // single, escaped unicode character
$utf16 = chr(hexdec($reg[1])) . chr(hexdec($reg[2])); $utf16 = chr(hexdec($reg[1])) . chr(hexdec($reg[2]));
$utf8 .= utf162utf8($utf16); $utf8 = utf162utf8($utf16);
$val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i',$utf8,$val); $val=preg_replace('/\\\u'.$reg[1].$reg[2].'/i',$utf8,$val);
} }
return $val; return $val;

View File

@ -621,7 +621,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0); $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($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
@ -629,7 +629,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && is_float($this->tva['0.000'])) ? true : false); $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
{ {
// Nothing to do // Nothing to do
@ -761,7 +761,13 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$resteapayer = price2num($object->total_ttc - $deja_regle); $creditnoteamount=0;
$depositsamount=0;
//$creditnoteamount=$object->getSumCreditNotesUsed();
//$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)
{ {

View File

@ -70,13 +70,18 @@ class pdf_expedition_merou extends ModelePdfExpedition
/** /**
* Fonction generant le document sur le disque * Function to build pdf onto disk
* *
* @param Object &$object Objet expedition a generer (ou id si ancienne methode) * @param Object &$object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/ */
function write_file(&$object, $outputlangs) function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{ {
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
@ -108,12 +113,12 @@ class pdf_expedition_merou extends ModelePdfExpedition
//Creation du destinataire //Creation du destinataire
$idcontact = $object->$origin->getIdContact('external','SHIPPING'); $idcontact = $object->$origin->getIdContact('external','SHIPPING');
$this->destinataire = new Contact($this->db); $this->destinataire = new Contact($this->db);
if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]); if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
//Creation du livreur //Creation du livreur
$idcontact = $object->$origin->getIdContact('internal','LIVREUR'); $idcontact = $object->$origin->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db); $this->livreur = new User($this->db);
if ($idcontact[0]) $this->livreur->fetch($idcontact[0]); if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
// Definition de $dir et $file // Definition de $dir et $file
if ($object->specimen) if ($object->specimen)

View File

@ -73,13 +73,18 @@ class pdf_expedition_rouget extends ModelePdfExpedition
} }
/** /**
* Fonction generant le document sur le disque * Function to build pdf onto disk
* *
* @param Object &$object Objet expedition a generer (ou id si ancienne methode) * @param Object &$object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/ */
function write_file(&$object, $outputlangs) function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{ {
global $user,$conf,$langs; global $user,$conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -119,14 +119,14 @@ class pdf_crabe extends ModelePDFFactures
/** /**
* Function to build pdf onto disk * Function to build pdf onto disk
* *
* @param int $object Id of object to generate * @param Object $object Object to generate
* @param object $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object * @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{ {
@ -745,7 +745,6 @@ class pdf_crabe extends ModelePDFFactures
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
{ {

View File

@ -117,14 +117,14 @@ class pdf_azur extends ModelePDFPropales
/** /**
* Function to build pdf onto disk * Function to build pdf onto disk
* *
* @param int $object Id of object to generate * @param Object $object Object to generate
* @param object $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object * @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO * @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{ {
@ -393,7 +393,8 @@ class pdf_azur extends ModelePDFPropales
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
// Affiche zone totaux // Affiche zone totaux
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
// Affiche zone versements // Affiche zone versements
/* /*

View File

@ -329,15 +329,18 @@ if ($pageposafter > $pageposbefore) {
$localtax1ligne=$object->lines[$i]->total_localtax1; $localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2; $localtax2ligne=$object->lines[$i]->total_localtax2;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if (! empty($object->remise_percent)) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; if (! empty($object->remise_percent)) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx; $vatrate=(string) $object->lines[$i]->tva_tx;
$localtax1rate=(string) $object->lines[$i]->localtax1_tx; $localtax1rate=(string) $object->lines[$i]->localtax1_tx;
$localtax2rate=(string) $object->lines[$i]->localtax2_tx; $localtax2rate=(string) $object->lines[$i]->localtax2_tx;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; 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->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne; $this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne; $this->localtax2[$localtax2rate]+=$localtax2ligne;
@ -627,7 +630,7 @@ if ($pageposafter > $pageposbefore) {
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0); $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($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
// Show VAT by rates and total // Show VAT by rates and total
$pdf->SetFillColor(248,248,248); $pdf->SetFillColor(248,248,248);
@ -764,7 +767,7 @@ if ($pageposafter > $pageposbefore) {
//$depositsamount=$object->getSumDepositsUsed(); //$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0; if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0) if ($deja_regle > 0)
{ {

View File

@ -1904,6 +1904,8 @@ class CommandeFournisseurLigne
var $total_localtax1; var $total_localtax1;
var $total_localtax2; var $total_localtax2;
var $total_ttc; var $total_ttc;
var $info_bits;
var $special_code;
// From llx_product // From llx_product
var $libelle; // Label produit var $libelle; // Label produit

View File

@ -77,7 +77,8 @@ class FactureFournisseur extends CommonInvoice
var $propalid; var $propalid;
var $lines; var $lines;
var $fournisseur; var $fournisseur; // deprecated
var $thirdparty; // To store thirdparty
var $extraparams=array(); var $extraparams=array();

View File

@ -548,7 +548,7 @@ if (empty($reshook))
$prod->id, $prod->id,
GETPOST('remise_percent'), GETPOST('remise_percent'),
'', '',
'', // TODO voir si fk_remise_except est encore valable car n'apparait plus dans les propales '',
$price_base_type, $price_base_type,
$pu_ttc $pu_ttc
); );

View File

@ -139,7 +139,7 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals($tmp['width'],250); $this->assertEquals($tmp['width'],250);
$this->assertEquals($tmp['height'],20);*/ $this->assertEquals($tmp['height'],20);*/
return $result; return 1;
} }
} }

View File

@ -120,7 +120,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
*/ */
public function testFactureMercure() public function testFactureMercure()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db,$mysoc;
$conf=$this->savconf; $conf=$this->savconf;
$user=$this->savuser; $user=$this->savuser;
$langs=$this->savlangs; $langs=$this->savlangs;